Skip to content

feat(boards.py): port monitor_filters + check_tool from root platformio.ini (#3274 Phase 1) - #3277

Merged
zackees merged 1 commit into
masterfrom
fix/boards-py-monitor-filters-check-tool
Jun 19, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/boards-py-monitor-filters-check-tool

Conversation

@zackees

@zackees zackees commented Jun 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Phase 1 remainder of #3274. Adds two new optional fields to the Board dataclass and auto-applies the ESP32 crash-decoder filter for the ESP32 family so the synthesised .build/pio/<env>/platformio.ini carries them without depending on the root platformio.ini merge.

  • monitor_filters: list[str] | None — serial monitor decoders/filters
  • check_tool: str | None — pio check static-analysis tool name

ESP32-family boards (board_name or real_board_name starting with esp32) auto-default monitor_filters to ["default", "esp32_exception_decoder"] inside Board.to_platformio_ini(). This matches the existing QEMU flash-mode auto-detection pattern in the same method. A board can suppress the auto-default with monitor_filters=[], or override it with a custom list.

check_tool is opt-in per-board with no auto-default — it only affects pio check, not the compile path, and isn't a CI gap. Sets that want it can declare check_tool="clangtidy" explicitly.

Why

PR #3276 (the PARLIO IRAM piece of Phase 1) and this PR together close the two gaps in ci/boards.py that the root-platformio.ini merge in ci/compiler/pio.py:155 is silently masking. With both landed, severing that merge (Phase 2 of #3274) becomes safe — every flag/filter the merge was carrying for CI has an authoritative declaration in boards.py.

Root platformio.ini deliberately untouched

The orthogonality rule: ci/boards.py and root platformio.ini serve disjoint audiences (CI vs. interactive local-dev). Root [env:generic-esp] retains its own monitor_filters and check_tool declarations for bash autoresearch / bash debug / raw pio run. Adding the flag to boards.py does NOT mean removing it from root — both surfaces independently need it.

Verification

$ uv run python -c "
from ci.boards import ESP32DEV, ESP32_C6_DEVKITC_1, ESP32_S3_DEVKITC_1, ESP32H2, ESP32_P4
from ci.boards import APOLLO3_RED_BOARD
assert 'monitor_filters' not in APOLLO3_RED_BOARD.to_platformio_ini()
for b in (ESP32DEV, ESP32_C6_DEVKITC_1, ESP32_S3_DEVKITC_1, ESP32H2, ESP32_P4):
    ini = b.to_platformio_ini()
    assert 'monitor_filters =' in ini and 'esp32_exception_decoder' in ini
print('OK')
"
  • All ESP32-family boards now emit monitor_filters with esp32_exception_decoder in the synthesised ini.
  • Non-ESP32 boards (Apollo3, Teensy, AVR, etc.) correctly omit it.
  • bash lint clean.

Files changed

  • ci/boards.py — Board dataclass: 2 new optional fields; to_platformio_ini: ~18-line emission block with the ESP32 auto-detect. +31 / -0.

Out of scope (deliberately deferred)

  • Severing the root-merge in ci/compiler/pio.py:155 — Phase 2 of Sever root platformio.ini from CI compile path; deprecate PioCompiler as a build fallback #3274.
  • merge_root_platformio: bool = False parameter on PioCompiler — Phase 2.
  • Deprecating PioCompiler as a build fallback — Phase 3.
  • Touching root platformio.ini — orthogonality rule.
  • Setting check_tool="clangtidy" on the ESP32 boards — opt-in per-board; defer unless a use case for pio check from the synthesised ini emerges.

Possible textual conflict with #3276

Both PRs add fields/constants near each other in ci/boards.py. Conflicts (if any) will be small and resolvable by whichever lands second.

Test plan

  • bash lint — clean
  • Smoke test confirms all 5 sampled ESP32 boards auto-emit monitor_filters and a non-ESP32 board does not
  • CI compile of an ESP32 board (e.g. esp32c6) — confirm monitor_filters line appears in .build/pio/esp32c6/platformio.ini

Refs #3274

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Boards now support configurable serial monitor filtering and static-analysis tool settings, enabling more granular control over development tools and workflows.

… exception_decoder

Adds two new optional fields to the `Board` dataclass:

  - `monitor_filters: list[str] | None` — serial monitor decoders/filters
  - `check_tool: str | None`            — `pio check` static-analysis tool

ESP32-family boards (board_name or real_board_name starting with "esp32")
auto-default `monitor_filters` to `["default", "esp32_exception_decoder"]`
inside `Board.to_platformio_ini()` so that under `bash debug` and other
flows that consume the synthesised `.build/pio/<env>/platformio.ini`,
crash backtraces decode to file:line without depending on the root
`platformio.ini` merge that `ci/compiler/pio.py:155` performs today.

The auto-default matches the existing pattern used for QEMU flash-mode
detection further up in the same method. A board can suppress the
auto-default by setting `monitor_filters=[]`, or override it by setting
a custom list. `check_tool` is opt-in per-board (no auto-default)
because it only affects `pio check`, not the compile path.

Root `platformio.ini` is deliberately left untouched — the two surfaces
are orthogonal and both audiences (CI via boards.py; interactive
`bash debug` / `bash autoresearch` / `pio run` via root) need the
filters declared in their own file.

This is Phase 1 of #3274 (sever root `platformio.ini` from CI compile
path). The other Phase 1 item — PARLIO IRAM flag — is in PR #3276.

Refs #3274

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

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 45cdc482-1828-4089-801e-3a1e5f14dd58

📥 Commits

Reviewing files that changed from the base of the PR and between dc9a0d4 and e1df78a.

📒 Files selected for processing (1)
  • ci/boards.py

📝 Walkthrough

Walkthrough

ci/boards.py adds two optional fields—monitor_filters and check_tool—to the Board dataclass. The to_platformio_ini() method is updated to auto-emit ESP32-family monitor filters when monitor_filters is None, suppress them when set to [], use custom values otherwise, and conditionally emit check_tool when set.

Changes

Board monitor_filters and check_tool configuration

Layer / File(s) Summary
Board fields and platformio.ini emission
ci/boards.py
Adds monitor_filters: list[str] | None = None and check_tool: str | None = None to Board. Updates to_platformio_ini() to detect ESP32-family boards, apply auto-default filters ["default", "esp32_exception_decoder"] when monitor_filters is None, suppress emission when monitor_filters=[], and emit check_tool when set.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • feat: support PlatformIO monitor_filters fbuild#644: This PR directly implements the monitor_filters feature described in the issue, adding the Board.monitor_filters field with the same ESP32-family auto-default behavior and to_platformio_ini() emission logic.

Poem

🐇 Hoppity-hop through the INI land,
Where ESP32 filters are auto-planned!
monitor_filters default, no fuss, no fret,
check_tool waits when its moment is met.
The rabbit cheers for configs so grand! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding monitor_filters and check_tool fields to the Board class to support per-board PlatformIO configuration, aligning with the actual implementation in ci/boards.py.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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/boards-py-monitor-filters-check-tool

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.

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