fix(hopper): preserve partial native call and string evidence

This commit is contained in:
morluto
2026-10-09 05:12:36 +08:00
parent 0a49d5bfb9
commit 246170238e
11 changed files with 188 additions and 77 deletions
+25
View File
@@ -110,6 +110,31 @@ async function verifySearchModes(call, address) {
assert.ok(long.startsWith(longItem.value));
assert.ok(longItem.provider_value.endsWith("…"));
assert.equal(longItem.string.termination, "missing");
const literalProcedure = (await call("list_procedures")).find((item) =>
item.value.endsWith("rea_long_literal_procedure"),
);
assert.ok(literalProcedure);
const dossier = await call("analyze_function", {
procedure: literalProcedure.address,
});
const referenced = dossier.referenced_strings.find(
(item) => item.address === longItem.address,
);
assert.ok(referenced, "function dossier omitted its long literal reference");
const { source_address, ...stringRecord } = referenced;
assert.ok(
dossier.outgoing_references.some(
(edge) =>
edge.source_address === source_address &&
edge.target_address === longItem.address,
),
);
assert.deepEqual(
stringRecord,
longItem,
"function dossier discarded typed string provenance",
);
const fragments = strings.filter((item) => {
const offset = BigInt(item.address) - BigInt(longItem.address);
return offset >= 0n && offset < BigInt(Buffer.byteLength(long));
+39
View File
@@ -1,3 +1,4 @@
import assert from "node:assert/strict";
import { requireFunctionDossierOracle } from "../../dist/application/RealHopperAssertions.js";
/** Require truthful tri-state permissions from real Hopper memory regions. */
@@ -122,6 +123,44 @@ export async function verifyRealHopperFixture({
require_assembly: true,
},
);
const calls = entryDossier.outgoing_references.filter(
(edge) => edge.call?.classification === "direct",
);
assert.ok(
calls.some((edge) => edge.target_address === branch.address),
"Hopper native direct-call classification was discarded",
);
const observed = normalizedResult(
await client.callTool(
{
name: "procedure_references",
arguments: { procedure: entry.address, direction: "outgoing" },
},
options,
),
"procedure_references native calls",
);
assert.deepEqual(entryDossier.unresolved_calls, observed.unresolved_calls);
for (const call of calls) {
assert.equal(call.call.provider_type, 2);
assert.equal(
call.call.provenance,
"hopper-public-python-api:CallReference",
);
assert.equal(
call.kind.available,
false,
"partial call metadata invented detailed reference flags",
);
assert.deepEqual(
observed.references.find(
(edge) =>
edge.source_address === call.source_address &&
edge.target_address === call.target_address,
)?.call,
call.call,
);
}
const branchDossier = requireFunctionDossierOracle(
await analyzeFixtureProcedure(client, options, branch, normalizedResult),
{