fix: correct native inventories and bridge error classification (#503)

* fix(hopper): preserve normalized inventory addresses

* test(hopper): isolate real inventory verification

* fix(native): preserve otool addresses and section alignment

* fix: preserve address spaces in call path evidence

* fix(hopper): distinguish request validation from provider faults

* fix(native): retain tool inventory facts and reject failed signatures
This commit is contained in:
morluto
2026-10-04 17:25:09 +08:00
committed by GitHub
parent 4fbc501121
commit 405732a7f5
34 changed files with 1009 additions and 161 deletions
+47
View File
@@ -0,0 +1,47 @@
import assert from "node:assert/strict";
import { HOPPER_PROVIDER_IDENTITY } from "../../dist/hopper/HopperProvider.js";
import {
requireMcpResult,
requireEvidenceProvider,
} from "./mcp-verifier-results.mjs";
/** Verify real Hopper inventories and address filters through the MCP transport. */
export async function verifyHopperInventories(client, options) {
const inventoryCounts = {};
for (const operation of ["list_strings", "list_names"]) {
const called = await client.callTool(
{ name: operation, arguments: {} },
options,
);
const inventory = requireMcpResult(called, operation);
requireEvidenceProvider(called, operation, HOPPER_PROVIDER_IDENTITY.id);
assert.ok(
Array.isArray(inventory) && inventory.length > 0,
`${operation} omitted the real fixture inventory`,
);
let previous = -1n;
for (const item of inventory) {
assert.match(item.address, /^0x[0-9a-f]+$/u);
assert.equal(typeof item.value, "string");
const address = BigInt(item.address);
assert.ok(
address > previous,
`${operation} is not numerically address-sorted`,
);
previous = address;
}
const filtered = requireMcpResult(
await client.callTool(
{
name: operation,
arguments: { address: inventory[0].address },
},
options,
),
operation,
);
assert.deepEqual(filtered, [inventory[0]]);
inventoryCounts[operation] = inventory.length;
}
return inventoryCounts;
}
+3
View File
@@ -32,6 +32,7 @@ import { verifyHopperFunctionBasics } from "./lib/real-hopper-function-basics.mj
import { openAndVerifyLargeFixture } from "./lib/real-hopper-exhaustive-search.mjs";
import { completeVerifierRun, createVerifierRun } from "./lib/verifier-run.mjs";
import { requireHopperSelection } from "./lib/real-hopper-selection.mjs";
import { verifyHopperInventories } from "./lib/real-hopper-inventory.mjs";
import { startUnrelatedHopperSentinel } from "./lib/unrelated-hopper-sentinel.mjs";
const execFileAsync = promisify(execFile);
const verifierRun = createVerifierRun();
@@ -310,6 +311,7 @@ try {
options,
);
requireSuccessfulTool(overview, "binary_overview");
const inventoryCounts = await verifyHopperInventories(client, options);
requireEvidenceProvider(
documents,
"list_documents",
@@ -442,6 +444,7 @@ try {
segmentCount: firstOverview.segment_count,
analyses: [firstAnalysis, secondAnalysis],
fixtureAnalysis,
inventoryCounts,
largeInventory,
fixtureManifest: fixtureTargets.manifestPath,
bundledMcpRunning,