Skip to content

fix(esp32): use the published toolchain slice - #1953

Merged
zackees merged 1 commit into
mainfrom
agent/toolchain-slice-name
Nov 7, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/toolchain-slice-name

Conversation

@zackees

@zackees zackees commented Nov 7, 2026

Copy link
Copy Markdown
Member

Fixes #1952. Makes the published per-chip toolchain slices
actually get used. Two client bugs,
both found by running a real ESP32-S3 build against the shard that #1951
published — neither is reachable from the existing tests, which is why the
feature shipped inert in #1949.

Bug 1: the toolchain package's name never reached the shard

PackageBase::published_slice keys the shard by self.name, and
slice_shard knew only toolchain-xtensa-esp-elf — the manifest/slicer name.
Esp32Toolchain::new/from_resolved name the same artifact esp32-xtensa-gcc,
so slice_shard returned None and the client never even fetched the
@esp-toolchain shard.

Measured before the fix (fresh cache, real build): 168 MB …tar.xz progress
(118/168 MB), 46 s download, and NO @esp-toolchain shard in
<cache>/mirror-manifest/shards/ — only esp-libs. Every ESP32-S3 build on a
cold cache downloaded the whole unified toolchain.

Bug 2: the slice was then verified against the whole archive's checksum

PackageBase::install re-verified the acquired archive against
self.checksum, which the metadata sets to the WHOLE archive's digest. A slice
is already verified against its own published sha256 inside download_slice,
so the second check always failed:

checksum mismatch for …slice.tar.zst: expected da31f36d…, got 36a9f0e7…

acquire_archive now returns whether the archive came from a slice, and the
whole-archive pin is applied only to the whole archive.

Reproduced live against the published shard before the fix (bug 1 fixed, bug 2
still present): fbuild build fetched the slice, then died with exactly that
checksum mismatch — so the failure is real, not inferred.

Tests

  • every_name_the_esp_orchestrator_builds_resolves_to_the_toolchain_shard —
    both names → @esp-toolchain, and both RISC-V names → None (that toolchain
    is never sliced). RED when the alias is removed.
  • a_slice_is_not_checked_against_the_whole_archive_checksum — installs a
    slice under a package pinned to a different whole-archive sha. RED when the
    from_slice filter is removed (exact live error text).
  • a_whole_archive_is_still_checked_against_its_pin — the opposite direction:
    dropping the check entirely must not pass.

270 lib tests for fbuild-packages-fetch pass (soldr cargo test -p fbuild-packages-fetch --lib), soldr cargo fmt --all --check clean.

Post-fix end-to-end

Rebuilt fbuild + fbuild-daemon from this branch, isolated empty cache,
FBUILD_MIRROR_MANIFEST_URL pointed at the published manifest, minimal
esp32-s3-devkitc-1 project:

before after
toolchain archive 168 MB whole …tar.xz (progress 118/168 MB) 106,462,349 B slice
mirror-manifest/shards/ only esp-libs esp-libs + @esp-toolchain
install dir …-linux-gnu (1.2 GB) …-linux-gnu+esp32s3 (603 MB)
whole archive on disk 168 MB none
result checksum mismatch / whole download build succeeded in 65.1s, flash: 355899 bytes

Firmware is byte-comparable to the pre-fix build (same flash/RAM numbers), so the
slice is a real toolchain, not a degraded one.

Two bugs made the per-chip toolchain slices inert in real builds:

1. `slice_shard` matched only the manifest name `toolchain-xtensa-esp-elf`, but
   `Esp32Toolchain` names its package `esp32-xtensa-gcc`, so the shard was never
   fetched and every cold ESP32 build downloaded the whole 176 MB archive.
2. After the slice download, `install` re-verified the archive against the
   package checksum, which pins the WHOLE archive -- so every slice install died
   with `expected da31f36d..., got 36a9f0e7...`.

Both were hidden by tests that force the slice and pass `checksum: None`.

Fixed by aliasing the toolchain package name in `slice_shard` and by having
`acquire_archive` report whether the archive is a slice, so the whole-archive pin
applies only to the whole archive. Real ESP32-S3 cold-cache build: 106 MB slice,
chip-scoped 603 MB install dir, no whole archive, build succeeds.
@coderabbitai

coderabbitai Bot commented Nov 7, 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
  • 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 7, 2026
Merged via the queue into main with commit 6e5be79 Nov 7, 2026
31 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: No status

Development

Successfully merging this pull request may close these issues.

bug(esp32): published toolchain slices are never used (name mismatch + wrong checksum)

1 participant