Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scripts/verify-platform-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ test("redact replaces known paths without touching unrelated text", () => {
);
});

test("redact covers raw and quoted Windows paths while preserving diagnostic filenames", () => {
const sandbox = String.raw`R:\fixture\sandbox`;
const input = `${sandbox}\\outputs\\missing input.json`;
const redactions = [{ path: sandbox, placeholder: "<sandbox>" }];
expect(redact(`reading ${input}`, redactions)).toBe(
String.raw`reading <sandbox>\outputs\missing input.json`,
);
const headline = redact(`cannot read ${JSON.stringify(input)}`, redactions);
expect(headline).toBe(String.raw`cannot read "<sandbox>\\outputs\\missing input.json"`);
});

test("runBinary executes a local executable and reports failures", () => {
if (process.platform === "win32") return;
const sandbox = mkdtempSync(join(tmpdir(), "rootform-run-"));
Expand Down
12 changes: 9 additions & 3 deletions scripts/verify-platform-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ export function childEnvironment(
export function redact(text: string, redactions: readonly Redaction[]): string {
let result = text;
for (const entry of [...redactions].sort((left, right) => right.path.length - left.path.length)) {
result = result.replaceAll(entry.path, entry.placeholder);
const quotedPath = JSON.stringify(entry.path).slice(1, -1);
result = result
.replaceAll(quotedPath, entry.placeholder)
.replaceAll(entry.path, entry.placeholder);
}
return result;
}
Expand Down Expand Up @@ -1315,15 +1318,18 @@ export async function runJourney(
assertCommandRefusal(checkInput(missingInput, "runtime-proofs.policy.passes"), {
code: "INPUT_UNREADABLE",
exitCode: 4,
headline: 'cannot read "<sandbox>/outputs/missing input.json"',
headline: redact(`cannot read ${JSON.stringify(missingInput)}`, redactions),
}),
);
inputRefusals.oversized = attempt("oversized-input-refused-before-compilation", () => {
const outcome = checkInput(oversizedInput, "runtime-proofs.policy.passes");
const refusal = assertCommandRefusal(outcome, {
code: "INPUT_REFUSED",
exitCode: 3,
headline: 'input "<sandbox>/outputs/oversized.json" exceeds the 128 MiB limit',
headline: redact(
`input ${JSON.stringify(oversizedInput)} exceeds the 128 MiB limit`,
redactions,
),
});
if (outcome.stderr.includes("Compiling")) {
throw new Error("oversized input reached compilation");
Expand Down
Loading