Wait for GitHub recovery to settle before asserting its deadline

Core master's Cloud readiness has failed the chat (1/3) shard on most
commits since #22798, which stopped master Docker images and every
production rollout. The recovery-deadline test asserted nextWakeAt equal to
the saved deadline immediately after registration. In the master shard a
recovery-queue notification from the previous case's cleanup arrives after
registration, marks the scope dirty, and the coordinator correctly schedules
an immediate rescan first, so nextWakeAt briefly equals now (30s early).

The test now polls until the coordinator is idle and settled on the saved
deadline before checking that no reads happen in the next 15s.

Tested: on the pre-split file, the master chat shard 1/3 failed 5/5 before
(expected X to be X+30000) and passed 2/2 after. The split
github-webhook-recovery suite passes (51 tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 committed 2026-11-24 18:18:39 -06:00
1 parent ba63f4f8b2
commit 33cf9a0799
1 file changed
+2 -2
@@ -493,8 +493,8 @@ describeEmbeddedPostgres("chat channels: github webhook recovery", () => {
try {
vi.useFakeTimers({ toFake: ["Date", "setTimeout", "clearTimeout"], shouldAdvanceTime: true });
await f.service.registerGitHubWebhookRecoveryWork(coordinator, () => true).ready;
await expect.poll(() => idleWorkSnapshot().active).toBe(0);
expect(coordinator.nextWakeAt()).toBe(dueAt);
await expect.poll(() => ({ active: idleWorkSnapshot().active, nextWakeAt: coordinator.nextWakeAt() }))
.toEqual({ active: 0, nextWakeAt: dueAt });
const reads = vi.spyOn(db, "select");
try { await vi.advanceTimersByTimeAsync(15_000); expect(reads).not.toHaveBeenCalled(); }
finally { reads.mockRestore(); }