Repository navigation
feat(packages): install a per-chip toolchain slice when the mirror lists one (#1944 client half) - #1949
Merged
Conversation
…sts one #1947 gave fbuild a slicer: one deterministic tar.zst per ESP32 chip, 75 MB instead of the 168 MB unified toolchain. Nothing resolved those slices, so a first ESP32-S3 install still downloaded the whole 660 MB tree. This is the resolving half. * `variants::slice_shard` is the single place that says which artifacts have per-chip slices: `@esp-libs` for the SDK libs, new `@esp-toolchain` for `toolchain-xtensa-esp-elf`. The RISC-V toolchain is never sliced -- its multilibs are ISA variants (rv32imc/ilp32), not chips. * `PackageBase` gains an optional chip variant. When the mirror lists a slice for that chip the archive comes from the slice; when it does not, the artifact's own URL is used, unchanged. Two rules carry the safety: * A slice installs into its own chip-scoped directory (`<version>+<chip>`). A slice holds ONE chip's SDK libs, so the shared path would let a later build for another chip find a tree that looks installed and fail at link. A whole archive keeps the shared path, which serves every chip, and is preferred when it already exists -- a host that installed before slicing existed never re-downloads. * A slice that IS listed is authoritative: a corrupt one fails the install instead of quietly fetching the full archive, matching the ESP libs contract. Only "no slice published for this chip" falls back. `Esp32Toolchain::with_slice_variant` + the orchestrator pass `build.mcu` on both the build and the `install --check` paths; `is_installed`, `get_info` and the DiskCache row all follow the directory actually on disk. Tests drive the real `staged_install` against a local HTTP server and assert what was NOT downloaded: a slice install requests exactly the slice URL (the vendor archive is served and never asked for), a corrupt slice fails with `checksum mismatch` and still makes one request, an existing shared install is returned for two different chips with no request, an unpublished slice falls back to the vendor URL, and one chip's slice never satisfies another. Refs #1944.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
`crates/fbuild-build-esp/src/esp32/orchestrator/packages.rs` sat at 999 LOC, so passing the chip to the toolchain pushed it to 1001 and tripped the "Reject .rs files over 1000 LOC" gate. Move the inline `registry_toolchain_tests` module to its own file, the same way `legacy_tests` is already split out (`#[path = ...]`). Pure move: the four tests are unchanged and still pass; packages.rs drops to 847 LOC.
This was referenced Nov 7, 2026
This was referenced Nov 8, 2026
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.
Client half of #1944: an ESP32 toolchain install now prefers a published
per-chip slice, so the 168 MB unified download becomes the ~75 MB esp32s3 one.
What changes
ci/slice_toolchain.py(#1947) already emits onetar.zstper chip. Nothingresolved them, so fbuild still downloaded the whole 660 MB tree. This adds the
resolving half:
variants.rslearns a second slice family:toolchain-xtensa-esp-elfislooked up in the
@esp-toolchainshard, exactly like the SDK libs are lookedup in
@esp-libs. The RISC-V toolchain is deliberately not slice-capable-- its multilib directories are ISA variants (
rv32imc/ilp32), not chips, sothere is nothing chip-shaped to slice.
PackageBasegains an optional chip variant (with_slice_variant). When themirror lists a slice for that chip, the archive comes from the slice; when it
does not, the artifact's own URL is used, unchanged.
Esp32Toolchain::with_slice_variant+ the orchestrator passbuild.mcu, onboth the build and the
install --checkpaths.The two rules that make it safe
A slice installs into its own chip-scoped directory (
<version>+<chip>).A slice ships one chip's SDK libraries; putting it in the shared directory
would let a later build for a different chip find a tree that looks installed
and fail at link. A whole archive keeps the shared directory, which serves
every chip, and the shared directory is preferred when it already exists -- so
a host that installed the full toolchain before slicing existed never
re-downloads, and two chips still get two correct trees.
A listed slice is authoritative. A corrupt slice fails the install instead
of quietly falling back to the full archive, matching the ESP libs contract:
a bad publish must be visible, not merely slow. Only "no slice published for
this chip" falls back to the whole archive.
The DiskCache index row is keyed by the chip-scoped version, so GC sees one row
per chip and LRU/
installed_bytesstay truthful.Tests
crates/fbuild-packages-fetch/src/chip_slice_tests.rsdrives the realstaged_installagainst a local HTTP server and asserts what was notdownloaded:
...+esp32s3, sentinel written,is_cached(),and the request log is exactly
["/slice.tar.zst"](the 4096-byte vendorarchive is served and never asked for);
checksum mismatch, still exactly one request, no chip dir;request at all;
satisfies another chip.
variants.rsgains the selection matrix: toolchain slice chosen for the chipit is listed for, whole archive for a chip without one, never for RISC-V.
Not in this PR
Publishing the slices (a
publish_esp_slices.py-shaped uploader plus the@esp-toolchainshard entry) and the end-to-end ESP32-S3 install measurement.Until a shard exists the client takes the fallback path, which is exactly
today's behaviour.
Refs #1944.