fix(evidence): preserve call coverage in function comparisons
Treat missing, partial, unknown, and unresolved call coverage as insufficient for call-set equality. Combine IDA caller/callee coverage without losing either explanation and recheck source coverage when verifying historical comparisons. Scope generated function-comparison unknowns with optional typed comparison/dimension facts, preserving legacy IDs and revision digests when absent. Keep unrelated dimensions conclusive, explicit dependencies applicable, and ambiguous function identity unknown. A confirmed change for matched functions remains a failure even if calls are incomplete. Validation: function/reconstruction/residual-unknown and bundle tests, recorded IDA protocol regression, public MCP comparison/verification, and advertised SDK JSON Schema checks. Real IDA provider execution was not verified. Fixes #2222
This commit is contained in:
@@ -223,11 +223,22 @@ describe("native IDA provider observations", () => {
|
||||
procedure: "main",
|
||||
});
|
||||
if (!dossier.ok) throw dossier.error;
|
||||
expect(dossier.value.relationshipCoverage).toEqual({
|
||||
expect(dossier.value.relationshipCoverage).toMatchObject({
|
||||
status: "unknown",
|
||||
reason:
|
||||
"Upstream xrefs do not establish direct caller relationships.",
|
||||
reason: more
|
||||
? expect.stringContaining(
|
||||
"Callees: Upstream callees capped results at 500; additional callees remain unknown.",
|
||||
)
|
||||
: expect.stringContaining(
|
||||
"Callers: Upstream xrefs do not establish direct caller relationships.",
|
||||
),
|
||||
});
|
||||
if (more)
|
||||
expect(dossier.value.relationshipCoverage).toMatchObject({
|
||||
reason: expect.stringContaining(
|
||||
"Callers: Upstream xrefs do not establish direct caller relationships.",
|
||||
),
|
||||
});
|
||||
expect(dossier.value.result).toMatchObject({
|
||||
callers: [],
|
||||
callees: [{ address: "0x2000", name: "puts" }],
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
} from "../domain/hopperValues.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import type { RelationshipCoverage } from "../domain/relationshipCoverage.js";
|
||||
import { combineFunctionRelationshipCoverage } from "../domain/functionCallCoverage.js";
|
||||
import { readCallGraphCallees, unavailableCallGraph } from "./IdaCallGraph.js";
|
||||
import type { IdaMcpConnection } from "./IdaMcpConnection.js";
|
||||
import type { IdaOperation } from "./IdaProviderCapabilities.js";
|
||||
@@ -70,33 +71,6 @@ interface IdaRelationships {
|
||||
readonly coverage: RelationshipCoverage;
|
||||
}
|
||||
|
||||
const combinedRelationshipCoverage = (
|
||||
callers: RelationshipCoverage,
|
||||
callees: RelationshipCoverage,
|
||||
): RelationshipCoverage => {
|
||||
const coverage = [callers, callees];
|
||||
const diagnostics = [
|
||||
...new Set(
|
||||
coverage.flatMap((item) =>
|
||||
"diagnostics" in item ? item.diagnostics : [],
|
||||
),
|
||||
),
|
||||
];
|
||||
const details = diagnostics.length > 0 ? { diagnostics } : {};
|
||||
const unknown = coverage.filter((item) => item.status === "unknown");
|
||||
if (unknown.length > 0)
|
||||
return {
|
||||
status: "unknown",
|
||||
reason: [...new Set(unknown.map((item) => item.reason))].join(" "),
|
||||
...details,
|
||||
};
|
||||
const limitations = coverage.flatMap((item) =>
|
||||
item.status === "partial" ? item.limitations : [],
|
||||
);
|
||||
return limitations.length > 0
|
||||
? { status: "partial", limitations, ...details }
|
||||
: { status: "complete", ...details };
|
||||
};
|
||||
/** The only lookup answers upstream reports for a name or address that is not a function. */
|
||||
const MISSING_PROCEDURE_ANSWERS: ReadonlySet<string> = new Set([
|
||||
"Not found",
|
||||
@@ -632,7 +606,7 @@ export class IdaOperationRunner {
|
||||
const pseudocode = await this.pseudocode(fn);
|
||||
const callers = await this.relationships(fn, "callers");
|
||||
const callees = await this.relationships(fn, "callees");
|
||||
this.relationshipCoverage = combinedRelationshipCoverage(
|
||||
this.relationshipCoverage = combineFunctionRelationshipCoverage(
|
||||
callers.coverage,
|
||||
callees.coverage,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user