Skip to content

ci: check the feature powerset with cargo-hack - #191

Merged
sksat (sksat) merged 1 commit into
mainfrom
ci/cargo-hack-feature-powerset
Jun 5, 2026
Merged

ci: check the feature powerset with cargo-hack#191
sksat (sksat) merged 1 commit into
mainfrom
ci/cargo-hack-feature-powerset

Conversation

@sksat

Copy link
Copy Markdown
Member

What

Add a cargo hack check --feature-powerset step to CI so every feature combination of every workspace crate is compiled.

Why

The plugs always pull in kble-socket with both stdio and tungstenite. Thanks to Cargo's feature unification, a normal cargo test over the workspace therefore never builds kble-socket with a single feature on its own — so a crate can advertise a feature that fails to compile by itself and CI stays green.

That is exactly what happened: kble-socket with stdio alone (no tungstenite) has failed to compile since the repo was first opened (7c463ac, 2023-04-12):

error[E0432]: unresolved import `stdio::from_stdio`

from_stdio is #[cfg(feature = "tungstenite")] but was re-exported under #[cfg(feature = "stdio")]. #190 fixes the bug; this PR adds the guard that would have caught it (and will catch the next one).

Demonstrating the catch (RED → GREEN)

cargo hack check --feature-powerset --no-dev-deps -p kble-socket on the current main:

running `cargo check --no-default-features --features stdio` on kble-socket (4/8)
error[E0432]: unresolved import `stdio::from_stdio`
error: could not compile `kble-socket` (lib) due to 1 previous error

With #190's fix applied, all 15 workspace runs (incl. kble-socket's 8 combos) pass.

This PR's own CI is intentionally RED right now — it is running the new check against main, which still has the bug. It goes green once #190 merges and this branch is rebased. That red is the demonstration, not a defect.

Notes

  • kble-socket is the only crate with [features], so the powerset is just its 2³ = 8 combinations; other members are checked once (no features). No combinatorial blowup.
  • cargo-hack is installed via taiki-e/install-action (a prebuilt binary) rather than cargo install, because the latest cargo-hack's MSRV (1.85) already exceeds this repo's pinned toolchain (1.78). The prebuilt binary is toolchain-independent; the underlying cargo check still runs under the pinned 1.78.

🤖 Generated with Claude Code

Every plug enables kble-socket with both `stdio` and `tungstenite`, so a
workspace build never compiles a single feature on its own — a crate can
advertise a feature that fails to build by itself while CI stays green
(kble-socket's `stdio`-only build has been broken since the repo opened).

Run `cargo hack check --feature-powerset` over the workspace so every
feature combination is compiled. cargo-hack is installed as a prebuilt
binary via taiki-e/install-action rather than `cargo install`, so it need
not satisfy the project's pinned toolchain (the latest cargo-hack's MSRV
already exceeds it).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sksat
sksat (sksat) force-pushed the ci/cargo-hack-feature-powerset branch from fe577d2 to eb0e5c0 Compare June 5, 2026 01:39
@sksat
sksat (sksat) merged commit bdc39b4 into main Jun 5, 2026
2 checks passed
@sksat
sksat (sksat) deleted the ci/cargo-hack-feature-powerset branch June 5, 2026 01:44
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.

1 participant