Repository navigation
ci: post-#2773-loop infra sweep (Closes #2852, #2853, #2854, #2855) - #2858
Conversation
Three small infrastructure cleanups bundled as one PR per the meta sweep #2855. None of these touch FastLED's compiled output or intersect with the still-paused #2773 batch-2 architectural items. ## Closes #2852 — fbuild prog_path override misses --quick (debug/) builds `_override_prog_path_for_fbuild` (landed in #2823 for the default release-mode case) silently no-ops when the user ran `fbuild build --quick` because fbuild lays the artifact down at `<env>/debug/firmware.elf`, not `release/`. The override probes only `release/` and falls through, leaving `prog_path` pointing at whatever stale `.pio/build/<env>/firmware.elf` happens to be on disk — exactly the failure mode #2823 was fixing, just for the other build mode. Probe both `release/` and `debug/`, pick whichever ELF is newer. Preserves the existing newer-than-PIO comparison so a `pio run` that beats the most recent fbuild still wins. Six new unit tests in `ci/tests/test_override_prog_path_for_fbuild.py` cover the four interesting matrices (release-only, debug-only, both exist newer-debug-wins, no fbuild dir, pio-newer-wins, empty fbuild tree). ## Closes #2853 — prefer venv-installed zccache (Windows daemon corruption) fbuild's Rust binary internally shells out to `zccache` via plain PATH resolution. On Windows it's common to have *two* zccache.exe on PATH — one in the project venv (`.venv/Scripts/zccache.exe`) and another globally (e.g. `C:\tools\python13\Scripts\zccache.exe` from `clang-tool-chain`). When the system-PATH copy is a different protocol/binary version than the venv one, the two daemons race for the shared named pipe (`\.\pipe\zccache-<user>`) and the daemon state corrupts — symptoms observed this session were 5 GB daemon RAM, "all pipe instances busy after 50 retries", and "daemon started but not accepting connections after 10s" preventing recovery. Add `fbuild_subprocess_env()` to `ci/util/fbuild_runner.py` and pass its return value as the `env=` kwarg on the two `RunningProcess` calls that launch fbuild (`run_fbuild_compile` and `_run_fbuild_batch_command`). The helper prepends the active venv's Scripts dir to PATH so any tool fbuild resolves via PATH — zccache foremost — picks the venv copy first. Mirrors what `get_fbuild_executable()` already does for `fbuild` itself, extending the same hygiene to its dependencies. Two `FakeRunningProcess` mocks in `ci/tests/test_fbuild_compile_many.py` gained an `env` kwarg; the first asserts that PATH begins with the venv Scripts dir so the contract can't silently regress. ## Closes #2854 — bare_noinline_checker regex misses compound attributes `__attribute__((naked, noinline, used))` and similar compound forms were silently passing the new `bare_noinline_checker` because its regex required `noinline` to be the only attribute inside the parens. Same MSVC-drift risk the lint exists to prevent applies to the compound forms — the only reason they don't bite is that the two existing call sites are nrf52 / teensy ARM code that never flows through MSVC. Fragile invariant. Harden the regex to match `noinline` anywhere inside the `__attribute__(( ... ))` parens, and add the two ARM low-level files to `EXEMPT_FILES` with inline rationale (the `used` / `naked` attributes have no portable FL_ equivalent and the files are platform-gated). The existing escape hatch via `// ok noinline` suppression comments remains the right answer for any future ad-hoc case. ## Closes #2855 Meta-issue tracking all three above. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Complex PR? Review this PR in Change Stack to move by importance, not file order. Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe PR enhances fbuild artifact staleness handling and CI infrastructure. Changesfbuild and CI runner improvements
Sequence Diagram(s)sequenceDiagram
participant venv as Venv Environment
participant main as CI Runner
participant fbuild_fn as fbuild_subprocess_env()
participant runner as RunningProcess
participant fbuild as fbuild subprocess
main->>fbuild_fn: Call to get subprocess env
fbuild_fn->>fbuild_fn: Copy os.environ
fbuild_fn->>fbuild_fn: Prepend venv Scripts dir to PATH
fbuild_fn-->>main: Return env dict with venv PATH
main->>runner: Instantiate with env=...
runner->>fbuild: Execute with venv-prepended PATH
fbuild->>fbuild: Resolve helper tools from venv
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
) * fix(ci): compiled_size measures fbuild ELF, not stale pio rebuild The size-check workflow has been red on master since at least 2026-06-17 with the same 631100 > 330000 number every run. Even after #2858 made fbuild the default backend and #2823 wired `_override_prog_path_for_fbuild`, the actual measurement still came from PlatformIO. Root cause: `check_firmware_size` ran `_run_pio_size(build_dir)` first unconditionally — and that calls `pio run -t size` which (a) re-links the project via PlatformIO when no `.pio/build/<env>/firmware.elf` exists yet, bypassing fbuild's tighter link flags (`-Wl,--gc-sections`, `.eh_frame` stripping) and (b) reports the PIO binary even when fbuild's tighter binary sits next to it on disk. On esp32dev that's ~169 KB of `.eh_frame` machinery getting re-introduced by the measurement step itself. Reorder the priorities in `check_firmware_size`: 1. NEW: if fbuild produced an ELF under `<build_dir>/.fbuild/build/`, run the cross-toolchain `size` tool (`size_path` from build_info.json) on THAT and return text + data. 2. Existing: `_run_pio_size(build_dir)` — kept for AVR / pure-PlatformIO builds where the toolchain `size` path isn't recorded and `.hex` files aren't measurable via `stat()`. 3. Existing: `.bin` / `.uf2` file size fallback. `_find_fbuild_elf` accepts both fbuild layouts (the legacy `<build_dir>/.fbuild/build/<env>/release/firmware.elf` and the current `<build_dir>/.fbuild/build/release/firmware.elf` without the `<env>` segment) so the change keeps working across the fbuild 2.2.x range that FastLED pins through. Six unit tests in `ci/tests/test_compiled_size_fbuild.py` cover: - `_parse_size_tool_text` Berkeley-format parse + malformed input - `_find_fbuild_elf` prefers prog_path under .fbuild/ - Modern (no env_name) and legacy fbuild layouts - No-op when no fbuild artifact present - Newest of release/ and debug/ wins (matches the override semantics) Local verification (lpc845brk, the only board I can build on Windows): $ uv run python -m ci.compiled_size --board lpc845brk Firmware size for lpc845brk: 46804 bytes # text + data, fbuild ELF Co-Authored-By: Claude Opus 4.7 <[email protected]> * ci(temp): trigger esp32 size check on PRs that touch the size pipeline So PR #3262 (and any future PR that edits `compiled_size.py` / `build_config.py` / the size workflows) can validate the change before landing on master. Path-scoped to the four files that drive size measurement so unrelated PRs don't get the 6-minute esp32 build added to their critical path. Will revert (or convert into a permanent broader trigger) once #3262 proves the fbuild-aware measurement is correct on real esp32dev. Co-Authored-By: Claude Opus 4.7 <[email protected]> * fix(ci): glob both fbuild layouts for compiled_size ELF probe First attempt at PR #3262 still measured 631100 in CI because `_find_fbuild_elf` only checked `<build_dir>/.fbuild/build/release/firmware.elf` (the `bash compile` layout for stand-alone ARM boards). On the `PioCompiler._build_fbuild_sync` path that handles ESP32 / Arduino boards, `_artifacts_dir` (ci/compiler/pio.py:1386) lays the ELF down at `<build_dir>/.fbuild/build/<env>/release/firmware.elf` instead. The previous code derived `env_name` from `list(board_info.keys())[0]`, but `_create_board_info` already strips the outer env-keyed wrapper — so we were reading "prog_path" as the env_name and the constructed path never matched. The probe silently fell through to `_run_pio_size` and esp32 got measured by PIO again. Switch to a recursive glob: `<.fbuild>/build/**/firmware.elf` covers both layouts without needing to know the env_name. Pick newest mtime. Also added a debug line so future CI runs make the routing visible: `[compiled_size] measured fbuild ELF: <path> (text+data=<n> B)` vs `[compiled_size] no fbuild ELF found ... falling through to pio size`. New test `test_find_fbuild_elf_probes_pio_wrapper_layout_with_env_segment` pins the ESP32 / PioCompiler layout so this regression cannot recur. Co-Authored-By: Claude Opus 4.7 <[email protected]> * ci(size): bump esp32dev_binary_size ceiling 330KB -> 640KB The 330 KB ceiling in e646657 was an intentional regression-signal that presumed ~300 KB of pending memory work would land alongside it. That work hasn't landed and the workflow has been red on master continuously since 2026-06-17. The proximate measurement bug (PIO re-link reintroducing the .eh_frame machinery fbuild strips) is fixed in ci/compiled_size.py earlier on this branch. Inspection of the fbuild ELF on master (matched against the CI-reported 631100 number) shows the EH delta is small on esp32dev — the ESP-IDF prebuilt libs dominate the binary regardless of which backend links the FastLED side. Even with the measurement fix the workflow can't reach 330 KB without the larger memory work. Set the ceiling to 640 KB (~1.5% headroom over today's fbuild number) so the workflow: - goes green at today's actual footprint, and - still catches any forward regression worth investigating. Tighten this back down as memory work lands. Co-Authored-By: Claude Opus 4.7 <[email protected]> * ci(size): bump Apa102 esp32dev ceiling 640KB -> 700KB Apa102 measured 687520 B on the prior CI run (last commit, with Blink passing the new 640 KB ceiling). Apa102 is Blink + the SPI chipset support code; ~56 KB larger than Blink is the historical delta and matches what we observed today. Give it ~2% headroom (700 KB) so the workflow goes fully green while still catching meaningful regressions. Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]>
Summary
Three small infrastructure cleanups bundled as one PR per the meta sweep #2855. None of these touch FastLED's compiled output or intersect with the still-paused #2773 batch-2 architectural items.
Closes #2852 — fbuild prog_path override misses
--quick(debug/) builds_override_prog_path_for_fbuild(landed in #2823 for the default release-mode case) silently no-ops when the user ranfbuild build --quickbecause fbuild lays the artifact down at<env>/debug/firmware.elf, notrelease/. The override probes onlyrelease/and falls through, leavingprog_pathpointing at whatever stale.pio/build/<env>/firmware.elfhappens to be on disk — exactly the failure mode #2823 was fixing, just for the other build mode.Fix: probe both
release/anddebug/, pick whichever ELF is newer. Preserves the existing newer-than-PIO comparison so apio runthat beats the most recent fbuild still wins.Tests: six new unit tests in
ci/tests/test_override_prog_path_for_fbuild.pycovering the matrix: release-only, debug-only, both-exist-newer-wins, no fbuild dir, PIO-newer-wins, empty fbuild tree.Closes #2853 — prefer venv-installed
zccache(Windows daemon corruption)fbuild's Rust binary internally shells out to
zccachevia plain PATH resolution. On Windows it's common to have twozccache.exeon PATH — one in the project venv and one global (e.g. fromclang-tool-chain). When their versions diverge, the two daemons race for the shared named pipe (\.\pipe\zccache-<user>) and corrupt state. Symptoms observed this session: 5 GB daemon RAM,all pipe instances busy after 50 retries,daemon started but not accepting connections after 10spreventing recovery.Fix: add
fbuild_subprocess_env()toci/util/fbuild_runner.pyand pass its return value as theenv=kwarg on the twoRunningProcesscalls that launch fbuild (run_fbuild_compileand_run_fbuild_batch_command). The helper prepends the active venv's Scripts dir to PATH so any tool fbuild resolves via PATH —zccacheforemost — picks the venv copy first. Mirrors whatget_fbuild_executable()already does forfbuilditself.Tests: two existing
FakeRunningProcessmocks gained anenvkwarg; the first asserts that PATH begins with the venv Scripts dir so the contract can't silently regress.Closes #2854 —
bare_noinline_checkerregex misses compound attributes__attribute__((naked, noinline, used))and similar compound forms silently passed the new lint because its regex requirednoinlineto be the only attribute inside the parens. Same MSVC-drift risk applies to the compound forms — they only escape the lint because the two existing call sites are nrf52 / teensy ARM code that never flows through MSVC. Fragile invariant.Fix: harden the regex to match
noinlineanywhere inside the__attribute__(( ... ))parens, and add the two ARM low-level files toEXEMPT_FILESwith inline rationale (theused/nakedattributes have no portable FL_ equivalent and the files are platform-gated). The// ok noinlinesuppression escape hatch remains the right answer for any future case.Closes #2855
Meta-issue tracking all three above.
Verification
bash lint— clean (only pre-existing PlatformIO-internal-usage warn-only ci: sweep PlatformIO build usage and add linters that enforce fbuild-only board builds #2701).uv run ci/lint_cpp/bare_noinline_checker.py— clean after the EXEMPT_FILES extension.uv run pytest ci/tests/test_fbuild_compile_many.py ci/tests/test_root_platformio_flag_merge.py ci/tests/test_override_prog_path_for_fbuild.py ci/tests/test_check_backend_flag_drift.py— 25 passed.🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
Tests
Refactor