fix(analysis): preserve relationship coverage across evidence and replay

Separate observed relationship coverage from general provider caveats. Authenticate and replay coverage without changing legacy Evidence IDs; expose unknown and capped relationship sets through CLI/MCP graphs and traces.

Validated focused domain, snapshot, IDA/Ghidra boundary, MCP, schema, package and static checks. Provider fixtures establish contract behavior; licensed engine behavior was not reverified.
This commit is contained in:
morluto
2026-10-12 05:57:35 +08:00
parent f1924cf9c1
commit 9c8511409c
24 changed files with 469 additions and 55 deletions
+35 -9
View File
@@ -64,6 +64,15 @@ const provider = (
);
};
const createElfClient = async (ghidra: GhidraProvider) => {
const target = executableTarget("elf", "x86_64");
const resolved = await ghidra.resolveAnalysisProfile(target);
if (!resolved.ok) throw resolved.error;
if (resolved.value.profile === null)
throw new Error("Expected a bound Ghidra profile");
return ghidra.createClient(target, resolved.value.profile);
};
describe("Ghidra provider", () => {
it("commits DOS loader and real-mode language while retaining the CPU family", async () => {
const ghidra = provider();
@@ -608,15 +617,6 @@ describe("Ghidra client projection", () => {
});
describe("Ghidra result projection", () => {
const createElfClient = async (ghidra: GhidraProvider) => {
const target = executableTarget("elf", "x86_64");
const resolved = await ghidra.resolveAnalysisProfile(target);
if (!resolved.ok) throw resolved.error;
if (resolved.value.profile === null)
throw new Error("Expected a bound Ghidra profile");
return ghidra.createClient(target, resolved.value.profile);
};
it("rejects malformed inventory output before Evidence creation", async () => {
const ghidra = provider(installationHost(), () => ({
start: () => Promise.resolve(ok(sessionInfo())),
@@ -763,6 +763,32 @@ describe("Ghidra result projection", () => {
});
});
describe("Ghidra relationship coverage", () => {
it("marks the full direct call-reference response complete while keeping static caveats", async () => {
const ghidra = provider(installationHost(), () => ({
start: () => Promise.resolve(ok(sessionInfo())),
callTool: (operation) =>
Promise.resolve(
ok(operation === "procedure_callees" ? ["0x2000"] : []),
),
close: () => Promise.resolve(ok(null)),
}));
const client = await createElfClient(ghidra);
const execution = await client.execute("procedure_callees", {
procedure: "0x1000",
document: "fixture",
});
if (!execution.ok) throw execution.error;
expect(execution.value.relationshipCoverage).toEqual({
status: "complete",
});
expect(execution.value.limitations).toContain(
"Only resolved Ghidra call references are returned; unresolved computed or indirect calls remain unknown, while function classifications distinguish thunks and externals.",
);
await client.close();
});
});
describe("Ghidra measured load-image projection", () => {
it.each(["verified", "changed-snapshot", "cancelled"] as const)(
"streams raw snapshot identity and preserves %s outcomes",
+4
View File
@@ -821,6 +821,10 @@ export const createGhidraProviderClient = (input: {
createAnalysisExecution(normalized, committedProfile.provider, {
rawResult: called.value,
analysisProfile: committedProfile,
...(operation === "procedure_callers" ||
operation === "procedure_callees"
? { relationshipCoverage: { status: "complete" as const } }
: {}),
limitations: [
...limitationsFor(operation),
...observationLimitations,