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
74 lines
1.8 KiB
TypeScript
74 lines
1.8 KiB
TypeScript
import { expect, it } from "vitest";
|
|
|
|
import { createResidualUnknown } from "./residualUnknown.js";
|
|
import { reconstructionClaimUnknowns } from "./reconstructionUnknowns.js";
|
|
|
|
const ev = (digit: string) => `ev_${digit.repeat(64)}`;
|
|
const base = {
|
|
severity: "high" as const,
|
|
domain: "function-comparison",
|
|
supporting_evidence_ids: [ev("a"), ev("b")],
|
|
contradicting_evidence_ids: [],
|
|
required_authority: null,
|
|
required_confidence: "derived" as const,
|
|
required_environment: null,
|
|
recommended_probes: [],
|
|
};
|
|
|
|
it("keeps explicit dependencies while excluding unrelated scoped unknowns", () => {
|
|
const comparisonId = ev("a");
|
|
const other = createResidualUnknown(
|
|
{
|
|
...base,
|
|
question: "Other dimension",
|
|
comparison_conclusion_scope: {
|
|
comparison_evidence_id: comparisonId,
|
|
dimensions: ["pseudocode"],
|
|
},
|
|
relationships: [],
|
|
},
|
|
ev("c"),
|
|
null,
|
|
);
|
|
const calls = createResidualUnknown(
|
|
{
|
|
...base,
|
|
question: "Call dimension",
|
|
comparison_conclusion_scope: {
|
|
comparison_evidence_id: comparisonId,
|
|
dimensions: ["calls"],
|
|
},
|
|
relationships: [{ type: "depends-on", unknown_id: other.unknown_id }],
|
|
},
|
|
ev("d"),
|
|
null,
|
|
);
|
|
const unrelated = createResidualUnknown(
|
|
{
|
|
...base,
|
|
question: "Unrelated dimension",
|
|
comparison_conclusion_scope: {
|
|
comparison_evidence_id: comparisonId,
|
|
dimensions: ["pseudocode"],
|
|
},
|
|
relationships: [],
|
|
},
|
|
ev("e"),
|
|
null,
|
|
);
|
|
const selected = reconstructionClaimUnknowns(
|
|
new Map([
|
|
[calls.unknown_id, calls],
|
|
[other.unknown_id, other],
|
|
[unrelated.unknown_id, unrelated],
|
|
]),
|
|
comparisonId,
|
|
[ev("b")],
|
|
"calls",
|
|
);
|
|
expect(selected.map(({ unknown_id }) => unknown_id)).toEqual([
|
|
calls.unknown_id,
|
|
other.unknown_id,
|
|
]);
|
|
});
|