Skip to content

fix(hopper-verifier): restore npm run verify:hopper on current main - #11800

Open
Diego-9612 wants to merge 3 commits into
morluto:mainfrom
Diego-9612:fix/verify-hopper-retained-comparison
Open

Diego-9612 wants to merge 3 commits into
morluto:mainfrom
Diego-9612:fix/verify-hopper-retained-comparison

Conversation

@Diego-9612

@Diego-9612 Diego-9612 commented Nov 17, 2026 •

Copy link
Copy Markdown

Summary

Refs #342, #343. npm run verify:hopper currently fails on macOS with a real Hopper. Three stale verifier assumptions cause this; with all of them fixed, the full real-Hopper verifier passes on current main, including the main → entry → branch → leaf chain those issues ask to prove.

Problem and expected behavior

On main at e896f6054 (macOS 26.6.2 arm64, Hopper 6.6.2-demo), npm run verify:hopper fails in three places. The run stops at the first one, so they appear one at a time, in the order 1, 3, 2:

  1. scripts/lib/real-hopper-semantic.mjs (analyzeFixtureProcedure) sends two complete analyze_function dossiers inline to compare_functions. REA rejects that before validation:
    compare_functions failed: {"error":{"code":"resource_constraint",...,"message":"The MCP tool arguments exceed the configured input element allowance; schema validation and tool execution did not start.",...,"reported_limits":{"max_input_elements":1024}}}
    
  2. scripts/lib/real-hopper-boundaries.mjs (verifyHopperLifecycleAndCli) failed assert.notEqual(firstDocument, secondDocument) with both values equal to 'image.hop'. REA opens an owned copy of every target under a fixed name (image.executable / image.macho in src/hopper/BridgeLauncher.ts), so Hopper names every document image.hop and names cannot tell targets apart. The later !list_documents().includes(secondDocument) check has the same flaw.
  3. scripts/lib/real-hopper-exhaustive-search.mjs (collectAllMatches) failed search_procedures did not return every expected match. Since 59a7999, an omitted detail returns a retained summary when the Evidence exceeds 32 KiB, and the verifier expects 1205 rows inline.

Expected: the verifier exercises the same behavior with current contracts and passes on a working host.

Change and scope

  • real-hopper-semantic.mjs: compare { kind: "retained-evidence", evidence_id } on both sides. This is the reference form the error's remediation names and functionComparisonInputSchema accepts. The evidence_id is checked against ev_<sha256> first, so a missing record fails with a clear message.
  • real-hopper-boundaries.mjs: after the first open, the switch and the final reopen, requireSelectedTarget checks three things: binary_session selects the expected target path (as verify-real-hopper.mjs does after its own switch), current_document is listed, and the document count never grows. Names alone cannot identify the target, because every document is image.hop.
  • real-hopper-exhaustive-search.mjs: pass detail: "complete", as 59a7999 describes.
  • tests/conformance/providers/hopper/realHopperExhaustiveSearch.test.ts: the fake client returns a summary unless complete detail is requested.
  • tests/conformance/providers/hopper/realHopperSemantic.test.ts: the fixture receipt test now requires retained-evidence references for every compare_functions call.

Not changed: product code, the input element limit, or the fixed image naming. If maintainers consider image.hop for every target a product problem, for example because document names are user-visible, that is a separate decision; this PR only stops the verifier from depending on unique names.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: verifier scripts only. The input element budget (src/config/mcpInputBudget.ts) and Hopper image preparation (src/hopper/BridgeLauncher.ts) are unchanged; the verifier now follows them.
  • Contribution scope fit and linked maintainer decision: not applicable (verification fix within existing boundaries).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none. The verifier runs on the same hosts as before.
  • Evidence, artifact, provenance, or reconstruction contract: none. compare_functions still compares the same authenticated record, now by retained reference.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): disposal is still asserted, by count instead of by name.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

(No new effects; the verifier's existing effects are unchanged.)

Evidence and regression coverage

  • Tests added or updated: realHopperSemantic.test.ts fails with the old inline arguments (1 failed, 4 passed); realHopperExhaustiveSearch.test.ts fails without detail: "complete" (2 failed, 1 passed).
  • Base reproduction or other evidence: the three real-Hopper failures above.
  • User-visible CLI/MCP output: npm run verify:hopper result summary after the fix:
    fixtureAnalysis: main 0x100000670 _main, entry 0x10000063c _rea_entry,
      branch 0x1000005e4 _rea_branch, leaf 0x1000005ac _rea_leaf;
      entryStrings 1, entryCallees 2, branchCallees 1, branchBlocks 5,
      leafStrings 1, leafNames 3
    lifecycleAndCli: targetSwitchDisposedDocument, cliByteParity, cliInvalidAddress,
      cliLiteralTraceParity, cliFunctionDossierParity, callerCancellationRecovered,
      closedDocumentAbsent: all true
    largeInventory: 1205 procedures / 1205 strings in one call each
    documentCountAfterTargetSwitch 1, documentCountAfterSameTargetReopen 1,
    unrelatedHopperSurvived true, cleanShutdown true, toolCount 264
    
  • Remaining proof gaps:
    • Hopper 6.6.2-demo, not a licensed build;
    • macOS arm64 only (verify:hopper:linux not run);
    • verify:hopper:callers, :deadlines, :fat and :fat64 were not rerun on e896f6054;
    • one earlier run, with only the first two fixes, failed with Target switching did not replace the previous Hopper document. The document lists were not captured and the cause is unknown. It did not recur in 7 further runs of that tree and its variants, or in the 6 runs of the final commit.

Validation performed

All on macOS 26.6.2 arm64, Node 24.22.1 (.nvmrc), Hopper 6.6.2-demo.

On d0856db, rebased onto main e896f6054:

  • npm run verify:hopper — passed, 6 of 6 runs, Hopper launched fresh for each.
  • npm run test:focused -- tests/conformance/providers/hopper/realHopperExhaustiveSearch.test.ts tests/conformance/providers/hopper/realHopperSemantic.test.ts — 8 passed.
  • check:fast, check:changed, docs:check, verify:test-discovery — passed.

Reproductions on e896f6054:

  • unmodified main — failed: compare_functions resource_constraint (failure 1).
  • main with fixes 1 and 2 — 4 of 4 runs failed: 3 with failure 3, 1 with the unexplained switch failure above.
  • main with fixes 1 and 3 — failed: 'image.hop' document-name assertion (failure 2).

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: real Hopper 6.6.2-demo on macOS 26.6.2 arm64.
  • Package or release metadata impact: none; verifier scripts are not packaged.
  • Security, privacy, process, or containment review: no new effects. Fixture immutability and cleanup assertions are unchanged.

Author readiness

Human owner: @Diego-9612

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The reviewed changes appear safe to merge.

Summary

Updates the Hopper verifier to follow current contracts.

  • Hopper fixture comparisons reuse their analyzed evidence.
  • Hopper lifecycle checks track targets without relying on document names.

No actionable new issues or security concerns were found. No previous review threads were supplied. Tests and real Hopper verification were not run during this review. Whether another PR supersedes this one could not be checked because GitHub access required authentication.

Reviews (2) · Last reviewed commit: "fix(hopper-verifier): identify switched ..." · Reviewed by Greptile

@Diego-9612
Diego-9612 marked this pull request as ready for review November 17, 2026 03:18
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T03:18:37.400277Z
We couldn’t complete this review. Comment @codex review to try again.
43083f7 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@Diego-9612

Copy link
Copy Markdown
Author

Friendly ping: npm run verify:hopper currently fails on main on macOS with a real Hopper. This PR restores it (two stale verifier assumptions; details in the description) and provides the real-Hopper evidence for #342 and #343. It still merges cleanly.

Could a maintainer approve the CI workflows when convenient? Thanks!

@morluto morluto added area: tests Test suite and verification bug Something isn't working provider: hopper Analysis provider / engine: hopper labels Nov 22, 2026
Diego-9612 and others added 3 commits November 24, 2026 17:27
The real-Hopper verifier failed on macOS before reaching its lifecycle
checks:

- compare_functions received two complete analyze_function dossiers
  inline, which exceeds the default MCP input element allowance (1024).
  Compare the retained session record by reference on both sides.
- Target-switch checks compared native document names, but REA now opens
  an owned copy of each target under a fixed image name, so every
  document is "image.hop". Assert disposal by document count instead,
  matching the target-switch check in verify-real-hopper.mjs.

The fixture receipt test now requires retained-evidence references for
compare_functions.

Refs morluto#342, morluto#343

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Counting documents shows that a target switch does not retain the old
native document, but not that the current document belongs to the new
target. Check binary_session's selected path after every switch and
reopen, alongside the listed current document and a document count that
never grows.

Validate analyze_function's evidence_id before comparing by retained
reference, so a missing record fails with a clear message instead of a
compare_functions schema error. Merge the duplicated compare_functions
branch in the receipt test.

Refs morluto#342, morluto#343

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An omitted detail returns a retained summary above 32 KiB since 59a7999, so
the large fixture search no longer received its expected rows inline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Diego-9612
Diego-9612 force-pushed the fix/verify-hopper-retained-comparison branch from 43083f7 to d0856db Compare November 24, 2026 22:36
@Diego-9612

Copy link
Copy Markdown
Author

I rebased this onto current main (e896f6054) and reran the real-Hopper verifier, because main gained a third failure that the previous version of this PR did not cover. macOS 26.6.2 arm64, Hopper 6.6.2-demo, Node 24.22.1, Hopper launched fresh for each run.

Tree verify:hopper
main fails: compare_functions exceeds the input element allowance (failure 1)
main + the previous version of this PR fails, 4 of 4 runs: 3 with search_procedures did not return every expected match (failure 3), 1 as described below
main + fixes 1 and 3 fails: both documents are named image.hop (failure 2)
this branch, d0856db passes, 6 of 6 runs

Failure 3: since 59a7999, an omitted detail returns a retained summary above 32 KiB, and real-hopper-exhaustive-search.mjs expects 1205 complete rows. It now passes detail: "complete", as that commit describes. The unit test's fake client returns a summary otherwise, so the test fails without it.

One caveat: one run of the previous version failed with Target switching did not replace the previous Hopper document. I did not capture its document lists and do not know the cause. It did not recur in 7 further runs of that tree and its variants, or in the 6 runs of d0856db.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification bug Something isn't working provider: hopper Analysis provider / engine: hopper

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants