Repository navigation
Description
Three of the 63 TOML filters cannot fire. Their inline tests all pass, so nothing surfaces the problem — the test harness validates the transformation but never the matching.
Provenance: AI-assisted source audit, human-directed, at v0.44.2 (700bdde). All 63 filter files were read; the regex claims were verified by executing the patterns. No wrapped tool was run.
Why the tests cannot catch it
src/core/toml_filter.rs:761:
for test in tests {
let actual = apply_filter(compiled, &test.input);The harness feeds test.input straight into apply_filter. match_command is never evaluated. So a filter whose pattern can never match a real command still reports every test green, in rtk verify and in CI.
1. gradle.toml:3 — the pattern requires the literal text twice
match_command = "^(gradle|gradlew|\./)gradlew?\b"The alternation consumes gradle/gradlew/./, and then gradlew? demands another gradle or gradlew. Verified by executing the pattern:
gradle build→ no matchgradlew build→ no match./gradlew build→ matches
And even that last case does not reach the filter: src/main.rs:1306-1309 takes file_name() before lookup, which strips ./, and Commands::Gradlew (main.rs:814 → 2411) routes it to the Rust module first anyway.
Net: 35 lines of configuration and 3 always-green tests for a filter that cannot activate. The intended pattern is presumably ^(\./)?gradlew?\b.
2 & 3. dotnet-build.toml and uv-sync.toml are shadowed by clap subcommands
rtk dotnet build is handled by Commands::Dotnet (main.rs:282 → 1899-1900, dotnet_cmd::run_build), and rtk uv … by Commands::Uv (main.rs:780 → 2383). Clap routes both before run_fallback ever consults the TOML filters, so neither definition is reachable — 64 and 37 lines respectively, plus 5 green tests.
The guard that exists for exactly this is stale
src/core/toml_filter.rs:315-326 already warns about this situation:
// Shadow warning: if match_command matches a Rust-handled command, this filter
// will never activate (Clap routes before run_fallback). Warn the author.
for cmd in RUST_HANDLED_COMMANDS {
if match_regex.is_match(cmd) { ... }
}But RUST_HANDLED_COMMANDS (:250-300) has drifted from the clap enum. Comparing the two, these subcommands exist in Commands but are absent from the list:
dotnet, uv, gradlew, mvn, gt, sbt, oc, rg, jest, rake, rspec, rubocop, pest, ecs, pint, and the php* family.
That is why dotnet-build and uv-sync were not caught by the mechanism written to catch them.
Suggested directions (untested)
- Fix the harness first — have the test runner check
match_commandagainst a sample command (either a newtest.commandfield, or by asserting the pattern matches at least one plausible invocation). Without that, this class recurs silently. - Derive
RUST_HANDLED_COMMANDSfrom the clap enum rather than maintaining it by hand, so it cannot drift again. If that is awkward, a test asserting everyCommandsvariant name appears in the list would catch the drift. - Then decide per filter: fix
gradle.toml's pattern, and deletedotnet-build.toml/uv-sync.toml(or keep them as documentation with a comment saying they are shadowed).
One more in the same family
src/filters/gcc.toml:3 is ^g(cc|\+\+)\b. \b cannot follow +, so g++ -o a main.cpp does not match (verified). The gcc half works; the g++ half is dead while gcc.toml:2 describes the filter as handling "gcc/g++". Harmless — it falls through to raw passthrough — but the description overstates what it does.
Activity
pszymkowiak commentedon Aug 4, 2026
🔍 Automated Triage
bugmediumSummary
Three TOML filters (gradle, dotnet-build, uv-sync) can never match/activate because the test harness never exercises match_command and the shadow-warning guard's RUST_HANDLED_COMMANDS list has drifted from the clap enum; fix the harness to test matching, resync/derive the shadow list, and correct or remove the dead filters.
📁 Relevant files
src/core/toml_filter.rssrc/filters/gradle.tomlsrc/filters/dotnet-build.tomlsrc/filters/uv-sync.tomlsrc/filters/gcc.tomlsrc/main.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
KuSh commentedon Sep 24, 2026
Re-verified this whole list against
develop(005eb9c5) with stand-in tools, since the audit was done at v0.44.2. Everything here still holds, and I have two more in the same family.gradle.tomlis about to be handled differently from the rest: #2709 deletes it rather than repairing its pattern. Widening it turned out to be actively harmful —gradlesorts beforespring-bootin the name-orderedBTreeMapand first match wins, so any pattern that matchesgradle bootRuntakes that command away fromspring-boot.tomland replaces a diagnosed startup failure with head-truncated INFO noise. So item 1 here is closed by removal, and the filter's own inline tests go with it.The other three are unchanged on current
develop:Two more holes in the same class
1.
test_builtin_all_expected_filters_presentguards only 41 of the filters. It documents itself as "the safeguard against accidentally deleting a filter file", but itsexpectedarray is a hand-maintained subset. Verified by mutation: deletesrc/filters/turbo.toml, bumptest_builtin_filter_countandtest_new_filter_discoverable_after_concatby one, and all four enumerating tests pass — the filter is silently gone. The unguarded names arebasedpyright,biome,bundle-install,gcc,jira,jj,jq,just,mise,nx,ollama,oxlint,skopeo,spring-boot,ssh,stat,task,turbo,ty,xcodebuild,yadm.Worth noting that
gccandspring-bootare both on that list, so the two filters this issue cares about most are also the ones the safeguard cannot see. Deriving the list fromsrc/filters/*.tomlat build time would close it.2.
build.rs:54's duplicate-filter-name detection is unreachable. Verified by adding a copy ofmake.toml: the build fails earlier, atbuild.rs:48, withTOML validation failed for combined filters: duplicate keymakein tablefilters`` — the combined document's own parse rejects the duplicate key beforeparsed.get("filters")runs. Duplicates are still caught loudly, so this is a dead diagnostic rather than a hole, but the dedicated message never fires.On the harness
The
commandfield on[[tests.X]]proposed in #3424 is the right shape for this — it makes a dead pattern fail instead of passing transform-only tests, which is what would have caught all four of these at authoring time. Combined with completingRUST_HANDLED_COMMANDSfromCli::command(), that closes the class rather than the instances.HetCreep commentedon Oct 14, 2026
Re-checked on v1.0.0 (stable, 2026-10-13): the official release binary plus the v1.0.0 source. Provenance: AI-assisted check, human-directed. "ran" = executed against
rtk 1.0.0with a control; "read" = verified from source only.Fixed: item 1.
gradle.tomlwas removed in757188f8;rtk rewrite "gradle build"now goes tortk gradlew build(ran). Thanks.Still live at v1.0.0 (read + ran):
dotnet-build.tomlanduv-sync.tomlare still shadowed:Commands::Dotnet(src/lib.rs:405) andUv(:992) route first;RUST_HANDLED_COMMANDS(src/core/toml_filter.rs:266-318) still lacksdotnet/uv(and others), sortk verifycannot say they are dead.toml_filter.rs:874) callsapply_filter(compiled, &test.input)and never evaluatesmatch_command.gcc.toml:3pattern^g(cc|\+\+)\b: theg++half does not matchg++ -o a main.cpp;rtk rewrite "g++ -o a main.cpp"exits 1 with no output, controlgcc a.c->rtk gcc a.c.rtk verifyreports 151/151 pass.main.rsis now a stub, so the routing cites are insrc/lib.rs.