Repository navigation
fix(config): refuse [platformio] extra_configs instead of silently ignoring it - #1928
Merged
Merged
Conversation
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.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gap
PlatformIO's
[platformio] extra_configsextendsplatformio.iniwith otherINI files: the referenced files are merged over the base file (later values win,
globs allowed), and the docs' own example puts
framework = espidfin the extrafile.
fbuildreads onlyplatformio.ini—git grep extra_configsreturnszero hits in
crates/,ci/anddocs/— so a project that uses the keyis 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 = espidfin #1664/#1730: a build that succeeds while reporting aconfiguration 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 = arduinoand whoseextra_envs.inisaysframework = espidfparses cleanly and resolves
s3as an Arduino environment — the extra file isnever opened.
The change
PlatformIOConfig::from_pathnow refuses the project, before any callerresolves an environment against a partial view:
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:
accepted;
[env:*]is not a file include in PlatformIOeither, so it is not treated as one here.
Tests
New
crates/fbuild-config/src/ini_parser/tests_extra_configs.rs(6 tests; asibling module because
tests.rsis 983 lines and the LOC gate recomputesagainst the base SHA):
framework = espidfcannot slip past: the project is refusedand the message names both
extra_configsand the referenced file;[platformio]section that also setsdefault_envsis still refused;[env:*]spelling is not refused.Verification
soldr cargo test -p fbuild-config --lib→ 240 passed, 0 failed, 1 ignored;the 6 new tests pass.
reject_extra_configs(§ions)?call: the 3refusal 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, globexpansion, per-env merging and
${}resolution across files — is a separatefeature with its own risk; refusing keeps today's behavior honest until then.