Skip to content

Sever root platformio.ini from CI compile path; deprecate PioCompiler as a build fallback #3274

Closed

Description

@zackees

Phase tracker (meta)

Each phase is gated on the previous landing. Phase 2 is blocked on Phase 1 PRs merging; Phase 3 is blocked on Phase 2 landing.


Problem statement

Root ./platformio.ini is silently merged into every firmware build via PioCompiler._init_platformio_build → get_root_platformio_build_flags (ci/compiler/pio.py:155, ci/compiler/build_config.py:33-89). This was added in PR #2794 (closing #2664) to fix a real interactive-dev pain — flags edited in root [env:<board>] were silently discarded by bash compile --backend platformio. But the fix was implemented at the wrong layer: at the shared setup function that every firmware build flows through (fbuild, PIO, size-check, bloat, autoresearch, bash debug, regression tests). There is no opt-out.

Critically, the leak is not PioCompiler-specific. fbuild reads the synthesised .build/pio/<env>/platformio.ini that PioCompiler's setup writes. So even though BOARD_BUILDS_USE_FBUILD = True is already the default (ci/compiler/compilation_orchestrator.py:25), fbuild still inherits the merge. Severing the coupling requires touching the setup function, not the backend selection.

Symptom of record: PR #3268 (esp32dev size-check). Inherited debug flags from [env:generic-esp] (build_type = debug, -g, -Og, CORE_DEBUG_LEVEL=5, FASTLED_DEBUG=1) silently doubled the esp32dev binary and forced manual -UDEBUG / -DNDEBUG / -Os / -fno-exceptions / -fno-rtti / build_type = release overrides inside [env:esp32dev] to defeat the merge.

Target architecture

Surface Reads root platformio.ini? Backend
bash autoresearch optional / direct (not via boards.py merge) fbuild only
bash debug optional / direct fbuild + optional pio for parity comparison
bash compile NO fbuild only; PioCompiler retained as --backend platformio comparison opt-in
bash bloat, size-check, regression tests NO fbuild only
WASM NO (already true) wasm-direct
CI workflows NO fbuild only

boards.py becomes the single source of truth for everything that compiles in CI. Root platformio.ini is retained only as developer scaffolding for interactive dev sessions (and is on a path to retirement once bash debug / bash autoresearch no longer need it).

PioCompiler is retained but deprecated as a build fallback. Its only sanctioned use is --backend platformio invoked explicitly to compare fbuild output and surface gaps. It must never be the default and must never be selected silently.

Phase 1 — Migrate flags that exist only in root

Audit found these blocking gaps in ci/boards.py that the merge is invisibly covering today. These MUST be ported before the merge can be removed:

  1. monitor_filters = esp32_exception_decoder lives only in [env:generic-esp] (platformio.ini:16-18). Inherited by every ESP32 board for crash-trace decoding. Add monitor_filters: list[str] to the Board dataclass in ci/boards.py, emit it from Board.to_platformio_ini(), and set it on the ESP32 board definitions (or a shared ESP32 base).
  2. check_tool = clangtidy (platformio.ini:41). Lower priority — affects pio check, not compile. Port or document as wontfix.
  3. -D CONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 and -D CONFIG_PARLIO_TX_ISR_CACHE_SAFE=1 on esp32c6 — tracked separately in esp32: CONFIG_PARLIO_TX_ISR_HANDLER_IN_IRAM=1 should be a boards.py default on all PARLIO-capable boards #3271 (must land before Phase 2).

Run a full diff: every flag in every [env:*] section of root vs the corresponding boards.py board's build_flags / defines. Anything that exists only in root and isn't dev-only (debug flags, monitor filters for serial sessions, etc.) must be migrated.

Phase 2 — Add deprecation telemetry, then sever the merge

  1. Log merged flags loudly for one release cycle:
    [DEPRECATION] Root platformio.ini contributed N build_flags to <board>: [...]
    These will stop being merged in vX.Y. Move them to ci/boards.py.
    
  2. Add a FASTLED_FAIL_ON_ROOT_MERGE=1 env var that CI workflows set; under it the merge raises instead of merging silently. Catches any missed migration in CI before flipping the default.
  3. Add a merge_root_platformio: bool = False parameter to PioCompiler.__init__ (default False). Plumb through _init_platformio_build so get_root_platformio_build_flags is only called when the parameter is True.
  4. Flip the call sites:
    • ci-compile.py (interactive bash compile): pass merge_root_platformio=False always. The merge is killed for the primary entry point.
    • ci/debug_attached.py (bash debug): pass True only if user invokes a "use my root config" mode (e.g. bash debug --use-root-ini); default False. Current behavior already reads only the synthesised ini for compile.
    • ci/autoresearch/build_driver.py: pass False. AutoResearch is 100% boards.py-driven today; no behavior change.
    • compile_board_examples (CI orchestrator): pass False.
    • CI workflows under .github/workflows/: no change needed — all route through bash compile / ci-compile.py.

Phase 3 — Deprecate PioCompiler as a build fallback

  1. Remove silent fallback. BOARD_BUILDS_USE_FBUILD = True is the default; tighten so use_fbuild=False only takes effect when the user passes --backend platformio explicitly. Reject programmatic callers that flip it without the explicit flag.
  2. Mark --backend platformio as a comparison tool. Update --help text and CLAUDE.md / build-system docs: "Use only to compare fbuild output and find gaps."
  3. Add a CI nightly job (low cost) that runs bash compile <small set of boards> --backend platformio and compares ELF sizes / symbol counts vs fbuild. Failures filed as gap-tracking issues, not merge-blockers.
  4. Eventual removal: track usage telemetry for one release cycle. If --backend platformio is unused outside the comparison nightly, remove PioCompiler entirely.

Phase 4 — Cleanup

  1. Delete get_root_platformio_build_flags, the merge call in pio.py:155-161, and ci/tests/test_root_platformio_flag_merge.py.
  2. Add a header comment to root platformio.ini: "This file is consumed only by bash autoresearch and bash debug. CI compile, size-check, bloat, and tests read ci/boards.py. Flags added here will NOT affect those builds."
  3. Revert PR fix(ci/size): esp32dev overrides generic-esp debug flags (restore 330KB ceiling) #3268's manual debug-flag overrides in [env:esp32dev] — they exist only to defeat the merge, which no longer fires.
  4. Close bash compile --backend platformio silently discards root platformio.ini build_flags #2664 with a note: the original fix is being replaced by the documented separation in the header comment; bash compile no longer reads root, by design.

Risks and migration order

  • Phase 1 must complete before Phase 2's flip. Removing the merge without porting monitor_filters silently breaks serial crash decoding on every ESP32 board.
  • The FASTLED_FAIL_ON_ROOT_MERGE=1 gate in CI is the safety net — makes any forgotten flag a loud failure during the migration window instead of a silent regression after.
  • bash debug already routes compile through the synthesised ini (ci/debug_attached.py uses PioCompiler with use_fbuild=True). Its dependency on root is weaker than implied — Phase 2 keeps an opt-in for it, but in practice may not need root at all once Phase 1 ports the monitor filters.
  • --backend platformio parity comparisons (Phase 3) are how the "fbuild has a gap" feedback loop stays alive once PioCompiler stops being a fallback. Don't skip the nightly.

Labels / refs

Activity

  1. zackees commented on Jun 19, 2026

    @zackees
    MemberAuthor

    All four phases complete and merged:

    Sub-issue bash autoresearch migration (#3281) also landed via PR #3290 — autoresearch now synthesises its own platformio.ini from ci/boards.py instead of consuming the root file.

    Closing as completed.

  2. moved this from Triage to Done in FastLED Trackeron Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions