fix(coding-agent): use physical temp paths in session-id-readonly test

On macOS tmpdir() is a symlink (/var -> /private/var) while the spawned
CLI's process.cwd() is physical, so session cwd filtering never matched
the fixtures and the fork-target rejection test failed locally.
This commit is contained in:
Mario Zechner
2026-06-10 20:09:18 +02:00
Unverified
parent a46f4e19f0
commit afc2bd370e
@@ -1,5 +1,14 @@
import { spawn } from "node:child_process";
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import {
existsSync,
mkdirSync,
mkdtempSync,
readdirSync,
readFileSync,
realpathSync,
rmSync,
writeFileSync,
} from "node:fs";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
@@ -15,7 +24,10 @@ afterEach(() => {
});
function createTempDir(): string {
const dir = mkdtempSync(join(tmpdir(), "pi-session-id-readonly-"));
// realpath: on macOS tmpdir() is a symlink (/var -> /private/var), but the
// spawned CLI sees the physical path via process.cwd(). Session cwd
// filtering compares paths textually, so the fixture must use physical paths.
const dir = realpathSync(mkdtempSync(join(tmpdir(), "pi-session-id-readonly-")));
tempDirs.push(dir);
return dir;
}