mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 16:03:49 +00:00
test(orchestration): distinguish the heartbeat straggler guard from the row's initial null
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.
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user