From 8f2332f8c45946e2cb82130ffdb822a9b18fd5de Mon Sep 17 00:00:00 2001 From: ranxianglei Date: Wed, 21 Oct 2026 12:11:50 +0800 Subject: [PATCH] fix(ci): flush the v2 envelope synchronously in the #3818 drift test The drifted-session assertion raced a fixed 120ms settle against the debounced envelope write; the win/node24 runner occasionally loaded the stale v1 envelope (served 2, expected 99). flushSync() commits the envelope before loadSync, making the test order-independent of FS latency (same determinism lesson as the plugin-fork cold restores). --- tests/storage-full-flip.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/storage-full-flip.test.ts b/tests/storage-full-flip.test.ts index 61b80044b2..b7583b5420 100644 --- a/tests/storage-full-flip.test.ts +++ b/tests/storage-full-flip.test.ts @@ -222,6 +222,9 @@ test("#3818 ④ verifyDrift in the wire; drifted session reads the envelope whil sh.record = () => {}; (session.stats as { requests: number }).requests = 99; store.scheduleSave(session); + // Commit the v2 envelope synchronously: a fixed 120ms settle races a + // slow FS (win/node24 runner saw the v1 envelope and served 2). + assert.ok(store.flushSync(session), "v2 envelope committed"); await settle(); sh.record = realRecord;