refactor!: trim the feature flags and stop testing their powerset - #70
Merged
Conversation
Seven flags produced a 127-job CI matrix (2^7 - 1), and most of those jobs told us nothing.
**Matrix.** `test-feature-matrix.py` enumerated the powerset. It now runs "nothing enabled", each
flag alone, and all together — N + 2 jobs. That finds the same bugs: a missing `#[cfg]` fails the
"alone" job and a conflict between flags fails the "all" job, while `task` x `prometheus`, which
share no code, never had anything to say. 127 jobs becomes 7.
**Flags.** `message` gated a 160-line module and a single `tokio/rt` feature, so it is always
available now, like configuration and validation. The remaining four each gate a dependency an
application might genuinely not want: `openapi` (oas, gotcha_core), `prometheus`
(axum-prometheus), `cors` and `static_files` (tower-http), `task` (cron).
**`cors` / `static_files` were broken, not redundant.** The dependency was declared as
`tower-http = { features = ["cors", "fs"] }`, so *either* flag enabled *both* halves — an
application that wanted only a CORS layer still compiled the whole static-file stack. Each flag
now enables only its own half (`tower-http/cors` costs nothing extra; `tower-http/fs` brings
http-range-header, futures-util, http-body-util and mime_guess). Measured: 186 crates with `cors`
alone against 192 with `static_files` alone.
BREAKING: `features = ["message"]` should be dropped — the message system is always available.
`cors` and `static_files` keep their names and meanings.
Verified locally: all seven combinations build and test, workspace builds with --all-features,
clippy --all-features, fmt.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Kilerd
force-pushed
the
refactor/feature-flags
branch
from
August 1, 2026 13:16
026ee72 to
104abaf
Compare
Merged
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.
Seven flags produced a 127-job CI matrix (2^7 − 1), and most of those jobs told us nothing.
A. Stop testing the powerset
test-feature-matrix.pyenumerated every subset. It now runs nothing enabled → each flag alone → all together: N + 2 jobs.That finds the same bugs. A feature that forgets a
#[cfg]fails its "alone" job; a conflict between two of them fails the "all" job.task×prometheusshare no code and never had anything to say. 127 jobs becomes 7.B. One flag removed, one pair repaired
messageis gone — it gated a 160-line module and a singletokio/rtfeature. The message system is now always available, like configuration and validation.cors/static_filesturned out to be broken, not redundant. The first version of this PR merged them, on the grounds that they were dependency-identical:But that sameness was the bug, not the design — either flag enabled both halves, so an application that only wanted a CORS layer still compiled the entire static-file stack. Each flag now enables only its own half:
tower-http/corscosts nothing extra (cors = []upstream);tower-http/fspullshttp-range-header,futures-util,http-body-util,mime_guessand friends. Measured on the real tree: 186 crates withcorsalone against 192 withstatic_filesalone.So the flags keep their names and meanings, and now they actually mean something.
Final flag set
openapioas,gotcha_coreprometheusaxum-prometheuscorstower-http/cors(no extra dependencies)static_filestower-http/fstaskcronfeatures = ["message"]should be dropped — the message system is always available.corsandstatic_filesare unchanged for callers.Verification
All seven combinations build and test locally, plus workspace build with
--all-features,cargo clippy --all-features --workspace,cargo fmt --check.🤖 Generated with Claude Code