Skip to content

fix(packages-fetch): prefer the vendor when a listed owner's shard is unavailable (#1825 item 4) - #1859

Merged
zackees merged 1 commit into
mainfrom
agent/1825-unverified-shard
Nov 2, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/1825-unverified-shard

Conversation

@zackees

@zackees zackees commented Nov 2, 2026

Copy link
Copy Markdown
Member

Closes #1825 (item 4). Follow-up to #1854, which shipped item 1.

Problem

downloaders::mirror::resolve_candidates asked the mirror manifest for an entry
and got Option: None meant 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.com first — and with no shard there is no
sha256 guarding those bytes for the object. A shard outage therefore silently
downgraded verification for every download from that owner.

Change

  • MirrorManifest::entry_lookup returns EntryLookup::{Found, NotListed, Unavailable};
    entry_for is now a thin Option wrapper over it (unchanged for its callers).
  • resolve_candidates maps the outcomes: Found → the manifest entry,
    NotListed → the previous precedence, Unavailable → resolve_unverified.
  • resolve_unverified keeps the vendor first and the built-in bucket as a last
    resort for mirrored hosts, and leaves non-mirrored hosts alone. An explicit
    FBUILD_DOWNLOAD_MIRROR_FIRST still wins, because that is the operator asking
    for the mirror order.
  • A shard that fails to load now logs
    mirror shard for <owner> is unavailable; bytes for its objects are unverified
    once per process instead of failing silently.
  • crates/fbuild-packages-fetch/README.md documents the distinction.

Tests

crates/fbuild-packages-fetch/src/downloader_mirror_manifest_tests.rs
entry_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 503 or <html> → Unavailable (and entry_for stays None).

crates/fbuild-packages-fetch/src/downloader_mirror_tests.rs
an_unavailable_owner_shard_prefers_the_vendor_over_unverified_bucket_bytes:
vendor first / bucket last with mirror_sha256 == None, non-mirrored host
unchanged, and FBUILD_DOWNLOAD_MIRROR_FIRST=1 keeps [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:

soldr cargo test -p fbuild-packages-fetch --lib -- mirror
test result: ok. 24 passed; 0 failed; ... (includes the new mirror test)

soldr cargo test -p fbuild-packages-fetch --lib -- entry_lookup
test downloader::manifest_tests::entry_lookup_tells_an_unavailable_shard_from_an_unlisted_owner ... ok
test result: ok. 1 passed; 0 failed; ...

soldr cargo test -p fbuild-packages-fetch
running 253 tests
test result: ok. 252 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out

Plus cargo fmt --all -- --check and workspace clippy (host target) — see the
checks 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)

bash test                      -> 47 suites, 4139 passed, 0 failed, rc 0
soldr cargo clippy --workspace --all-targets -- -D warnings -> rc 0
soldr cargo fmt --all -- --check -> clean
ci/check_test_layout.py        -> ok, rc 0
ci/enforce_platform_boundary.py --print-totals -> rows=44; dylint_rows=43

The targeted soldr dylint --all -- --package fbuild-packages-fetch was
attempted 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, no std::fs, no cfg!(unix) and adds no file, which is what those
lints key on.

…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.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees
zackees added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit f4afd58 Nov 2, 2026
30 checks passed
@zackees
zackees deleted the agent/1825-unverified-shard branch November 2, 2026 16:22
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

mirror manifest: decouple Pages deploy from benchmark build; automate incremental hashing

1 participant