feat(managed): select declaring types in inspect_managed_members

Select exact declaring types before managed signatures and CIL bodies are decoded, preserving caller choices in CLI/MCP Evidence. Keep unmatched names and selected coverage explicit; comparisons and graphs retain unknowns outside their observed scope. Reuse existing metadata ownership/accounting and advertise unique selections through the actual SDK Schema.

Validated with 229 focused tests across 21 files, 11 managed conformance controls, fullstatic/docs checks and real Linux CLI and fresh MCP inspection of two unchanged DLLs. All 118 selected CIL hashes matched original PE-mapped bytes; result/caller-argument parity and unmatched controls passed. Full artifact/native-boundary metadata is complete; whole-assembly members retain the unchanged 64 MiB resource constraint. No target code executes.

Refs #1878

Co-authored-by: skared <190618464+skoodster@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com>
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
skoodster
2026-10-12 08:31:37 +08:00
committed by GitHub
co-authored by skared Claude Opus 5.5 Ysopwnable factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Kaoru0822
parent f28f338283
commit a149d183ef
21 changed files with 645 additions and 90 deletions
@@ -629,3 +629,55 @@ describe("managed application graph coverage", () => {
});
});
});
describe("managed application graph type selection", () => {
const project = (result: Parameters<typeof createEvidence>[2]["result"]) => {
const bytes = buildManagedPeFixture();
const binary = managedPeFixtureTarget(bytes, "/fixture/ManagedInterop.exe");
const projection = projectManagedApplicationGraphEvidence({
managed_members: createEvidence(binary, MANAGED_STATIC_PROVIDER, {
operation: "inspect_managed_members",
parameters: {},
result,
rawResult: null,
limitations: [],
}),
});
if (!projection.ok) throw new Error("projection failed");
return managedApplicationGraphResultSchema.parse(
parseEvidence(projection.value).normalized_result,
);
};
it("marks a graph from selected member inspection partial", () => {
const bytes = buildManagedPeFixture();
const binary = managedPeFixtureTarget(bytes, "/fixture/ManagedInterop.exe");
const selected = inspectManagedMembersBytes(bytes, binary, {
typeNames: ["Fixture.Program"],
});
expect(selected.coverage.state).toBe("complete");
const result = project(selected);
expect(result.coverage).toMatchObject({ status: "partial" });
expect(result.limitations).toContain(
"Managed member Evidence selected only these declaring types: Fixture.Program; type, method, and field nodes of other types are omitted, not absent.",
);
expect(result.limitations).not.toContain(
"At least one supplied managed Evidence record has partial coverage.",
);
});
it("accepts member Evidence recorded before type selection existed", () => {
const bytes = buildManagedPeFixture();
const binary = managedPeFixtureTarget(bytes, "/fixture/ManagedInterop.exe");
const { selection: _selection, ...legacy } = inspectManagedMembersBytes(
bytes,
binary,
);
expect(managedMemberInspectionSchema.parse(legacy).selection).toBeNull();
expect(project(legacy).coverage).toMatchObject({
status: "complete-within-inputs",
});
});
});