Repository navigation
fix(ci): skip pio check on fbuild-compiled boards to unblock esp32c2 CI - #2305
Conversation
`ci/ci-cppcheck.py` shells out to `pio check`, which requires a fully
populated PlatformIO project tree. Boards now compiled by fbuild don't
get their partition CSVs (e.g. `huge_app.csv`) written into the PIO
project dir, so `pio check` fails in CMake configure:
Missing partition table file `.../.build/pio/esp32c2/huge_app.csv`
UserSideException: Processing esp32c2 ...
This has kept esp32c2 red on master since #2292 (2026-04-18) and blocks
PR #2300.
Short-term: detect fbuild output presence by testing
`.build/.fbuild/build/<env>/release/` (the fbuild artifact dir returned
by `PioCompiler._artifacts_dir` in `ci/compiler/pio.py`). When that
directory exists for the target board, skip `pio check` with a visible
SKIP notice and return 0 rather than fail CI.
This accepts a temporary cppcheck-coverage gap on fbuild-default boards
(esp32c2 today, s3/c3/c6 on deck) until the proper clang-tool-chain-bin
integration lands — tracked by:
- #2301 — fbuild cppcheck support
- #2302 — esp32c2 CI regression (closed by this commit)
- #2303 — umbrella: clang-tool-chain-bin for IWYU + cppcheck +
other linting tools
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
📝 WalkthroughWalkthroughA helper function Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ci/ci-cppcheck.py`:
- Around line 102-112: The current was_compiled_with_fbuild function returns
True merely on the existence of build_root/.fbuild/build/<board>/release which
can produce stale-artifact false positives; update was_compiled_with_fbuild to
either (a) consult the authoritative FBUILD_BOARDS set (import from
ci.compiler.fbuild_boards and return board_name in FBUILD_BOARDS) or (b)
strengthen the check to ensure the release directory contains a real recent
firmware artifact (e.g., look for expected firmware files like *.elf/*.bin/*.hex
and optionally validate modification time is recent) before returning True,
keeping the function name and behavior but avoiding stale-directory detection.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a9c3a330-d2bb-4626-a38c-b6bc4e086ecc
📒 Files selected for processing (1)
ci/ci-cppcheck.py
| def was_compiled_with_fbuild(build_root: Path, board_name: str) -> bool: | ||
| """Detect whether the active backend for this board was fbuild. | ||
|
|
||
| fbuild writes artifacts under ``.build/.fbuild/build/<env>/release/`` | ||
| (see ``ci/compiler/pio.py::PioCompiler._artifacts_dir``). If that | ||
| directory exists for the target board, fbuild produced the compile, | ||
| and ``pio check`` will fail during CMake configure because partition | ||
| CSVs and other PIO-side metadata are never written to the PIO project | ||
| tree — see FastLED#2302 for the esp32c2 symptom. | ||
| """ | ||
| return (build_root / ".fbuild" / "build" / board_name / "release").exists() |
There was a problem hiding this comment.
Potential stale-artifact false positive.
Detecting fbuild by the mere existence of .build/.fbuild/build/<board>/release/ will also trigger if the board was previously built with fbuild and is now being recompiled with PlatformIO (e.g., a developer toggling backends locally, or CI caches persisting across runs). In that case pio check would be silently skipped even though a valid PIO project tree exists.
Given this is an explicit short-term unblock tied to #2301/#2302/#2303, this is likely acceptable, but consider either (a) preferring the authoritative FBUILD_BOARDS set from ci/compiler/fbuild_boards.py for detection, or (b) also checking that the release/ directory contains a recent firmware artifact, so stale dirs don't mask regressions.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ci/ci-cppcheck.py` around lines 102 - 112, The current
was_compiled_with_fbuild function returns True merely on the existence of
build_root/.fbuild/build/<board>/release which can produce stale-artifact false
positives; update was_compiled_with_fbuild to either (a) consult the
authoritative FBUILD_BOARDS set (import from ci.compiler.fbuild_boards and
return board_name in FBUILD_BOARDS) or (b) strengthen the check to ensure the
release directory contains a real recent firmware artifact (e.g., look for
expected firmware files like *.elf/*.bin/*.hex and optionally validate
modification time is recent) before returning True, keeping the function name
and behavior but avoiding stale-directory detection.
Replace the short-term SKIP (#2305) with real cppcheck coverage on fbuild-compiled boards, using fbuild's own compile database instead of a PlatformIO project tree. How it works: - New helper `ci/util/fbuild_compiledb.py` wraps `fbuild build -e <env> --target compiledb` (built into fbuild 2.1+), which emits `compile_commands.json` under `.build/.fbuild/build/<env>/release/` without performing a full compile. The helper also lifts `was_compiled_with_fbuild()` out of `ci-cppcheck.py` so other entry points (IWYU, etc.) can share it. - `ci/ci-cppcheck.py` now branches on `was_compiled_with_fbuild()` and invokes `cppcheck --project=<db>/compile_commands.json` directly when fbuild is the active backend. PIO-backed boards still go through `pio check` unchanged. - Severity mapping preserved: `--enable=warning,performance,portability` covers `pio check --severity=medium`, and `--error-exitcode=1` replaces `--fail-on-defect=high`. - `build_template.yml` and `build_template_custom_board.yml` install system `cppcheck` on Linux runners before the CPP Check step. No change needed on Windows/macOS runners (fbuild ESP32 boards are Linux-only today). Closes #2301 (fbuild cppcheck support), #2302 (esp32c2 CI regression). Partial progress on #2303 (clang-tool-chain-bin umbrella) — IWYU migration to the same compile-DB pathway lands in a follow-up PR. Supersedes #2305 (short-term SKIP). Once this lands the SKIP branch is unreachable and can be dropped entirely. Research memo: `ci/docs/fbuild-static-analysis-research.md` documents the `clang-tool-chain` package surface (wrappers, Python API) and fbuild's compile-DB generation. Kept in-tree because #2303 follow-ups (IWYU, clang-tidy) will keep referring to it. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…d compile DB Supersedes the short-term SKIP from #2305 with real static-analysis coverage on fbuild-compiled boards, routed entirely through `clang-tool-chain-tidy` against fbuild's own compile database. No system-package dependency, no `pio check`, no PIO project tree. - New helper `ci/util/fbuild_compiledb.py` wraps `fbuild build -e <env> --target compiledb` (built into fbuild 2.1+). Emits `.build/.fbuild/build/<env>/release/compile_commands.json` without a full compile. Also lifts `was_compiled_with_fbuild()` out of `ci-cppcheck.py` (previously inline from #2305) so `ci-iwyu.py` and future analysis tools can share it. - `ci/ci-cppcheck.py` now branches on `was_compiled_with_fbuild()` and invokes `uv run clang-tool-chain-tidy -p <db-dir> <src/ files>` for fbuild boards. PIO-backed boards continue through `pio check` unchanged. `clang-tool-chain` lazily validates/fetches its bundled toolchain on first use, so no `apt-get install` is needed. Matches the invocation pattern at `ci/lint/stage_impls.py:101-114`. - `parse_args(argv: list[str] | None = None)` per testability guideline. Missing-DB path fails fast with stderr + exit 1 (per CodeRabbit: no silent fallback on missing critical resources). - Check selection is governed by the repo-root `.clang-tidy` — already enables the cppcheck-equivalent families (`bugprone-*`, `clang-analyzer-*`, `performance-*`). No inline `--checks` override. - Source filter preserved: compile-DB loader filters entries to files under `<project_root>/src/`, matching `pio check --src-filters=+<src/>`. - Research memo `ci/docs/fbuild-static-analysis-research.md` documents the `clang-tool-chain` API surface and fbuild's compile-DB behavior. Closes #2301 (fbuild static-analysis support), #2302 (esp32c2 regression). Phase A of #2303 — IWYU migration onto the same pathway lands in a follow-up PR. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…d compile DB (phase A of #2303) (#2307) * feat(ci): route static analysis through clang-tool-chain-tidy + fbuild compile DB Supersedes the short-term SKIP from #2305 with real static-analysis coverage on fbuild-compiled boards, routed entirely through `clang-tool-chain-tidy` against fbuild's own compile database. No system-package dependency, no `pio check`, no PIO project tree. - New helper `ci/util/fbuild_compiledb.py` wraps `fbuild build -e <env> --target compiledb` (built into fbuild 2.1+). Emits `.build/.fbuild/build/<env>/release/compile_commands.json` without a full compile. Also lifts `was_compiled_with_fbuild()` out of `ci-cppcheck.py` (previously inline from #2305) so `ci-iwyu.py` and future analysis tools can share it. - `ci/ci-cppcheck.py` now branches on `was_compiled_with_fbuild()` and invokes `uv run clang-tool-chain-tidy -p <db-dir> <src/ files>` for fbuild boards. PIO-backed boards continue through `pio check` unchanged. `clang-tool-chain` lazily validates/fetches its bundled toolchain on first use, so no `apt-get install` is needed. Matches the invocation pattern at `ci/lint/stage_impls.py:101-114`. - `parse_args(argv: list[str] | None = None)` per testability guideline. Missing-DB path fails fast with stderr + exit 1 (per CodeRabbit: no silent fallback on missing critical resources). - Check selection is governed by the repo-root `.clang-tidy` — already enables the cppcheck-equivalent families (`bugprone-*`, `clang-analyzer-*`, `performance-*`). No inline `--checks` override. - Source filter preserved: compile-DB loader filters entries to files under `<project_root>/src/`, matching `pio check --src-filters=+<src/>`. - Research memo `ci/docs/fbuild-static-analysis-research.md` documents the `clang-tool-chain` API surface and fbuild's compile-DB behavior. Closes #2301 (fbuild static-analysis support), #2302 (esp32c2 regression). Phase A of #2303 — IWYU migration onto the same pathway lands in a follow-up PR. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * review(ci-cppcheck): resolve relative compile-DB file paths per JSON spec Per the JSON Compilation Database spec, the `file` field may be absolute or relative to the entry's `directory` field. The previous code used `Path(raw).resolve()` which resolves against the Python CWD, so a relative `file` would resolve incorrectly and be silently filtered out of the src/ list — potentially yielding zero TUs (and a success return) even though fbuild had actually emitted source entries. Fix: when `file` is relative, resolve it against the entry's `directory` (falling back to the compile DB's parent when `directory` is missing), matching what clang-tidy / clangd itself does. Addresses CodeRabbit on PR #2307 (ci/ci-cppcheck.py:128, fingerprint f24a46e1). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * review(fbuild-compiledb): canonical fbuild arg order + stderr + KeyboardInterrupt Two CodeRabbit fixes on PR #2307: - Move `str(project_root)` to position 1 (before `build`), matching the canonical FastLED fbuild invocation pattern at `ci/util/fbuild_runner.py:104-114`: `[fbuild, <project_dir>, build, -e <env>, …]`. `cwd=str(project_root)` stays set so config discovery is identical regardless of whether the positional is honored by a given fbuild version. - Route the failure message to `sys.stderr` for stream consistency with the caller in `ci/ci-cppcheck.py`, and add an explicit `KeyboardInterrupt` re-raise ahead of the broader exception tuple so Ctrl-C can never be swallowed if the tuple is extended later. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
esp32c2workflow has been red on every commit since perf(ci): use fbuild for ESP32 QEMU merged-bin builds #2292 (2026-04-18). TheCPP Checkstep fails becausepio checkcan't resolvehuge_app.csvin the PIO project tree — fbuild compiles without populating that file.ci/ci-cppcheck.pynow detects when fbuild was the active backend (by probing.build/.fbuild/build/<env>/release/) and skipspio checkwith a visibleSKIP:notice, returning 0.Why this is safe as a short-term measure
Issues
pio checkcan't resolvehuge_app.csvafter fbuild compile #2302 (esp32c2 CI regression)clang-tool-chain-binintegration for IWYU + cppcheck + other linting)Test plan
esp32c2workflow goes green on this branch (previous run: https://github.com/FastLED/FastLED/actions/runs/24598125268 — red withUserSideException: ... Missing partition table file huge_app.csv)was_compiled_with_fbuild()returns False for nonexistent path, True when the fbuild release dir exists (verified during development)🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes