Skip to content

feat(ci): slice ESP toolchains per chip (#1944 server half) - #1947

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

zackees merged 1 commit into
mainfrom
agent/toolchain-slices

Conversation

@zackees

@zackees zackees commented Nov 7, 2026

Copy link
Copy Markdown
Member

Server half of #1944's remaining option: publish a single-chip, zstd-compressed
toolchain instead of the 168 MB unified download.

Why

#1944 measured the composition of the 660 MB installed xtensa-esp-elf tree:
the per-chip SDK libs are the removable bulk (lib/esp32 204 MB, lib/esp32s2
103 MB, lib/esp32s3 102 MB), while bin/libexec (80 MB each) and the
top-level multilib archives are chip-shared. Compression alone saves 42 MB and
still lands at ~4.0 min on a 10 Mbit link; dropping the sibling chips is what
buys the rest.

What this adds

ci/slice_toolchain.py — one deterministic tar.zst per chip, plus a
slices.json index carrying the same manifest_slices shape the ESP libs
slicer emits (url/sha256/size/format per chip).

  • Selection is by path component: a member is chip-specific when any path
    component names a chip (lib/esp32s3, lib/gcc/<triple>/<version>/esp32s3),
    so shared content is never dropped by a hardcoded list going stale.
  • Deterministic output: sorted members, mtime 0, uid/gid 0, zstd checksums on,
    single-threaded encoder. Two runs of the same tree are byte-identical.
  • Fails closed on: a requested chip with no directory, a tree with no per-chip
    directories (never emit a "slice" that is a whole-tree copy), an absolute or
    escaping symlink, and a symlink whose in-tree target the slice drops. An
    in-tree .. link is kept — the real toolchain ships
    lib/bfd-plugins/liblto_plugin.so -> ../../libexec/....
  • .install_complete is never archived: a stale marker inside a slice would let
    an interrupted extraction pass as a complete install.
  • --verify extracts each slice and runs that chip's compiler from the
    extraction
    : --version, a -print-libgcc-file-name that must resolve
    inside the slice, and a real -std=gnu++17 -Os -c. --check recomputes and
    compares without writing.

Measured on the real toolchain (not a paper size)

Cached production xtensa-esp-elf 13.2.0 tree, --chips esp32s3 --verify:

value
slice 75,299,480 B (75.3 MB)
payload uncompressed 423,807,794 B, 2,030 entries
sha256 00a6ca50…c66c
vendor unified download 168 MB
wall time 4m50s including verification

Verification output from the extracted slice itself:
xtensa-esp32s3-elf-gcc (crosstool-NG esp-13.2.0_20240530) 13.2.0,
libgcc = lib/gcc/xtensa-esp-elf/13.2.0/esp32s3/libgcc.a (inside the slice),
and the probe TU compiled with exit 0.

Projection on #1944's own measured rate (68.7 MB/min): after #1945's 70 MiB
esptool cut the install is ~317 MB / 4.62 min; swapping 168 MB of toolchain for
75.3 MB gives ~222 MB / 3.24 min, i.e. inside the issue's under-4-min target.

Tests

ci/test_slice_toolchain.py — 11 tests, registered in ci/local_suites.py
(LOCAL_ONLY_MODULES, same lane as the ESP libs slicer). Real runs:
Ran 11 tests ... OK; ruff check ci/ clean; ci/check_python_complexity.py
clean; ci/gate_script_coverage.py --budget 0 reports every workflow-invoked
gate accounted for.

Three mutations each kill their tests (selection keeps everything → 8 failures,
incl. the new fail-closed post-condition; libgcc containment not checked → the
outside-the-slice test; install marker shipped → 2 marker tests).

Not in this PR

Publishing (mirror upload + shard/manifest registration) and the client half
(resolve toolchain URL + MCU → slice, whole archive as fallback) are the
follow-ups; ci/publish_esp_slices.py is the model. Until then no client
consumes these archives, and the slice has not yet been exercised by a real
fbuild build for an ESP32-S3 sketch — that is the end-to-end gate for the
client PR.

per-chip archives are the remaining ~95 MB of the ESP32-S3 install budget:
#1944 measured 660 MB extracted -> 75.3 MB for esp32s3 at zstd -19 against
a 168 MB vendor download. This adds the slicer; publishing and client
resolution follow.

Selection is by path component (any path naming a chip), so bin/libexec/
include and the top-level multilib archives stay in every slice. Fails
closed on an unknown chip, a tree with no per-chip dirs, an escaping
symlink, and a symlink whose in-tree target the slice drops; an in-tree
.. link is kept. --verify extracts the slice and runs that chip's compiler
from it (version, libgcc resolving inside the slice, a real C++ compile).
@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 5795a71 Nov 7, 2026
29 checks passed
@zackees
zackees deleted the agent/toolchain-slices branch November 7, 2026 12:10
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 8, 2026
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