From aca7599219027aa8537d3320290f0ff61ee2dd5c Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 16 Aug 2026 22:36:12 -0700 Subject: [PATCH] test(worktrees): make the retirement backoff window a real assertion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/main/worktree-retirement-backfill-scan.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/worktree-retirement-backfill-scan.test.ts b/src/main/worktree-retirement-backfill-scan.test.ts index f7e3b922663..f90d4ccf405 100644 --- a/src/main/worktree-retirement-backfill-scan.test.ts +++ b/src/main/worktree-retirement-backfill-scan.test.ts @@ -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 () => {