Files
reverse-engineering-anything/src/contracts/functionComparisonExample.ts
T
morluto 049132ab43 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
2026-10-13 04:12:34 +08:00

62 lines
1.7 KiB
TypeScript

import { enhancedInputSchemas } from "./enhancedInputs.js";
import { createEvidence } from "../domain/evidence.js";
import { jsonValueSchema } from "../domain/jsonValue.js";
const dossier = (text: string) =>
jsonValueSchema.parse({
procedure: {
address: "0x1000",
name: "main",
classification: null,
body: {
available: false,
reason: "The fixture omits function-body extent observations.",
},
signature: "int main(void)",
locals: [],
},
pseudocode: text,
assembly: [],
comments: [],
callers: [],
callees: [],
incoming_references: [],
outgoing_references: [],
referenced_strings: [],
referenced_names: [],
basic_blocks: [{ start: "0x1000", end: "0x1001", successors: [] }],
native_api: null,
native_value_flow: null,
limitations: ["The fixture omits native API and value-flow observations."],
});
const observe = (digit: string, text: string) =>
createEvidence(
{
path: `/tmp/function-${digit}`,
sha256: digit.repeat(64),
format: "mach-o",
},
{
id: "rea-workflow",
name: "REA composed investigation workflow",
version: "1",
},
{
operation: "analyze_function",
parameters: enhancedInputSchemas.analyze_function.parse({
procedure: "main",
}),
result: dossier(text),
confidence: "derived",
authority: "shipped-artifact",
relationshipCoverage: { status: "complete" },
},
);
/** Canonical explicit function pair used in public contract examples. */
export const FUNCTION_COMPARISON_EXAMPLE = {
left: observe("0", "return 0;"),
right: observe("1", "return 1;"),
} as const;