From e757e447371c4781a3eff3a0ea9dc9c4eceb060a Mon Sep 17 00:00:00 2001 From: Dotta Date: Wed, 4 Nov 2026 08:21:41 -0600 Subject: [PATCH] test(evals): report remaining fixed private scanner reasons Co-Authored-By: Paperclip --- tests/runner-e2e/private-attempt-diagnostic.test.ts | 12 ++++++++++++ tests/runner-e2e/private-attempt-diagnostic.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/runner-e2e/private-attempt-diagnostic.test.ts b/tests/runner-e2e/private-attempt-diagnostic.test.ts index 77c095a8940..15d7cb71e99 100644 --- a/tests/runner-e2e/private-attempt-diagnostic.test.ts +++ b/tests/runner-e2e/private-attempt-diagnostic.test.ts @@ -108,3 +108,15 @@ it("reports fixed embedded HTML and reporter text bounds while excluding unknown ]); expect(JSON.stringify(diagnostic)).not.toMatch(/private-error|html-report/); }); + + +it("retains each remaining fixed scanner reason without dynamic text", () => { + const reasons = ["embedded report encoding could not be inspected", "reporter symlink cannot be inspected", + "credential in reporter filename", "reporter JSON could not be safely parsed"]; + const diagnostic = privateAttemptDiagnostic({ stage: "package-original", observation: { privacy: { issues: [ + ...reasons.map(reason => ({ file: "html-report/index.html", reason })), + { file: "private-filename", reason: "zip could not be inspected: private-error" }, + ] } } }); + expect(diagnostic.carrierReasons).toEqual(reasons.map(reason => ({ source: "reporter", carrier: "embedded-html", reason, count: 1 }))); + expect(JSON.stringify(diagnostic)).not.toMatch(/private-filename|private-error|html-report/); +}); diff --git a/tests/runner-e2e/private-attempt-diagnostic.ts b/tests/runner-e2e/private-attempt-diagnostic.ts index ac0b4e72998..40a15fcb2f6 100644 --- a/tests/runner-e2e/private-attempt-diagnostic.ts +++ b/tests/runner-e2e/private-attempt-diagnostic.ts @@ -33,7 +33,7 @@ function closedPackagingBudget(input: unknown, message: string) { export interface PrivateAttemptDiagnosticInput { stage: unknown; result?: unknown; error?: unknown; observation?: unknown; evidence?: unknown } const record = (value: unknown): Record => value && typeof value === "object" ? value as Record : {}; const member = (value: unknown, choices: string[]) => typeof value === "string" && choices.includes(value) ? value : "unknown"; -const reporterReasons = ["zip inspection exceeded its expanded-byte bound", "zip inspection exceeded its time bound", "exact secret value", "secret-shaped value", "embedded report exceeded its byte bound", "reporter text exceeds inspection bound"]; +const reporterReasons = ["zip inspection exceeded its expanded-byte bound", "zip inspection exceeded its time bound", "exact secret value", "secret-shaped value", "embedded report exceeded its byte bound", "reporter text exceeds inspection bound", "embedded report encoding could not be inspected", "reporter symlink cannot be inspected", "credential in reporter filename", "reporter JSON could not be safely parsed"]; function carrierReasons(input: unknown, source: "reporter" | "packaging") { const findings = (Array.isArray(input) ? input : []).map(issue => { const file = typeof record(issue).file === "string" ? record(issue).file.replace(/\\/g, "/") : "";