fix(registry): fi in IGNORED_PREFIXES shadows find commands#246
Merged
pszymkowiak merged 1 commit intortk-ai:masterfrom Feb 28, 2026
Merged
fix(registry): fi in IGNORED_PREFIXES shadows find commands#246pszymkowiak merged 1 commit intortk-ai:masterfrom
fi in IGNORED_PREFIXES shadows find commands#246pszymkowiak merged 1 commit intortk-ai:masterfrom
Conversation
The shell keyword "fi" was listed as a bare prefix in IGNORED_PREFIXES,
causing classify_command("find ...") to return Ignored because
"find".starts_with("fi") is true. This prevented find commands from
being rewritten by rtk rewrite and the hook system.
Move "fi" and "done" from IGNORED_PREFIXES to IGNORED_EXACT so they
only match as exact standalone keywords, not as prefixes of other
commands.
Fixes rtk-ai#170, rtk-ai#204, rtk-ai#236 (partially — find classification was the root
blocker for rtk rewrite).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes a command-classification bug in the discovery registry where shell keywords in the ignored prefix list caused unrelated commands (notably find) to be incorrectly classified as Ignored, preventing rewrite/hook interception.
Changes:
- Moves
fianddonefromIGNORED_PREFIXES(prefix match) toIGNORED_EXACT(exact match) to avoid shadowing commands likefind. - Adds regression tests ensuring
find ...is classified asSupportedwhile barefi/doneremainIgnored.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
heAdz0r
added a commit
to heAdz0r/rtk
that referenced
this pull request
Feb 28, 2026
…tk-ai#217, rtk-ai#196, rtk-ai#248, rtk-ai#211, rtk-ai#200, rtk-ai#192, rtk-ai#268) Wave 1 (critical bugs): - fix(registry): fi/done moved to IGNORED_EXACT — find no longer shadowed (rtk-ai#246) - fix(playwright): f64 duration, specs[] structure, --reporter=json after subcmd (rtk-ai#193) - fix(gh): should_passthrough_gh_view for --json/--jq/--template/--web in view_pr/issue/run (rtk-ai#217+196) Wave 2 (reliability): - fix(git): is_blob_show_arg — blob show passthrough without trailing-newline trim (rtk-ai#248) - fix(find): parse_find_args with native -name/-type/-maxdepth/-iname support (rtk-ai#211) - fix(main): graceful Clap fallback + parse_failures SQLite table + rtk gain --failures (rtk-ai#200) Wave 3 (UX): - feat(git): global options -C/-c/--git-dir/--work-tree/--no-pager/--no-optional-locks/--bare/--literal-pathspecs (rtk-ai#192) - feat(proxy): streaming output via spawn()+threads instead of buffered output() (rtk-ai#268) Tests: 1091 → 1117 (+26), 0 regressions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
Clean fix. Moving "fi" and "done" to IGNORED_EXACT is exactly right — the other shell keywords already used suffix delimiters ("do\n", "do ", "if ", etc.) to avoid this class of prefix Regression tests cover the important cases. LGTM. |
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
"fi"(shell keyword for endingifblocks) was listed as a bare string inIGNORED_PREFIXES"find".starts_with("fi")istrue, so allfindcommands were classified asIgnoredrtk rewrite "find ..."always returned exit 1 (no rewrite), making the hook system unable to interceptfindcommands"done"which could shadow hypothetical commands starting withdoneFix
"fi"and"done"fromIGNORED_PREFIXEStoIGNORED_EXACT(exact match only)registry.rsare fixedfindis nowSupported, barefianddoneremainIgnoredRoot cause analysis
Other shell keywords like
then,else,doalready used the"keyword\n"/"keyword "suffix pattern to avoid this.fianddonewere the only bare entries without a trailing delimiter.Test plan
cargo test— 416 passed, 0 failedrtk rewrite "find . -name foo"→rtk find . -name foo(was exit 1 before)rtk rewrite "git status"→rtk git status(no regression)rtk rewrite "ls -la"→rtk ls -la(no regression)Partially fixes #170, #204, #236 — those issues reported
findfailures due to flag syntax mismatch, but the deeper blocker was thatfindwas never classified as supported in the first place.