Repository navigation
fix(packages-fetch): prefer the vendor when a listed owner's shard is unavailable (#1825 item 4) - #1859
Merged
Conversation
…ailable
`resolve_candidates` read the mirror manifest through `entry_for`, an
`Option`, so "the index lists this owner but its shard could not be fetched"
was indistinguishable from "the index has no entry". The first case then took
the ordinary built-in-bucket path and tried unverified bucket bytes for the
object before the vendor, silently dropping the manifest's sha256 guard for
that download.
`entry_lookup` now returns `EntryLookup::{Found, NotListed, Unavailable}` and the
download path maps them: a found entry is used as before, an unlisted URL keeps
the documented precedence, and an unavailable shard resolves vendor-first with
the built-in bucket as a last resort (an explicit
`FBUILD_DOWNLOAD_MIRROR_FIRST` still wins). A shard that fails to load warns
once instead of failing silently.
Closes #1825 item 4.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
Closes #1825 (item 4). Follow-up to #1854, which shipped item 1.
Problem
downloaders::mirror::resolve_candidatesasked the mirror manifest for an entryand got
Option:Nonemeant both "the index has no entry for this URL" and"the index lists this owner, but its shard could not be fetched". The second
case then took the ordinary built-in-bucket path, i.e. fbuild tried
fbuild.sfo3.digitaloceanspaces.comfirst — and with no shard there is nosha256guarding those bytes for the object. A shard outage therefore silentlydowngraded verification for every download from that owner.
Change
MirrorManifest::entry_lookupreturnsEntryLookup::{Found, NotListed, Unavailable};entry_foris now a thinOptionwrapper over it (unchanged for its callers).resolve_candidatesmaps the outcomes:Found→ the manifest entry,NotListed→ the previous precedence,Unavailable→resolve_unverified.resolve_unverifiedkeeps the vendor first and the built-in bucket as a lastresort for mirrored hosts, and leaves non-mirrored hosts alone. An explicit
FBUILD_DOWNLOAD_MIRROR_FIRSTstill wins, because that is the operator askingfor the mirror order.
mirror shard for <owner> is unavailable; bytes for its objects are unverifiedonce per process instead of failing silently.
crates/fbuild-packages-fetch/README.mddocuments the distinction.Tests
crates/fbuild-packages-fetch/src/downloader_mirror_manifest_tests.rsentry_lookup_tells_an_unavailable_shard_from_an_unlisted_owner: index + shard→
Found; URL absent from a loaded shard, unlisted owner, no owner →NotListed;shard served as
503or<html>→Unavailable(andentry_forstaysNone).crates/fbuild-packages-fetch/src/downloader_mirror_tests.rsan_unavailable_owner_shard_prefers_the_vendor_over_unverified_bucket_bytes:vendor first / bucket last with
mirror_sha256 == None, non-mirrored hostunchanged, and
FBUILD_DOWNLOAD_MIRROR_FIRST=1keeps[1, 0].Both were written first and failed to compile against the old API (RED:
E0599 entry_lookup not found,E0432 unresolved imports).Real output:
Plus
cargo fmt --all -- --checkand workspace clippy (host target) — see thechecks on this PR.
Not in scope
Item 2 of #1825 (a scheduled hashing workflow with bucket read credentials) is
maintainer-only and stays open. Nothing here changes the published manifest
schema or the precedence documented for operator mirrors.
Gate output (local, this host)
The targeted
soldr dylint --all -- --package fbuild-packages-fetchwasattempted but its cold dylint-driver build ran past a 25-minute box on this
host, so the PR's Dylint jobs are the first real run — the change touches no
PathBuf, nostd::fs, nocfg!(unix)and adds no file, which is what thoselints key on.