fix(evidence): validate closure projections and browser body coverage

Share ledger status, coverage, reports, graphs, Evidence links and closure commitments between the producer and readiness validation. Preserve limitation-driven unknown results and reject stale or inconsistent projections.

Distinguish malformed CDP response envelopes from unavailable JSON payload shapes. Validate required encoding flags and preserve partial request facts.

Validation: 116 focused tests, static and architecture checks, documentation checks. Browser regression coverage uses controlled CDP responses.
This commit is contained in:
morluto
2026-10-12 08:59:14 +08:00
parent f889a69fb9
commit aada0ca812
11 changed files with 955 additions and 411 deletions
@@ -3,7 +3,12 @@ import { describe, expect, it } from "vitest";
import {
reconstructionObligationLedgerSchema,
reconstructionObligationManifestSchema,
type ReconstructionObligationLedger,
} from "./reconstructionObligationLedgerSchemas.js";
import {
reconstructionObligationLedgerClosureDigest,
summarizeReconstructionObligations,
} from "./reconstructionObligationLedgerIntegrity.js";
const digest = "a".repeat(64);
@@ -32,20 +37,13 @@ describe("reconstruction obligation ledger schemas", () => {
reconstructionObligationManifestSchema.parse(manifest).bindings,
).toHaveLength(10_001);
const ledger = {
const ledgerBase: Omit<ReconstructionObligationLedger, "closure_digest"> = {
schema: "ReconstructionObligationLedger",
ledger_id: `rol_${digest}`,
closure_digest: digest,
status: "ready",
status: "unknown",
coverage: { status: "complete" },
summary: {
total: 0,
required: 0,
verified: 0,
required_open: 0,
by_status: [],
by_application_layer: [],
by_evidence_authority: [],
...summarizeReconstructionObligations([]),
},
reports: {
missing_owner_obligation_ids: [],
@@ -62,6 +60,10 @@ describe("reconstruction obligation ledger schemas", () => {
),
limitations: [],
};
const ledger = {
...ledgerBase,
closure_digest: reconstructionObligationLedgerClosureDigest(ledgerBase),
};
expect(
reconstructionObligationLedgerSchema.parse(ledger).evidence_links,