Skip to content

feat(prebuilt): descriptor-verifying Catalog Index/shard reader (#1882) - #2171

Merged
zackees merged 1 commit into
mainfrom
agent/1882-catalog
Nov 24, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/1882-catalog

Conversation

@zackees

@zackees zackees commented Nov 24, 2026

Copy link
Copy Markdown
Member

Unit 6 of #1882 — the descriptor-verifying Catalog reader. #1882 stays open (remaining cells: the fetch ladder, archive extraction/GC, the BuildRequest field, the bucket key and the publish 8c ruling).

Why a separate reader

crates/fbuild-packages-fetch/src/downloader_mirror_manifest.rs cannot serve this slice, and changing it would alter the live mirror path:

gap consequence for a prebuilt Catalog
parse accepts only Release / Index a Catalog shard is rejected outright
descriptors are #[cfg(test)]-visible only no consumer can pin a shard
stale-cache fallback is parse_shard(&bytes).ok() a cached shard is used without re-checking it against the current Index descriptor

The new prebuilt module 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

  1. Query is an exact identity — framework, arch, abi, version, 64-hex fingerprint. A channel name, a version range or a fingerprint prefix never authorizes a hit.
  2. The Index descriptor pins the shard's exact size_bytes and SHA-256; both are checked on every read — fresh cache, network fetch, and the stale cache used when no source answers.
  3. The release must match the exact tool + version, a min_client_version this client satisfies, a none/<arch>/<abi> platform, the fp-<first 16 hex> flavor, a fbuild-fp:<fingerprint> provides entry, a 64-hex asset SHA, parts.is_empty() and a non-empty allowed (https / loopback-http) URL list.

Anything else is Resolution::Miss and the caller builds from source.

Tests (real output)

cd crates/fbuild-wt-1882-catalog && soldr cargo test -p fbuild-packages-fetch prebuilt

running 6 tests
test prebuilt::tests::explicit_operator_overrides_and_mirror_order ... ok
test prebuilt::tests::identity_helpers_reject_short_upper_and_empty_values ... ok
test prebuilt::tests::no_index_is_a_miss ... ok
test prebuilt::tests::a_catalog_that_does_not_claim_the_exact_fingerprint_is_a_miss ... ok
test prebuilt::tests::exact_match_offline_and_descriptor_integrity ... ok
test prebuilt::tests::shard_sha_and_exact_size_are_checked_on_network_and_last_good_reads ... ok

test result: ok. 6 passed; 0 failed

Tests 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-totals rc 0; ci.test_enforce_platform_boundary 14 tests OK; ci/platform_boundary_research.py --check rc 0.

RED proven twice by mutation

  • Deleting b.len() as u64 == descriptor.size_bytes from the shard-load validator -> shard_sha_and_exact_size_are_checked_on_network_and_last_good_reads FAILED (5 passed, 1 failed).
  • Deleting the 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 BuildRequest field, the bucket key (core <product> naming is unruled) and the publish decision 8c — all still open on #1882.

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

coderabbitai Bot commented Nov 24, 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

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "enabled" at "reviews.pre_merge_checks"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
  • 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 24, 2026
Merged via the queue into main with commit ad30da5 Nov 24, 2026
34 checks passed
@zackees
zackees deleted the agent/1882-catalog branch November 24, 2026 21:35
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 25, 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.

1 participant