Skip to content

findPreviewUrlFromChecks doesn't paginate check-runs, unlike its sibling functions in the same file #7779

Description

@JSONbored

Context

findPreviewUrlFromChecks (src/review/visual/preview-url.ts:212-244, check-runs fetch at 231-239) fetches only page 1 of a commit's check-runs (?per_page=100) and never follows pagination — but the exact same endpoint, in the exact same file, is walked correctly via the file's own findAcrossPages helper (lines 99-115) by both getPreviewBuildState (line 299) and findPreviewUrlFromPrComments (line 263). The file's own header comment (lines 78-84) explicitly reasons about this exact failure mode ("a commit with >100 check-runs would push the Cloudflare Workers Builds bot's ... check-run onto page 2+ and this discovery would then return null/absent as if it genuinely didn't exist") — but findPreviewUrlFromChecks is the one function that doesn't apply the fix its neighbors already have.

Called from src/review/visual/capture.ts:163 as the primary preview-URL-discovery step, before getPreviewBuildState. A repo with GitHub Actions matrix builds, multiple external CI checks, or several LoopOver-published checks alongside real CI can exceed 100 check-runs on a head SHA. When the Cloudflare Workers Builds check-run lands on page 2+, findPreviewUrlFromChecks returns null even though the check exists — while the later getPreviewBuildState call (which does paginate) correctly reports "building"/"succeeded". Result: the system knows a preview deploy succeeded but never surfaces its URL, so the PR comment shows a permanent loading spinner instead of the real preview screenshot.

Requirements

⚠️ Required pattern — reuse findAcrossPages (same file, preview-url.ts:99-115) exactly, the same way getPreviewBuildState and findPreviewUrlFromPrComments already do for this identical endpoint. Do not write a new pagination loop.

  • findPreviewUrlFromChecks's check-runs fetch must paginate through all pages via findAcrossPages, not just page 1.

Deliverables

  • findPreviewUrlFromChecks in src/review/visual/preview-url.ts paginates check-runs the same way its sibling functions in the same file already do.
  • A regression test covering a commit with >100 check-runs where the relevant check-run is on page 2, asserting the preview URL is still found.

Test Coverage Requirements

src/review/** is under the top-level 99% patch coverage gate — the new pagination branch and its test must both be covered.

Expected Outcome

findPreviewUrlFromChecks finds the preview-deploy check-run regardless of which page of check-runs it lands on, consistent with its sibling functions in the same file.

Links & Resources

  • src/review/visual/preview-url.ts:212-244 (the bug), :99-115 (findAcrossPages, the pattern to reuse), :299 and :263 (sibling functions already using it correctly for the same endpoint)
  • src/review/visual/capture.ts:163 (the caller)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions