perf(evidence): reuse authenticated comparisons through aggregation

This commit is contained in:
morluto
2026-10-13 14:39:49 +08:00
parent 1b953021ea
commit 26bffb94bf
4 changed files with 146 additions and 76 deletions
@@ -309,7 +309,9 @@ it("separately rejects a tampered digest before admission to any consumer or ses
};
const digestMismatch = /semantic identifier does not match/u;
expect(() => parseEvidence(tampered)).toThrow(digestMismatch);
expect(() => findChangedBehavior([tampered])).toThrow(digestMismatch);
expect(() => findChangedBehavior({ comparisons: [tampered] })).toThrow(
digestMismatch,
);
expect(() => correlateStaticAndRuntime(correlationInput(tampered))).toThrow(
digestMismatch,
);
@@ -336,6 +338,19 @@ it("separately rejects a tampered digest before admission to any consumer or ses
}
});
it("maps malformed changed-behavior Evidence to an invalid request before closure lookup", async () => {
const { client, comparison } = await connectedComparison();
const malformed = { ...comparison, evidence_links: undefined } as unknown;
const response = await client.callTool({
name: "find_changed_behavior",
arguments: { comparisons: [malformed] },
});
expect(response.isError).toBe(true);
expect(parseMcpToolError(response)).toMatchObject({
error: { code: "invalid_request" },
});
});
it("keeps withheld ownership unknown through CLI and MCP comparison", async () => {
const { client, right } = await connectedComparison();
const left = captureEvidence("left", {