Repository navigation
Key the download cache by release, not by library version - #8
Merged
Merged
Conversation
clippy's manual_is_multiple_of, which -D warnings makes fatal, so the repo's own post-change check did not pass on a current toolchain. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
build.rs resolves `releases/latest`, but cached what it found under the upstream library version alone. `latest` moves and the version does not, so the first release a machine ever downloaded answered for every later build of that version, forever — and because the archives of one version differ (an option changed, a patch applied, a flag corrected), the symptom was a feature quietly missing rather than a failure. The cache is now one directory per release tag, and which release `latest` is gets asked before it is read: the `/releases/latest` redirect names the tag in its Location header, so it is one HEAD with no body and no `api.github.com` rate limit to parse JSON through. Both the archive and its SHA256SUMS are then fetched from that tag rather than resolving `latest` twice. Where the question cannot be asked — CARGO_NET_OFFLINE, or a network that does not answer — the newest cached release for the version is used and the provenance line says it was not revalidated; the stamp in a tag is a fixed-width UTC timestamp, so lexicographic max is the newest. A `latest` whose version is not the one the checkout builds against is now an error naming both, instead of a 404 on a URL nobody typed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
build.rsresolvesreleases/latest, but cached what it found under the upstream libraryversion alone.
latestmoves and the version does not, so the first release a machine everdownloaded answered for every later build of that version, forever — and because the archives
of one version differ, the symptom was a feature quietly missing rather than a failure.
It cost a day in the consuming project: a FreeRDP archive cached before
rdpeiwas built inkept the touch channel out of every local build for a month, while CI, which has no such cache,
was correct throughout. All four prebuilt repositories had the same keying, so all four get the
same fix.
What changes
$CARGO_HOME/<repo>/<tag>/<target>/.latestis gets asked before the cache is read./releases/latestnames thetag in its
Locationheader, so it is one HEAD with no body — noapi.github.com, no 60/hourunauthenticated ceiling, and no JSON to parse in a build script whose selling point is that it
compiles no dependencies.
SHA256SUMSnow both come from that tag, which also closes thepre-existing race of resolving
latesttwice.CARGO_NET_OFFLINE, or a network that does not answer) → the newest cachedrelease for the version, provenance labelled
not revalidated, and a warning when it was nota deliberate offline build. Tag stamps are fixed-width UTC, so lexicographic max is newest.
latestwhose version is not the one the checkout builds against is an error naming both,instead of a 404 on a URL nobody typed.
FDK_AAC_PREBUILT_DIR-style overrides andprebuilt/<target>/still short-circuit ahead of allof this, so the local build loop makes no network request at all.
Tested
Each scenario run against the real releases, on
aarch64-apple-darwin:not revalidatedcargo clippy --all-targets -- -D warningsandcargo testpass.🤖 Generated with Claude Code