Skip to content

fix(filters): repair never-activating filters and make the test harness check match_command - #3424

Open
RawNuke wants to merge 4 commits into
rtk-ai:developfrom
RawNuke:fix/dead-toml-filters-and-test-harness
Open

fix(filters): repair never-activating filters and make the test harness check match_command#3424
RawNuke wants to merge 4 commits into
rtk-ai:developfrom
RawNuke:fix/dead-toml-filters-and-test-harness

Conversation

@RawNuke

@RawNuke RawNuke commented Aug 4, 2026

Copy link
Copy Markdown

Closes #3402

What was wrong

Three TOML filters could never fire, and the test harness validated only the transform (apply_filter) — never match_command — so rtk verify and CI reported them green.

  1. gradle.toml: ^(gradle|gradlew|\./)gradlew?\b demanded the literal text twice (gradle build and gradlew build never matched; only ./gradlew did, which file_name() strips and which clap routes to the Rust Gradlew module before fallback anyway).
  2. gcc.toml: ^g(cc|\+\+)\b could never match g++ — there is no word boundary after +.
  3. dotnet-build.toml / uv-sync.toml: shadowed by clap (Commands::Dotnet, Commands::Uv route before run_fallback consults filters).

The fix

  • gradle.toml: ^gradle\b — the half that actually reaches the TOML fallback (gradlew is clap-routed; verified with RTK_TOML_DEBUG=1: rtk gradle build matches the filter, rtk gradlew build never reaches it).
  • gcc.toml: ^(gcc|g\+\+)(\s|$)gcc -c main.c and g++ -o main main.cpp both verified to match.
  • dotnet-build.toml / uv-sync.toml: deleted — they could never activate; their inline tests were always-green noise.

The harness now checks activation

[[tests.X]] accepts an optional command field. When present, the harness asserts the filter's match_command actually matches that command; a dead pattern fails instead of passing transform-only tests. The gradle and gcc tests carry activation commands, so this class can't recur silently.

The drift guard

RUST_HANDLED_COMMANDS had drifted from the clap enum — that is why the existing shadow warning never caught dotnet-build and uv-sync. It is now completed (dotnet, uv, gradlew, mvn, gt, sbt, oc, rg, jest, rake, rspec, rubocop, pest, ecs, pint, php, phpunit, phpstan, paratest, cc-economics, session, telemetry, learn, run, hook, hook-audit, untrust, glab), and a new test derives every clap subcommand name from Cli::command() and asserts each is reserved — it flagged telemetry and untrust during development, and will flag any future variant the moment it is added.

Verification

  • rtk verify: 150/150 tests pass.
  • cargo test: 2571 pass, 0 fail.
  • cargo clippy --all-targets: clean.
  • Manual: gradle build, gcc -c main.c, g++ -o main main.cpp all activate their filters; no spurious shadow warning.

RawNuke added 4 commits August 5, 2026 00:14
yadm manages a separate dotfiles repository whose work-tree is HOME.
The git rewrite rule enumerated yadm in its pattern and rewrite
prefixes, so yadm commit/push/checkout/add were rewritten to 'rtk git'
and acted on whatever project the shell was standing in. Remove yadm
from the rule; the yadm filter now routes yadm to the yadm binary as
'rtk yadm <subcommand>', matching the already-correct 'yadm list' path.

run_add also injected '.' when git add had no pathspec, turning real
git's deliberate no-op into a whole-worktree stage. A bare 'rtk git add'
now passes no pathspec, so nothing gets staged implicitly.

Closes rtk-ai#3408
The uninstall dispatcher routed Hermes, Droid, Cursor and Pi explicitly
and sent everything else to the Claude uninstaller. Windsurf, Cline,
Kilocode, Antigravity and Kimi fell into that else arm with both the
cursor and pi flags false, which is exactly the Claude path: the
uninstall deleted ~/.claude/RTK.md, rewrote ~/.claude/CLAUDE.md and
stripped the hook from ~/.claude/settings.json while removing nothing
for the named agent (issue rtk-ai#3404).

Replace the if/else chain with an explicit match on AgentTarget. The
five unwired agents now return 'uninstall is not supported for
--agent <name>' instead of silently uninstalling a different agent, and
the compiler flags the next variant someone adds to the enum.

Tests cover Hermes, Cursor, Pi routing, the Claude default, and
fail-closed errors for all five unwired agents without touching the
standard uninstaller.

Closes rtk-ai#3404
…ss check match_command

Three of the TOML filters could never fire, and the test harness only
exercised the transform, never match_command, so they reported green in
rtk verify and CI (issue rtk-ai#3402).

- gradle.toml: pattern ^(gradle|gradlew|\./)gradlew?\b demanded the
  literal text twice; no real invocation matched. The gradlew half is
  routed to the Rust Gradlew module by clap before fallback, so the
  filter now matches ^gradle\b (the half that actually reaches it).
- gcc.toml: ^g(cc|\+\+)\b could never match g++ (no word boundary
  after +). Now ^(gcc|g\+\+)(\s|$).
- dotnet-build.toml and uv-sync.toml were shadowed by clap subcommands
  (Commands::Dotnet, Commands::Uv route before run_fallback) and could
  never activate. Deleted, per the issue's suggested direction.

The harness now supports an optional command field on [[tests.X]]: when
present it asserts the filter's match_command actually matches that
command, so a dead pattern fails instead of passing on transform-only
tests. gradle/gcc tests carry activation commands.

RUST_HANDLED_COMMANDS had drifted from the clap enum (that is why the
shadow warning never caught dotnet-build and uv-sync). It is now
completed, and a new test derives every clap subcommand name from
Cli::command() and asserts each one is reserved, so a new Commands
variant is flagged the moment it is added.

Closes rtk-ai#3402
@CLAassistant

CLAassistant commented Aug 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@RawNuke

RawNuke commented Aug 4, 2026

Copy link
Copy Markdown
Author

The pull request is complete. The work was done as a free contribution.
If you found it useful, a tip is appreciated:

  • EVM (ETH, USDC, USDT, Base): 0x9C7d9BfC606D3D5B5fB22C199495cF7207C5Cd16
  • Bitcoin: bc1qswtgp6a0dp4qpsstf0jsrnzgquq80nzy2g5nmm
  • Solana: EW4SCPWMiATUC53Apkaxw9EDKLRQtm8oTGAzk4XhDcP9
  • Tron: TBEJYtPeK1owFA6P67dKtBntSU6u29PwsH
  • Base: 0x9C7d9BfC606D3D5B5fB22C199495cF7207C5Cd16

No tip is expected. The contribution stands on its own.

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.

gradle, dotnet-build and uv-sync filters can never activate — and rtk verify reports them green because the test harness never exercises match_command

2 participants