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:
@@ -507,6 +507,50 @@ describe("managed application graph token scope", () => {
|
||||
"token scope SHA-256",
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
"module identity absent",
|
||||
"module MVID unknown",
|
||||
"token scope MVID unknown",
|
||||
] as const)("rejects inconsistent identity when %s", (variant) => {
|
||||
const { memberEvidence, boundaryEvidence } = createManagedInteropEvidence();
|
||||
const members = managedMemberInspectionSchema.parse(
|
||||
parseEvidence(memberEvidence).normalized_result,
|
||||
);
|
||||
if (members.module === null || members.module.mvid === null)
|
||||
throw new Error("Expected fixture module identity and MVID");
|
||||
const module =
|
||||
variant === "module identity absent"
|
||||
? null
|
||||
: variant === "module MVID unknown"
|
||||
? { ...members.module, mvid: null }
|
||||
: members.module;
|
||||
const identity_scope =
|
||||
variant === "token scope MVID unknown"
|
||||
? { ...members.identity_scope, requires_mvid: null }
|
||||
: members.identity_scope;
|
||||
const inconsistentMembers = createEvidence(
|
||||
undefined,
|
||||
MANAGED_STATIC_PROVIDER,
|
||||
{
|
||||
operation: "inspect_managed_members",
|
||||
parameters: {},
|
||||
result: { ...members, module, identity_scope },
|
||||
rawResult: null,
|
||||
limitations: members.limitations,
|
||||
},
|
||||
);
|
||||
|
||||
const projected = projectManagedApplicationGraphEvidence({
|
||||
managed_members: inconsistentMembers,
|
||||
managed_native_boundaries: boundaryEvidence,
|
||||
});
|
||||
|
||||
expect(projected.ok).toBe(false);
|
||||
if (projected.ok)
|
||||
throw new Error("An inconsistent token scope was accepted");
|
||||
expect(JSON.stringify(projected.error)).toContain("token scope MVID");
|
||||
});
|
||||
});
|
||||
|
||||
describe("unknown managed application graph token scope", () => {
|
||||
|
||||
Reference in New Issue
Block a user