Skip to content

fix(discover): read ignored commands as whole words - #5022

Open
KuSh wants to merge 1 commit into
rtk-ai:developfrom
KuSh:fix/discover-ignored-words
Open

KuSh wants to merge 1 commit into
rtk-ai:developfrom
KuSh:fix/discover-ignored-words

Conversation

@KuSh

@KuSh KuSh commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

rtk discover compared ignored commands as raw prefixes, so waitress-serve x, wait-for-it x, truecrypt x and pwdx 1 vanished from the report because they start with wait, true or pwd. echo<tab>a and sleep<tab>1 were listed as unsupported because only a space counted.

Those commands are now compared with the command's first word as the lexer reads it, through a new lexer::first_plain_word. wait<tab>1, pwd), true>f and wait& stay out of the report, and rm$x file and test* are counted because they are other commands.

Behaviour changes

  • A bare word is now left out like its argument form: sleep alone, as sleep 1 already was.
  • The same check gates the hook's TOML fallback. A user's filter now applies to wait-for-it x, and no longer to bare sort or sort<tab>f, as it already did not to sort f.

Known limits

  • A glued backquote reads as the end of the word, so rm`x` file is left out. Telling it from the closing one in `cd x && pwd` needs more than the next character.
  • An escaped backslash in rm\\ x reads like a continuation.
  • A multi-line call is one part of the report, so a first line of sleep hides the lines after it. Splitting those lines needs the newline tokens in the lexing stack, and is planned there.

Test plan

  • cargo fmt --all, cargo clippy --all-targets, cargo test --all, and both with --no-default-features
  • Each boundary character fails a test when removed
  • Report compared before and after on 63 inputs: only these rows moved, and no rewrite changed

🤖 Generated with Claude Code

The report dropped any command that merely starts with `true`, `false`, `wait` or
`pwd`, such as `waitress-serve x`, `wait-for-it x` and `pwdx 1`, and listed
`echo<tab>a` as unsupported.

Those commands are now compared with the command's first word as the lexer reads it,
so `wait<tab>1`, `pwd)` and `true>f` stay out of the report and the others are
counted. The bare forms come along: `sleep` alone is left out as `sleep 1` is.

The same check gates the hook's TOML fallback, so a user's filter now applies to
`wait-for-it x`, and no longer to bare `sort`, as it already did not to `sort f`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working discover lexer labels Nov 5, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

Fixes rtk discover incorrectly treating ignored-command prefixes as raw string prefixes, which caused false negatives (e.g. waitress-serve, wait-for-it, truecrypt, pwdx wrongly excluded) and false positives (echo<tab>a, sleep<tab>1 wrongly reported as unsupported). Introduces a new lexer::first_plain_word helper to compare the command's actual first word as read by the lexer against an IGNORED_WORDS list, replacing the old IGNORED_EXACT/prefix-string approach, and applies th…

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working discover lexer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant