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:
@@ -36,8 +36,9 @@ type EvidenceWriteFailure =
|
||||
/** Read and validate an evidence bundle at the caller-supplied path. */
|
||||
export const readEvidenceBundle = (
|
||||
path: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<Result<EvidenceBundle, EvidenceReadFailure>> =>
|
||||
readBundle(path, parseEvidenceBundle);
|
||||
readBundle(path, parseEvidenceBundle, signal);
|
||||
|
||||
/** Read an authenticated immutable snapshot for a subsequent session import. */
|
||||
export const readImmutableEvidenceBundle = (
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user