test(worktrees): make the retirement backoff window a real assertion

The test that claimed to cover it settled the stalled listing and re-entered in the same tick, so
outstanding cleared only in a later microtask and the no-restack rule answered first. It was a duplicate
of the test above it, and the backoff clause it was meant to pin had no coverage at all: deleting
the clause left all twelve tests in both files green, so a regression that re-probes a wedged mount
on every generated create would have shipped.

Flush the microtask so the listing is genuinely settled, then assert both directions — the memo
still serves the failure inside the window, and the same call succeeds once the window lapses.
This commit is contained in:
Brennan Benson
2026-08-20 00:40:24 -07:00
parent e510131466
commit aca7599219
@@ -85,10 +85,20 @@ describe('runRetirementBackfillScan', () => {
const store = {}
const stalled = await stallPastDeadline(store, 'ns')
const retry = vi.fn(async () => found(['nautilus']))
// The listing must be fully settled before this asserts anything: while it is still
// outstanding the no-restack rule answers first, and the backoff would go untested.
stalled.fail()
await vi.advanceTimersByTimeAsync(0)
await expect(runRetirementBackfillScan(store, 'ns', retry)).rejects.toThrow(/exceeded/)
expect(retry).not.toHaveBeenCalled()
// And it is the backoff, not the listing, that is holding it back.
await vi.advanceTimersByTimeAsync(RETIREMENT_BACKFILL_RETRY_AFTER_FAILURE_MS)
await expect(runRetirementBackfillScan(store, 'ns', retry)).resolves.toEqual(
new Set(['nautilus'])
)
})
it('never lets one wedged namespace stop another from scanning', async () => {