Skip to content

fix(config): refuse [platformio] extra_configs instead of silently ignoring it - #1928

Merged
zackees merged 1 commit into
mainfrom
agent/reject-extra-configs
Nov 6, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/reject-extra-configs

Conversation

@zackees

@zackees zackees commented Nov 6, 2026

Copy link
Copy Markdown
Member

The gap

PlatformIO's [platformio] extra_configs extends platformio.ini with other
INI files: the referenced files are merged over the base file (later values win,
globs allowed), and the docs' own example puts framework = espidf in the extra
file. fbuild reads only platformio.ini — git grep extra_configs returns
zero hits in crates/, ci/ and docs/ — so a project that uses the key
is built from a strict subset of what it declares, with no diagnostic.

That is the "honor or reject" failure mode already fixed for bare
framework = espidf in #1664/#1730: a build that succeeds while reporting a
configuration the project never asked for. Here the divergence can be anything —
framework, board, build_flags, or a whole [env:*] section.

Reproduction (RED, before this change): a project whose base file says
framework = arduino and whose extra_envs.ini says framework = espidf
parses cleanly and resolves s3 as an Arduino environment — the extra file is
never opened.

The change

PlatformIOConfig::from_path now refuses the project, before any caller
resolves an environment against a partial view:

[platformio] extra_configs = extra_envs.ini is unsupported: fbuild reads only
platformio.ini, so every setting declared in that file (framework, board,
build_flags, env sections, ...) would be silently ignored and the project would
build with different settings than it declares. Inline those settings into
platformio.ini, or build this project with PlatformIO (see FastLED/fbuild#1664)

Rejecting in the parser covers every entry point that loads a project
(build, deploy, monitor, libraries, clangd, ide, reset, …).

Deliberately narrow, to avoid false reds:

  • an empty value, or a value that is only a comment, declares no file and is
    accepted;
  • a same-named key inside [env:*] is not a file include in PlatformIO
    either, so it is not treated as one here.

Tests

New crates/fbuild-config/src/ini_parser/tests_extra_configs.rs (6 tests; a
sibling module because tests.rs is 983 lines and the LOC gate recomputes
against the base SHA):

  • the extra file's framework = espidf cannot slip past: the project is refused
    and the message names both extra_configs and the referenced file;
  • every declared file is named in one multi-line value, inline comments are not;
  • a [platformio] section that also sets default_envs is still refused;
  • glob values are refused;
  • empty and comment-only values are accepted, and the environment still resolves;
  • the [env:*] spelling is not refused.

Verification

  • soldr cargo test -p fbuild-config --lib → 240 passed, 0 failed, 1 ignored;
    the 6 new tests pass.
  • RED proven by removing the reject_extra_configs(&sections)? call: the 3
    refusal tests fail, the 3 accept-tests still pass (they are the
    no-false-red direction).

Not in this PR

Honoring extra_configs — merging files with later-wins semantics, glob
expansion, per-env merging and ${} resolution across files — is a separate
feature with its own risk; refusing keeps today's behavior honest until then.

PlatformIO merges the files listed in `[platformio] extra_configs` over
`platformio.ini` (later values win, globs allowed), so an environment's
framework, board, build_flags or a whole `[env:*]` section can live in a
file fbuild never opens. fbuild had no reference to the key at all, so such
a project silently built from a subset of what it declares -- the same
false-coverage failure fixed for a bare `framework = espidf` in #1664/#1730.

Reject the project in the parser, which covers every entry point that loads
a project, and name the files that were declared. An empty or comment-only
value declares nothing and is accepted; the key outside `[platformio]` is
not a file include in PlatformIO either, so it is not refused here.

Tests: 6 new cases in a sibling module (tests.rs is 983 LOC). RED proven by
removing the guard call: the 3 refusal tests fail, the 3 accept tests pass.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@zackees
zackees added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 2c9ef4f Nov 6, 2026
31 checks passed
@zackees
zackees deleted the agent/reject-extra-configs branch November 6, 2026 05:46
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant