From 705e4269eaa1808035c939fdc65ce6025a5895aa Mon Sep 17 00:00:00 2001 From: ework-agent Date: Fri, 16 Oct 2026 10:37:20 +0800 Subject: [PATCH] fix(tests): pin AC12 sweep visit order so the grandchild-first precondition no longer rides wall-clock luck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The AC12 boot-reconcile scenario requires the sweep to reach the grandchild before the intermediate child adopts. listSessions() orders by lastSeen desc and the two turns are ~seconds apart on a fast box, but the timestamps are ambient: a coarse clock or any reload path restamping lastSeen ties/flips the order — observed deterministically on the windows-latest CI lanes (every completed run of master since the batch). Once the child is visited first it legitimately adopts from the root, and the grandchild adopting from a now-block-bearing parent is CORRECT behavior under the #2807 contract, so the assertion fires for the wrong reason. Pin grandchild.lastSeen one minute past the child's after the strip step; production behavior is unchanged (both visit orders are legal outcomes). --- tests/lineage-reconcile-boot.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/lineage-reconcile-boot.test.ts b/tests/lineage-reconcile-boot.test.ts index ad33f5db4e..03f4badf0c 100644 --- a/tests/lineage-reconcile-boot.test.ts +++ b/tests/lineage-reconcile-boot.test.ts @@ -447,6 +447,18 @@ test("AC12: a multi-hop grandchild stays eligible when its intermediate parent h s.state.blocks.length = 0; delete s.metadata.derivedBlocksAdopted; } + // The scenario under test needs the sweep to reach the grandchild + // BEFORE the child adopts. listSessions() orders by lastSeen desc, and + // the two turns' timestamps are ambient wall-clock: a coarse clock or + // a reload path restamping lastSeen can tie or flip them (observed + // deterministically on the windows-latest CI lanes). Once the child is + // visited first it legitimately adopts from the root, and the + // grandchild's adoption from a now-block-bearing parent is CORRECT + // behavior (#2807 contract) — failing this assertion for the wrong + // reason. Pin the order instead of leaning on clock luck. + const pinnedChild = listSessions().find((x) => x.id === childId)!; + const pinnedGrandchild = listSessions().find((x) => x.id === grandchildId)!; + pinnedGrandchild.lastSeen = Math.max(pinnedGrandchild.lastSeen, pinnedChild.lastSeen + 60_000); } finally { await close(proxy); await close(relay);