From bd5b1cd44fa314b097dbb1281de89e7a8eca85d1 Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Sat, 19 Sep 2026 00:07:18 +0800 Subject: [PATCH] test(session): keep persistence fixture inventory keys portable The accepted-baseline tests inventory temporary files with keys produced by the host path.join. On Windows those keys contain backslashes, but the status lookup and acknowledgement-preservation filters use repository-style slash paths. Windows coverage therefore reads undefined for the status assertion; the filtered preservation loops also select no files on that platform. Use posix.join for logical inventory keys while keeping native path.join for filesystem access. All platforms now exercise the same status lookup and preservation assertions. This is confined to the test helper and changes no production admission rule, compatibility policy, schema, or recorded fixture. --- scripts/persistence-changes.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/persistence-changes.spec.ts b/scripts/persistence-changes.spec.ts index 09a3643441..761a00dd19 100644 --- a/scripts/persistence-changes.spec.ts +++ b/scripts/persistence-changes.spec.ts @@ -3,7 +3,7 @@ import { spawnSync } from 'node:child_process' import { mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' -import { join, resolve } from 'node:path' +import { join, posix, resolve } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' import { canonicalizeSchema, schemaDigest } from './persistence-schema-model.ts' import type { PersistenceRoot, PersistenceSchemaInventory, SchemaNode, SchemaProperty, SourceCompatibility } from './persistence-schema-model.ts' @@ -179,7 +179,7 @@ function contents(root: string): Record { const files: Record = {} const visit = (directory: string): void => { for (const entry of readdirSync(join(root, directory), { withFileTypes: true })) { - const path = join(directory, entry.name) + const path = posix.join(directory, entry.name) if (entry.isDirectory()) visit(path) else files[path] = readFileSync(join(root, path), 'utf8') }