From dc33bb386b1acf45a3af02a4a23b99444f7d952e Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 14:17:47 +0100 Subject: [PATCH 01/15] test: the in-memory filesystem reads Windows and POSIX paths as one entry (#1705) --- src/ports/memory-filesystem-paths.test.ts | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/ports/memory-filesystem-paths.test.ts diff --git a/src/ports/memory-filesystem-paths.test.ts b/src/ports/memory-filesystem-paths.test.ts new file mode 100644 index 000000000..ee2c894bc --- /dev/null +++ b/src/ports/memory-filesystem-paths.test.ts @@ -0,0 +1,46 @@ +import { describe, expect, it } from "vitest"; + +import { MemoryFilesystem } from "./index.js"; + +const STYLES = ["D:\\a\\b", "\\a\\b", "D:/a/b", "/a/b"] as const; + +async function withTree(): Promise { + const filesystem = new MemoryFilesystem(); + await filesystem.mkdirp("/a"); + return filesystem; +} + +describe("MemoryFilesystem path styles", () => { + it("reads `D:\\a\\b`, `\\a\\b`, `D:/a/b` and `/a/b` as one entry, `C:\\a` and `D:\\a` as one, and returns the `/` form", async () => { + for (const written of STYLES) { + for (const read of STYLES) { + const filesystem = await withTree(); + await filesystem.writeFileAtomic(written, "x"); + expect(await filesystem.readFile(read), `write ${written}, read ${read}`).toBe("x"); + expect(await filesystem.readdir("D:\\a"), `readdir after ${written}`).toEqual(["b"]); + await filesystem.rename(read, "C:\\a\\c"); + expect(await filesystem.exists("/a/b"), `rename from ${read}`).toBe(false); + expect(await filesystem.readFile("/a/c")).toBe("x"); + await filesystem.rm(read === "/a/b" ? "D:\\a\\c" : "\\a\\c"); + expect(await filesystem.exists("/a/c")).toBe(false); + } + } + + const made = new MemoryFilesystem(); + await made.mkdirp("D:\\x\\y"); + expect((await made.lstat("/x/y")).kind).toBe("directory"); + expect(await made.realpath("D:\\x")).toBe("/x"); + + const linked = await withTree(); + linked.defineSymlink("/link", "D:\\a"); + await linked.writeFileAtomic("/a/f", "y"); + expect(await linked.realpath("/link")).toBe("/a"); + expect(await linked.readFile("/link/f")).toBe("y"); + + const relative = new MemoryFilesystem(); + await expect(relative.readFile("rel\\file")).rejects.toMatchObject({ code: "ENOENT" }); + + const missing = new MemoryFilesystem(); + await expect(missing.readFile("D:\\nope")).rejects.toThrow(/D:\\nope|\/nope/); + }); +}); From d5aef533f517a18e6d151df9bf110e587f9faf51 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 14:18:35 +0100 Subject: [PATCH 02/15] feat(ports): the in-memory filesystem reads Windows and POSIX paths as one entry (#1705) --- src/ports/filesystem.ts | 76 +++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 30 deletions(-) diff --git a/src/ports/filesystem.ts b/src/ports/filesystem.ts index 2cc36f8f8..620881fd9 100644 --- a/src/ports/filesystem.ts +++ b/src/ports/filesystem.ts @@ -460,6 +460,7 @@ export class NodeFilesystem implements Filesystem { } async directorySize(path: string): Promise { + path = memoryPath(path); let total = 0; for (const entry of await readdir(path, { withFileTypes: true })) { const child = join(path, entry.name); @@ -510,7 +511,7 @@ export class MemoryFilesystem implements Filesystem { } async readFile(path: string): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); const entry = this.#entryAt(path); if (entry.kind !== "file") { @@ -529,7 +530,7 @@ export class MemoryFilesystem implements Filesystem { body: ReadableStream, options: { readonly mode?: number } = {}, ): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); path = this.#underResolvedParent(path); this.#requireDirectory(parentPath(path)); if (this.#entries.has(path)) throw errnoError("EEXIST", `File already exists: ${path}`); @@ -549,7 +550,7 @@ export class MemoryFilesystem implements Filesystem { } async openFile(path: string): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); const entry = this.#entryAt(path); if (entry.kind !== "file") throw errnoError("EISDIR", `Is a directory: ${path}`); const bytes = fileBytes(entry); @@ -573,8 +574,8 @@ export class MemoryFilesystem implements Filesystem { to: string, _options: { readonly timeoutMs: number }, ): Promise { - this.#failIfDefined(from); - this.#failIfDefined(to); + from = this.#failIfDefined(from); + to = this.#failIfDefined(to); this.#rawEntryAt(from); if (this.#entries.has(to)) throw errnoError("EEXIST", `File already exists: ${to}`); this.#requireDirectory(parentPath(to)); @@ -602,7 +603,7 @@ export class MemoryFilesystem implements Filesystem { contents: string, options?: WriteFileAtomicOptions, ): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); path = this.#underResolvedParent(path); this.#requireDirectory(parentPath(path)); this.#entries.set(path, { @@ -616,7 +617,7 @@ export class MemoryFilesystem implements Filesystem { contents: string, options: { readonly mode: number }, ): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); path = this.#underResolvedParent(path); const existing = this.#entries.get(path); @@ -635,7 +636,7 @@ export class MemoryFilesystem implements Filesystem { contents: string, options?: WriteFileExclusiveOptions, ): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); path = this.#underResolvedParent(path); if (this.#entries.has(path)) { @@ -650,7 +651,7 @@ export class MemoryFilesystem implements Filesystem { } async mkdirp(path: string, options: MkdirpOptions = {}): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); let currentPath = ""; for (const segment of path.split("/")) { @@ -678,8 +679,8 @@ export class MemoryFilesystem implements Filesystem { * is what tells it another process won the race. */ async rename(from: string, to: string): Promise { - this.#failIfDefined(from); - this.#failIfDefined(to); + from = this.#failIfDefined(from); + to = this.#failIfDefined(to); const moved = this.#rawEntryAt(from); const occupant = this.#entries.get(to); @@ -714,7 +715,7 @@ export class MemoryFilesystem implements Filesystem { } async rm(path: string): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); const prefix = path.endsWith("/") ? path : `${path}/`; for (const entryPath of this.#entries.keys()) { @@ -725,7 +726,7 @@ export class MemoryFilesystem implements Filesystem { } async stat(path: string): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); const entry = this.#entryAt(path); return { @@ -738,14 +739,14 @@ export class MemoryFilesystem implements Filesystem { } async lstat(path: string): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); const entry = this.#rawEntryAt(path); return { kind: entry.kind, uid: entry.uid, mode: entry.mode }; } async mkdir(path: string, options: { readonly mode?: number } = {}): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); path = this.#underResolvedParent(path); if (this.#entries.has(path)) { @@ -759,12 +760,12 @@ export class MemoryFilesystem implements Filesystem { } async chmod(path: string, mode: number): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); this.#rawEntryAt(path).mode = mode & 0o777; } async realpath(path: string): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); const resolved = this.#resolveLinks(path, 0); if (!this.#entries.has(resolved)) { @@ -775,7 +776,7 @@ export class MemoryFilesystem implements Filesystem { } async readdir(path: string): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); this.#requireDirectory(path); const prefix = path === "/" ? "/" : `${path}/`; const children = new Set(); @@ -802,7 +803,7 @@ export class MemoryFilesystem implements Filesystem { * the double pass for correct. */ async exists(path: string): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); try { this.#entryAt(path); @@ -827,10 +828,10 @@ export class MemoryFilesystem implements Filesystem { } async directorySize(path: string): Promise { + path = memoryPath(path); let total = 0; for (const name of await this.readdir(path)) { - const child = joinMemoryPath(path, name); - this.#failIfDefined(child); + const child = this.#failIfDefined(joinMemoryPath(path, name)); const entry = this.#rawEntryAt(child); if (entry.kind === "directory") total += await this.directorySize(child); else if (entry.kind === "file") total += fileBytes(entry).byteLength; @@ -839,14 +840,15 @@ export class MemoryFilesystem implements Filesystem { } async readlink(path: string): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); const entry = this.#rawEntryAt(this.#underResolvedParent(path)); if (entry.kind !== "symlink") throw errnoError("EINVAL", `Not a symbolic link: ${path}`); return entry.target; } - async replaceSymlink(path: string, target: string): Promise { - this.#failIfDefined(path); + async replaceSymlink(path: string, given: string): Promise { + path = this.#failIfDefined(path); + const target = memoryPath(given); const at = this.#underResolvedParent(path); const entry = this.#rawEntryAt(at); if (entry.kind !== "symlink") throw errnoError("EINVAL", `Not a symbolic link: ${path}`); @@ -854,7 +856,7 @@ export class MemoryFilesystem implements Filesystem { } async writeAt(path: string, offset: number, bytes: Uint8Array): Promise { - this.#failIfDefined(path); + path = this.#failIfDefined(path); const entry = this.#entryAt(path); if (entry.kind !== "file") throw errnoError("EISDIR", `Is a directory: ${path}`); const old = fileBytes(entry); @@ -870,18 +872,21 @@ export class MemoryFilesystem implements Filesystem { * reach the branches that turn an unexpected filesystem failure into a typed rejection. */ defineFailure(path: string, code: string): void { - this.#failures.set(path, code); + this.#failures.set(memoryPath(path), code); } defineSymlink(path: string, target: string): void { - this.#entries.set(path, this.#newEntry({ kind: "symlink", target })); + this.#entries.set( + memoryPath(path), + this.#newEntry({ kind: "symlink", target: memoryPath(target) }), + ); } defineAttributes( path: string, attributes: { readonly uid?: number; readonly mode?: number; readonly modifiedAtMs?: number }, ): void { - const entry = this.#rawEntryAt(path); + const entry = this.#rawEntryAt(memoryPath(path)); if (attributes.uid !== undefined) { entry.uid = attributes.uid; @@ -896,11 +901,14 @@ export class MemoryFilesystem implements Filesystem { } } - #failIfDefined(path: string): void { + /** why: every public method enters here, so the one place that fails an injected path is also the one that reads a path in either style. */ + #failIfDefined(given: string): string { + const path = memoryPath(given); const code = this.#failures.get(path); if (code !== undefined) { - throw errnoError(code, `Injected ${code} failure: ${path}`); + throw errnoError(code, `Injected ${code} failure: ${given}`); } + return path; } #newEntry(kind: MemoryEntryKind): MemoryEntry { @@ -976,6 +984,14 @@ function fileBytes(entry: { readonly contents: string; readonly bytes?: Uint8Arr return entry.bytes ?? Buffer.from(entry.contents, "utf8"); } +/** + * why: the fake reads `D:\a\b`, `\a\b` and `/a/b` as one entry, so a test written for the host's + * path style passes on every host; production code keeps `node:path`. + */ +function memoryPath(path: string): string { + return path.replace(/^[A-Za-z]:(?=[\\/]|$)/, "").replaceAll("\\", "/"); +} + function joinMemoryPath(parent: string, child: string): string { return parent === "/" || parent === "" ? `/${child}` : `${parent}/${child}`; } From 38b80073c57454e41ecc9c154960ea96f6485d29 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 14:19:18 +0100 Subject: [PATCH 03/15] test: CI runs the unit tests on Windows and Quality needs that job (#1705) --- src/test-lanes.repo.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test-lanes.repo.test.ts b/src/test-lanes.repo.test.ts index df3e0b01d..7ee62c5ca 100644 --- a/src/test-lanes.repo.test.ts +++ b/src/test-lanes.repo.test.ts @@ -211,3 +211,21 @@ describe("the console lane in CI (.github/workflows/ci.yml)", () => { } }); }); + +describe("the Windows unit job in CI (.github/workflows/ci.yml)", () => { + it("runs `pnpm run test:unit` as `Unit tests (Windows)` on windows-2025 under bash with a 30 minute limit, `quality` needs it, and text files check out with LF", () => { + const ci = readFileSync(join(REPO_ROOT, ".github/workflows/ci.yml"), "utf8"); + const attributes = readFileSync(join(REPO_ROOT, ".gitattributes"), "utf8"); + const jobs = ciJobs(ci); + const windows = jobs.get("windows-unit") ?? ""; + + expect(windows, "a job `windows-unit`").not.toBe(""); + expect(windows).toMatch(/\n {4}name: Unit tests \(Windows\)\n/); + expect(windows).toContain("runs-on: windows-2025"); + expect(windows).toMatch(/\n {6}shell: bash\n|\n {4}defaults:\n {6}run:\n {8}shell: bash\n/); + expect(windows).toContain("timeout-minutes: 30"); + expect(windows).toMatch(/run: pnpm run test:unit\n/); + expect(jobs.get("quality")).toMatch(/needs:\s*\[[^\]]*\bwindows-unit\b/); + expect(attributes.split("\n")).toContain("* text=auto eol=lf"); + }); +}); From a693e45d9338067e4ed00c7a1aa16efd6e714fc8 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 14:19:26 +0100 Subject: [PATCH 04/15] ci: the unit tests run on Windows and Quality needs that job (#1705) --- .gitattributes | 4 ++++ .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 9e627ed8f..80c3b7b1d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,7 @@ # a union merge keeps both instead of stopping the stack sync on an add/add conflict. The # src/adr-index.repo.test.ts check keeps the table complete and in order. docs/internal/adr/README.md merge=union + +# why: a Windows checkout would otherwise turn text files into CRLF, which breaks the tests that +# compare file text and the scripts bash runs. +* text=auto eol=lf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0f1e0fe8..10683e40f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,36 @@ jobs: - name: Unit tests run: pnpm run test:unit + # why: the Windows paths are otherwise tested only by passing `platform: "win32"` on Linux; + # bash is Git Bash, which the repository's tooling needs on Windows (ADR 0087 section 6). + windows-unit: + name: Unit tests (Windows) + runs-on: windows-2025 + permissions: + contents: read + timeout-minutes: 30 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 22 + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: "3.13" + - name: Enable Corepack + run: | + corepack enable + corepack prepare pnpm@12.8.1+sha512.f64ba907507f5ceafe06c8d38e6052d0179444580ec1279ddd5bfc11cb48aa8a2644b66598e07e761da84872a9fc57d5f902b87fa49d024198d558612aabbe45 --activate + - name: Install dependencies + run: pnpm install --frozen-lockfile --ignore-scripts + - name: Unit tests + run: pnpm run test:unit + timing: name: Timing tests runs-on: ubuntu-24.04 @@ -126,7 +156,7 @@ jobs: # by a failed need would count as passed. quality: name: Quality - needs: [static, unit, timing, e2e] + needs: [static, unit, windows-unit, timing, e2e] if: always() runs-on: ubuntu-24.04 permissions: {} From 16079c4ec55c1581e36b7d740b83a2af2617c843 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 14:19:40 +0100 Subject: [PATCH 05/15] test: windowsSkipped is the Windows job's list of left-out files (#1705) --- src/test-lanes.repo.test.ts | 21 +++++++++++++++++++++ src/test-support/windows-skipped.ts | 9 +++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/test-support/windows-skipped.ts diff --git a/src/test-lanes.repo.test.ts b/src/test-lanes.repo.test.ts index 7ee62c5ca..24316e3dd 100644 --- a/src/test-lanes.repo.test.ts +++ b/src/test-lanes.repo.test.ts @@ -5,6 +5,8 @@ import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; +import { windowsSkipped } from "./test-support/windows-skipped.js"; + const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), ".."); const packageJson = JSON.parse(readFileSync(join(REPO_ROOT, "package.json"), "utf8")) as { @@ -229,3 +231,22 @@ describe("the Windows unit job in CI (.github/workflows/ci.yml)", () => { expect(attributes.split("\n")).toContain("* text=auto eol=lf"); }); }); + +describe("the files the Windows job leaves out (src/test-support/windows-skipped.ts)", () => { + it("`windowsSkipped` is the list on win32 and empty on linux and darwin, holds sorted tracked test files once each, and `vitest.config.ts` gives it to the `unit` project only", () => { + const tracked = new Set( + spawnSync("git", ["ls-files"], { cwd: REPO_ROOT, encoding: "utf8" }).stdout.split("\n"), + ); + const list = windowsSkipped("win32"); + const config = readFileSync(join(REPO_ROOT, "vitest.config.ts"), "utf8"); + const unitProject = /name:\s*"unit"[\s\S]*?name:\s*"ui-dom"/.exec(config)?.[0] ?? ""; + + expect(windowsSkipped("linux")).toEqual([]); + expect(windowsSkipped("darwin")).toEqual([]); + expect(list).toEqual([...new Set(list)].sort()); + expect(list.filter((path) => !tracked.has(path))).toEqual([]); + expect(list.filter((path) => !/\.test\.tsx?$/.test(path))).toEqual([]); + expect(unitProject).toContain("...windowsSkipped(process.platform)"); + expect(config.match(/windowsSkipped\(/g)).toHaveLength(1); + }); +}); diff --git a/src/test-support/windows-skipped.ts b/src/test-support/windows-skipped.ts new file mode 100644 index 000000000..ebe07626d --- /dev/null +++ b/src/test-support/windows-skipped.ts @@ -0,0 +1,9 @@ +/** + * why: ADR 0087 section 4: the test files the `Unit tests (Windows)` job leaves out until a later + * task fixes them. Sorted, repo-relative; a task takes entries off and none is ever added. + */ +const WINDOWS_SKIPPED: readonly string[] = []; + +export function windowsSkipped(platform: string): readonly string[] { + return platform === "win32" ? WINDOWS_SKIPPED : []; +} From 2c6ae4dc53f56702763c157294923501c9b6d4cf Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 14:19:58 +0100 Subject: [PATCH 06/15] feat(test): the unit project leaves out windowsSkipped on a Windows host (#1705) --- vitest.config.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vitest.config.ts b/vitest.config.ts index f1e7ced22..8488c8739 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,5 +1,7 @@ import { defineConfig } from "vitest/config"; +import { windowsSkipped } from "./src/test-support/windows-skipped.js"; + export default defineConfig({ test: { // strictTags (default in vitest 4.1) rejects any tag not declared here or on a @@ -25,6 +27,8 @@ export default defineConfig({ "src/**/*.timing.test.ts", "packages/*/src/**/*.timing.test.ts", "ui/**/*.dom.test.tsx", + // why: files that still fail on Windows, read on a Windows host only (ADR 0087). + ...windowsSkipped(process.platform), ], // why: the script tests under src/ spawn node, git and a fake gh per case; under a full // parallel run the default five seconds times three of them out (lint-rules, claim, From 99e418be4bbe16625d21256b9b76080798f36765 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 14:20:13 +0100 Subject: [PATCH 07/15] docs: toolchain, testing rule 5 and the test-support manual name the Windows job and its list (#1705) --- docs/internal/agent-rules/testing.md | 6 +++++- docs/internal/agent-rules/toolchain.md | 10 +++++++--- src/test-support/AGENTS.md | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/internal/agent-rules/testing.md b/docs/internal/agent-rules/testing.md index 94af71a6c..2712b1998 100644 --- a/docs/internal/agent-rules/testing.md +++ b/docs/internal/agent-rules/testing.md @@ -73,7 +73,11 @@ here and moves into its module's test file. guesses. Check out the base commit, run the same test, and let the result decide; a failure that reproduces there is not yours to fix in this change, and one that does not reproduce is yours. Never skip, disable, or - quarantine a test to get to green. + quarantine a test to get to green. A test of a fact Windows does not have + (a POSIX mode, a launchd file) is skipped on `win32`: that is not + skipping to get to green. Until the Windows feature ends, the files on + `src/test-support/windows-skipped.ts` are left out of the Windows job + too, and that list only shrinks. Most flakes are written, not found: an assertion on a deadline, a duration, a throughput or a frame time without a fake clock passes on an idle machine and fails on a loaded runner. A bound on real time diff --git a/docs/internal/agent-rules/toolchain.md b/docs/internal/agent-rules/toolchain.md index e91edab39..4bd24efa1 100644 --- a/docs/internal/agent-rules/toolchain.md +++ b/docs/internal/agent-rules/toolchain.md @@ -64,9 +64,13 @@ list and this one the same. `.fallowrc.json` limits, and refactoring targets never fail. Its findings show as annotations on the PR. A `fallow-ignore` comment names its reason after ` -- `, and one that no longer hides a finding fails. The `pnpm - check` steps run as parallel jobs (static checks, unit tests, the timing - tests, the e2e lane in three shards); the Quality check passes only when all of them - do. The console DOM tests run with the unit tests. The console lane runs + check` steps run as parallel jobs (static checks, unit tests, the unit + tests on Windows, the timing tests, the e2e lane in three shards); the + Quality check passes only when all of them do. A contributor on Windows + runs the tests from Git Bash with Python 3 installed, never PowerShell. A + failure only the `Unit tests (Windows)` job shows is reproduced by + rerunning that job on the base commit's CI run (`gh run rerun --job + `), not locally. The console DOM tests run with the unit tests. The console lane runs in Chromium in two shards (the required Console check passes only when they all do) on every push to `main`, and on a pull request when it changes a source, UI, console spec or build file. diff --git a/src/test-support/AGENTS.md b/src/test-support/AGENTS.md index 555556463..5ac59a048 100644 --- a/src/test-support/AGENTS.md +++ b/src/test-support/AGENTS.md @@ -10,5 +10,7 @@ Does: test-only helpers shared across modules; excluded from the build. - A repo-wide grep over source runs on `blankSource` output: it blanks comments (and with `strings`, string and template text) and keeps every newline, so a match is code, at the right line. +- `windows-skipped.ts` is the one list of test files the Windows CI job leaves out (ADR 0087); + it is read on a Windows host only and only shrinks. - `promiseState` reads whether a promise settled without awaiting it, so a broken timer fails on an assertion, not a test timeout. From 3999175c2ec9c354f17322dae723489aa519c9fa Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 14:25:53 +0100 Subject: [PATCH 08/15] fix(ports): the in-memory filesystem reads backslashes only in absolute paths (#1705) --- src/ports/filesystem.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ports/filesystem.ts b/src/ports/filesystem.ts index 620881fd9..f91dfde50 100644 --- a/src/ports/filesystem.ts +++ b/src/ports/filesystem.ts @@ -989,7 +989,8 @@ function fileBytes(entry: { readonly contents: string; readonly bytes?: Uint8Arr * path style passes on every host; production code keeps `node:path`. */ function memoryPath(path: string): string { - return path.replace(/^[A-Za-z]:(?=[\\/]|$)/, "").replaceAll("\\", "/"); + const absolute = path.replace(/^[A-Za-z]:(?=[\\/]|$)/, ""); + return /^[\\/]/.test(absolute) ? absolute.replaceAll("\\", "/") : path; } function joinMemoryPath(parent: string, child: string): string { From dfdad8232b533da95e4c38e35d285a1ad887565e Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 15:16:38 +0100 Subject: [PATCH 09/15] test: the Windows job leaves out the files that failed in three runs (#1705) --- src/test-support/windows-skipped.ts | 136 +++++++++++++++++++++++++++- 1 file changed, 135 insertions(+), 1 deletion(-) diff --git a/src/test-support/windows-skipped.ts b/src/test-support/windows-skipped.ts index ebe07626d..eb7430a74 100644 --- a/src/test-support/windows-skipped.ts +++ b/src/test-support/windows-skipped.ts @@ -2,7 +2,141 @@ * why: ADR 0087 section 4: the test files the `Unit tests (Windows)` job leaves out until a later * task fixes them. Sorted, repo-relative; a task takes entries off and none is ever added. */ -const WINDOWS_SKIPPED: readonly string[] = []; +const WINDOWS_SKIPPED: readonly string[] = [ + "src/agent-device/host/agent-device-supervisor-state.test.ts", + "src/agent-device/host/install.test.ts", + "src/budget-guard.test.ts", + "src/ci-failures.test.ts", + "src/claim.test.ts", + "src/cli/index-auto-launch-handshake.test.ts", + "src/cli/index-daemon-service.test.ts", + "src/cli/index-daemon-status.test.ts", + "src/cli/index-device-config.test.ts", + "src/cli/index-events-mcp-smoke.test.ts", + "src/cli/index-files.test.ts", + "src/cli/index.test.ts", + "src/cli/passthrough.test.ts", + "src/cli/tunnel-forward-and-emulator.test.ts", + "src/clock-hook.test.ts", + "src/core/device-root.test.ts", + "src/core/instance-identity.test.ts", + "src/core/registry.test.ts", + "src/daemon/connection-host.test.ts", + "src/daemon/device-data-tables.test.ts", + "src/daemon/dispatcher-events.test.ts", + "src/daemon/dispatcher-usage.test.ts", + "src/daemon/driver-discovery.test.ts", + "src/daemon/gateway-fleet.e2e.test.ts", + "src/daemon/identity-uplink.e2e.test.ts", + "src/daemon/lease-files.test.ts", + "src/daemon/main-agent-device.test.ts", + "src/daemon/main-history.test.ts", + "src/daemon/main-host-load.test.ts", + "src/daemon/main-start-daemon.test.ts", + "src/daemon/main-state-db.test.ts", + "src/daemon/main-stop.test.ts", + "src/daemon/main-update.test.ts", + "src/daemon/main-worker-lock.test.ts", + "src/daemon/main.test.ts", + "src/daemon/optional-modules-start.test.ts", + "src/daemon/optional-modules-stop.test.ts", + "src/daemon/optional-modules.test.ts", + "src/daemon/relay-gateway-bodies.e2e.test.ts", + "src/daemon/relay-gateway-cancel.e2e.test.ts", + "src/daemon/relay-gateway-capacity.e2e.test.ts", + "src/daemon/relay-gateway-files.e2e.test.ts", + "src/daemon/relay-gateway.e2e.test.ts", + "src/daemon/relay-worker.e2e.test.ts", + "src/daemon/remote-client.e2e.test.ts", + "src/daemon/server-claim-and-stop.test.ts", + "src/daemon/server-drivers.test.ts", + "src/daemon/server-leases.test.ts", + "src/daemon/server-pushes-gateway.test.ts", + "src/daemon/server-pushes.test.ts", + "src/daemon/server-requests.test.ts", + "src/daemon/server-roles.test.ts", + "src/daemon/server-startup.test.ts", + "src/daemon/server-update.test.ts", + "src/daemon/server.test.ts", + "src/daemon/session-path.e2e.test.ts", + "src/delivery-stats.test.ts", + "src/drivers/android/device-table.test.ts", + "src/drivers/android/index-boot.test.ts", + "src/drivers/android/index-copies-recovery.test.ts", + "src/drivers/android/index-device-tcp.test.ts", + "src/drivers/android/index-image-fit.test.ts", + "src/drivers/android/index-launch.test.ts", + "src/drivers/android/index-lifecycle.test.ts", + "src/drivers/android/index-profiles-components.test.ts", + "src/drivers/android/index-screen-capture.test.ts", + "src/drivers/android/index.test.ts", + "src/drivers/android/physical-handler-inspect-list.test.ts", + "src/drivers/android/physical-handler-network.test.ts", + "src/drivers/android/physical-handler-passthrough.test.ts", + "src/drivers/android/physical-handler.test.ts", + "src/drivers/android/seeds-copies.test.ts", + "src/drivers/android/seeds-library-and-fit.test.ts", + "src/drivers/android/two-instances.test.ts", + "src/drivers/ios/boot-courtesies.test.ts", + "src/drivers/ios/boot-deadline.test.ts", + "src/drivers/ios/devicectl-passthrough.test.ts", + "src/drivers/ios/index-component-install.test.ts", + "src/drivers/ios/index-device-set.test.ts", + "src/drivers/ios/index-list-components.test.ts", + "src/drivers/ios/index-passthrough.test.ts", + "src/drivers/ios/index-provenance-root.test.ts", + "src/drivers/ios/index-remove-component.test.ts", + "src/drivers/ios/index-save-source-lifecycle.test.ts", + "src/drivers/ios/index-seed-provision.test.ts", + "src/drivers/ios/index-seed-record.test.ts", + "src/drivers/ios/index-seed-sources.test.ts", + "src/drivers/ios/index-seed-swap.test.ts", + "src/drivers/ios/index-seed-throwaway.test.ts", + "src/drivers/ios/index-simulator-audio.test.ts", + "src/drivers/ios/index-slim-mode.test.ts", + "src/drivers/ios/index-slim-resolve-advisories.test.ts", + "src/drivers/ios/index.test.ts", + "src/drivers/ios/physical-files-and-limits.test.ts", + "src/drivers/ios/physical-presence.test.ts", + "src/drivers/ios/physical.test.ts", + "src/drivers/ios/slim-except.test.ts", + "src/drivers/ios/slim-named-services.test.ts", + "src/fast-track.test.ts", + "src/gateway/boundary.test.ts", + "src/gateway/dispatcher-reads.test.ts", + "src/history/history.test.ts", + "src/instructions/setup.test.ts", + "src/lint-rules.test.ts", + "src/manual-hook.test.ts", + "src/mcp/main.test.ts", + "src/merge-pr.test.ts", + "src/mutate.test.ts", + "src/ports/daemon-launcher.test.ts", + "src/ports/filesystem.test.ts", + "src/ports/ipc.test.ts", + "src/ports/logger.test.ts", + "src/ports/npm-cli.test.ts", + "src/ports/paths.test.ts", + "src/ports/process-runner.test.ts", + "src/ports/service-manager.test.ts", + "src/ports/sqlite.test.ts", + "src/ports/updater-launcher.test.ts", + "src/ports/uplink-websocket.test.ts", + "src/ports/worker-lock.test.ts", + "src/pr-body-check.test.ts", + "src/recurring-findings.test.ts", + "src/refactor-check.test.ts", + "src/release-pack.test.ts", + "src/review-inputs.test.ts", + "src/simlock-client/no-core-leak.test.ts", + "src/slow-e2e.test.ts", + "src/state/state.test.ts", + "src/test-support/imports.test.ts", + "src/tool-guard.test.ts", + "src/updater/index.test.ts", + "src/worktree-script.test.ts", + "ui/src/ds/contrast.test.ts", +]; export function windowsSkipped(platform: string): readonly string[] { return platform === "win32" ? WINDOWS_SKIPPED : []; From c4eafeca89832db82145965ba337ec69ae591bae Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 15:17:12 +0100 Subject: [PATCH 10/15] test: the printed-text path check leaves out src/test-support, which only tests import (#1705) --- src/docs-audience.repo.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docs-audience.repo.test.ts b/src/docs-audience.repo.test.ts index e36b8836d..f610cbdf0 100644 --- a/src/docs-audience.repo.test.ts +++ b/src/docs-audience.repo.test.ts @@ -123,7 +123,7 @@ const REPO_PATH = const printingSources = trackedFiles.filter( (name) => /^(?:src|ui\/src)\/.+\.tsx?$/.test(name) && - !/\.test\.tsx?$|(?:^|\/)testing\.ts$|(?:^|\/)test-[^/]*$/.test(name), + !/\.test\.tsx?$|(?:^|\/)testing\.ts$|(?:^|\/)test-[^/]*$|^src\/test-support\//.test(name), ); function repoPaths(name: string, text: string): string[] { From 9f30279f4da056ec0703879f3e3867746f5338f6 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 15:30:04 +0100 Subject: [PATCH 11/15] test: the Windows job also leaves out rig-ports.e2e.test.ts, which failed in a fourth run (#1705) --- src/test-support/windows-skipped.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test-support/windows-skipped.ts b/src/test-support/windows-skipped.ts index eb7430a74..1057364f6 100644 --- a/src/test-support/windows-skipped.ts +++ b/src/test-support/windows-skipped.ts @@ -5,6 +5,7 @@ const WINDOWS_SKIPPED: readonly string[] = [ "src/agent-device/host/agent-device-supervisor-state.test.ts", "src/agent-device/host/install.test.ts", + "src/agent-device/rig-ports.e2e.test.ts", "src/budget-guard.test.ts", "src/ci-failures.test.ts", "src/claim.test.ts", From cd00f14d1e9639721e516eba7d2a703cee3a35f5 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 15:40:14 +0100 Subject: [PATCH 12/15] test: the Windows job also leaves out docs-surface-check and host-load, which failed in a fifth run (#1705) --- src/test-support/windows-skipped.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test-support/windows-skipped.ts b/src/test-support/windows-skipped.ts index 1057364f6..acd2836ee 100644 --- a/src/test-support/windows-skipped.ts +++ b/src/test-support/windows-skipped.ts @@ -61,6 +61,7 @@ const WINDOWS_SKIPPED: readonly string[] = [ "src/daemon/server.test.ts", "src/daemon/session-path.e2e.test.ts", "src/delivery-stats.test.ts", + "src/docs-surface-check.test.ts", "src/drivers/android/device-table.test.ts", "src/drivers/android/index-boot.test.ts", "src/drivers/android/index-copies-recovery.test.ts", @@ -114,6 +115,7 @@ const WINDOWS_SKIPPED: readonly string[] = [ "src/mutate.test.ts", "src/ports/daemon-launcher.test.ts", "src/ports/filesystem.test.ts", + "src/ports/host-load.test.ts", "src/ports/ipc.test.ts", "src/ports/logger.test.ts", "src/ports/npm-cli.test.ts", From 47cbf17d08fbd375bdf6ef5bc580201b00d97b5b Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 15:58:37 +0100 Subject: [PATCH 13/15] fix(ports): the real directorySize keeps its path; the fake's injected failures and symlink targets are tested in both path styles (#1705) --- src/ports/filesystem.ts | 1 - src/ports/memory-filesystem-paths.test.ts | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ports/filesystem.ts b/src/ports/filesystem.ts index f91dfde50..0470addb0 100644 --- a/src/ports/filesystem.ts +++ b/src/ports/filesystem.ts @@ -460,7 +460,6 @@ export class NodeFilesystem implements Filesystem { } async directorySize(path: string): Promise { - path = memoryPath(path); let total = 0; for (const entry of await readdir(path, { withFileTypes: true })) { const child = join(path, entry.name); diff --git a/src/ports/memory-filesystem-paths.test.ts b/src/ports/memory-filesystem-paths.test.ts index ee2c894bc..7a6133fdf 100644 --- a/src/ports/memory-filesystem-paths.test.ts +++ b/src/ports/memory-filesystem-paths.test.ts @@ -37,6 +37,15 @@ describe("MemoryFilesystem path styles", () => { expect(await linked.realpath("/link")).toBe("/a"); expect(await linked.readFile("/link/f")).toBe("y"); + const injected = await withTree(); + injected.defineFailure("D:\\a\\f", "EIO"); + await expect(injected.readFile("/a/f")).rejects.toMatchObject({ code: "EIO" }); + + const replaced = await withTree(); + replaced.defineSymlink("/link", "/a"); + await replaced.replaceSymlink("/link", "D:\\a\\other"); + expect(await replaced.readlink("/link")).toBe("/a/other"); + const relative = new MemoryFilesystem(); await expect(relative.readFile("rel\\file")).rejects.toMatchObject({ code: "ENOENT" }); From 7fee05ce9f3d68e78b90b1f56d805b065f4a1d5a Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 16:04:49 +0100 Subject: [PATCH 14/15] fix(ports): the relative-path case of the fake fails when a relative path becomes absolute; the #failIfDefined doc names what enters it (#1705) --- src/ports/filesystem.ts | 2 +- src/ports/memory-filesystem-paths.test.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ports/filesystem.ts b/src/ports/filesystem.ts index 0470addb0..398c56b49 100644 --- a/src/ports/filesystem.ts +++ b/src/ports/filesystem.ts @@ -900,7 +900,7 @@ export class MemoryFilesystem implements Filesystem { } } - /** why: every public method enters here, so the one place that fails an injected path is also the one that reads a path in either style. */ + /** why: every method that takes a path and can fail enters here, so the one place that fails an injected path is also the one that reads a path in either style. */ #failIfDefined(given: string): string { const path = memoryPath(given); const code = this.#failures.get(path); diff --git a/src/ports/memory-filesystem-paths.test.ts b/src/ports/memory-filesystem-paths.test.ts index 7a6133fdf..d936c20f8 100644 --- a/src/ports/memory-filesystem-paths.test.ts +++ b/src/ports/memory-filesystem-paths.test.ts @@ -47,7 +47,9 @@ describe("MemoryFilesystem path styles", () => { expect(await replaced.readlink("/link")).toBe("/a/other"); const relative = new MemoryFilesystem(); - await expect(relative.readFile("rel\\file")).rejects.toMatchObject({ code: "ENOENT" }); + relative.defineFailure("rel\\file", "EIO"); + await expect(relative.readFile("rel\\file")).rejects.toMatchObject({ code: "EIO" }); + await expect(relative.readFile("/rel/file")).rejects.toMatchObject({ code: "ENOENT" }); const missing = new MemoryFilesystem(); await expect(missing.readFile("D:\\nope")).rejects.toThrow(/D:\\nope|\/nope/); From 60623b3c47c7b9b84474a7ede7020b2fbb51481e Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Wed, 18 Nov 2026 16:10:45 +0100 Subject: [PATCH 15/15] test(ports): a relative `rel/file` is not the injected `rel\\file` (#1705) --- src/ports/memory-filesystem-paths.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ports/memory-filesystem-paths.test.ts b/src/ports/memory-filesystem-paths.test.ts index d936c20f8..ddcbb09b5 100644 --- a/src/ports/memory-filesystem-paths.test.ts +++ b/src/ports/memory-filesystem-paths.test.ts @@ -50,6 +50,7 @@ describe("MemoryFilesystem path styles", () => { relative.defineFailure("rel\\file", "EIO"); await expect(relative.readFile("rel\\file")).rejects.toMatchObject({ code: "EIO" }); await expect(relative.readFile("/rel/file")).rejects.toMatchObject({ code: "ENOENT" }); + await expect(relative.readFile("rel/file")).rejects.toMatchObject({ code: "ENOENT" }); const missing = new MemoryFilesystem(); await expect(missing.readFile("D:\\nope")).rejects.toThrow(/D:\\nope|\/nope/);