Skip to content

fix(web): treat an out-of-range issue or PR number as not addressed - #686

Merged
PastaPastaPasta merged 1 commit into
masterfrom
fix/item-number-range
Nov 24, 2026
Merged

PastaPastaPasta merged 1 commit into
masterfrom
fix/item-number-range

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Opening /repo/pull/?owner=…&name=…&number=-1 on forge.dashhq.org says "Couldn't reach Dash Platform. Nothing answered this read." Platform is fine: -1 (also 0, or anything above u32) is not a number the contracts accept ($defs.num: 1..4294967295), so the read is refused and the page reports it as a network failure. Found in tonight's mainnet-readiness QA (lane web-A, error states).

The issue, PR and #N pages now parse the number with parseItemNumber, which returns NaN outside that range. They then show their existing "No issue/PR addressed" state and make no read.

Test: pnpm exec vitest run hooks/use-query-param.test.ts (new parseItemNumber cases); tsc --noEmit clean.

🤖 Generated with Claude Code

/repo/pull/?number=-1 (also 0, or a number above u32) sent the number to
Platform, which refused it, and the page then said "Couldn't reach Dash
Platform". Numbers outside the contracts' 1..4294967295 range now show
the "No issue/PR addressed" state without a read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d50e1f6e-66a7-4396-a461-10ceb8249abd
Commits

Reviewing files that changed from the base of the PR and between cf8693e and c2f4471.

Files selected for processing: 5

  • forge-web/app/repo/issue/client.tsx
  • forge-web/app/repo/number/client.tsx
  • forge-web/app/repo/pull/client.tsx
  • forge-web/hooks/use-query-param.test.ts
  • forge-web/hooks/use-query-param.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: approve

The fix is correct and its scope is right. parseItemNumber (forge-web/hooks/use-query-param.ts:28) returns NaN for anything outside 1..4294967295, which is $defs.num in forge-collab. IssueContent, PullContent and NumberContent all gate their reads on Number.isFinite(number) / valid, so 0, -1, -0 and 4294967296 now render "No … addressed" without reading anything.

Callers. Only app/repo/{issue,pull,number}/client.tsx use the helper, and none of them needs 0 or values above u32. Board keys (?b=, board/settings/client.tsx:9, boards/board-page.tsx:132), comment indices and paging don't go through it, and the PR doesn't touch them.

Edge cases. These all come from Number.parseInt and behave exactly as before the PR, so nothing regresses: " 5", "05", "+5" and "5.0" give 5, and "1e3" and "5abc" give 1 and 5. "1e3" opening #1 is a little surprising, but it is always an in-range read, never a Platform error. Not blocking. If you want strict parsing, use /^[1-9]\d*$/ before Number(...).

Test. forge-web/hooks/use-query-param.test.ts:35 covers the refusal: '', abc, 0, -1, -0, 4294967296, and 1e20, the case where parseInt returns an integer beyond u32. :29-31 pin both bounds. There's no assertion for the lenient forms above. Fine as is.

Non-blocking follow-up, same bug class. ?upstream= is still parsed with a bare Number.parseInt (app/repo/issue/client.tsx:12, app/repo/pull/client.tsx:12). resolveUpstreamNumber (lib/view/upstream.ts:48) rejects values ≤ 0 but not values above 4294967295. upstreamNumber also has maximum: 4294967295 in the schema, so ?upstream=4294967296 still queries Platform and, by this PR's own premise, ends in "Couldn't look it up here. Try again later." The fix is one line: parseItemNumber(useParam('upstream')), or an upper bound in resolveUpstreamNumber.

CI: when I reviewed, web (the vitest job) was still pending. Every check that had finished was green.


🤖 Posted autonomously by Claude (claude-opus-5-5) on behalf of pasta.

@PastaPastaPasta
PastaPastaPasta merged commit a5e22eb into master Nov 24, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant