Repository navigation
[backport] Fix quarto install tinytex failing on GitHub API rate limit - #15391
Merged
Merged
Conversation
`quarto install tinytex` looked up rstudio/tinytex-releases through api.github.com, whose unauthenticated limit is 60 requests per hour per IP, and one install made two lookups (the tool summary, then preparePackage). Behind shared egress (CI runners, Docker build farms, corporate NAT) the install failed with "Unable to determine latest release for rstudio/tinytex-releases 403 - Forbidden". Without a token, the tag now comes from the 302 that github.com/<repo>/releases/latest returns to releases/tag/<tag>, and the download URLs are built from the tag with tinyTexPkgName(), the way the yihui.org install scripts use fixed URLs. Those candidates are not checked against an asset list any more, so preparePackage moves on to the next candidate (old naming) when a download is a 404. The API stays the path when a token is set, and the fallback when the redirect carries no tag: github.com web endpoints have their own anonymous limits. Install and update now pass the release info they already looked up to preparePackage instead of fetching it again. getLatestRelease also reads GITHUB_TOKEN, the variable GitHub Actions provides, after GH_TOKEN.
An undefined token falls back to githubToken(), which reads GH_TOKEN, and the test workflow sets GH_TOKEN, so on CI these tests took the authenticated API path instead of the unauthenticated one they assert.
preparePackage tried the next candidate when a download failed with a 404, but the install context's download exits the process on any failure, so the old-name fallback could never run. The unit test hid this with a download stub that returned the 404 instead. A HEAD request on each github.com download URL now picks the first candidate that is not a 404 (github.com answers 302 for an existing asset and 404 otherwise), and only that one is downloaded. This keeps the install context and the other tools' download handling unchanged, at the cost of one extra github.com request per install. A HEAD that fails outright selects the candidate, so the download reports the real error.
The main-branch entry lives in changelog-1.12.md, which does not exist on v1.11. Backport entries go under the v1.12 backports section of changelog-1.11.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Backport of #15388 to
v1.11.When
quarto install tinytexruns behind a shared IP (GitHub Actions runners, Docker build farms, corporate NAT), it can fail withUnable to determine latest release for rstudio/tinytex-releasesand403 - Forbidden.Quarto looked up the latest TinyTeX release through the GitHub REST API, which allows 60 anonymous requests per hour per IP. Install made two of those calls and
quarto update tinytexmade three. #15388 resolves the latest tag from thegithub.comreleases redirect instead, probes the bundle download URL with a HEAD request, reuses the release across install and update, and readsGITHUB_TOKENafterGH_TOKEN. The API is still used when a token is set.The four code commits cherry-apply to
v1.11. The only conflict wastools/runtime-boundary-baseline.json, where thev1.11values are kept. The runtime boundary check passes againstupstream/v1.11with them, since the ported code uses slightly fewerDeno.*calls than that baseline allows.The changelog entry from #15388 targets
changelog-1.12.md, which does not exist on this branch. It is added as a separate commit under# v1.12 backports > ## In this releaseofchangelog-1.11.md.Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.