Repository navigation
fix(hopper): name the failing fields when a bridge reply misses its contract - #10713
Merged
Merged
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. |
Contributor
[Medium impact] The reviewed changes appear safe to merge once the stated dependency is included and required checks pass. SummaryThe PR adds field-level details to native reply failures and expands package checks to cover Hopper’s bridge and native schemas.
Reviews (5) · Last reviewed commit: "fix(hopper): name nested union failures ..." · Reviewed by Greptile |
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mainfails "Native package baseline (darwin arm64)" (run 43656106187). The packagedrea analyze <node> --provider hopper --jsonreturnsunreadable_output"Hopper bridge output did not match the list_segments contract". That job runs the packaged CLI against the fake Hopper bridge (tests/fixtures/fakeLauncher.mjs->fakeHopper.mjs), not real Hopper. #10662 began validatinglist_segmentsagainstnativeSegmentListSchema, and the fake's reply lackedpermissions,provenanceandsections. The refusal did not say which fields failed, and neither the contracts nor the fake were in the package lane's CI scope, so the mismatch reachedmain.The fake's replies are fixed in #10734. This PR fixes the two reasons the failure was hard to see and reached
main:outputContractDiagnostics(insrc/domain/native/nativeProviderOutput.ts, the shared native-output owner) projects each Zod issue to its field path, issue code, expected kind and observed JSON kind. No reported text is included. BothparseHopperReplyandinvalidNativeOutputattach it asdetails.diagnostics.packageCI scope covers the fake bridge (tests/fixtures/fakeLauncher.mjs,tests/fixtures/fakeHopper*.mjs), the real bridge, the reply contract table and every non-test native domain module (src/domain/native/!(*.test).ts), since the contracts import those schemas transitively. A change on either side runs the darwin package baseline before merge.Depends on #10734: this PR's own darwin package job runs the stale fake until #10734 merges and this branch is rebased.
Problem and expected behavior
A Hopper reply outside its contract must stay an
AnalysisOutputError, and the error must say which fields failed so the producer can be fixed. Before this PR it said only "did not match the list_segments contract".Change and scope
bridge/hopper_bridge.py) already emits every field thelist_segmentscontract requires; only the fake was stale.GhidraInventoryValues.ts,GhidraFunctionValues.ts). They build their own errors; follow-up.Contract and boundary impact
Semantic owner and earliest changed stage:
outputContractDiagnosticsowns how a native reply's contract failure is described. Its consumers areparseHopperReplyandinvalidNativeOutput.CLI and MCP/tool-catalog contract:
unreadable_outputerrors from these two producers now carrydetails.diagnostics.contract_issue_countandcontract_issues[], each{path, code, union_branches?, expected?, received?}, capped at 16 issues. A failed union is replaced by the issues of every option it tried, at their full path;union_branchesgives the option index at each union level. This is additive.Provider, bridge, target-format, or platform compatibility: none.
Evidence, artifact, provenance, or reconstruction contract: none.
Generated metadata, package, or installation impact: CI scope only.
Read existing files or captured data.
Evidence and regression coverage
HopperReplyContracts.test.ts"names each failing field without echoing reported text" and "names the nested field of each option a failed union tried".ciChangeScope.test.tsroutestests/fixtures/fakeHopper.mjs,tests/fixtures/fakeHopperReplies.mjs,src/hopper/HopperReplyContracts.ts,nativeSegments.ts,functionBody.tsandnativeSymbol.tsto thepackagelane, andfunctionBody.test.tsnot.node scripts/rea.mjs analyze <node> --provider hopper --json(withHOPPER_LAUNCHER_PATH/HOPPER_LOADER_ARGS_JSONset asscripts/verify-package-environment.mjssets them) reproduces main's failure, now withdetails.diagnostics.contract_issuesnaming[0, "permissions"](invalid_union),[0, "provenance"](invalid_value) and[0, "sections"](invalid_type, receivedmissing).Validation performed
npm run test:local -- src/hopper/HopperReplyContracts.test.ts: 12 passed.npm run test:focused -- tests/boundary/filesystem/ciChangeScope.test.ts tests/boundary/filesystem/ciRequiredLanes.test.ts: 399 passed.npm run check:fast: passed.npm run test:focused -- tests/boundary/filesystem/ciChangeScope.test.ts tests/boundary/filesystem/ciRequiredLanes.test.ts src/hopper/HopperReplyContracts.test.ts: 403 passed;npm run test:focused -- tests/boundary/mcp/enhancedTools.06-rejects-incomplete-function-dossiers-at.test.ts: 7 passed;npm run check:fast: passed.npx oxlintandnpx oxfmton the two files changed in the latest commit: no errors.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.