Skip to content

fix(capture): report an out-of-range record ordinal as a selection fault - #7067

Merged
morluto merged 1 commit into
morluto:mainfrom
Adolanium:fix/web-capture-ordinal-out-of-range
Oct 25, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
Adolanium:fix/web-capture-ordinal-out-of-range

Conversation

@Adolanium

@Adolanium Adolanium commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7068.

inspect_web_network_capture reports a record_ordinals entry past the end of a valid capture as an invalid_format issue on record_ordinals, with no bounds. The request is well formed; the caller selected an ordinal the capture does not have. The issue is now out_of_range on that entry, with the valid bounds, as #6979 did for script_index.

Problem and expected behavior

WebNetworkCaptureService.#projectCapture returned { path: ["record_ordinals"], reason: "invalid_format" } when safeValue.records[ordinal] was missing. docs/web-network-captures.md describes out-of-range selections as input errors, and AnalysisInputIssue defines out_of_range with minimum / maximum so a client can correct the request. With invalid_format, a client is told the request is malformed and gets no range.

Expected: { path: ["record_ordinals", i], reason: "out_of_range", minimum: 0, maximum: total_records - 1 } for the first out-of-range entry i, and invalid_value when the capture has no records.

Change and scope

  • src/application/WebNetworkCaptureService.ts: the out-of-range branch reports the entry's index in the path and the bounds from total_records, which the service already checks equals records.length. The message is unchanged.

Not included: the duplicate-ordinal and protobuf-without-ordinals checks keep their current issues.

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.

Contribution scope: not applicable. This is a fix inside the existing web network capture inspection.

Contract and boundary impact

  • Semantic owner and earliest changed stage: WebNetworkCaptureService.#projectCapture, where the selected ordinals are resolved.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: the error code stays invalid_request; the issue reason, path and bounds change as described.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): the selection fault is reported against the selected entry.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): 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.

Evidence and regression coverage

  • Tests added or updated: src/application/WebNetworkCaptureService.test.ts, "reports an ordinal past the capture's records as an out-of-range selection": with record_ordinals: [0, 5] on the fixture capture, the projected error is invalid_request with details.issues [{ path: ["record_ordinals", 1], reason: "out_of_range", minimum: 0, maximum: total_records - 1 }]. The existing "rejects invalid caller selection" cases still pass.
  • Base reproduction or other evidence: with WebNetworkCaptureService.ts from upstream/main 8e6a957 and the new test, the test fails.
  • User-visible CLI/MCP output (if applicable): the invalid_request details for an out-of-range record_ordinals entry (CLI --record).
  • Remaining proof gaps: the empty-capture branch (invalid_value) has no dedicated test.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

On Linux (WSL Ubuntu, Node 24.22.1) at 9513da7 (on upstream/main 8e6a957), after npm ci and npm run build:cached:

  • npx tsc -p . --noEmit passed.
  • npx oxfmt --check on the changed files: clean. node scripts/ci/static-check-report.mjs lint: 0 errors.
  • npx vitest run src/application/WebNetworkCaptureService.test.ts tests/acceptance/tools/harBoundaryFacts.test.ts and the HAR boundary tests: 51 passed, in two runs.
  • The negative check above failed the new test.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; the error code is unchanged.
  • Real Hopper/Ghidra, browser, or OS coverage: Linux only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner: @Adolanium

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

inspect_web_network_capture reported a record_ordinals entry past the capture's records as an invalid_format issue on record_ordinals, with no bounds. It is now an out_of_range issue on that entry (record_ordinals[i]) with minimum 0 and maximum total_records - 1, or invalid_value when the capture has no records.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-25T04:40:42.905735Z
We couldn’t complete this review. Comment @codex review to try again.
9513da7 PR opened
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The PR reports missing selected records as selection errors rather than malformed captures.

  • Capture selection errors point to the bad entry and valid range.

No actionable defects or new security issues were found. Tests were inspected, not executed. Supersession could not be checked because GitHub access required authentication.

Adolanium explicitly acknowledged the missing dedicated test: “Remaining proof gaps: the empty-capture branch (invalid_value) has no dedicated test.”

Reviews (1) · Last reviewed commit: "fix(capture): report an out-of-range rec..." · Reviewed by Greptile

@morluto
morluto merged commit 4973ce7 into morluto:main Oct 25, 2026
42 of 43 checks passed
@Adolanium
Adolanium deleted the fix/web-capture-ordinal-out-of-range branch October 25, 2026 05:57
@morluto morluto mentioned this pull request Oct 25, 2026
3 tasks done
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] An out-of-range record_ordinals entry is reported as invalid_format

2 participants