test(features): build tests/api under single-language feature sets - #1452
Merged
Merged
Conversation
Sweeping all 22 single-language subsets of `-p big-code-analysis
--all-targets` under `clippy -D warnings` found five failing legs, not
the two the issue reported, from three distinct defects — every one of
them a hand-maintained `cfg` union in `tests/api/ast_seam_test.rs` that
had drifted from the items it gates:
c `PathBuf` / `MetricsOptions` gated on
`rust`/`python`/`cpp`, used by a `c`-gated test: the
imports vanish and the test cannot resolve them (E0433).
cpp, python `ops_tree_contains_operator` gated on three languages
with one `rust`-gated caller: it builds unused
(`dead_code`).
tcl, irules the two-row Tcl-family table in
`count_string_agrees_with_find_on_tcl_family_bodies`
has cfg-gated rows, so enabling one of the pair leaves
a singleton (`clippy::single_element_loop`).
`LANG` / `Source` carried the same `c`-shaped drift as `PathBuf`, and
the sweep reported that leg green anyway: its union ended in
`not(feature = "javascript")`, which is true in every single-language
build, so the union was satisfied without any language arm and none of
them was load-bearing. The arm was load-bearing for a real reason — the
two `LanguageDisabled` tests need these names with no language enabled
at all — so it is not simply dropped: those two tests import the names
themselves, and the shared union becomes the bare language list. That
is what makes each language's own leg able to see a dropped arm.
The unions are corrected; the helper narrows to its sole caller's gate;
the table becomes two `#[cfg]` blocks calling a shared `check`,
matching the sibling test above it and correct at one row or two. The
`#[cfg(any(tcl, irules))]` gate on the `fn` and the `ran > 0`
non-vacuity assertion both stay, per `.claude/rules/testing.md`.
CI could not see any of it: `feature-matrix` built only `default`,
`no-default-features` and `minimal-langs`, and `rust` is in the last of
those, so nearly every union was satisfied by accident. The job now
runs `cargo clippy --all-targets -- -D warnings` instead of `cargo
check`, which reaches the `single_element_loop` class `check` does not
run at all (the other two are already hard errors under this workflow's
top-level `RUSTFLAGS: -D warnings`). It gains single-language legs `c`,
`go`, `python` and `tcl` for the library and `go` for the parse layer.
All ten pre-existing legs were verified against the stricter command
first.
The library itself always built, so no published configuration was
affected. Tests that compile under a partial feature set and panic at
run time are a separate class, still open as #1285 / #1413; the `c` leg
has 24 of them in `suppression_test.rs` and `derive_eq_hash_ord.rs`,
untouched here.
Verified by re-running the same 22-leg sweep after the fix: 22 pass, 0
fail, against 17/5 before. `big-code-analysis-ast` was clean on all 22
both times. Each corrected union was confirmed load-bearing by
perturbation, and the `LANG` / `Source` restructure by the pair that
motivates it: with the old union, dropping `feature = "c"` still
compiles under `--features c` (exit 0 — the leg is blind); with the
bare language list the same drift is an `E0433`.
Fixes #1426
dekobon
added a commit
that referenced
this pull request
Sep 14, 2026
Brings in #1460 (rustls 0.23.45, clearing RUSTSEC-2026-0285) and #1452 (single-language feature subsets build their tests again). The only conflict was `CHANGELOG.md`, where both sides inserted at the top of `### Fixed` — additive on both sides, so both are kept. The rustls entry merged cleanly into `### Security`. `.bca-baseline.toml` is `-merge` in `.gitattributes` and would have come back wholly conflicted had both sides touched it; main did not, so the branch's regenerated values carry through unchanged. Nothing main brings in moves a metric: its changes are CI config, a lockfile, a changelog and a test file.
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.
Fixes #1426.
What was broken
Sweeping all 22 single-language subsets of
-p big-code-analysis --all-targetsunderclippy -D warningsfound five failing legs, not thetwo the issue reported, from four distinct
cfg-union defects — every oneof them in
tests/api/ast_seam_test.rs, and every one a hand-maintained unionthat had drifted from the items it gates.
cPathBuf/MetricsOptionsgatedany(rust, python, cpp), used by ac-gated test — union too narrowE0433cpp,pythonops_tree_contains_operatorgated on three languages with onerust-gated caller — union too widedead_codetcl,irulesclippy::single_element_loopLANG/Sourcecarried the samec-shaped drift, but no leg could see itE0433, only underc,javascriptThe
cpp/pythonclass is the exact mirror of the reportedcone: thesame union, wrong in the other direction.
The library itself always built, so no published configuration was
affected. This was a contributor-facing break, and a costly one, because
--features gois the subset.claude/rules/testing.mdtells contributors torun and the compile error landed in a file unrelated to their change — the
same false-attribution failure as #1220 / PR #1221 and #1286, one layer down.
The fourth defect is the interesting one
LANG/Sourcewas gated:#[cfg(any(rust, python, c, cpp, tcl, irules, not(feature = "javascript")))]not(feature = "javascript")is true in every single-language build, so theunion was satisfied without any language arm and none of the six was
load-bearing on any leg. The 22-leg sweep that found the other three
defects reported this line green while it was defective.
The arm exists for a real reason — the two
LanguageDisabledtests need thosenames with no language enabled — so it is not simply deleted. Those two
tests now import the names themselves and the shared union becomes the bare
language list, which makes every arm load-bearing on its own language's leg.
Measured rather than argued — perturb the
carm out, build--features c:not(feature = "javascript")error[E0433]An earlier revision of this branch instead added a
c,javascriptCI leg. Thatis superseded: it would have gated the
carm alone and left the other fiveas blind as before.
Changes
tests/api/ast_seam_test.rsPathBufandMetricsOptionsunions gainfeature = "c".ops_tree_contains_operatornarrows tofeature = "rust", its solecaller's gate.
LANG/Sourcegainsfeature = "c"and drops itsnot(feature = "javascript")arm; the twoLanguageDisabledtests importlocally.
count_string_agrees_with_find_on_tcl_family_bodiesdrops the cfg-gated rowtable for two
#[cfg]blocks calling a sharedcheck, matching the siblingtest directly above it and correct at one row or two. The
#[cfg(any(tcl, irules))]gate on thefnand theran > 0non-vacuityassertion both stay, per
.claude/rules/testing.md..github/workflows/ci.yml,feature-matrixcargo check --all-targets→cargo clippy --all-targets -- -D warnings.single_element_loopis a clippy lintchecknever runs at all; the othertwo classes are already hard errors here because the workflow sets
RUSTFLAGS: "-D warnings"top-level. The explicit-- -D warningsisinsurance against that env var being narrowed later.
c,go,python,tcl(lib) andgo(ast).On the leg choice: the issue suggested
goalone, which would have caughtnone of the defects — it enables none of the five features the shared
items in
ast_seam_test.rsare gated on. It is kept (it is the subset thetesting rule names, and it does compile Go's own gated code under
src/—thirteen
feature = "go"gates, including a test), but the discriminatinglegs are
c,pythonandtcl.Verification
both times, and the before run was not uniform — three distinct error texts
— so the harness discriminates rather than describing itself.
clean each time via an in-memory backup, never a file-level
git checkout(
.claude/rules/testing.md).before the promotion landed, so no unrelated failure rides in with it.
LanguageDisabledtests run and pass under--no-default-features(zero languages — the case the local imports existfor) and under
--features rust, where the shared and local imports areboth in scope, with no shadowing warning.
--features tcl,--features irulesand--all-features, not merely compile.make pre-commit:BCA_GATE: pass (gate=pre-commit).make actionlintclean.
Scope
Compile failures only. Tests that compile under a partial feature set and
panic at run time are a separate class, tracked in #1285 / #1413 — running
cargo test --no-default-features --features c --test apinow that itcompiles gives 24 such failures, all in
suppression_test.rs(20) andderive_eq_hash_ord.rs(4), which parse Rust fixtures with norustgate.ast_seam_testitself is clean on that leg. Untouched here.No public API change, so no
STABILITY.mdcross-reference is required.