Repository navigation
feat(prebuilt): descriptor-verifying Catalog Index/shard reader (#1882) - #2171
Merged
Merged
Conversation
The mirror reader in `downloader::mirror_manifest` cannot serve this slice:
it rejects the `Catalog` kind, keeps its shard descriptors private to tests,
and its stale-shard fallback parses cached bytes without re-checking them
against the current Index descriptor. This adds the independent reader the
design doc lists as reusable from the closed pilot (`prebuilt/reader.rs`),
ported against the current tree instead of the pilot's module tree.
- `Query` is an exact identity: framework, arch, abi, version and a 64-hex
fingerprint. A channel, a version range or a fingerprint prefix never
authorizes a hit.
- The Index descriptor pins the shard's exact `size_bytes` AND SHA-256, and
both are checked on every read: fresh cache, network fetch, and the stale
cache used when no source answers.
- A release must match tool, version, `min_client_version`, a
`none`/`<arch>`/`<abi>` platform, the `fp-<first 16 hex>` flavor, a
`fbuild-fp:<fingerprint>` `provides` entry, a 64-hex asset SHA and a
non-empty allowed URL list with no multi-part assets. Anything else is a
`Miss` and the caller builds from source.
- `Reader` is TTL-cached (24 h) per source list, writes shard bytes through a
tempfile rename, and never trusts a cache entry it has not verified.
- `operator_urls` keeps the explicit-mirror override contract: opt-in mirrors
first, an empty override disables published URLs, `{path}`/`{filename}`
placeholders substituted.
|
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.
Unit 6 of #1882 — the descriptor-verifying Catalog reader. #1882 stays open (remaining cells: the fetch ladder, archive extraction/GC, the
BuildRequestfield, the bucket key and the publish 8c ruling).Why a separate reader
crates/fbuild-packages-fetch/src/downloader_mirror_manifest.rscannot serve this slice, and changing it would alter the live mirror path:parseaccepts onlyRelease/IndexCatalogshard is rejected outright#[cfg(test)]-visible onlyparse_shard(&bytes).ok()The new
prebuiltmodule is self-contained and leaves that reader untouched, as the design doc requires (docs/design/artifact-serving-decisions.md, "reusable from the pilot … the descriptor-verifying Catalog reader").What decides a hit
Queryis an exact identity —framework,arch,abi,version, 64-hex fingerprint. A channel name, a version range or a fingerprint prefix never authorizes a hit.size_bytesand SHA-256; both are checked on every read — fresh cache, network fetch, and the stale cache used when no source answers.min_client_versionthis client satisfies, anone/<arch>/<abi>platform, thefp-<first 16 hex>flavor, afbuild-fp:<fingerprint>providesentry, a 64-hex asset SHA,parts.is_empty()and a non-empty allowed (https / loopback-http) URL list.Anything else is
Resolution::Missand the caller builds from source.Tests (real output)
cd crates/fbuild-wt-1882-catalog && soldr cargo test -p fbuild-packages-fetch prebuiltTests run against real local axum fixtures (no network, no bucket).
Full crate:
soldr cargo test -p fbuild-packages-fetch --lib->323 passed; 0 failed; 2 ignored.clippy -p fbuild-packages-fetch --all-targets -- -D warnings-> exit 0;cargo fmt --all --check-> exit 0.ci/enforce_platform_boundary.py --print-totalsrc 0;ci.test_enforce_platform_boundary14 tests OK;ci/platform_boundary_research.py --checkrc 0.RED proven twice by mutation
b.len() as u64 == descriptor.size_bytesfrom the shard-load validator ->shard_sha_and_exact_size_are_checked_on_network_and_last_good_readsFAILED (5 passed, 1 failed).provides.contains("fbuild-fp:<fp>")guard -> 2 tests FAILED (4 passed, 2 failed).Both restored; 6/6 green.
Not in this PR
The fetch ladder (daemon single-flight, Range/If-Range resume, staging GC, LRU), archive extraction, the
BuildRequestfield, the bucket key (core <product>naming is unruled) and the publish decision 8c — all still open on #1882.