mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-08 08:53:43 +08:00
watcher_unwatch_drains_pending_free failed three times on macos-14 CI with `index_call_count == 0, expected 1` at its dirty-poll precondition. That precondition needs every git subprocess of one poll (rev-parse HEAD, status, submodule foreach) to succeed. A transient probe failure (spawn refused under runner load, a non-zero exit) makes that poll a fail-closed no-op by design: #937 leaves the baseline uncommitted and the next poll retries. Several of those paths return without a log line, which matches the CI output exactly: watch, baseline, FAIL, with no watcher.changed and no watcher.git.failed. Holding a spawn failure with cbm_subprocess_force_spawn_eagain_for_testing reproduces that output deterministically. This is a test race, not a production defect. The precondition was also unrelated to the contract under test. A poll that stopped draining would neither crash nor leak, because cbm_watcher_free frees the same deferred list. So the old test could not see a broken drain at all. Add a test-only seam, cbm_watcher_test_pending_free_count, and assert the stable states the watcher holds: 0 parked before unwatch, 1 after, 0 after the next poll with no index work, and still 0 after a further poll. No assertion depends on a git probe succeeding. Dirty-poll reindexing stays covered by watcher_detects_dirty_worktree and watcher_modify_tracked_file. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>