From b8962c5f73c5005712ed70ca947a375b42203422 Mon Sep 17 00:00:00 2001 From: EtienneLescot Date: Fri, 21 Aug 2026 17:44:06 +0200 Subject: [PATCH] test(ai-edition): share one base document in the addZoom invariant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `createEmptyDocument` stamps `createdAt`/`updatedAt` from the wall clock, and this test called `fixtureDocument()` twice — so the two runs it compares started from two different documents, and the assertion held only while both calls landed in the same millisecond. On a loaded CI runner that is a coin flip; it just failed a PR that touches none of this code, with a one-digit diff: "createdAt":"…T15:37:58.275Z" vs "createdAt":"…T15:37:58.276Z" Handing both runs the SAME document is also the invariant the test means to state: one zoom, written by a runtime that can read telemetry and one that cannot, must come out identical. Comparing outputs of two different inputs was never that claim. The pattern is already used elsewhere in this file. --- electron/ai-edition/agent-tools.test.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/electron/ai-edition/agent-tools.test.ts b/electron/ai-edition/agent-tools.test.ts index 5f46c96ec..9132a8bce 100644 --- a/electron/ai-edition/agent-tools.test.ts +++ b/electron/ai-edition/agent-tools.test.ts @@ -1761,9 +1761,16 @@ describe("addZoom answers for the focus it was given", () => { // that can read telemetry and one written by a runtime that cannot must be // the same zoom, in the same place, described to the user the same way. const args = JSON.stringify({ startSec: 2, endSec: 6, focus: { cx: 0.2, cy: 0.1 } }); - const blind = executeAgentTool(fixtureDocument(), "addZoom", args); + // ponytail: ONE base for both runs. Two `fixtureDocument()` calls are two + // different inputs — `createEmptyDocument` stamps `createdAt`/`updatedAt` + // with the wall clock, so the pair differs whenever the calls straddle a + // millisecond, and this assertion was a coin flip on a loaded runner. The + // invariant is about the same document written by two runtimes; handing them + // the same document is what states it. + const base = fixtureDocument(); + const blind = executeAgentTool(base, "addZoom", args); const seeing = executeAgentTool( - fixtureDocument(), + base, "addZoom", args, withTrack(parkedSamples(2, 6, 0.8, 0.7)),