Files
rea/src/contracts/functionComparisonExample.ts
morluto a4ba8aecd5 fix(contracts)!: require observed provider output metadata
Reject omitted segment bounds, procedure classification and body facts, unresolved-call observations, dossier facets, and Ghidra parameter flow metadata. Providers emit explicit nulls for unsupported facets. Verify those unknowns in the real Hopper workflow.

BREAKING CHANGE: Provider analysis outputs must explicitly supply metadata previously repaired with defaults; unsupported nullable facets must be reported as null.
2026-10-10 03:52:13 +08:00

61 lines
1.6 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",
},
);
/** 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;