fix(filters): repair never-activating filters and make the test harness check match_command - #3424
Open
RawNuke wants to merge 4 commits into
Open
fix(filters): repair never-activating filters and make the test harness check match_command#3424RawNuke wants to merge 4 commits into
RawNuke wants to merge 4 commits into
Conversation
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
Author
|
The pull request is complete. The work was done as a free contribution.
No tip is expected. The contribution stands on its own. |
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.
Closes #3402
What was wrong
Three TOML filters could never fire, and the test harness validated only the transform (
apply_filter) — nevermatch_command— sortk verifyand CI reported them green.^(gradle|gradlew|\./)gradlew?\bdemanded the literal text twice (gradle buildandgradlew buildnever matched; only./gradlewdid, whichfile_name()strips and which clap routes to the RustGradlewmodule before fallback anyway).^g(cc|\+\+)\bcould never matchg++— there is no word boundary after+.Commands::Dotnet,Commands::Uvroute beforerun_fallbackconsults filters).The fix
^gradle\b— the half that actually reaches the TOML fallback (gradlewis clap-routed; verified withRTK_TOML_DEBUG=1:rtk gradle buildmatches the filter,rtk gradlew buildnever reaches it).^(gcc|g\+\+)(\s|$)—gcc -c main.candg++ -o main main.cppboth verified to match.The harness now checks activation
[[tests.X]]accepts an optionalcommandfield. When present, the harness asserts the filter'smatch_commandactually 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_COMMANDShad 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 fromCli::command()and asserts each is reserved — it flaggedtelemetryanduntrustduring 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.gradle build,gcc -c main.c,g++ -o main main.cppall activate their filters; no spurious shadow warning.