From 4df94de689a8ae7427f49a8db6f7a3686cbd5785 Mon Sep 17 00:00:00 2001 From: ework-agent Date: Fri, 25 Sep 2026 14:31:15 +0800 Subject: [PATCH] fix(tests): normalize golden snapshots to LF before compare (Windows autocrlf) CI run 36102348905: all 4 golden tests failed on windows-latest because GitHub Actions checkouts materialize committed-LF files as CRLF in the worktree; runtime-generated canonical text uses LF. Normalize disk content to LF so the gate is platform-deterministic while still catching any real content drift. --- tests/wire-contract-golden.test.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/wire-contract-golden.test.ts b/tests/wire-contract-golden.test.ts index 1dd195d1a..b1cc51c5d 100644 --- a/tests/wire-contract-golden.test.ts +++ b/tests/wire-contract-golden.test.ts @@ -1,8 +1,12 @@ // Golden schema snapshots (#1304 item 2). Every tool schema bili or the pinned -// kernel advertises on any wire has a committed byte-exact snapshot under -// tests/golden/wire-contract/. Any schema change turns these red; regeneration -// (node --import tsx scripts/update-wire-contract-goldens.ts) is only valid -// with justification in the PR body — silent drift is what #1299 was. +// kernel advertises on any wire has a committed snapshot under +// tests/golden/wire-contract/. Comparison is byte-exact on canonical LF text: +// disk content is normalized \r\n → \n first because Windows CI checkouts +// apply autocrlf and materialize committed-LF goldens as CRLF in the worktree +// (first-run failure on windows-latest, run 36102348905). Any schema change +// turns these red; regeneration (node --import tsx +// scripts/update-wire-contract-goldens.ts) is only valid with justification in +// the PR body — silent drift is what #1299 was. import test from "node:test"; import assert from "node:assert/strict"; @@ -20,8 +24,8 @@ test("wire-contract goldens: no orphaned snapshot files", () => { }); for (const spec of buildGoldens()) { - test(`wire-contract goldens: ${spec.name} (${spec.layer}) matches committed snapshot byte-for-byte`, () => { - const expected = fs.readFileSync(path.join(GOLDEN_DIR, spec.name), "utf8"); + test(`wire-contract goldens: ${spec.name} (${spec.layer}) matches committed snapshot`, () => { + const expected = fs.readFileSync(path.join(GOLDEN_DIR, spec.name), "utf8").replace(/\r\n/g, "\n"); const actual = canonicalize(spec.build()); assert.equal( actual,