Skip to content

test(features): build tests/api under single-language feature sets - #1452

Merged
dekobon merged 1 commit into
mainfrom
fix/1426-single-language-feature-legs
Sep 14, 2026
Merged

dekobon merged 1 commit into
mainfrom
fix/1426-single-language-feature-legs

Conversation

@dekobon

@dekobon dekobon commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Fixes #1426.

What was broken

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 four distinct cfg-union defects — every one
of them in tests/api/ast_seam_test.rs, and every one a hand-maintained union
that had drifted from the items it gates.

Leg(s) Defect Diagnostic
c PathBuf / MetricsOptions gated any(rust, python, cpp), used by a c-gated test — union too narrow E0433
cpp, python ops_tree_contains_operator gated on three languages with one rust-gated caller — union too wide dead_code
tcl, irules two-row Tcl-family fixture table with cfg-gated rows collapses to a singleton clippy::single_element_loop
(no leg) LANG / Source carried the same c-shaped drift, but no leg could see it E0433, only under c,javascript

The cpp / python class is the exact mirror of the reported c one: the
same 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 go is the subset .claude/rules/testing.md tells contributors to
run 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 / Source was gated:

#[cfg(any(rust, python, c, cpp, tcl, irules, not(feature = "javascript")))]

not(feature = "javascript") is true in every single-language build, so the
union 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 LanguageDisabled tests need those
names 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 c arm out, build --features c:

union shape result
with not(feature = "javascript") exit 0 — the leg is blind
bare language list (shipped) error[E0433]

An earlier revision of this branch instead added a c,javascript CI leg. That
is superseded: it would have gated the c arm alone and left the other five
as blind as before.

Changes

tests/api/ast_seam_test.rs

  • PathBuf and MetricsOptions unions gain feature = "c".
  • ops_tree_contains_operator narrows to feature = "rust", its sole
    caller's gate.
  • LANG / Source gains feature = "c" and drops its
    not(feature = "javascript") arm; the two LanguageDisabled tests import
    locally.
  • count_string_agrees_with_find_on_tcl_family_bodies drops the cfg-gated row
    table for two #[cfg] blocks calling a shared check, matching the sibling
    test directly 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.

.github/workflows/ci.yml, feature-matrix

  • cargo check --all-targetscargo clippy --all-targets -- -D warnings.
    single_element_loop is a clippy lint check never runs at all; the other
    two classes are already hard errors here because the workflow sets
    RUSTFLAGS: "-D warnings" top-level. The explicit -- -D warnings is
    insurance against that env var being narrowed later.
  • New legs: c, go, python, tcl (lib) and go (ast).

On the leg choice: the issue suggested go alone, which would have caught
none of the defects — it enables none of the five features the shared
items in ast_seam_test.rs are gated on. It is kept (it is the subset the
testing rule names, and it does compile Go's own gated code under src/
thirteen feature = "go" gates, including a test), but the discriminating
legs are c, python and tcl.

Verification

  • Full 22-leg sweep: 22 pass, 0 fail, against 17/5 before. Same script
    both times, and the before run was not uniform — three distinct error texts
    — so the harness discriminates rather than describing itself.
  • Every corrected union confirmed load-bearing by perturbation, restoring
    clean each time via an in-memory backup, never a file-level git checkout
    (.claude/rules/testing.md).
  • All ten pre-existing matrix legs verified passing under the stricter command
    before the promotion landed, so no unrelated failure rides in with it.
  • The two LanguageDisabled tests run and pass under
    --no-default-features (zero languages — the case the local imports exist
    for) and under --features rust, where the shared and local imports are
    both in scope, with no shadowing warning.
  • The Tcl-family tests run and pass under --features tcl,
    --features irules and --all-features, not merely compile.
  • make pre-commit: BCA_GATE: pass (gate=pre-commit). make actionlint
    clean.

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 api now that it
compiles gives 24 such failures, all in suppression_test.rs (20) and
derive_eq_hash_ord.rs (4), which parse Rust fixtures with no rust gate.
ast_seam_test itself is clean on that leg. Untouched here.

No public API change, so no STABILITY.md cross-reference is required.

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
dekobon merged commit 78a11ec into main Sep 14, 2026
48 checks passed
@dekobon
dekobon deleted the fix/1426-single-language-feature-legs branch September 14, 2026 16:43
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(features): single-language legs fail to build tests/api/ast_seam_test.rs

1 participant