Skip to content

fix(ci,channels): restore fbuild + 330KB esp32 size budget (refs #2773) - #2821

Merged
zackees merged 1 commit into
masterfrom
fix/2779-restore-fbuild-esp32-size-check
Jun 5, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2779-restore-fbuild-esp32-size-check

Conversation

@zackees

@zackees zackees commented Jun 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Per #2773: continue memory hunting / reduction. This restores the two CI changes that were workarounds for now-fixed fbuild issues, so the eh_frame stripping + 330 KB historical high-water mark are both back in force.

Why fbuild is safe again

Original blocker Status Closed in
fbuild#297 (no build_info_<env>.json emitter) ✅ CLOSED fbuild PR 309 → fbuild 2.2.10
fbuild#304 (framework .o's not archived → ISR pull-in) ✅ CLOSED fbuild PR 306 → fbuild 2.2.10

We pin fbuild==2.2.17 in pyproject.toml, so both fixes ship.

Local verification

$ uv run python -m ci.ci-compile esp32dev --examples Blink
…
✅ Compilation succeeded (fbuild) [99.6s]
SUCCESS: Blink
✅ Generated build_info_Blink.json at .build/pio/esp32dev/build_info_Blink.json

$ uv run python ci/ci-check-compiled-size.py esp32dev --max-size 330000 --example Blink --no-build
esp32dev size 640228 is greater than max size 330000
::error::Compiled size exceeds maximum allowed size

The fbuild backend emits build_info_Blink.json with the full aliases block (nm, c++filt, objdump, addr2line, …) that symbol_analysis_runner.py consumes, so the downstream symbolizer/symbol-analysis steps in the workflow keep working.

Test plan

  • Local fbuild build succeeds on esp32dev for Blink (640228 B firmware text+data).
  • build_info_Blink.json lands at the expected path with aliases populated.
  • ci-check-compiled-size.py --max-size 330000 exits non-zero at 640228 > 330000 (expected red — drives further memory-reduction work in Meta: ESP32-S3 binary-size reduction — Batch 1 (~26 KB) + Batch 2 (~26–50 KB) (supersedes #2771) #2773).
  • bash test channel --cpp passes after the enum rename.
  • esp32dev_binary_size CI run on this PR (this PR's own workflow run is the authoritative check that the symbolizer pipeline is intact end-to-end on Ubuntu).
  • Other *_binary_size workflows (attiny85, teensy*, bluepill) still pass under fbuild + their historical max_size.

Refs #2773 (memory hunting / minimal-size invariant), supersedes the platformio-backend pin (#2605) and the 700 KB ceiling bump (#2790) now that the upstream fbuild blockers are closed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Resolved macro-name collision issue affecting Arduino-ESP32 platform compatibility.
  • Chores

    • Tightened binary size validation limits in CI/CD workflows.
    • Updated build validation configurations for stricter quality checks.
    • Synchronized test assertions with internal naming updates.

…2773)

The esp32dev_binary_size workflow had been pinned to --backend platformio
(PR #2605) and the budget bumped 330000 -> 700000 (PR #2790) to dodge two
fbuild deficiencies — fbuild#297 (no build_info.json emitter) and
fbuild#304 (framework objects not archived). Both upstream issues are
fixed in fbuild 2.2.10+ (we pin 2.2.17), so restore both:

- build_template_binary_size.yml: drop the three --backend platformio
  flags so ci.ci-compile defaults to fbuild and we get .eh_frame stripping
  back on every size workflow (~169KB on esp32dev).
- check_esp32_size.yml: revert max_size/max_size_apa102 to the historical
  330000 high-water mark. The test will fail at this ceiling — that is
  the regression signal the user asked for ("minimal memory size... goal
  is complete when the esp size test is failing again with its historical
  high water mark").

Also fix a master-blocking compile error introduced by #2795: the new
enum class DriverStatus { DISABLED, ENABLED } in fl/channels/manager.h
is textually rewritten by Arduino-ESP32's `#define DISABLED 0x00`
(esp32-hal-gpio.h:59) at every site that includes Arduino.h before
manager.h — which is every esp32 sketch. The platformio-backend CI is
failing for the same reason (`esp32dev_binary_size` red on every push).
Rename to STATUS_DISABLED/STATUS_ENABLED and update the four callers in
channel.cpp.hpp, manager.cpp.hpp, and tests/fl/channels/channel.cpp.

Local verification: fbuild build of examples/Blink on esp32dev succeeds,
emits build_info_Blink.json (with tool aliases the symbol_analysis
pipeline needs), and ci-check-compiled-size.py reports
"esp32dev size 640228 is greater than max size 330000" — the expected
regression signal.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR renames ChannelManager::DriverStatus enum members from DISABLED/ENABLED to STATUS_DISABLED/STATUS_ENABLED to avoid macro collisions on Arduino-ESP32, updates all usages of these members across implementation and tests, and adjusts CI workflows to remove an explicit backend flag and tighten ESP32 binary size limits.

Changes

Enum rename and codebase propagation

Layer / File(s) Summary
Enum definition and documentation
src/fl/channels/manager.h
ChannelManager::DriverStatus enum members renamed from DISABLED / ENABLED to STATUS_DISABLED / STATUS_ENABLED; driverStatus() documentation updated to reference the new names.
Enum usage in implementation, callers, and tests
src/fl/channels/manager.cpp.hpp, src/fl/channels/channel.cpp.hpp, tests/fl/channels/channel.cpp
driverStatus() return statements, Channel::showPixels() conditionals, and test assertions all updated to use the renamed STATUS_DISABLED and STATUS_ENABLED members.

CI workflow updates

Layer / File(s) Summary
Binary size check invocation and size limits
.github/workflows/build_template_binary_size.yml, .github/workflows/check_esp32_size.yml
Build template workflow removes --backend platformio from three size-check command invocations; ESP32 workflow tightens max_size and max_size_apa102 from 700000 to 330000.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • FastLED/FastLED#2608: The tightened binary size limits (330000) and removal of --backend platformio directly address the ESP32 binary-size investigation and failure thresholds identified in this issue.
  • FastLED/FastLED#2473: The ChannelManager::DriverStatus enum rename and updates to Channel::showPixels directly modify the same code that was flagged as a contributor to binary size in this size-optimization investigation.

Possibly related PRs

  • FastLED/FastLED#2605: Both PRs modify the same .github/workflows/build_template_binary_size.yml size-check invocations for Blink/Apa102/FASTLED_HD_COLOR_MIXING cases (this PR removes --backend platformio, while that PR adds it).
  • FastLED/FastLED#2790: Both PRs directly modify ESP32 size-check limits in .github/workflows/check_esp32_size.yml, with this PR tightening max_size/max_size_apa102 to 330000 while that PR increases them to 700000.
  • FastLED/FastLED#2804: Both PRs adjust the same max_size/max_size_apa102 thresholds in .github/workflows/check_esp32_size.yml, in opposite directions.

Poem

🐰 Enums renamed for peace and harmony,
Macro collisions begone, compiler-free!
FastLED shines bright without the name clash,
Binary checks tightened—no more memory thrash.
A small refactor, yet very precise! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: reverting fbuild setup and reducing ESP32 size budget from 700KB to 330KB, plus fixing a macro collision via enum rename.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2779-restore-fbuild-esp32-size-check

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
tests/fl/channels/channel.cpp

tests/fl/channels/channel.cpp:5:10: fatal error: 'FastLED.h' file not found
5 | #include "FastLED.h"
| ^~~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/e646657d0160436ef0b76567f828f4b55b4823f0-d95f1ae37209823e/tmp/clang_command_.tmp.f0e54a.txt
++Contents of '/tmp/coderabbit-infer/e646657d0160436ef0b76567f828f4b55b4823f0-d95f1ae37209823e/tmp/clang_command_.tmp.f0e54a.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-c

... [truncated 1058 characters] ...

stall/lib/clang/18/include"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/d95f1ae37209823e/file.o" "-x" "c++"
"tests/fl/channels/channel.cpp" "-O0" "-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/build_template_binary_size.yml (1)

44-44: ⚖️ Poor tradeoff

Mitigate template injection risk in workflow inputs.

Static analysis (zizmor) flags potential code injection via template expansion of ${{ inputs.board }} and ${{ inputs.extra_args }} directly in run: commands. While the current caller (check_esp32_size.yml) uses hardcoded values, the pattern is vulnerable if a future workflow passes user-controlled input (e.g., from PR metadata).

🔒 Recommended mitigation using intermediate environment variables
       - name: Check Compiled Program Size for ${{ inputs.board }}
-        run: uv run ci/ci-check-compiled-size.py ${{ inputs.board }} --max-size ${{ inputs.max_size }} --example Blink ${{ inputs.extra_args }}
+        env:
+          BOARD: ${{ inputs.board }}
+          MAX_SIZE: ${{ inputs.max_size }}
+          EXTRA_ARGS: ${{ inputs.extra_args }}
+        run: uv run ci/ci-check-compiled-size.py "$BOARD" --max-size "$MAX_SIZE" --example Blink $EXTRA_ARGS

Apply the same pattern to lines 65 and 87.

Also applies to: 65-65, 87-87

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build_template_binary_size.yml at line 44, The run step
currently expands `${{ inputs.board }}` and `${{ inputs.extra_args }}` directly
into the `run:` command which is flagged for template-injection risk; change the
step to pass those inputs into environment variables (e.g., BOARD and
EXTRA_ARGS) via an `env:` block and reference them in the `run:` command as
shell env vars (e.g., `$BOARD` and `$EXTRA_ARGS`) when invoking
`ci/ci-check-compiled-size.py`, applying the same env-variable pattern to the
other instances mentioned (the steps controlling lines 65 and 87); keep the
script name `ci/ci-check-compiled-size.py` and flags (`--max-size`, `--example
Blink`) the same but substitute template inputs with the new env vars.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/build_template_binary_size.yml:
- Line 44: The run step currently expands `${{ inputs.board }}` and `${{
inputs.extra_args }}` directly into the `run:` command which is flagged for
template-injection risk; change the step to pass those inputs into environment
variables (e.g., BOARD and EXTRA_ARGS) via an `env:` block and reference them in
the `run:` command as shell env vars (e.g., `$BOARD` and `$EXTRA_ARGS`) when
invoking `ci/ci-check-compiled-size.py`, applying the same env-variable pattern
to the other instances mentioned (the steps controlling lines 65 and 87); keep
the script name `ci/ci-check-compiled-size.py` and flags (`--max-size`,
`--example Blink`) the same but substitute template inputs with the new env
vars.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 86139952-cf87-4ae7-9dab-b2a964c6176d

📥 Commits

Reviewing files that changed from the base of the PR and between b1d4fe9 and e646657.

📒 Files selected for processing (6)
  • .github/workflows/build_template_binary_size.yml
  • .github/workflows/check_esp32_size.yml
  • src/fl/channels/channel.cpp.hpp
  • src/fl/channels/manager.cpp.hpp
  • src/fl/channels/manager.h
  • tests/fl/channels/channel.cpp

@zackees
zackees merged commit 6e04acb into master Jun 5, 2026
6 of 7 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: Done

Development

Successfully merging this pull request may close these issues.

1 participant