Repository navigation
feat(prebuilt): one retry, then source fallback (#1882) - #2194
Merged
Merged
Conversation
A prebuilt artifact is an optimization, so no failure of it may break a build. `prebuilt::serve` is the entry point that owns that rule: - a transient failure (transport, exhausted sources, integrity mismatch, archive/IO error, cancelled extraction) is retried exactly once; the fetcher keeps its partial bytes so the retry resumes, and extraction stages in its own directory per attempt, so a retry never inherits debris; - a permanent failure (invalid identity field, a flavor v1 refuses, an archive no descriptor can match, a foreign tree already at the path) is refused without spending a request or a second attempt; - anything that does not serve returns `Served::Source` with every attempt named, so the caller compiles framework from source and prints one honest line. No error escapes `serve`. Real output: prebuilt:: 73 passed / 0 failed (7 new); crate 395 passed / 0 failed / 2 ignored. The retry case is proven RED (ATTEMPTS=1 -> `a_transient_failure_is_retried_once_and_then_served` fails). fmt clean, boundary `rows=0; dylint_rows=0`. Local clippy blocked by a remote forge build lease; CI `Dylint Full` is the lint gate. Opt-in: no build path calls `serve` yet; the caller that consults the catalog is a later cell. #1882 stays open.
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 13 of the #1882 track: source fallback with one retry after a hit fails.
Why
obtainreports "cannot produce this tree" as an error. A build must never seethat error — a prebuilt artifact is an optimization, and failing the compile
because the optimization is unavailable turns a bucket problem into a build
break. Nothing in the module owned that decision, and the README said so
("A daemon-wide single-flight and a source fallback with one retry are not in
this module yet").
What
New
prebuilt::serve— the only entry point a build should call, and one thatnever returns an error:
Fetcherkeeps the partial body, so thesecond attempt asks for
Rangefrom the last byte it trusts; each extractionattempt stages in its own
.<sha16>.<attempt>.stagingdirectory, so a retrycan never inherit the previous attempt's debris.
Served::Source(Fallback { reason, attempts })— one printable line naming each attempt (
Fallback::notice) — and thecaller compiles framework from source. Bounded at
ATTEMPTS = 2, never more.Evidence
The retry is proven RED: with
ATTEMPTS = 1,a_transient_failure_is_retried_once_and_then_servedfails (0 passed, 1failed) — a source that fails twice then answers is only reached through the
retry. Tests drive a real axum server that answers
500for its first Nrequests, real
.tar.zstbytes and the real cache layout:Prebuilt, 3 requests (one fetch exhausts two, the retry's firstrequest is the third);
Source,attempts == 2, exactly 4 requests, no tree left;Source,attempts == 1, 0 requests;Source,attempts == 1, 0 requests, treeuntouched;
Prebuilt,downloaded == false, 1 request overall;ObtainError/FetchError/ExtractErrorvariantasserting the retry rule itself.
fmt clean; boundary
rows=0; dylint_rows=0. Local workspace clippy could notrun (a remote forge worker holds the build-activity lease, a known host issue);
CI
Dylint Fullis the lint gate for this PR.Scope
Opt-in: no build path calls
serveyet — the caller that consults the catalogis a later cell. No workflow files, no new crate, no behavior change for any
existing path.
#1882 stays open.