Skip to content

fix(cli): reject non-decimal source-map decode deadlines - #9168

Closed
Plastic-time wants to merge 1 commit into
morluto:mainfrom
Plastic-time:rrfz/decimal-source-map-decode-timeout
Closed

Plastic-time wants to merge 1 commit into
morluto:mainfrom
Plastic-time:rrfz/decimal-source-map-decode-timeout

Conversation

@Plastic-time

@Plastic-time Plastic-time commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

trace-web-source-location already reads its script index, line and column with cliIntegerArgument. Its --decode-timeout-ms option was still the shared decode_timeout_ms number, which Incur reads through Number(). So --decode-timeout-ms 0x1 ran the owned source-map codec with a 1 ms deadline, and 2e4 meant 20 seconds. This change reads that option with cliDecimalField, as #8919 did for other numeric options.

No issue is linked. I found this while checking which numeric CLI options still go through Number().

Problem and expected behavior

On main bacc1e384, with the webSourceLocationFixture() manifest, script and map written to a temporary directory:

  • rea trace-web-source-location <manifest> 0 <map> <url> 1 0 --decode-timeout-ms=0x1 --json exits 1 with code: "provider_timeout".
  • The same call with --decode-timeout-ms=020000 exits 0 and maps the position.

Expected: --decode-timeout-ms takes decimal text only, like the positionals of the same command. A non-decimal spelling is refused during argument parsing and names the field. Decimal values keep the shared 1 to 2147483647 bounds. Omitting the option still means 20000.

Change and scope

  • src/cli/webSourceLocationCommands.ts: decodeTimeoutMs uses cliDecimalField(webSourceLocationInputSchema.shape.decode_timeout_ms). The field is optional, so an omitted deadline stays absent.
  • MCP trace_web_source_location is unchanged.

Scope decision: not applicable. This is an ordinary fix within the existing CLI boundary.

Contract and boundary impact

  • Semantic owner and earliest changed stage: webSourceLocationInputSchema owns the bounds and the description. CLI argument parsing now admits only decimal text before it.
  • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable.
  • CLI and MCP/tool-catalog contract: the CLI option now refuses non-decimal text. Help keeps the description; the type hint changes from <number> to <value>, as for the other decimal options. MCP is unchanged.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none. A decimal deadline reaches the same input as before.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): a refused option reads no manifest or map and starts no codec process.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none committed.

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: "admits only a decimal source-map decode deadline" at the end of tests/acceptance/webSourceLocationCli.test.ts. It writes the existing fixture and runs the real CLI twice. --decode-timeout-ms=0x1 must give VALIDATION_ERROR on decodeTimeoutMs. --decode-timeout-ms=020000 must exit 0 with generated_offset: 0.

  • Base reproduction: with main's webSourceLocationCommands.ts (rebuilt by test:focused), the file gives 1 failed, 4 passed. The new test receives "code": "provider_timeout" for 0x1. With this change: 5 passed.

  • User-visible CLI output for --decode-timeout-ms=0x1:

    Before: exit 1, "code":"provider_timeout".

    After:

    {"code":"VALIDATION_ERROR","message":"REA could not read the command arguments. Check the named argument and its expected type, then try again.","fieldErrors":[{"code":"invalid_format","missing":false,"path":"decodeTimeoutMs","expected":"","received":"","message":"Expected a decimal integer"}]}
  • Remaining proof gaps: Linux CI has not run yet. The test runs the Node codec runtime; Bun was not tried.

Boundary regressions: input admission at the CLI argument boundary, through the compiled CLI and the owned codec. Lifecycle regressions: not applicable.

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.

Not an evidence-bearing change.

Validation performed

Windows 11, Node.js 24.22.1, base bacc1e384.

Compatibility, safety, and release

  • Breaking changes or migration steps: a non-decimal spelling such as 0x1 or 2e4 is now refused. The deadline is documented in milliseconds, so this follows fix(cli): reject non-decimal byte-entropy window options #8919 without a breaking marker.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; no browser is used.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new process, file, or network effect.

Author readiness

Human owner: @Plastic-time

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

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-06T16:22:48.581182Z
We couldn’t complete this review. Comment @codex review to try again.
dbfa9d2 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Low impact] The PR appears safe to merge; no blocking issue was found.

Summary

trace-web-source-location now uses cliDecimalField to reject non-decimal decode deadlines before number conversion.

  • Source-map tracing now rejects non-decimal deadline text.

Reviews (2) · Last reviewed commit: "fix(cli): reject non-decimal source-map ..." · Reviewed by Greptile

@morluto morluto closed this Nov 7, 2026
@morluto morluto added area: cli CLI adapter and one-shot commands bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants