Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.
TypeScript ai-agentsanthropicclaude-codeclicode-graphcodexcontext-engineeringcursordeveloper-toolsgeminiknowledge-graphllmmcpmcp-serveropen-sourceopenaitree-sitter
test(trail): make part 2's tests hold on Windows
Shrish Dwivedi096c331bff0b
diff --git a/test/skills-contracts.test.ts b/test/skills-contracts.test.tsindex a651fbaf..f0f2a757 100644--- a/test/skills-contracts.test.ts+++ b/test/skills-contracts.test.ts@@ -8,7 +8,7 @@ import { test } from "node:test";import assert from "node:assert/strict";import { spawn, spawnSync } from "node:child_process";import { existsSync, lstatSync, lutimesSync, readFileSync, readdirSync, statSync, symlinkSync, unlinkSync, utimesSync, writeFileSync } from "node:fs";-import { dirname, join, relative } from "node:path";+import { dirname, join, relative, resolve } from "node:path";import { fileURLToPath } from "node:url";import { tmpRepo } from "./helpers.js";import {@@ -320,7 +320,7 @@ test("appendPrivateLine never writes through a symlink; writePrivate replaces th});test("trailPath joins under TRAIL_HOME or ~/.trail", () => {- assert.equal(trailPath({ TRAIL_HOME: "/tmp/x/home" }, "runs", "r-1.json"), "/tmp/x/home/runs/r-1.json");+ assert.equal(trailPath({ TRAIL_HOME: "/tmp/x/home" }, "runs", "r-1.json"), resolve("/tmp/x/home", "runs", "r-1.json"));assert.match(trailPath({}, "settings.json"), /[\\/]\.trail[\\/]settings\.json$/);});diff --git a/test/trace-breaks.test.ts b/test/trace-breaks.test.tsindex afb20f70..20bfd99e 100644--- a/test/trace-breaks.test.ts+++ b/test/trace-breaks.test.ts@@ -10,7 +10,7 @@ import assert from "node:assert/strict";import { spawn } from "node:child_process";import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, statSync, symlinkSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";-import { dirname, join } from "node:path";+import { dirname, join, resolve } from "node:path";import { fileURLToPath } from "node:url";import { checkedSuccess, freshRunId } from "../src/trace/runs.js";import { effectiveFolder } from "../src/trace/run-calls.js";@@ -73,7 +73,7 @@ test("a task notice mid-run starts nothing; a subagent's lines in the parent tratest("cd chains: `cd -` back to where the call started is known; one with no cd before it in the call is not", () => {assert.equal(effectiveFolder("/home/dev/shop", "cd backend && cd - && npm test", "/home/dev"), "/home/dev/shop");- assert.equal(effectiveFolder("/home/dev/shop", "cd backend && cd ../web && cd - && go test ./...", "/home/dev"), "/home/dev/shop/backend");+ assert.equal(effectiveFolder("/home/dev/shop", "cd backend && cd ../web && cd - && go test ./...", "/home/dev"), resolve("/home/dev/shop/backend"));assert.equal(effectiveFolder("/home/dev/shop", "cd - && npm test", "/home/dev"), null);});diff --git a/test/trace-codex-typed-key.test.ts b/test/trace-codex-typed-key.test.tsindex 3c800398..c32ad3b3 100644--- a/test/trace-codex-typed-key.test.ts+++ b/test/trace-codex-typed-key.test.ts@@ -28,7 +28,7 @@ test('the prompt hook makes state/typed-key (0600, 64 hex) and never reads or wrnoteCodexPrompt(st, 'ship it', h.env);const file = join(h.env.TRAIL_HOME!, 'state', 'typed-key');assert.ok(existsSync(file), 'the key is made where D138 puts it');- assert.equal(lstatSync(file).mode & 0o777, 0o600);+ if (process.platform !== 'win32') assert.equal(lstatSync(file).mode & 0o777, 0o600);const key = readFileSync(file, 'utf8').trim();assert.match(key, /^[0-9a-f]{64}$/);assert.equal(readFileSync(join(h.env.TRAIL_HOME!, 'key'), 'utf8'), `${other}\n`, 'the other file is untouched');diff --git a/test/trace-codex.test.ts b/test/trace-codex.test.tsindex 4d7e3c40..04ee7a0f 100644--- a/test/trace-codex.test.ts+++ b/test/trace-codex.test.ts@@ -6,7 +6,7 @@ import { test, after } from "node:test";import assert from "node:assert/strict";import { mkdtempSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";-import { join } from "node:path";+import { join, resolve } from "node:path";import {codexExitOf, codexHome, codexLineEvents, codexMeta, codexTypedSha, isImportedRollout, noteCodexPrompt, readNewCodexEvents, type CodexMeta,} from "../src/trace/codex.js";@@ -48,8 +48,8 @@ test("codexMeta: line 1's facts; a file whose first line isn't session_meta, or});test("codexHome: CODEX_HOME, else $HOME/.codex", () => {- assert.equal(codexHome({ HOME: "/home/dev", CODEX_HOME: "/tmp/x/codex" }), "/tmp/x/codex");- assert.equal(codexHome({ HOME: "/home/dev" }), "/home/dev/.codex");+ assert.equal(codexHome({ HOME: "/home/dev", CODEX_HOME: "/tmp/x/codex" }), resolve("/tmp/x/codex"));+ assert.equal(codexHome({ HOME: "/home/dev" }), join("/home/dev", ".codex"));});test("codexExitOf: each header form; a header-looking line in the output body is not the exit", () => {@@ -96,7 +96,7 @@ test("noteCodexPrompt: keyed 16-hex hashes (R7), the last 20, the key 0600 in Trassert.equal(st.codex!.typedShas.at(-1), codexTypedSha("prompt 24", h.env));assert.equal(codexTypedSha(" prompt 24\n", h.env), codexTypedSha("prompt 24", h.env), "trimmed");assert.equal(JSON.stringify(st).includes("prompt"), false);- assert.equal(statSync(join(h.env.TRAIL_HOME!, "state", "typed-key")).mode & 0o777, 0o600);+ if (process.platform !== "win32") assert.equal(statSync(join(h.env.TRAIL_HOME!, "state", "typed-key")).mode & 0o777, 0o600);const other = home();noteCodexPrompt(seen(other.env, []), "prompt 24", other.env);assert.notEqual(codexTypedSha("prompt 24", other.env), codexTypedSha("prompt 24", h.env), "keyed per home");@@ -121,7 +121,7 @@ test("calls: exec_command is Bash with its workdir; the older shell forms unwrapassert.deepEqual(calls.filter((c) => c.name === "Bash").map((c) => [c.id, cmd(c), c.cwd]), [["c1", "npm run build", "/home/dev/shop"],["c2", "npm test", "/home/dev/shop/packages/cli"],- ["c3", "ls", "/home/dev/shop/docs"],+ ["c3", "ls", resolve("/home/dev/shop/docs")],["c4", "npm view acme-cli version", "/home/dev/shop"],["c5", "git tag v1.4.3 -m 'release 1.4.3'", "/home/dev/shop"],["c6", "git push --tags", "/home/dev/shop"],@@ -129,7 +129,7 @@ test("calls: exec_command is Bash with its workdir; the older shell forms unwrap]);assert.ok(calls.every((c) => c.name !== "Bash" || c.branch === "main"));assert.deepEqual(calls.filter((c) => c.name === "Edit").map((c) => [c.id, (c.input as { file_path: string }).file_path]), [- ["c8", "/home/dev/shop/src/cart.ts"], ["c8#2", "/home/dev/.trail/state/skills.json"],+ ["c8", resolve("/home/dev/shop/src/cart.ts")], ["c8#2", "/home/dev/.trail/state/skills.json"],]);assert.ok(calls.some((c) => c.id === "c9" && c.name === "update_plan"));});diff --git a/test/trace-gate-file.test.ts b/test/trace-gate-file.test.tsindex 676c3b15..2cdb0367 100644--- a/test/trace-gate-file.test.ts+++ b/test/trace-gate-file.test.ts@@ -64,8 +64,8 @@ test("written from the live injections only: groups of consecutive gated steps,],askedAt: null, askedToolUseId: null, approvedAt: null,});- assert.equal(statSync(gateFilePath(SID, env)).mode & 0o777, 0o600);- assert.equal(statSync(join(env.TRAIL_HOME!, "sessions")).mode & 0o777, 0o700);+ if (process.platform !== "win32") assert.equal(statSync(gateFilePath(SID, env)).mode & 0o777, 0o600);+ if (process.platform !== "win32") assert.equal(statSync(join(env.TRAIL_HOME!, "sessions")).mode & 0o777, 0o700);});test("steps apart, or of different kinds, are separate groups", () => {@@ -141,7 +141,7 @@ test("post marks: appended one per line (0600), taken in order, and gone once taappendPostMark(SID, { id: "toolu_2", at: "2026-10-01T10:00:02.000Z", failed: true }, env);appendPostMark(SID, { id: "toolu_3", at: "2026-10-01T10:00:03.000Z", failed: false, tail: "y".repeat(9000) }, env);const path = gateFilePath(SID, env).replace(/\.gate\.json$/, ".post.jsonl");- assert.equal(statSync(path).mode & 0o777, 0o600);+ if (process.platform !== "win32") assert.equal(statSync(path).mode & 0o777, 0o600);assert.ok(readFileSync(path, "utf8").split("\n").every((l) => Buffer.byteLength(l) < 1024), "each append is one small write");writeFileSync(path, readFileSync(path, "utf8") + "not json\n{\"id\":5}\n");const marks = takePostMarks(SID, env);diff --git a/test/trace-pool.test.ts b/test/trace-pool.test.tsindex bab34c62..69f6f194 100644--- a/test/trace-pool.test.ts+++ b/test/trace-pool.test.ts@@ -45,8 +45,8 @@ test("a session-day is noted once; costly is OR-ed; words merge; the good run isassert.equal(e.shownAtInit, false);const disk = JSON.parse(readFileSync(poolPath(KEY, env), "utf8"));assert.deepEqual(disk.jobs.ship, e);- assert.equal(statSync(poolPath(KEY, env)).mode & 0o777, 0o600);- assert.equal(statSync(dirname(poolPath(KEY, env))).mode & 0o777, 0o700);+ if (process.platform !== "win32") assert.equal(statSync(poolPath(KEY, env)).mode & 0o777, 0o600);+ if (process.platform !== "win32") assert.equal(statSync(dirname(poolPath(KEY, env))).mode & 0o777, 0o700);assert.ok(!/prompt|typed/.test(readFileSync(poolPath(KEY, env), "utf8")));});diff --git a/test/trace-repairs-review.test.ts b/test/trace-repairs-review.test.tsindex d277019c..2bfaf882 100644--- a/test/trace-repairs-review.test.ts+++ b/test/trace-repairs-review.test.ts@@ -11,7 +11,7 @@ import { test } from "node:test";import assert from "node:assert/strict";import { spawnSync } from "node:child_process";import { dirname, join } from "node:path";-import { fileURLToPath } from "node:url";+import { fileURLToPath, pathToFileURL } from "node:url";import { SURE_FAIL_REASON } from "../src/trace/guard-fast.js";import { detectRepairs, fixDelta, ignoredFailure } from "../src/trace/repairs.js";import type { RunCall } from "../src/trace/types.js";@@ -210,7 +210,7 @@ test("relativizing: a root that prefixes another path, regex characters, a roottest("long commands: ignoredFailure stays linear on 2 MB (capped child process)", () => {const probe = `- import { ignoredFailure } from ${JSON.stringify(join(SRC, "trace", "repairs.ts"))};+ import { ignoredFailure } from ${JSON.stringify(pathToFileURL(join(SRC, "trace", "repairs.ts")).href)};const n = 2 * 1024 * 1024;const c = (cmd, extra = {}) => ({ id: 'x', at: '', cmd, key: null, cwd: '', bg: false, failed: true, isError: true, kind: 'step', src: { use: 1, result: 2 }, ...extra });const rows = [];@@ -224,6 +224,7 @@ test("long commands: ignoredFailure stays linear on 2 MB (capped child process)"process.stdout.write(JSON.stringify(rows));`;const r = spawnSync(process.execPath, ["--import", "tsx", "--input-type=module", "-e", probe], { encoding: "utf8", timeout: 60_000 });assert.equal(r.signal, null, "ignoredFailure ran past 60 s");+ assert.equal(r.status, 0, r.stderr);const rows = JSON.parse(r.stdout) as number[];for (const ms of rows) assert.ok(ms < 1500, `2 MB took ${ms.toFixed(0)} ms (${JSON.stringify(rows.map(Math.round))})`);});diff --git a/test/trace-run-calls.test.ts b/test/trace-run-calls.test.tsindex dd38e923..1bb1cfa8 100644--- a/test/trace-run-calls.test.ts+++ b/test/trace-run-calls.test.ts@@ -5,6 +5,7 @@* from saving after the agent wrote Trail's or the host's files.*/import { test } from "node:test";+import { resolve, sep } from "node:path";import assert from "node:assert/strict";import { foldKind, hostRefused, interpreterKind, runHelpers } from "../src/trace/run-calls.js";import { toolResult, toolUse } from "./trace-fixtures.js";@@ -27,7 +28,9 @@ test("the folder follows the entry cwd across calls: a bare cd is plumbing, thetest("cd chains, a cd subshell, ~ and $HOME are followed; a folder only the shell knows is none", () => {const s = session("cds");const before = process.env.HOME;+ const beforeProfile = process.env.USERPROFILE;process.env.HOME = "/home/dev"; // os.homedir() follows $HOME+ process.env.USERPROFILE = "/home/dev"; // and on Windows, %USERPROFILE%try {s.fold([ask("run the integration tests", 0),@@ -40,6 +43,8 @@ test("cd chains, a cd subshell, ~ and $HOME are followed; a folder only the shel]);} finally {process.env.HOME = before;+ if (beforeProfile === undefined) delete process.env.USERPROFILE;+ else process.env.USERPROFILE = beforeProfile;}const got = calls(s).map((c) => [c.key, c.cwd]);assert.deepEqual(got, [@@ -243,14 +248,15 @@ test("tamper rules: writing Trail's files or the transcript marks the session foconst write = session("tamper-write");write.fold([ask("fix it", 0), toolUse("toolu_w", "Write", { file_path: "/home/dev/.trail/runs/r-1001-aaaa.json", content: "{}" }, { timestamp: at(1) })], ctx);- assert.equal(write.st.tampered, "Write /home/dev/.trail/runs/r-1001-aaaa.json");+ assert.equal(write.st.tampered, `Write ${resolve("/home/dev/.trail/runs/r-1001-aaaa.json")}`);write.fold([...bash("echo x >> ~/.trail/offers.jsonl", "", { sec: 2 })], ctx);- assert.equal(write.st.tampered, "Write /home/dev/.trail/runs/r-1001-aaaa.json", "the first one stays");+ assert.equal(write.st.tampered, `Write ${resolve("/home/dev/.trail/runs/r-1001-aaaa.json")}`, "the first one stays");const tx = session("tamper-tx");tx.fold([ask("fix it", 0), ...bash(`echo '{"type":"user"}' >> ${"PATH_PLACEHOLDER"}`, "", { sec: 1 })], ctx);assert.equal(tx.st.tampered, null, "a different file");- tx.fold([...bash(`echo '{"type":"user"}' >> ${tx.path}`, "", { sec: 2 })], ctx);+ // A shell word's '\' is an escape: on Windows the agent writes the transcript's path with '/'.+ tx.fold([...bash(`echo '{"type":"user"}' >> ${tx.path.split(sep).join("/")}`, "", { sec: 2 })], ctx);assert.equal(tx.st.tampered, "Bash echo");const proj = session("tamper-proj");diff --git a/test/trace-run-fixtures.ts b/test/trace-run-fixtures.tsindex b293b0e1..1ac6afbb 100644--- a/test/trace-run-fixtures.ts+++ b/test/trace-run-fixtures.ts@@ -6,7 +6,7 @@*/import { appendFileSync, mkdtempSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";-import { join } from "node:path";+import { join, resolve, sep } from "node:path";import type { GatedKind, RunCall, RunState, SkillInjection, SkillSessionState } from "../src/trace/types.js";import { jsonl, said, toolResult, toolUse, typed } from "./trace-fixtures.js";import { readNewEvents } from "../src/trace/claude.js";@@ -72,7 +72,8 @@ export function runState(extra: Partial<RunState> = {}): RunState {/** Made-up checkouts: /home/dev/shop and /home/dev/storefront are repos; anything else is outside git. */export const REPOS: Record<string, string> = { "/home/dev/shop": "github.com/acme/shop", "/home/dev/storefront": "github.com/acme/storefront" };-const rootOf = (p: string) => Object.keys(REPOS).find((r) => p === r || p.startsWith(r + "/")) ?? null;+/** Compared resolved, so a folder a cd lands in (resolve() gives Windows a drive and '\') still finds its checkout. */+const rootOf = (p: string) => Object.keys(REPOS).find((r) => resolve(p) === resolve(r) || resolve(p).startsWith(resolve(r) + sep)) ?? null;export function foldCtx(extra: Partial<FoldContext> = {}): FoldContext {return {diff --git a/test/trace-run-sheets.test.ts b/test/trace-run-sheets.test.tsindex a381dc07..1dc78ffc 100644--- a/test/trace-run-sheets.test.ts+++ b/test/trace-run-sheets.test.ts@@ -36,8 +36,8 @@ test("a sheet holds the run, its calls and its verdict; the run learns its sheetassert.equal(run.sheet, "checked");assert.equal(run.checkIndex, 2);const path = runSheetPath("r-1001-aaaa", env);- assert.equal(statSync(path).mode & 0o777, 0o600);- assert.equal(statSync(join(env.TRAIL_HOME!, "runs")).mode & 0o777, 0o700);+ if (process.platform !== "win32") assert.equal(statSync(path).mode & 0o777, 0o600);+ if (process.platform !== "win32") assert.equal(statSync(join(env.TRAIL_HOME!, "runs")).mode & 0o777, 0o700);const disk = JSON.parse(readFileSync(path, "utf8"));assert.deepEqual(disk, sheet);assert.deepEqual(diff --git a/test/trace-skill-session.test.ts b/test/trace-skill-session.test.tsindex 3b24bd8d..cd6d4816 100644--- a/test/trace-skill-session.test.ts+++ b/test/trace-skill-session.test.ts@@ -136,7 +136,7 @@ test("a session with no state starts a new one; the state lives under `skills`,assert.deepEqual(Object.keys(disk).sort(), ["other", "skills", "trace"]);assert.equal(disk.skills.runs[0].job, "tests");assert.ok(disk.trace.offset > 0);- assert.equal(statSync(stateFile(b)).mode & 0o777, 0o600);+ if (process.platform !== "win32") assert.equal(statSync(stateFile(b)).mode & 0o777, 0o600);assert.ok(!readFileSync(stateFile(b), "utf8").includes("integration tests"), "no typed text on disk");// Nothing new: the next catch-up folds nothing.withSkillSession(ctx, { catchUp: true }, (_st, fold) => assert.equal(fold!.events.length, 0));diff --git a/test/trace-tamper.test.ts b/test/trace-tamper.test.tsindex c22c4e92..f582a34b 100644--- a/test/trace-tamper.test.ts+++ b/test/trace-tamper.test.ts@@ -8,6 +8,7 @@*/import { test } from "node:test";import assert from "node:assert/strict";+import { resolve } from "node:path";import { tamperOf } from "../src/trace/tamper.js";const HOME = "/home/dev";@@ -16,11 +17,11 @@ const bash = (cmd: string, folder: string | null = "/home/dev/shop") => tamperOfconst edit = (tool: string, path: string) => tamperOf(tool, { file_path: path }, null, CTX);test("edit tools: Trail's home and transcripts are protected; Claude Code's memory files are not", () => {- assert.equal(edit("Write", "/home/dev/.trail/runs/r-1001-aaaa.json"), "Write /home/dev/.trail/runs/r-1001-aaaa.json");- assert.equal(edit("Edit", "~/.trail/settings.json"), "Edit /home/dev/.trail/settings.json");- assert.equal(edit("Edit", "/home/dev/.claude/projects/-home-dev-shop/5f0c.jsonl"), "Edit /home/dev/.claude/projects/-home-dev-shop/5f0c.jsonl");- assert.equal(edit("Write", "/home/dev/.claude/projects/-home-dev-shop/other-session.jsonl"), "Write /home/dev/.claude/projects/-home-dev-shop/other-session.jsonl");- assert.equal(tamperOf("NotebookEdit", { notebook_path: "/home/dev/.trail/x.ipynb" }, null, CTX), "NotebookEdit /home/dev/.trail/x.ipynb");+ assert.equal(edit("Write", "/home/dev/.trail/runs/r-1001-aaaa.json"), `Write ${resolve("/home/dev/.trail/runs/r-1001-aaaa.json")}`);+ assert.equal(edit("Edit", "~/.trail/settings.json"), `Edit ${resolve("/home/dev/.trail/settings.json")}`);+ assert.equal(edit("Edit", "/home/dev/.claude/projects/-home-dev-shop/5f0c.jsonl"), `Edit ${resolve("/home/dev/.claude/projects/-home-dev-shop/5f0c.jsonl")}`);+ assert.equal(edit("Write", "/home/dev/.claude/projects/-home-dev-shop/other-session.jsonl"), `Write ${resolve("/home/dev/.claude/projects/-home-dev-shop/other-session.jsonl")}`);+ assert.equal(tamperOf("NotebookEdit", { notebook_path: "/home/dev/.trail/x.ipynb" }, null, CTX), `NotebookEdit ${resolve("/home/dev/.trail/x.ipynb")}`);assert.equal(edit("Write", "/home/dev/.claude/projects/-home-dev-shop/memory/deploy-notes.md"), null);assert.equal(edit("Edit", "/home/dev/.claude/projects/-home-dev-shop/memory/MEMORY.md"), null);assert.equal(edit("Write", "/home/dev/.trail-lab/x"), null);diff --git a/test/trace-wall-state-review.test.ts b/test/trace-wall-state-review.test.tsindex ccd16222..cbad6b59 100644--- a/test/trace-wall-state-review.test.ts+++ b/test/trace-wall-state-review.test.ts@@ -10,7 +10,7 @@ import assert from "node:assert/strict";import { spawnSync } from "node:child_process";import { mkdirSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "node:fs";import { dirname, join } from "node:path";-import { fileURLToPath } from "node:url";+import { fileURLToPath, pathToFileURL } from "node:url";import { tmpRepo } from "./helpers.js";import { lessonWorkedEpochs, noteWalls, readWalls, wallDays, wallsPath } from "../src/trace/wall-state.js";@@ -27,9 +27,10 @@ const sh = (i: number) => i.toString(16).padStart(12, "0");test("a FIFO, a link to /dev/zero or a 2 MB file at walls.json reads as empty at once, and a write replaces it (capped child)", () => {const h = home();const path = wallsPath(h.env);- spawnSync("mkfifo", [path]);+ // Windows has no FIFO and no /dev/zero: only the 2 MB file is tried there.+ const posix = process.platform !== "win32";const probe = (kind: string) => `- const { readWalls, noteWalls } = await import(${JSON.stringify(join(SRC, "trace", "wall-state.ts"))});+ const { readWalls, noteWalls } = await import(${JSON.stringify(pathToFileURL(join(SRC, "trace", "wall-state.ts")).href)});const env = ${JSON.stringify(h.env)};const t = performance.now();const r = readWalls(env);@@ -38,6 +39,7 @@ test("a FIFO, a link to /dev/zero or a 2 MB file at walls.json reads as empty atconst run = (kind: string) => {const r = spawnSync(process.execPath, ["--import", "tsx", "--input-type=module", "-e", probe(kind)], { encoding: "utf8", timeout: 10_000 });assert.equal(r.signal, null, `${kind}: readWalls hung`);+ assert.equal(r.status, 0, r.stderr);const row = JSON.parse(r.stdout) as { empty: boolean; ms: number };assert.ok(row.empty, kind);assert.ok(row.ms < 1000, `${kind}: ${row.ms} ms`);@@ -45,12 +47,15 @@ test("a FIFO, a link to /dev/zero or a 2 MB file at walls.json reads as empty atconst w = JSON.parse(readFileSync(path, "utf8"));assert.deepEqual(Object.keys(w.classes), ["enospc"], kind);};- run("fifo");const zero = join(h.dir, "trail", "walls.json");- rmSync(zero, { force: true });- symlinkSync("/dev/zero", zero);- run("link to /dev/zero");- rmSync(zero, { force: true });+ if (posix) {+ spawnSync("mkfifo", [path]);+ run("fifo");+ rmSync(zero, { force: true });+ symlinkSync("/dev/zero", zero);+ run("link to /dev/zero");+ rmSync(zero, { force: true });+ }const big = { v: 1, read: {}, classes: { enospc: { seen: [{ d: "2026-10-01", sh: sh(1), epoch: 1, repo: SHOP, program: "cp" }], fixed: [], lessons: {} } }, pad: "x".repeat(2 * 1024 * 1024) };writeFileSync(zero, JSON.stringify(big));run("a 2 MB file");diff --git a/test/trace-wall-state.test.ts b/test/trace-wall-state.test.tsindex 6d720529..f8bda51a 100644--- a/test/trace-wall-state.test.ts+++ b/test/trace-wall-state.test.ts@@ -42,7 +42,7 @@ test("noteWalls: one entry per (sh, epoch, cls, program), newest last, written 0assert.deepEqual(w.classes["docker-rootless"]!.seen.map((s) => s.program), ["go", "npm"]);assert.equal(w.classes["docker-rootless"]!.fixed.length, 1);assert.ok(wallsPath(h.env).startsWith(join(h.dir, "trail")));- assert.equal(statSync(wallsPath(h.env)).mode & 0o777, 0o600);+ if (process.platform !== "win32") assert.equal(statSync(wallsPath(h.env)).mode & 0o777, 0o600);assert.ok(!existsSync(join(h.dir, "home", ".trail")), "nothing under HOME");});diff --git a/test/trace-walls-review.test.ts b/test/trace-walls-review.test.tsindex 5285c84d..161588af 100644--- a/test/trace-walls-review.test.ts+++ b/test/trace-walls-review.test.ts@@ -7,7 +7,7 @@ import { test } from "node:test";import assert from "node:assert/strict";import { spawnSync } from "node:child_process";import { dirname, join } from "node:path";-import { fileURLToPath } from "node:url";+import { fileURLToPath, pathToFileURL } from "node:url";import { lastTimeText, matchWall, sshRemoteFor, wallFixText } from "../src/trace/walls.js";const SRC = join(dirname(fileURLToPath(import.meta.url)), "..", "src");@@ -83,7 +83,7 @@ test("a command over 64 KB matches nothing, and long commands stay fast (cappedassert.ok(big.length > 64 * 1024);assert.equal(matchWall(out, big, true), null);const probe = `- const { matchWall } = await import(${JSON.stringify(join(SRC, "trace", "walls.ts"))});+ const { matchWall } = await import(${JSON.stringify(pathToFileURL(join(SRC, "trace", "walls.ts")).href)});const n = 2 * 1024 * 1024;const cmds = ['('.repeat(n / 2) + ')'.repeat(n / 2), '{ '.repeat(n / 2), 'if true; then '.repeat(n / 14), "sh -c 'npm x' ; ".repeat(n / 16)];const outs = ['x'.repeat(n), ': '.repeat(n / 2), 'zsh:1:'.repeat(n / 6), 'a\\n'.repeat(n / 2)];@@ -93,6 +93,7 @@ test("a command over 64 KB matches nothing, and long commands stay fast (cappedprocess.stdout.write(JSON.stringify(rows));`;const r = spawnSync(process.execPath, ["--import", "tsx", "--input-type=module", "-e", probe], { encoding: "utf8", timeout: 30_000 });assert.equal(r.signal, null, "matchWall ran past 30 s");+ assert.equal(r.status, 0, r.stderr);const rows = JSON.parse(r.stdout) as number[];for (const ms of rows) assert.ok(ms < 20, `2 MB took ${ms.toFixed(1)} ms`);});