fix(dotnet): downgrade truncated CIL identity and coverage

This commit is contained in:
N0zoM1z0
2026-07-17 20:26:22 +08:00
parent 1387be08dd
commit dae6807c4a
44 changed files with 312 additions and 105 deletions
+54
View File
@@ -8,6 +8,8 @@ import {
importManagedReconstruction,
managedReconstructionImportInputSchema,
} from "../src/domain/managedReconstruction.js";
import { managedMemberInspectionSchema } from "../src/domain/managedArtifact.js";
import { createEvidence } from "../src/domain/evidence.js";
const exampleInput = () =>
managedReconstructionImportInputSchema.parse(
@@ -97,6 +99,58 @@ describe("managed decompiler reconstruction import", () => {
).toThrow(/does not match/u);
});
it("rejects reconstruction locks for partial CIL without normalized identity", () => {
const input = exampleInput();
const observed = managedMemberInspectionSchema.parse(
input.static_members.normalized_result,
);
const method = observed.methods.items[0];
if (method === undefined) throw new Error("missing observed method");
const partial = {
...observed,
methods: {
...observed.methods,
items: [
{
...method,
body: {
...method.body,
status: "partial" as const,
normalized_il_sha256: null,
truncated_instructions: 1,
issue: "instruction limit reached",
},
},
],
},
coverage: { state: "partial" as const, issues: [] },
};
const partialEvidence = createEvidence(
undefined,
input.static_members.provider,
{
operation: "inspect_managed_members",
parameters: {},
result: partial,
rawResult: null,
limitations: partial.limitations,
},
);
expect(() =>
importManagedReconstruction({
...input,
static_members: partialEvidence,
methods: [
{
...exampleMethod(),
normalized_il_sha256: null,
},
],
}),
).toThrow(/does not match/u);
});
it("wraps imported reconstruction in Evidence v2", () => {
const evidence = importManagedReconstructionEvidence(exampleInput());