fix(evidence): reject unsupported metadata before authentication

Close persisted Evidence, bundle, profile and unknown record shapes so parsing cannot silently remove caller metadata before checking semantic identity. Keep constructor provider projection explicit and JSON payload fields open.

Exercise actual MCP export/import with independent record and manifest mutations, unchanged state after rejection, and a valid round trip. Prune duplicate source assertions. Validation: focused domain/CLI/MCP/filesystem checks, converted JSON Schemas, docs and typecheck/lint.
This commit is contained in:
morluto
2026-10-13 13:00:39 +08:00
parent c105391db5
commit acf75e6700
8 changed files with 331 additions and 26 deletions
+24
View File
@@ -52,6 +52,30 @@ it("preserves omitted relationship diagnostics and authenticates reported diagno
).toThrow("semantic identifier");
});
it("projects known provider fields and preserves open JSON payloads", () => {
const liveProvider = { ...PROVIDER, transient_status: "starting" };
const evidence = createEvidence(TARGET, liveProvider, {
operation: "inspect",
parameters: { caller_metadata: { note: "kept" } },
result: { producer_extension: { value: "kept" } },
analysisProfile: PROFILE,
environment: {
id: "fixture",
platform: "linux",
architecture: "x86_64",
isolation: "process",
},
locations: [{ kind: "address", address: "0x1000" }],
});
expect(evidence.provider).toEqual(PROVIDER);
expect(evidence.parameters).toEqual({ caller_metadata: { note: "kept" } });
expect(evidence.normalized_result).toEqual({
producer_extension: { value: "kept" },
});
expect(parseEvidence(evidence)).toEqual(evidence);
});
it("preserves identity and bytes when reusing an owned immutable result", () => {
const value = { nested: { values: ["observed", 1] } };
const mutable = createEvidence(TARGET, PROVIDER, {