Skip to content

fix(github,forgejo): paginate past an all-prerelease first page of releases#10420

Merged
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:fix-github-prerelease-pagination
Jun 14, 2026
Merged

fix(github,forgejo): paginate past an all-prerelease first page of releases#10420
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:fix-github-prerelease-pagination

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

What

mise use github:owner/repo (and the forgejo: / gitlab: backends) could fail with no versions found for <pkg> matching date filter when a repo's most recent releases are all prereleases (e.g. auto-generated nightly/alpha builds), because:

  • With MISE_LIST_ALL_VERSIONS unset (the default), the forge release listers fetch only the first API page at the server default size (30 for GitHub/Forgejo, 20 for GitLab).
  • The read path filters out prereleases/drafts by default, so an all-prerelease first page leaves zero candidates.

Reported in #10343 (repro: refactoringhq/tolaria).

Fix

  • Request larger pages: per_page=100 (GitHub/GitLab) and limit=100 (Forgejo) on the release/tag listers.
  • For GitHub and Forgejo, keep paginating — bounded to 3 pages (≈300 releases) — while every release seen so far is a prerelease/draft, so an older stable release is still discovered. Behavior with MISE_LIST_ALL_VERSIONS=1 (fetch all pages) is unchanged.
  • GitLab gets only the page-size bump, since GitlabRelease carries no prerelease/draft flag.

Tests

  • New mockito unit tests in src/github.rs (3) and src/forgejo.rs (1): the page-size param is sent; an all-prerelease first page with a Link: next triggers a bounded fallback that surfaces a stable release; a stable release on page 1 stops pagination; the fallback caps at 3 pages.
  • Updated e2e/cli/test_error_display to match the /releases error URL without the query string, so the assertion doesn't depend on pagination parameters.

Addresses discussion #10343.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved release and tag pagination for GitHub, GitLab, and Forgejo, including bounded fallback behavior to ensure stable releases are found even when early pages contain only drafts or prereleases.
    • Increased items per page for release/tag listing to reduce pagination churn.
  • Tests
    • Added async tests covering GitHub pre-release fallback pagination (including stop conditions and page caps).
    • Improved end-to-end CLI error assertions to be resilient to GitHub releases pagination details.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: de8f8d2c-aac7-4b06-9249-64813e273449

📥 Commits

Reviewing files that changed from the base of the PR and between 7f059a0 and 2ddde7c.

📒 Files selected for processing (4)
  • e2e/cli/test_error_display
  • src/forgejo.rs
  • src/github.rs
  • src/gitlab.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • e2e/cli/test_error_display
  • src/gitlab.rs
  • src/forgejo.rs
  • src/github.rs

📝 Walkthrough

Walkthrough

Adds bounded fallback pagination (MAX_RELEASE_FALLBACK_PAGES) to GitHub and Forgejo list_releases_ so stable releases are found even when initial pages contain only prereleases or drafts. Sets per_page=100 across GitHub tag endpoints and GitLab release/tag endpoints. Extends mock-based tests and fixes e2e URL-matching assertions.

Changes

Release pagination improvements

Layer / File(s) Summary
GitHub release and tag pagination
src/github.rs
Adds MAX_RELEASE_FALLBACK_PAGES constant and rewrites list_releases_ to request per_page=100 and follow Link: rel=next only until a stable release is found or the fallback cap is hit; sets per_page=100 on list_tags_ and list_tags_with_dates_.
Forgejo release pagination
src/forgejo.rs
Adds MAX_RELEASE_FALLBACK_PAGES and rewrites list_releases_ to request releases?limit=100, then conditionally follow next pages until a stable release appears or the cap is reached; full pagination when MISE_LIST_ALL_VERSIONS is set.
GitLab per_page=100 for releases and tags
src/gitlab.rs
Adds ?per_page=100 to the releases and tags API URL construction in list_releases_ and list_tags_; no control-flow changes.
Mock tests and e2e assertion fixes
src/github.rs, src/forgejo.rs, e2e/cli/test_error_display
New mockito async tests cover GitHub fallback-to-page-2, stop-on-stable, and page-cap scenarios; tokio test covers Forgejo Link header follow; e2e assertions updated to match /releases URL without query-string parameters.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 Hop past the prereleases, one page, then two,
The stable release hides where the bunnies grew.
With a cap of fallback pages, we won't chase all day,
per_page=100 speeds the carrot away.
Tests confirm the logic, assertions now align—
This rabbit's pagination is perfectly fine! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(github,forgejo): paginate past an all-prerelease first page of releases' directly and specifically summarizes the main change: enabling pagination past prerelease-only first pages in GitHub and Forgejo release listing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes the "no versions found" error that occurred when a repo's most recent releases are entirely prereleases/drafts, by bumping the initial page size to 100 and adding bounded fallback pagination (capped at 3 total pages) for GitHub and Forgejo.

  • src/github.rs / src/forgejo.rs: list_releases_ now requests per_page=100 / limit=100 and keeps fetching additional pages (up to MAX_RELEASE_FALLBACK_PAGES = 3 total) until at least one stable, non-draft release is seen — falling back to this only when MISE_LIST_ALL_VERSIONS is not set. Three unit tests per backend cover the regression case, the early-stop on page 1 stable, and the page cap.
  • src/gitlab.rs: Receives only the page-size bump (no prerelease fallback) because GitlabRelease carries no prerelease/draft flag.
  • e2e/cli/test_error_display: Two assertions trimmed to match the URL path up to /releases (without the closing )) so they remain valid regardless of query-string pagination parameters.

Confidence Score: 5/5

Safe to merge — the change is additive (larger initial page, bounded extra fetches), leaves the MISE_LIST_ALL_VERSIONS=1 path untouched, and is covered by six new unit tests plus the updated e2e assertion.

The pagination cap logic is correct: pages_fetched starts at 1 (counting the already-fetched initial page), the break fires when pages_fetched >= 3, and the increment happens after each successful fetch — so at most 3 pages total are ever requested in fallback mode. GitHub and Forgejo share identical logic and each has three targeted tests. GitLab's omission of the fallback is intentional and documented. No existing behavior is regressed.

No files require special attention.

Important Files Changed

Filename Overview
src/github.rs Adds per_page=100 to releases/tags URLs, bounded prerelease fallback pagination in list_releases_ (MAX_RELEASE_FALLBACK_PAGES=3), and three new unit tests covering the regression, early-stop, and cap scenarios.
src/forgejo.rs Mirrors the github.rs changes: limit=100 query param, same bounded prerelease fallback loop, and three equivalent unit tests — addressing the gap noted in the previous review thread.
src/gitlab.rs Only receives the per_page=100 bump; no prerelease fallback is added because GitlabRelease carries no prerelease/draft flag, which is acknowledged in the PR description.
e2e/cli/test_error_display Drops the closing ) from the GitHub releases URL in two assertions so the substring match works correctly when ?per_page=100 is appended to the URL.

Reviews (2): Last reviewed commit: "fix(github,forgejo): paginate past an al..." | Re-trigger Greptile

Comment thread src/github.rs Outdated
Comment thread src/forgejo.rs
…leases

When MISE_LIST_ALL_VERSIONS is unset (the default), the forge release listers
fetched only the first API page at the server default size (30 for GitHub/Forgejo,
20 for GitLab), and the read path drops prereleases/drafts. A repo whose most
recent releases are all prereleases (e.g. nightly builds) was then left with zero
candidates and failed with "no versions found for <pkg> matching date filter".

Request larger pages (per_page=100 / limit=100), and for GitHub and Forgejo keep
paginating -- bounded to 3 pages -- while every release seen so far is a
prerelease/draft, so an older stable release is still discovered. GitLab gets only
the page-size bump since its release objects carry no prerelease/draft flag.

Update e2e/cli/test_error_display to match the /releases error URL without the
query string so the assertion does not depend on pagination parameters.

Addresses discussion jdx#10343.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JamBalaya56562 JamBalaya56562 force-pushed the fix-github-prerelease-pagination branch from 7f059a0 to 2ddde7c Compare June 14, 2026 01:35
@jdx jdx enabled auto-merge (squash) June 14, 2026 01:44
@jdx jdx merged commit b28866a into jdx:main Jun 14, 2026
33 checks passed
@JamBalaya56562 JamBalaya56562 deleted the fix-github-prerelease-pagination branch June 14, 2026 01:48
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.

2 participants