Skip to content

paginate every listing read in the tracker #308

Closed

Description

@davison

Goal

Comments, SubIssues, listIssues and every other first-page read in internal/tracker page through the whole listing, so a milestone issue past a hundred comments keeps its newest QA verdicts and milestone close cannot report VERDICT_MISSING for a verdict on page two; each paginated reader is tested against a synthetic listing longer than one page. Adopts #264.

Requirements

M15-R3

Adopts

Plan

The change. internal/tracker/github.go — the four unpaginated listing reads get gh api --paginate, which merges a REST array endpoint's pages into one JSON array (checked against this repo's own labels and pulls endpoints on gh 2.100), so gh.JSON unmarshals the whole listing exactly as it already does for Labels:

  • Comments — GitHub's oldest-first order is preserved across pages, so milestone close and status see the newest verdicts and latest-wins is computed over the whole issue;
  • SubIssues — a milestone past a hundred tasks lists all of them;
  • listIssues — behind MilestoneIssues/listMilestones; it grows a paginate flag because RecentIssues shares it;
  • OpenPRsForBranch — the stale sweep's keep-a-branch-under-an-open-PR check.

Two deliberate exceptions, each stated in a code comment and in the PR. RecentIssues reads the newest page by design (the floor fallback, #195) — walking a repo's whole history to build a floor buys nothing. TaskBranches reports hasNextPage and its callers already say "swept in part" (SPEC §6); #310 builds on that flag this milestone.

Out of scope, recorded as a Decision. The GraphQL first: N connections (ClosingPRs, LinkedBranches, Task's assignees/labels/closing refs) are per-issue relations bounded far under their limits, not listings.

Tests. A gh fake that pages the way the real one does — the whole listing only when the call carried --paginate, the first hundred otherwise — so a reader that drops the flag fails rather than passing on a short fixture. A 101-comment fixture for Comments asserting every comment arrives, in order, with the newest present and last; two-page fixtures for SubIssues, listIssues (through MilestoneIssues) and OpenPRsForBranch; and RecentIssues asserted to stay unpaginated.

SPEC. No change: git grep -n "hundred\|per_page\|first page\|one page" finds no sentence implying a hundred-comment ceiling, and the only partial-listing language in §6 is TaskBranches's "swept in part", which stays true. Pagination is an implementation correction, not a protocol change.

Requirements covered. M15-R3 (adopts #264).

Ask-the-human points

None. Which mechanism each reader uses — --paginate or a GraphQL cursor — is an ordinary engineering call and is recorded as a Decision.

Activity

  1. added
    cc:task
    on Sep 6, 2026
  2. radiusred-cody commented on Sep 6, 2026

    @radiusred-cody
    Contributor

    Started by @radiusred-cody[bot].

  3. radiusred-cody commented on Sep 7, 2026

    @radiusred-cody
    Contributor

    Decision: all four readers page with gh api --paginate rather than a GraphQL cursor.
    Trade-off: --paginate costs one flag per call and no new code — gh follows the Link header and joins a REST array endpoint's pages into a single JSON array, in request order, so gh.JSON unmarshals the whole listing exactly as it already does for Labels, and Comments stays oldest-first across the boundary. I checked the join against this repo's own labels and pulls endpoints on gh 2.100 before relying on it, including the -X GET -f … form OpenPRsForBranch uses. The cost is that the call is unbounded: a pathological listing is now several requests instead of one truncated read, which is the correct trade for a gate that must not miss a verdict.
    Rejected: hand-rolled cursor loops in Go (a page= walk, or moving these reads to GraphQL after:). Each would add paging state and an end condition per reader, in a package whose founding decision is that gh owns the transport (docs/founding-decisions.md); the one listing already paginated in this file set the precedent, and matching it keeps four readers on one mechanism.

  4. radiusred-cody commented on Sep 7, 2026

    @radiusred-cody
    Contributor

    Decision: the GraphQL first: N connections in the tracker are left as they are, and are not counted as first-page listing reads under M15-R3.
    Trade-off: ClosingPRs (first: 20), LinkedBranches (first: 20) and Task's nested assignees(first: 10) / labels(first: 20) / closedByPullRequestsReferences(first: 10) are per-issue relations, not repository listings: an issue with twenty-one closing PRs or eleven assignees is not a shape the protocol produces, and every one of them is read for a yes/no (is a PR open, which branch is linked) rather than for a set that must be complete. Paginating them would add cursor loops with no reachable failure to prevent. The listing reads that #264 actually observed truncating — comments, sub-issues, the issue listing, the pulls listing — all walk to the end now.
    Rejected: cursor-walking them anyway "for symmetry". If one of these ever needs it the change is local and testable; adding it now would be untested paging code on paths no fixture can drive honestly.

  5. radiusred-cody commented on Sep 7, 2026

    @radiusred-cody
    Contributor

    Decision: the tracker's gh fake grew a third stand-in, pagingGH, which models the real gh's paging rather than returning a fixed body.
    Why it was needed: neither existing seam could express pagination — fakeGH re-enters the test binary with a hard-coded answer per endpoint, and recordGH prints one fixed stdout whatever the arguments. A fixture of 101 comments served unconditionally would pass with or without --paginate, proving nothing. pagingGH serves the whole listing only when the call carried --paginate and truncates to the first hundred otherwise, exactly as GitHub's first page does — so each new test fails when the flag is dropped. I verified that: removing --paginate from all four readers fails all four tests with "returned 100 of …", and restoring it passes.
    Trade-off: a third fake in one test file. It is nine lines and it is the only one that asserts a call's paging behaviour rather than its shape; folding it into recordGH would have made that helper argument-sensitive for every existing caller.
    Deviation from nothing else: fakeGH's /pulls matcher now finds the path anywhere in the argument list instead of at args[1], because --paginate now sits ahead of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cc:task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions