fix(evidence): enforce managed identity and cancel bundle reads

Validate managed reconstruction through the shared artifact and MVID scope boundary, including known/unknown identity contradictions. Forward MCP comparison cancellation into both bundle reads and consolidate pre-cancel coverage.

Verified managed graph/reconstruction and filesystem/MCP cancellation workflows. A controlled missing-signal mutation reads 130 chunks instead of the expected one; cancellation leaves the session unchanged and retry succeeds.
This commit is contained in:
morluto
2026-10-12 13:06:30 +08:00
parent 83a4445f44
commit 3bcc68c037
8 changed files with 329 additions and 38 deletions
@@ -53,6 +53,33 @@ describe("managed decompiler reconstruction import", () => {
).toThrow(/does not match/u);
});
it("rejects static Evidence with a token MVID but no module identity", () => {
const input = exampleInput();
const members = managedMemberInspectionSchema.parse(
input.static_members.normalized_result,
);
if (members.module === null || members.module.mvid === null)
throw new Error("Expected fixture module identity and MVID");
const inconsistentEvidence = createEvidence(
undefined,
input.static_members.provider,
{
operation: "inspect_managed_members",
parameters: {},
result: { ...members, module: null },
rawResult: null,
limitations: members.limitations,
},
);
expect(() =>
importManagedReconstruction({
...input,
static_members: inconsistentEvidence,
}),
).toThrow(/token scope MVID/u);
});
it("rejects reconstruction locks for partial CIL without normalized identity", () => {
const input = exampleInput();
const observed = managedMemberInspectionSchema.parse(