From 8b7dcc7f2e152174f3436d64f6b3a3bdf0c40e0a Mon Sep 17 00:00:00 2001 From: AstroHan Date: Tue, 1 Sep 2026 20:13:47 +0800 Subject: [PATCH] test(cli): compare State Root locations with the platform separator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `durable state covers the control namespace, not only the State Root` built its expectations with POSIX literals while the code under test builds paths with `path.join`. On Windows the two disagree: `join` returns `\qualification-scope\state-root`, so the equality assertion was always false and `npm run check:release` — which the Windows packaging job runs — failed there. Build the expected State Root with the same `join` the production code uses, and separate the nesting guard with `path.sep`. That guard had the same POSIX assumption: on Windows no golden path can start with `/`, so it passed vacuously and proved nothing. The defect stayed latent because `Release Windows check` only runs when a pull request touches the release packaging inputs, and this test file is not one of them. Generated-by: Claude Code --- scripts/qualify-released-cli-state-root.test.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/qualify-released-cli-state-root.test.mjs b/scripts/qualify-released-cli-state-root.test.mjs index 9a02a466ba..7243d2e2f4 100644 --- a/scripts/qualify-released-cli-state-root.test.mjs +++ b/scripts/qualify-released-cli-state-root.test.mjs @@ -20,7 +20,7 @@ import assert from 'node:assert/strict'; import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; -import { isAbsolute, join, resolve } from 'node:path'; +import { isAbsolute, join, resolve, sep } from 'node:path'; import test from 'node:test'; import { assertExpectedEpochRelation, @@ -199,14 +199,14 @@ test('durable state covers the control namespace, not only the State Root', () = // transition it proved was never the one a user performs. const locations = durableStateLocations('/qualification-scope'); assert.ok(locations.length >= 2); - assert.ok(locations.some(({ live }) => live === '/qualification-scope/state-root')); + assert.ok(locations.some(({ live }) => live === join('/qualification-scope', 'state-root'))); assert.ok( locations.some(({ live }) => live.endsWith(join('.cache', 'maka', 'runtime-hosts'))), 'the account-local control namespace must be captured and restored', ); for (const { live, golden } of locations) { assert.ok(isAbsolute(live) && isAbsolute(golden)); - assert.ok(!golden.startsWith(`${live}/`), 'a golden copy must not nest inside its live path'); + assert.ok(!golden.startsWith(live + sep), 'a golden copy must not nest inside its live path'); } });