Repository navigation
Conversation
…orted
`rtk discover` was flagging `git checkout`, `git clone`, `git remote`
and other unhandled-by-name git subcommands in its 'TOP UNHANDLED
COMMANDS -- open an issue?' section, even though `rtk git <anything>`
already works via the `run_passthrough` handler in `src/cmds/git/git.rs`.
This caused noise in the report and prompted users (and AI assistants
following RTK instructions) to file unnecessary 'add git X support'
issues, or worse, to conclude `rtk git checkout` doesn't work and keep
using bare `git checkout` without the proxy.
Root cause: the git rule in `src/discover/rules.rs` enumerates only the
subcommands with dedicated filters
(`status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree`).
Anything else falls through `classify_command` to `Unsupported`, which
populates the 'TOP UNHANDLED' bucket.
Fix: add `passthrough_parent_classification` to `classify_command` as
a fallback before the `Unsupported` return. For commands whose parent
has a `run_passthrough` handler (git, yadm), classify as
`Supported { rtk_status: Passthrough }` so the report shows them under
'MISSED SAVINGS' with status 'passthrough' instead of 'TOP UNHANDLED'.
`estimated_savings_pct: 0.0` keeps the savings totals honest (no
filter-based compression on the passthrough path).
The fallback runs only after the existing rule-matching fails, so:
- Known git subcommands (`git status`, `git diff`, ...) keep their
dedicated-filter classification with `status: Existing` and the
per-subcommand savings_pct (70%, 80%, etc).
- Yadm continues to share git's rewrite path (already configured via
`rewrite_prefixes: ["git", "yadm"]` on the existing rule).
5 regression tests added:
- `test_classify_git_checkout_passthrough` (the issue's example)
- `test_classify_git_clone_passthrough`
- `test_classify_git_remote_passthrough`
- `test_classify_yadm_checkout_passthrough` (yadm parity)
- `test_classify_git_status_still_uses_dedicated_filter` (sentinel
that the new fallback doesn't shadow the existing rule for known
subcommands)
Scope: git/yadm only, matching the issue. Other universal-proxy parents
(`cargo`, `pnpm`, `go`, `gh`, `glab`, `dotnet`, `pip`) also have
`run_passthrough` handlers; the same fix could extend to those once
the maintainer signals the direction is right.
All checks pass: cargo test 1875/1875, cargo fmt --check clean,
cargo clippy --all-targets -- -D warnings clean.
Fixes rtk-ai#1897.
Contributor
|
This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet. |
Contributor
|
Closing this pull request after a prolonged period of inactivity. If this is still relevant, please ask for it to be reopened. Thank you! |
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.
Summary
rtk discoverwas flagginggit checkout,git clone,git remoteand other unhandled-by-name git subcommands in itsTOP UNHANDLED COMMANDS -- open an issue?section, even thoughrtk git <anything>already works via the universalrun_passthroughhandler insrc/cmds/git/git.rs. The report would prompt users (and AI assistants following RTK instructions) to file unnecessary "add git X support" issues, or worse, to concludertk git checkoutdoes not work and to keep using baregit checkoutwithout the proxy.Root cause
The git rule in
src/discover/rules.rsenumerates only the subcommands with dedicated filters:Anything else (
checkout,clone,remote,fetch-pack,cat-file, ...) falls throughclassify_commandtoClassification::Unsupported, which populates theunsupportedbucket that the report renders underTOP UNHANDLED COMMANDS.Fix
Add
passthrough_parent_classificationtoclassify_commandas a fallback before the existingUnsupportedreturn. For commands whose parent has arun_passthroughhandler (git,yadm), classify asSupported { rtk_status: Passthrough }so the report shows them underMISSED SAVINGSwith statuspassthroughinstead ofTOP UNHANDLED.estimated_savings_pct: 0.0keeps the savings totals honest (no filter-based compression on the passthrough path).The fallback runs only after the existing rule-matching fails, so:
git status,git diff, ...) keep their dedicated-filter classification withstatus: Existingand the per-subcommandsavings_pct(70%, 80%, etc).rewrite_prefixes: ["git", "yadm"]on the existing rule).Test plan
5 regression tests added to
mod testsinsrc/discover/registry.rs:test_classify_git_checkout_passthrough(the issue's example:git checkout -b my-branch)test_classify_git_clone_passthroughtest_classify_git_remote_passthroughtest_classify_yadm_checkout_passthrough(yadm parity)test_classify_git_status_still_uses_dedicated_filter(sentinel that the new fallback does not shadow the existing rule for known subcommands, sincematches.last()picks the more specific later match)All checks pass:
cargo test: 1875 passed, 0 failed, 6 ignored.cargo fmt --check: clean.cargo clippy --all-targets -- -D warnings: clean.Scope
Git/yadm only, matching the issue. Other universal-proxy parents (
cargo,pnpm,go,gh,glab,dotnet,pip) also haverun_passthroughhandlers; the same fix could extend to those once the maintainer signals the direction is right.Fixes #1897.