From 6f7125ecf28f5d75a0cc4cb867663d69ff5b9beb Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 7 Sep 2026 15:53:33 -0500 Subject: [PATCH] Measure live checkpoint cadence from persisted start events Co-Authored-By: Paperclip --- tests/runner-e2e/deployed-work-folders.spec.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/runner-e2e/deployed-work-folders.spec.ts b/tests/runner-e2e/deployed-work-folders.spec.ts index d6f461a2ae..666f4438a5 100644 --- a/tests/runner-e2e/deployed-work-folders.spec.ts +++ b/tests/runner-e2e/deployed-work-folders.spec.ts @@ -146,6 +146,17 @@ test("saves during two real 180-second intervals and flushes the final edit", as } const first = observations[0]!.saves.find((save) => save.active)!; const second = observations[1]!.saves.find((save) => save.runId === first.runId)!; - expect(Date.parse(second.lastSavedAt!) - Date.parse(first.lastSavedAt!)).toBeGreaterThanOrEqual(170_000); - await info.attach("real-checkpoint-intervals", { contentType: "application/json", body: Buffer.from(JSON.stringify(observations, null, 2)) }); + // Upload duration varies; completion times do not measure the timer cadence. + // The host records checkpoint intent before transferring any files. + const activity = await api.json>( + `/api/companies/${stack.companyId}/activity?entityType=heartbeat_run&entityId=${first.runId}&limit=100`, + ); + const starts = activity.filter((entry) => entry.action === "work_folder.checkpoint" && entry.runId === first.runId) + .map((entry) => Date.parse(entry.createdAt)).sort((a, b) => a - b); + await info.attach("real-checkpoint-intervals", { contentType: "application/json", body: Buffer.from(JSON.stringify({ observations, starts }, null, 2)) }); + expect(starts.length).toBeGreaterThanOrEqual(3); + expect(starts[1]! - starts[0]!).toBeGreaterThanOrEqual(179_000); + expect(starts[1]! - starts[0]!).toBeLessThan(210_000); + expect(starts[0]!).toBeLessThanOrEqual(Date.parse(first.lastSavedAt!)); + expect(starts[1]!).toBeLessThanOrEqual(Date.parse(second.lastSavedAt!)); });