Gate: every indexer test that can reach flush/apply_resolution must hold RESOLVE_HOOK_LOCK (5th recurrence) #311

Closed
opened 2026-10-02 19:28:31 +02:00 by buildagent · 1 comment
Member

FAIL_NEXT_COMMITS and FAIL_NEXT_RESOLVE are process-global test seams. RESOLVE_HOOK_LOCK's doc requires every test that can trigger flush or apply_resolution to hold the lock. Nothing enforces that, and it has now failed five times:

  • Phase 0 (PR #306): native Windows CI failed packaged_profile_isolation_tests with "injected busy (test seam)".
  • Phase 0 lane N: the W7 tests and the m0070/m0071 migration tests.
  • Phase 1 fixes: found again on review.
  • 2026-10-02: watcher::tests::a_cancelled_directory_reconcile_indexes_nothing called index_path unguarded. A parallel the_shutdown_flush_gives_up_after_its_cap then counted 6 commit attempts where it injects for 3. Fixed in 5e76fc9 on the integration branch.

Each time the fix was one more let _g = RESOLVE_HOOK_LOCK.lock(). That is a fix per case, not a mechanism.

Wanted: one structural gate.

Option A, preferred if it is simple: make the seam per-connection or per-thread instead of process-global, so no test can see another test's injection. Then the lock and its rule disappear.

Option B: a registry test that scans #[cfg(test)] code in crates/indexer and fails on any #[test] fn that can reach index_path, flush, the writer loop or apply_resolution without taking RESOLVE_HOOK_LOCK. Use the index (find_callers) or a source scan, whichever is sound.

Test for the fix: remove the lock from one test; the gate must turn RED (option B), or the cross-test interference must become impossible (option A).

`FAIL_NEXT_COMMITS` and `FAIL_NEXT_RESOLVE` are process-global test seams. `RESOLVE_HOOK_LOCK`'s doc requires every test that can trigger `flush` or `apply_resolution` to hold the lock. Nothing enforces that, and it has now failed five times: - **Phase 0 (PR #306):** native Windows CI failed `packaged_profile_isolation_tests` with "injected busy (test seam)". - **Phase 0 lane N:** the W7 tests and the m0070/m0071 migration tests. - **Phase 1 fixes:** found again on review. - **2026-10-02:** `watcher::tests::a_cancelled_directory_reconcile_indexes_nothing` called `index_path` unguarded. A parallel `the_shutdown_flush_gives_up_after_its_cap` then counted 6 commit attempts where it injects for 3. Fixed in 5e76fc9 on the integration branch. Each time the fix was one more `let _g = RESOLVE_HOOK_LOCK.lock()`. That is a fix per case, not a mechanism. **Wanted:** one structural gate. **Option A, preferred if it is simple:** make the seam per-connection or per-thread instead of process-global, so no test can see another test's injection. Then the lock and its rule disappear. **Option B:** a registry test that scans `#[cfg(test)]` code in `crates/indexer` and fails on any `#[test]` fn that can reach `index_path`, `flush`, the writer loop or `apply_resolution` without taking `RESOLVE_HOOK_LOCK`. Use the index (`find_callers`) or a source scan, whichever is sound. **Test for the fix:** remove the lock from one test; the gate must turn RED (option B), or the cross-test interference must become impossible (option A).
Author
Member

Verified complete under the issue's preferred option A. Commit 09dc0bbeae replaces the process-global injections and RESOLVE_HOOK_LOCK with database-scoped seams; it is an ancestor of published v0.41.34. Separate connections to the same database intentionally share its injection, while a different project's database cannot consume it. Guards remove the entry when the test ends.

Revalidated on candidate d641f8ec: seams_are_scoped_to_their_own_database and no_unkeyed_process_global_test_seam_exists both pass within the full indexer suite (598 passed, 4 existing ignored). The isolation test performs real indexing of database B while A is armed to fail commits and resolution, verifies B resolved references and did not consume A's injections, then proves those injections reach A through a separate writer connection. The permanent registry test also rejects an unregistered process-global test seam. Existing recorded mutations document both negative controls.

The requested mechanism is already shipped and its regression controls remain green; closing without another code change or CI run.

Verified complete under the issue's preferred option A. Commit 09dc0bbeae9a6ca9d9307e658f9cc5206cb3bfc1 replaces the process-global injections and RESOLVE_HOOK_LOCK with database-scoped seams; it is an ancestor of published v0.41.34. Separate connections to the same database intentionally share its injection, while a different project's database cannot consume it. Guards remove the entry when the test ends. Revalidated on candidate d641f8ec: `seams_are_scoped_to_their_own_database` and `no_unkeyed_process_global_test_seam_exists` both pass within the full indexer suite (598 passed, 4 existing ignored). The isolation test performs real indexing of database B while A is armed to fail commits and resolution, verifies B resolved references and did not consume A's injections, then proves those injections reach A through a separate writer connection. The permanent registry test also rejects an unregistered process-global test seam. Existing recorded mutations document both negative controls. The requested mechanism is already shipped and its regression controls remain green; closing without another code change or CI run.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
h-dv/code-index#311
No description provided.