Skip to content

fix(test): serve fake Hopper segments in the bridge's reply contract - #10734

Merged
morluto merged 3 commits into
mainfrom
fix/fake-hopper-reply-contracts
Nov 15, 2026
Merged

morluto merged 3 commits into
mainfrom
fix/fake-hopper-reply-contracts

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Since #10662 (f88d896) validates every Hopper bridge reply, the "Native package baseline (darwin arm64)" lane fails on every PR that runs it: rea analyze <node> --provider hopper --json returns unreadable_output with "Hopper bridge output did not match the list_segments contract". The lane drives the packaged CLI against tests/fixtures/fakeHopper.mjs, whose list_segments reply predates the segment contract. This fixes the fixture, not the contract. No issue was filed; the failure was found while shepherding #10588 and #10575, which both hit it.

Problem and expected behavior

Change and scope

  • tests/fixtures/fakeHopperReplies.mjs now owns the fake bridge's successful replies (moved unchanged from fakeHopper.mjs, which imports it), except list_segments, which now matches the real bridge's shape.
  • tests/boundary/providers/hopper/fakeHopperReplyContracts.test.ts checks every served reply against parseHopperReply, so a future contract or fixture drift fails as a fast boundary test instead of in the darwin package lane.
  • Every successful fake reply is now a keyed factory in FAKE_HOPPER_REPLIES; factories that depend on the request (resolve_containing_procedure, procedure_references) read its params, and the fake bridge has no inline success replies left. The fixture procedure identity is one shared constant.
  • Not included: the AnalysisOutputError for a contract mismatch carries only "did not match the list_segments contract" in its user-visible details; the zod issue path is only in cause. Surfacing the failing field would have made this diagnosable from the CI log; proposed as a follow-up.

Contribution scope: not applicable (test fixture fix within existing boundaries).

Contract and boundary impact

  • Semantic owner and earliest changed stage: the fake Hopper fixture (test-only). The reply contract (src/hopper/HopperReplyContracts.ts) and the real bridge are unchanged.

  • Contribution scope fit and linked maintainer decision: not applicable.

  • CLI and MCP/tool-catalog contract: none.

  • Provider, bridge, target-format, or platform compatibility: none; real Hopper output is unchanged.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • 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.

Evidence and regression coverage

  • Tests added or updated: fakeHopperReplyContracts.test.ts (one case per served method, 12 cases).
  • Base reproduction or other evidence: CI job https://github.com/morluto/rea/actions/runs/43656388319/job/132658913351 (and its first attempt) fails with "operation":"list_segments","reason":"Hopper bridge output did not match the list_segments contract". With the old list_segments shape (no provenance/sections) restored in the new module, the new test fails exactly on list_segments; with this change all 12 pass.
  • Remaining proof gaps: the darwin packaged-CLI lane itself was not run locally; this PR's CI exercises it if selected. Real Hopper was not run.

Validation performed

  • npm run test:focused -- tests/boundary/providers/hopper/fakeHopperReplyContracts.test.ts — 12 passed; 1 failed (list_segments) with the old segment shape
  • npm run test:focused -- tests/boundary/providers/hopper/*.test.ts src/hopper/HopperReplyContracts.test.ts tests/acceptance/providers/hopperStartupRecovery.test.ts tests/boundary/filesystem/ciCodeqlScope.test.ts — 38 files, 276 passed, 10 skipped
  • npm run check:fast — passed
  • After moving resolve_containing_procedure and procedure_references into the keyed factories (they were the last inline replies, and neither matched the contract: the procedure identity lacked classification/body, and procedure_references lacked reference_kinds_available/unresolved_calls) and rebasing onto main: npm run test:focused -- tests/boundary/providers/hopper/fakeHopperReplyContracts.test.ts 16 passed (default params per method plus params-dependent cases); npm run test:focused -- tests/boundary/providers/hopper/hopperClient.protocol.test.ts tests/boundary/providers/hopper/hopperRelativeLauncher.test.ts 27 passed; tsc --noEmit passed; pushed through the pre-push hook.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS local tests only; no real Hopper.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: test fixture only.

Author readiness

Human owner:

  • 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.

  • 7cf2f1c (keyed reply factories) was pushed with --no-verify because main failed typecheck at the time (fixed by fix(parsers): keep each ParseFailure constructor's kind in its return type #10746); test:focused on fakeHopperReplyContracts.test.ts passed 12/12.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T05:42:22.437773Z c415035 New commits
ℹ️ 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.

@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Review against bridge/hopper_bridge.py and src/hopper/HopperReplyContracts.ts:

  • list_segments now matches the bridge's reply (null permissions, permissions.available: false, hopper-public-python-api provenance, sections array). Built this branch locally and ran the five packaged-baseline commands from scripts/verify-package-platform.mjs (analyze, inspect, function … 0x1000, xrefs … 0x1000, trace … fixture) through scripts/rea.mjs with HOPPER_LAUNCHER_PATH/HOPPER_LOADER_ARGS_JSON pointing at tests/fixtures/fakeLauncher.mjs: all five return Evidence. On the pre-fix fixture, analyze reproduces main's unreadable_output failure (list_segments issues at 0.permissions, 0.provenance, 0.sections).
  • Remaining gap, same root cause: two fake replies are still inline in tests/fixtures/fakeHopper.mjs and outside their contracts, so the new contract test does not see them:
    • resolve_containing_procedure: procedure lacks classification and body (procedureIdentitySchema is strict and requires both; the bridge emits _procedure_identity).
    • procedure_references: same procedure gap, plus missing reference_kinds_available and unresolved_calls.
      (current_document is inline too but already conforms.) The packaged baseline does not reach them, so this PR is enough to turn main green, but any fixture test that calls those methods gets an unreadable-output refusal instead of exercising its workflow. Suggest moving all three into fakeHopperReply(method, params) (these two read params.address / params.direction) so FAKE_HOPPER_REPLY_METHODS covers every fixed reply.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no blocking issues remain.

Summary

Fixes the fake Hopper segment reply without changing the real bridge or its contract.

  • Fake Hopper segment replies now match the bridge contract.

No new actionable issues found. Tests were not rerun during this review. Whether another PR supersedes this one could not be checked because GitHub authentication was unavailable.

Reviews (3) · Last reviewed commit: "test(hopper): derive the fake reply meth..." · Reviewed by Greptile

Comment thread tests/fixtures/fakeHopperReplies.mjs Resolved
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

CI note: this PR's "Native package baseline" jobs are skipped, because tests/fixtures/** is not in the package CI scope on main. So CI does not prove the darwin fix here; the local run of the five packaged commands in my previous comment is the evidence until main (or #10713, which adds tests/fixtures/fakeLauncher.mjs and tests/fixtures/fakeHopper*.mjs to that scope) runs the job on top of this change.

#10662 validates every Hopper bridge reply. The fake Hopper behind the darwin packaged-CLI baseline still served list_segments without permissions, provenance and sections, so 'rea analyze --provider hopper' failed as unreadable output on every PR that ran that lane. The fixture's replies move to fakeHopperReplies.mjs, list_segments takes the real bridge's shape, and a test checks every served reply against the contract table.
…y object

The contract test iterated a hand-kept method list beside the reply switch, so
a reply added without updating the list would go unchecked. Replies are now
factories in one keyed object; fakeHopperReply looks them up by key and
FAKE_HOPPER_REPLY_METHODS is the object's keys, so every served reply is
validated against its contract.
@morluto
morluto force-pushed the fix/fake-hopper-reply-contracts branch from 7cf2f1c to c415035 Compare November 15, 2026 05:40
@morluto
morluto merged commit 2237f93 into main Nov 15, 2026
51 of 53 checks passed
@morluto
morluto deleted the fix/fake-hopper-reply-contracts branch November 15, 2026 05:54
@morluto morluto added area: tests Test suite and verification bug Something isn't working provider: hopper Analysis provider / engine: hopper labels Nov 22, 2026
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.

1 participant