From 98a34be85347cd80b60d1150256b66cf7aeda221 Mon Sep 17 00:00:00 2001 From: LogicDuke Date: Sat, 15 Aug 2026 22:55:54 +0200 Subject: [PATCH] test: make path marker proof conclusive --- tests/adapters/process-transport.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/adapters/process-transport.test.ts b/tests/adapters/process-transport.test.ts index 517f8bd..f0e4573 100644 --- a/tests/adapters/process-transport.test.ts +++ b/tests/adapters/process-transport.test.ts @@ -3,6 +3,7 @@ import { EventEmitter } from 'node:events'; import { readdirSync, existsSync, + mkdirSync, mkdtempSync, readFileSync, rmSync, @@ -2449,7 +2450,14 @@ describe('invokeAgentProcess — boundary', () => { it('starts no process at all when a path is ill-formed', async () => { const directory = makeTempDirectory(); + // The path Node substitutes for the ill-formed one at the native boundary. + // It must exist, or a regression that dropped the validation would still + // leave the marker absent — because `spawn` failed on a missing directory, + // not because the transport refused. Creating it makes the marker the only + // thing standing between a regression and a passing test. + const replacementDirectory = `${directory}\uFFFD`; try { + mkdirSync(replacementDirectory); const marker = join(directory, 'ran'); const script = `require("node:fs").writeFileSync(${JSON.stringify(marker)},"ran");`; @@ -2485,6 +2493,7 @@ describe('invokeAgentProcess — boundary', () => { expect(refusedExecutable.rejection).toBe('EXECUTABLE_INVALID'); expect(existsSync(marker)).toBe(false); } finally { + removeTempDirectory(replacementDirectory); removeTempDirectory(directory); } });