fix(evidence): name the failed constraint when a bundle is rejected
evidence-import, evidence-export, compare and the MCP bundle tools gave every rejected file the same message: "Evidence is invalid or has changed. Recreate or re-import it". That included a single Evidence record, which is what every command prints, so `rea compare a.json b.json` on two command results looked like tampering. Report a single record as such and point to export_evidence_bundle. Locate the first schema issue, and keep thrown constraint messages such as a semantic identifier mismatch. EvidenceIntegrityError now accepts the userMessage option that other typed errors already use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
40e18b2e37
commit
cf96ceb211
@@ -2,6 +2,7 @@ import canonicalize from "canonicalize";
|
||||
|
||||
import {
|
||||
createEvidenceBundle,
|
||||
describeEvidenceBundleFailure,
|
||||
parseEvidenceBundle,
|
||||
validateResidualUnknownAddition,
|
||||
type EvidenceBundle,
|
||||
@@ -68,6 +69,7 @@ export class EvidenceLedger {
|
||||
return err(
|
||||
new EvidenceIntegrityError("Evidence bundle validation failed", {
|
||||
cause,
|
||||
userMessage: describeEvidenceBundleFailure(input, cause),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user