Repository navigation
feat(prebuilt): the identity -> tree call site (#1882) - #2192
Merged
Merged
Conversation
`extract` had no caller: nothing decided where a prebuilt tree lives, or what
to do when that place is already occupied. Add `prebuilt::obtain` as the one
opt-in call site, and give the marker check the shape that decision needs.
- `tree_root` derives the destination from the exact identity alone:
`{cache}/prebuilt/<framework>/<version>/<arch>/fp-<sha16>` -- the same key the
bucket uses (asserted against `operator_urls`). Each component must be one
ordinary path component, so a catalog value cannot steer the write.
- `obtain` reuses a marked tree with zero network traffic, refuses a marker
from a different archive untouched (eviction is the LRU's), and otherwise
fetches then extracts at that path.
- Extraction now reports the marker through `existing_tree`/`Existing`, so the
policy lives at the call site and `completed()` keeps its exact behaviour.
- Fix: the marker recorded only the archive's size, so a reused tree reported
the compressed size where a fresh extraction reported decompressed bytes.
`TreeMarker.extracted_bytes` makes both agree; `extract_tests` asserts it.
No build path calls `obtain` yet, and nothing is wired to a request.
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.
What
Unit 11 of #1882: the call site that turns an exact identity into one reusable
tree. Until now the pieces were disconnected —
Readerresolved,Fetcherverified,
extractunpacked — but nothing decided where a tree lives or what todo when that place was already occupied, so
extracthad no caller at all.tree_root(cache, query){cache}/prebuilt/<framework>/<version>/<arch>/fp-<sha16>— the same key the bucket uses, asserted equal to the pathoperator_urlsbuilds/,\,:, NUL,.,.., empty) and the fingerprint 64 lowercase hex — a catalog value can never steer the writeobtain(cache, query, asset, fetcher)extract::existing_tree+Existing::{None,Same,Different};completed()is now a thin caller of it and keeps its exact behaviour (the existing occupied/reuse tests still pass)sweep_staging_treevisits — a test proves the sweep reaps that sibling under the real layoutBug fixed on the way: the marker recorded only the archive size, so a reused
tree reported the compressed size (92 B) where a fresh extraction reported
decompressed bytes (7 B).
TreeMarker.extracted_bytesmakes the two agree; thereuse test asserts
tree == freshandtree.bytes == content length.Opt-in: no build path calls
obtain, and nothing is wired to a request or flag —the per-request opt-in/kill-switch, the source-fallback retry, the LRU and the
benchmark hook remain open cells. #1882 stays open.
Verification (real output)
soldr cargo test -p fbuild-packages-fetch --lib prebuilt::→ 54 passed; 0 failed(6 new
obtaintests: bucket-key agreement, path-component refusal, reuse withno request, identity conflict refused untouched with 0 requests, unparseable
marker, sweep covers the layout).
soldr cargo test -p fbuild-packages-fetch --lib→ 376 passed; 0 failed; 2 ignored.soldr cargo clippy -p fbuild-packages-fetch --all-targets -- -D warnings→ clean.soldr cargo fmt --check -p fbuild-packages-fetch→ clean.uv run --no-project python ci/enforce_platform_boundary.py --print-totals→rows=0; dylint_rows=0.obtain.rs132 LOC,obtain_tests.rs254 LOC (limit 1000).Not done
No workflow file, no new crate, no daemon request path, no tuning of the pool's
daemon route. Nothing in Zach's live tree was touched.