fix(evidence): report a single record selected as a bundle as invalid input
Reading a caller-selected Evidence bundle that holds one intact Evidence record, such as one command's --json result, failed with evidence_integrity_mismatch. The record authenticates; the caller chose the wrong kind of file. That is a selection error like a missing or non-regular path, which #1256 already reports as invalid input. Classify it at the file-reading boundary as EvidenceFileError reason not-bundle, projected as invalid_request / invalid_input with the selected path and the record's evidence_id. The guidance to export a session bundle is unchanged. Unparseable or tampered bundles remain evidence_integrity_mismatch. Fixes #2050 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3bdc8730bd
commit
31bb73768c
@@ -439,13 +439,15 @@ describe("evidence bundle filesystem adapter", () => {
|
||||
const record = bundle().records[0];
|
||||
const single = join(directory, "record.json");
|
||||
await writeFile(single, JSON.stringify(record));
|
||||
// An intact record is the caller's file selection, not damaged content.
|
||||
expect(await readEvidenceBundle(single)).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
_tag: "EvidenceIntegrityError",
|
||||
userMessage: expect.stringContaining(
|
||||
`this JSON is one Evidence record (${String(record?.evidence_id)})`,
|
||||
),
|
||||
_tag: "EvidenceFileError",
|
||||
operation: "read",
|
||||
reason: "not-bundle",
|
||||
path: single,
|
||||
evidenceId: record?.evidence_id,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -134,10 +134,17 @@ describe("bundle comparison MCP integration", () => {
|
||||
expect(result.isError).toBe(true);
|
||||
expect(parseMcpToolError(result)).toMatchObject({
|
||||
error: {
|
||||
code: "evidence_integrity_mismatch",
|
||||
code: "invalid_request",
|
||||
category: "invalid_input",
|
||||
message: expect.stringContaining(
|
||||
`this JSON is one Evidence record (${record.evidence_id})`,
|
||||
),
|
||||
details: {
|
||||
operation: "read",
|
||||
reason: "not-bundle",
|
||||
path: recordPath,
|
||||
evidence_id: record.evidence_id,
|
||||
},
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user