Repository navigation
Commit 5a9c72d
committed
test(watcher): pin the pending-free drain on a held state, not a git probe
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: DeusData#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>1 parent 64c23fa commit 5a9c72d
3 files changed
Lines changed: 52 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1653 | 1653 | | |
1654 | 1654 | | |
1655 | 1655 | | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3361 | 3361 | | |
3362 | 3362 | | |
3363 | 3363 | | |
3364 | | - | |
3365 | | - | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
3366 | 3380 | | |
3367 | 3381 | | |
3368 | 3382 | | |
| |||
3383 | 3397 | | |
3384 | 3398 | | |
3385 | 3399 | | |
| 3400 | + | |
3386 | 3401 | | |
3387 | 3402 | | |
3388 | | - | |
| 3403 | + | |
| 3404 | + | |
3389 | 3405 | | |
3390 | | - | |
3391 | 3406 | | |
3392 | | - | |
| 3407 | + | |
| 3408 | + | |
3393 | 3409 | | |
3394 | 3410 | | |
3395 | 3411 | | |
3396 | 3412 | | |
3397 | 3413 | | |
3398 | | - | |
3399 | | - | |
3400 | 3414 | | |
3401 | | - | |
| 3415 | + | |
3402 | 3416 | | |
3403 | 3417 | | |
| 3418 | + | |
3404 | 3419 | | |
3405 | | - | |
3406 | | - | |
3407 | | - | |
| 3420 | + | |
| 3421 | + | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
3408 | 3429 | | |
3409 | 3430 | | |
3410 | 3431 | | |
| |||
0 commit comments