fix(review): paginate check-runs in findPreviewUrlFromChecks - #7881
Conversation
findPreviewUrlFromChecks fetched only page 1 of a head SHA's check-runs (?per_page=100) and never followed pagination, while its two siblings in the same file -- getPreviewBuildState and findPreviewUrlFromPrComments -- already walk this identical endpoint via findAcrossPages. The file's own header comment reasons about exactly this failure: a commit with >100 check-runs pushes the Cloudflare Workers Builds check-run onto page 2+, and a page-1-only read then returns null as if the preview didn't exist -- so the PR comment shows a permanent loading spinner even though the deploy succeeded. Route the check-runs fetch through findAcrossPages, reusing the exact pattern getPreviewBuildState already applies to this endpoint (no new pagination loop); the per-run preview-URL scan moves into the page probe unchanged. Adds regression tests: a preview check-run on page 2 is still found (asserting the walk reaches page 2), a page-1 hit takes no extra request, a failed check-run is skipped, and an all-next-Link/no-check_runs response terminates bounded at null. Closes JSONbored#7779
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7881 +/- ##
==========================================
- Coverage 91.40% 88.77% -2.63%
==========================================
Files 730 89 -641
Lines 74763 21353 -53410
Branches 22815 3722 -19093
==========================================
- Hits 68335 18957 -49378
+ Misses 5385 2213 -3172
+ Partials 1043 183 -860
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-21 16:05:47 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Problem
findPreviewUrlFromChecks(src/review/visual/preview-url.ts) fetched only page 1 of a head SHA's check-runs (?per_page=100) and never followed pagination — while its two siblings in the same file,getPreviewBuildStateandfindPreviewUrlFromPrComments, already walk this identical endpoint viafindAcrossPages. The file's own header comment reasons about exactly this: a commit with >100 check-runs pushes the Cloudflare Workers Builds check-run onto page 2+, and a page-1-only read then returnsnullas if the preview didn't exist — so the PR comment shows a permanent loading spinner even though the deploy succeeded (getPreviewBuildState, which paginates, reportssucceeded).Fix
Route the check-runs fetch through
findAcrossPages, reusing the exact patterngetPreviewBuildStatealready applies to this endpoint — no new pagination loop. The per-run preview-URL scan moves into the page probe unchanged.Tests (
preview-url.test.tshad nofindPreviewUrlFromCheckscoverage before)Link: next/ no-check_runsresponse terminates bounded atnullChanged lines are 100% covered (statements + branches); root
typecheckclean;src/review/**diff only (2 files).Closes #7779