mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[PR #7133] fix(browser): report an out-of-range generated position as a selection fault #7665
Open
opened 2026-11-03 13:39:29 +00:00 by bsakaguchi
·
0 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
morluto/rea#7665
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/morluto/rea/pull/7133
Author: @amyanger
Created: 10/25/2026
Status: 🔄 Open
Base:
main← Head:fix/web-source-position-out-of-range📝 Commits (1)
0255065fix(browser): report an out-of-range generated position as a selection fault📊 Changes
5 files changed (+195 additions, -27 deletions)
View changed files
📝
src/application/WebSourceLocationService.test.ts(+47 -0)📝
src/application/WebSourceLocationService.ts(+33 -16)📝
src/domain/webSourcePosition.test.ts(+56 -1)📝
src/domain/webSourcePosition.ts(+31 -9)📝
tests/acceptance/webSourceLocationCli.test.ts(+28 -1)📄 Description
Summary
trace_web_source_location(CLItrace-web-source-location) reported a well-formedgenerated_positionpast the end of the selected script as aninvalid_formatissue on["generated_position"], with no bounds. It now reports anout_of_rangeissue on the coordinate that is past the end,["generated_position","line"]or["generated_position","column"], withminimumandmaximum, as #6979 did forscript_indexand #7067 did forrecord_ordinals.Fixes #7132
Problem and expected behavior
Smallest trigger: a manifest whose selected script is the one-line text
generated, andgenerated_position{line: 2, column: 0}or{line: 1, column: 999}. Both are valid integers inside the input schema, so the request is well formed; the coordinate is only outside the retained script.invalid_formattells the caller its input is malformed and gives no valid range. Expected: the same caller-selection fault shape the two precedents use, naming the coordinate and its bounds.Change and scope
src/domain/webSourcePosition.ts: the existing line scan now lives inresolveWebSourcePosition, which returns{offset}for a position inside the text,{field, maximum}naming the coordinate past the end, orundefinedfor coordinates that are not valid integers.webSourceOffsetkeeps its signature and returns the offset from that result, so its other caller (TraceSourceMap.ts) is unchanged. One scan computes both the offset and the bound, so a rejected position does not rescan the text and the two answers cannot disagree on line terminators.src/application/WebSourceLocationService.ts: a newadmitGeneratedOffsethelper builds theout_of_rangeissue inline, asWebNetworkCaptureService.tsandLocalWebScriptArtifacts.tsdo. Line bounds are 1 to the last line. Column bounds are 0 to that line's UTF-16 length. The message names the value and the bound, for exampleNo line 2; the retained script ends at line 1 (one-based lines).Sinceccdeda7a2andb4b5c37ab, main checks the position intraceafterverifyPairingand wraps failures inincomplete(...)sopartial_observationis retained. The helper is called at that same point and its error goes throughincomplete(...)too, so the new issue keepspartial_observation. Theundefinedcase keeps the previousinvalid_formatissue through the file'sinvalid()helper; the input schema (z.int().min(1)/z.int().min(0)) rejects those coordinates before this point.TraceSourceMap.tsreports out-of-range original positions as a recorded result (outside-embedded-text), not an input error, so it is left alone.Contribution scope: ordinary fix within an existing boundary; maintainer scope decision not applicable.
Contract and boundary impact
WebSourceLocationService.trace(admitGeneratedOffset), after artifact acquisition and the pairing check, before decoding. Consumers are the CLI and MCP error projections, which passpath,reason,minimumandmaximumthrough unchanged.invalid_formaton["generated_position"]toout_of_rangeon["generated_position","line" | "column"]with bounds. The errorcodestaysinvalid_requestand the exit code stays 1. No advertised schema changes.normalized_resultare unchanged.Expected effects:
Evidence and regression coverage
tests/acceptance/webSourceLocationCli.test.ts: the existing CLI out-of-range case now assertsout_of_rangeon["generated_position","line"]withminimum: 1, maximum: 1, and a new stdio MCP call assertsout_of_rangeon["generated_position","column"]withmaximumequal to the script length.src/application/WebSourceLocationService.test.ts: line past the end, column past the end of a CRLF-terminated line, and column past the end of the last line, with bounds and messages.src/domain/webSourcePosition.test.ts:resolveWebSourcePositionbounds for empty text, a trailing CRLF, lone CR, U+2028/U+2029 and a surrogate pair, andundefinedfor invalid coordinates. The existingwebSourceOffsettests are unchanged and pass.fc43e285e): with the acceptance fixture's manifest, script and map,trace-web-source-location ... 1 0 --jsonexits 0 withgenerated_offset: 0;... 2 0 --jsonand... 1 999 --jsonexit 1 with{"path":["generated_position"],"reason":"invalid_format","message":"Selected generated position is outside the retained script text (one-based lines; zero-based UTF-16 columns)."}.npm run test:focused -- src/domain/webSourcePosition.test.ts src/application/WebSourceLocationService.test.ts tests/acceptance/webSourceLocationCli.test.tswith the branch's test files onfc43e285e: 15 failed. 11 are the new domain cases (resolveWebSourcePositiondoes not exist on base), 3 are the service out-of-range cases (receivedinvalid_formaton["generated_position"]), and 1 is the acceptance test.codeanddetails.issuesfrom--json, other fields trimmed.)npm run test:local -- src/domain/webSourcePosition.test.ts src/application/WebSourceLocationService.test.ts. Every mutant failed at least one test: exclusive column end, column maximum +1, line maximum -1, last line skipped,webSourceOffsetdropping the offset, CRLF counted as two breaks, minimum always 0, reason reverted toinvalid_format, path without the coordinate, line and column messages swapped, and invalid coordinates given a limit.webSourceOffsetover more than 1000 rejected positions built from empty text, CR, LF, CRLF, U+2028/U+2029 and surrogate pairs. For each, the reported maximum was accepted and maximum + 1 was rejected. It found no consumer, doc, fixture or golden depending on the old issue shape; the one assertion on the old path is updated here. A/code-reviewpass found no correctness bug and flagged that a first version scanned the text twice through two copies of the line loop; that is why the scan is shared in this version. A second adversarial review of the final diff compared base'swebSourceOffsetwith the new wrapper over 400,000 random inputs (texts of CR, LF, U+2028/U+2029, lone surrogate halves, U+0085, VT and FF; positions including -1, -0, 1.5, NaN, Infinity, 2^53 and non-numbers) and found no difference in any result. It also confirmed the reported bounds are tight on those inputs.Boundary regressions covered: input issue path, reason and bounds for a caller selection fault through CLI and MCP. Lifecycle regressions: not applicable; no resource ownership changes.
For evidence-bearing changes:
Validation performed
Ported onto main
570abe95fon 2026-10-27, afterccdeda7a2andb4b5c37abrestructured this code and made the PR conflict. Main CI is red on that commit for reasons outside this diff. Runs on the ported commit:npm run test:focused -- src/application/WebSourceLocationService.test.ts src/domain/webSourcePosition.test.ts tests/acceptance/webSourceLocationCli.test.ts: 42 passed. The acceptance case asserts theout_of_rangeissue together with main'spartial_observation.npm run check:fast: passednpm run test:changed -- --base 570abe95f: 11 files, 114 tests passednpm run check: onlyknipfailed, on unused exports injavascriptStaticAnalysisHelpers.ts,androidJniLibraryFacts.ts,androidManifestComponents.tsandobjcSwiftMetadata.ts.npm run knipon clean570abe95fprints the same four entries and exits 1. The other five tasks passed.invalid_format, path without the coordinate and minimum always 0 each failsrc/application/WebSourceLocationService.test.ts. An offset off by one failstests/acceptance/webSourceLocationCli.test.ts(generated_offset1 instead of 0)./code-review(high) on the ported commit: no correctness bug. It flagged seven cleanup and test-quality items, none of them new to the port. Theresolved === undefinedbranch cannot run because the input schema rejects those coordinates first; it keeps the previousinvalid_formatissue rather than inventing a new one.webSourceOffsetstays as a wrapper soTraceSourceMap.tsis unchanged. Theminimumternary, the hand-builtAnalysisInputErrornext toinvalid(), service-test fixture plumbing, overlap between service and domain tests, and the acceptancemaximum: fixture.source.lengthtied to a one-line ASCII fixture are left as they are to keep this port the same change that was reviewed before. I can fold any of them in if a maintainer prefers.Runs on the original version of this PR, before the port:
npm run test:focused -- src/domain/webSourcePosition.test.ts src/application/WebSourceLocationService.test.ts tests/acceptance/webSourceLocationCli.test.ts src/javascript/sourceMaps/TraceSourceMap.test.ts: 71 passednpm run check:fast: exit 0npm run test:changed -- --base fc43e285eaae2155d32e2ca0ab5d2181a4e2f1b5: 10 files, 103 tests passednpm run check: exit 0. The only diagnostic in a touched file is the existingmax-lines-per-functionwarning onWebSourceLocationService.trace, which this diff does not change.npm run verify:test-discovery: discovered all 2485 test files exactly onceCompatibility, safety, and release
fix.Author readiness
Human owner: @amyanger
Before merge
type(scope): outcome.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.