fix(evidence): authenticate a single record before classifying it as not-bundle

The schema-only check admitted a record whose evidence_id no longer
matches its content, so a tampered record was reported as a caller
selection error instead of an integrity mismatch. Use the authenticating
Evidence parser; only an authentic record is a mis-selected file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-12 05:35:04 +00:00
co-authored by Claude Opus 5.5
parent 31bb73768c
commit 6c5aa93140
2 changed files with 28 additions and 3 deletions
@@ -479,3 +479,21 @@ describe("evidence bundle filesystem adapter", () => {
});
});
});
describe("evidence bundle single-record selection", () => {
it("keeps a tampered single record an integrity failure", async () => {
const directory = await createTestTempDirectory("rea-evidence-");
const record = bundle().records[0];
// A record whose identifier no longer matches its content is damaged,
// not a mis-selected file.
const tampered = join(directory, "tampered-record.json");
await writeFile(
tampered,
JSON.stringify({ ...record, operation: "tampered_operation" }),
);
expect(await readEvidenceBundle(tampered)).toMatchObject({
ok: false,
error: { _tag: "EvidenceIntegrityError" },
});
});
});