fix(registry): fi in IGNORED_PREFIXES shadows find commands#246
Open
hoklims wants to merge 1 commit intortk-ai:masterfrom
Open
fix(registry): fi in IGNORED_PREFIXES shadows find commands#246hoklims wants to merge 1 commit intortk-ai:masterfrom
fi in IGNORED_PREFIXES shadows find commands#246hoklims wants to merge 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.
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.