From 3a9ddd10686fb1df76fc5ab8189d1aecabae1613 Mon Sep 17 00:00:00 2001 From: Tauri-EPO Date: Mon, 17 Aug 2026 17:25:03 -0300 Subject: [PATCH] test(orchestration): distinguish the heartbeat straggler guard from the row's initial null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The straggler case never gave the row a heartbeat before settling it, so last_heartbeat_at was null from creation and the expected value equalled the initial state. That did catch outright removal of recordHeartbeat's `AND status = 'dispatched'` filter, but it conflated "guard held" with "completeDispatch cleared the column" and with "recordHeartbeat is inert" — both of those regressions kept toBeNull() green. Seed a heartbeat while the row is still dispatched so the expectation is a timestamp: null now means the column was cleared, '2026-05-04...' means the guard is gone. Carried from #15165. --- src/main/runtime/orchestration/db.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/runtime/orchestration/db.test.ts b/src/main/runtime/orchestration/db.test.ts index 04985a9ee0e..4fb008fd15f 100644 --- a/src/main/runtime/orchestration/db.test.ts +++ b/src/main/runtime/orchestration/db.test.ts @@ -658,11 +658,13 @@ describe('OrchestrationDb', () => { const d = createDb() const task = d.createTask({ spec: 'work' }) const ctx = d.createDispatchContext(task.id, 'term_a') + // Why: seed first so the expectation isn't the row's initial null — a completion that cleared the column would satisfy that too. + d.recordHeartbeat(ctx.id, '2026-05-03T00:00:00.000Z') d.completeDispatch(ctx.id) d.recordHeartbeat(ctx.id, '2026-05-04T00:00:00.000Z') const after = d.getDispatchContext(task.id) - expect(after?.last_heartbeat_at).toBeNull() + expect(after?.last_heartbeat_at).toBe('2026-05-03T00:00:00.000Z') }) it('getStaleDispatches returns only dispatched rows past the grace window', () => {