diff --git a/tests/hooks/context-gate-ownership.test.js b/tests/hooks/context-gate-ownership.test.js index 5e978fea8..33eb4cbae 100644 --- a/tests/hooks/context-gate-ownership.test.js +++ b/tests/hooks/context-gate-ownership.test.js @@ -33,7 +33,7 @@ function test(name, fn) { } function createSandbox() { - const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-context-gate-owner-')); + const root = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-context-gate-owner-'))); const dataHome = path.join(root, 'data'); const resumeDir = path.join(dataHome, 'session-data', 'resume'); fs.mkdirSync(resumeDir, { recursive: true }); diff --git a/tests/hooks/context-gate.test.js b/tests/hooks/context-gate.test.js index 4d6ac62c0..a3355cd4b 100644 --- a/tests/hooks/context-gate.test.js +++ b/tests/hooks/context-gate.test.js @@ -27,7 +27,7 @@ function test(name, fn) { // Private per-run directory for fixtures, so no test writes a predictable name // directly under the shared OS temp directory. -const FIXTURE_DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-context-gate-test-')); +const FIXTURE_DIR = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-context-gate-test-'))); process.on('exit', () => fs.rmSync(FIXTURE_DIR, { recursive: true, force: true })); let fixtureSeq = 0; @@ -387,7 +387,7 @@ function runTests() { // cases that follow. if ( test('a pre-existing project RESUME.md is never targeted and is left untouched', () => { - const projDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-proj-')); + const projDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-proj-'))); const existing = path.join(projDir, 'RESUME.md'); fs.writeFileSync(existing, 'OPERATOR CONTENT — must survive\n', 'utf8'); const t = writeTranscript(950000); @@ -429,7 +429,7 @@ function runTests() { test('missing identity: same-named projects never collide on a shared destination', () => { // Sandbox the handoff home so the fire touches tmp only. ECC_AGENT_DATA_HOME // is read by getSessionsDir() from process.env, so it must be set there. - const sandbox = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-home-')); + const sandbox = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-home-'))); const resumeDir = path.join(sandbox, 'session-data', 'resume'); fs.mkdirSync(resumeDir, { recursive: true }); // A pre-existing handoff at the exact path the OLD literal-fallback code @@ -476,7 +476,7 @@ function runTests() { if ( test('a destination owned by a different session is disambiguated, not overwritten', () => { - const sandbox = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-home-')); + const sandbox = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-home-'))); const resumeDir = path.join(sandbox, 'session-data', 'resume'); fs.mkdirSync(resumeDir, { recursive: true }); // Seed the exact path this session resolves to, owned by ANOTHER session. @@ -509,7 +509,7 @@ function runTests() { if ( test('a destination owned by the same session is reused (idempotent)', () => { - const sandbox = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-home-')); + const sandbox = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-home-'))); const resumeDir = path.join(sandbox, 'session-data', 'resume'); fs.mkdirSync(resumeDir, { recursive: true }); let own; diff --git a/tests/hooks/ecc-context-monitor.test.js b/tests/hooks/ecc-context-monitor.test.js index 10e5d3cdc..2072f82d3 100644 --- a/tests/hooks/ecc-context-monitor.test.js +++ b/tests/hooks/ecc-context-monitor.test.js @@ -148,7 +148,7 @@ function runTests() { test('run(): readable transcript in the gate band suppresses the context warning', () => { const sessionId = `ctx-monitor-gate-active-${process.pid}-${Date.now()}`; const warnPath = path.join(os.tmpdir(), `ecc-ctx-warn-${sessionId}.json`); - const transcript = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-ctx-monitor-')), 'transcript.jsonl'); + const transcript = path.join(fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-ctx-monitor-'))), 'transcript.jsonl'); // 190k of an assumed 200k window = 95% >= the 90% gate threshold. fs.writeFileSync( transcript, @@ -185,7 +185,7 @@ function runTests() { // Same in-band transcript, but with no ECC_CONTEXT_GATE_MODE the gate is // inert — the monitor must keep emitting CONTEXT CRITICAL. const sessionId = `ctx-monitor-gate-advisory-${process.pid}-${Date.now()}`; - const transcript = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-ctx-monitor-')), 'transcript.jsonl'); + const transcript = path.join(fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-ctx-monitor-'))), 'transcript.jsonl'); fs.writeFileSync( transcript, JSON.stringify({ diff --git a/tests/hooks/suggest-compact.test.js b/tests/hooks/suggest-compact.test.js index 4e77f4094..b9fec8ac4 100644 --- a/tests/hooks/suggest-compact.test.js +++ b/tests/hooks/suggest-compact.test.js @@ -670,7 +670,7 @@ function runTests() { return path.join(suiteTempDir, `claude-context-bucket-${sessionId}`); } - const transcriptDir = fs.mkdtempSync(path.join(suiteTempDir, 'ecc-compact-transcripts-')); + const transcriptDir = fs.realpathSync(fs.mkdtempSync(path.join(suiteTempDir, 'ecc-compact-transcripts-'))); process.once('exit', () => fs.rmSync(transcriptDir, { recursive: true, force: true })); let transcriptSeq = 0; diff --git a/tests/lib/context-gate-state.test.js b/tests/lib/context-gate-state.test.js index ff3dda302..74078fb7e 100644 --- a/tests/lib/context-gate-state.test.js +++ b/tests/lib/context-gate-state.test.js @@ -49,7 +49,7 @@ function test(desc, fn) { // Private per-run directory for fixtures, so no test writes a predictable name // directly under the shared OS temp directory. -const FIXTURE_DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-state-test-')); +const FIXTURE_DIR = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'ecc-gate-state-test-'))); process.on('exit', () => fs.rmSync(FIXTURE_DIR, { recursive: true, force: true })); let fixtureSeq = 0;