fix(evidence): require a complete record before the single-record hint
A malformed bundle that merely has an evidence_id field was described as one Evidence record. Use the single-record message only when the input matches the Evidence record schema; otherwise report the bundle schema failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cf96ceb211
commit
38bbb656da
@@ -160,6 +160,21 @@ describe("evidence bundle filesystem adapter", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const partial = join(directory, "partial.json");
|
||||
await writeFile(partial, JSON.stringify({ evidence_id: "typo" }));
|
||||
const rejected = await readEvidenceBundle(partial);
|
||||
expect(rejected).toMatchObject({
|
||||
ok: false,
|
||||
error: {
|
||||
userMessage: expect.stringContaining(
|
||||
"does not match the bundle schema",
|
||||
),
|
||||
},
|
||||
});
|
||||
expect(rejected).not.toMatchObject({
|
||||
error: { userMessage: expect.stringContaining("one Evidence record") },
|
||||
});
|
||||
|
||||
const mismatched = join(directory, "mismatched.json");
|
||||
await writeFile(mismatched, JSON.stringify({ ...bundle(), records: {} }));
|
||||
expect(await readEvidenceBundle(mismatched)).toMatchObject({
|
||||
|
||||
Reference in New Issue
Block a user