Repository navigation
fix(test): serve fake Hopper segments in the bridge's reply contract - #10734
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Review against
|
[Low impact] The PR appears safe to merge; no blocking issues remain. SummaryFixes the fake Hopper segment reply without changing the real bridge or its 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 |
|
CI note: this PR's "Native package baseline" jobs are skipped, because |
#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.
…he keyed factories
7cf2f1c to
c415035
Compare
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 --jsonreturnsunreadable_outputwith "Hopper bridge output did not match the list_segments contract". The lane drives the packaged CLI againsttests/fixtures/fakeHopper.mjs, whoselist_segmentsreply 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
nativeSegmentListSchemarequirespermissions,provenanceandsections; the fixture sent only name, range and booleans.bridge/hopper_bridge.py(list_segmentsreports permissions as unavailable from Hopper's public API,hopper-public-python-apiprovenance, nested sections).Change and scope
tests/fixtures/fakeHopperReplies.mjsnow owns the fake bridge's successful replies (moved unchanged fromfakeHopper.mjs, which imports it), exceptlist_segments, which now matches the real bridge's shape.tests/boundary/providers/hopper/fakeHopperReplyContracts.test.tschecks every served reply againstparseHopperReply, so a future contract or fixture drift fails as a fast boundary test instead of in the darwin package lane.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.AnalysisOutputErrorfor a contract mismatch carries only "did not match the list_segments contract" in its user-visible details; the zod issue path is only incause. 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
fakeHopperReplyContracts.test.ts(one case per served method, 12 cases)."operation":"list_segments","reason":"Hopper bridge output did not match the list_segments contract". With the oldlist_segmentsshape (noprovenance/sections) restored in the new module, the new test fails exactly onlist_segments; with this change all 12 pass.Validation performed
npm run test:focused -- tests/boundary/providers/hopper/fakeHopperReplyContracts.test.ts— 12 passed; 1 failed (list_segments) with the old segment shapenpm 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 skippednpm run check:fast— passedresolve_containing_procedureandprocedure_referencesinto the keyed factories (they were the last inline replies, and neither matched the contract: the procedure identity lackedclassification/body, andprocedure_referenceslackedreference_kinds_available/unresolved_calls) and rebasing ontomain:npm run test:focused -- tests/boundary/providers/hopper/fakeHopperReplyContracts.test.ts16 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.ts27 passed;tsc --noEmitpassed; pushed through the pre-push hook.Compatibility, safety, and release
Author readiness
Human owner:
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-verifybecause main failed typecheck at the time (fixed by fix(parsers): keep each ParseFailure constructor's kind in its return type #10746);test:focusedon fakeHopperReplyContracts.test.ts passed 12/12.