Skip to content

feat(prebuilt): one retry, then source fallback (#1882) - #2194

Merged
zackees merged 1 commit into
mainfrom
agent/1882-source-fallback
Nov 27, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/1882-source-fallback

Conversation

@zackees

@zackees zackees commented Nov 27, 2026

Copy link
Copy Markdown
Member

Unit 13 of the #1882 track: source fallback with one retry after a hit fails.

Why

obtain reports "cannot produce this tree" as an error. A build must never see
that 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 that
never returns an error:

failure decision
transport / exhausted sources / integrity / archive / IO / cancelled extraction retry once
invalid fingerprint or key component, unsupported flavor, unsafe entry, size/entry ceilings, occupied destination, identity conflict refused at once — a second identical attempt can only fail identically
  • The retry is cheap and resuming: Fetcher keeps the partial body, so the
    second attempt asks for Range from the last byte it trusts; each extraction
    attempt stages in its own .<sha16>.<attempt>.staging directory, so a retry
    can never inherit the previous attempt's debris.
  • Every non-serving path returns Served::Source(Fallback { reason, attempts })
    — one printable line naming each attempt (Fallback::notice) — and the
    caller compiles framework from source. Bounded at ATTEMPTS = 2, never more.
  • Reuse stays offline: a marked tree is served with zero requests.

Evidence

running 73 tests   (prebuilt::, 7 new)
test result: ok. 73 passed; 0 failed
running 397 tests  (crate lib, 395 passed; 0 failed; 2 ignored)

The retry is proven RED: with ATTEMPTS = 1,
a_transient_failure_is_retried_once_and_then_served fails (0 passed, 1
failed) — a source that fails twice then answers is only reached through the
retry. Tests drive a real axum server that answers 500 for its first N
requests, real .tar.zst bytes and the real cache layout:

  • transient → Prebuilt, 3 requests (one fetch exhausts two, the retry's first
    request is the third);
  • dead source → Source, attempts == 2, exactly 4 requests, no tree left;
  • 63-hex fingerprint → Source, attempts == 1, 0 requests;
  • foreign marker at the path → Source, attempts == 1, 0 requests, tree
    untouched;
  • complete tree → Prebuilt, downloaded == false, 1 request overall;
  • plus a table test over every ObtainError/FetchError/ExtractError variant
    asserting the retry rule itself.

fmt clean; boundary rows=0; dylint_rows=0. Local workspace clippy could not
run (a remote forge worker holds the build-activity lease, a known host issue);
CI Dylint Full is the lint gate for this PR.

Scope

Opt-in: no build path calls serve yet — the caller that consults the catalog
is a later cell. No workflow files, no new crate, no behavior change for any
existing path.

#1882 stays open.

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.
@zackees
zackees added this pull request to the merge queue Nov 27, 2026
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 27, 2026
Merged via the queue into main with commit 80c377e Nov 27, 2026
34 checks passed
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