Repository navigation
fix(web): treat an out-of-range issue or PR number as not addressed - #686
Conversation
/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]>
|
Warning Review limit reachedYou'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. View limit details
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. |
PastaPastaPasta
left a comment
There was a problem hiding this comment.
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.
Opening
/repo/pull/?owner=…&name=…&number=-1on forge.dashhq.org says "Couldn't reach Dash Platform. Nothing answered this read." Platform is fine:-1(also0, 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
#Npages now parse the number withparseItemNumber, 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(newparseItemNumbercases);tsc --noEmitclean.🤖 Generated with Claude Code