Skip to content

fix(filters): stop the task filter matching hyphenated commands - #4776

Open
sarankumar1325 wants to merge 1 commit into
rtk-ai:developfrom
sarankumar1325:fix/task-filter-hyphenated-commands
Open

sarankumar1325 wants to merge 1 commit into
rtk-ai:developfrom
sarankumar1325:fix/task-filter-hyphenated-commands

Conversation

@sarankumar1325

Copy link
Copy Markdown

Summary

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test (all pass, clippy clean)
  • New test_task_match_command_excludes_task_dash_commands (toml_filter.rs) and test_rewrite_toml_task_ignores_hyphenated_commands (registry.rs). Both fail on develop and pass with the fix.
  • Manual testing: rtk hook check "task-start foo" and rtk hook check "./scripts/task-start foo" now print No rewrite for: ..., and rtk hook check "task build" still prints rtk task build.

I wrote this change with help from an AI coding assistant, then reviewed it and ran the tests above.

`^task\b` also matched `task-start`, `task-runner` and other
`task-*` programs, because `\b` sits between `k` and `-`. The hook
then rewrote them to `rtk task-...` and the go-task filter truncated
their output. Require whitespace or end of string after the name, as
ssh.toml and liquibase.toml already do.

Fixes rtk-ai#4775
@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working effort-small Quelques heures, 1 fichier filter-quality Filter produces incorrect/truncated signal labels Oct 24, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes the task filter's match_command regex from ^task\b to ^task(?:\s|$) so hyphenated commands like task-start or task-runner are no longer incorrectly matched and rewritten by the go-task filter. The \b boundary matched between k and -, causing false positives; the fix mirrors the approach already used in ssh.toml and liquibase.toml. New tests cover both the TOML filter matching and the command rewrite registry behavior.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4775


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

@CLAassistant

CLAassistant commented Oct 24, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sarankumar1325

Copy link
Copy Markdown
Author

signed it :)

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

Labels

bug Something isn't working effort-small Quelques heures, 1 fichier filter-quality Filter produces incorrect/truncated signal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

task.toml: match_command = "^task\\b" matches hyphenated commands (task-start, task-runner), so the hook rewrites them

2 participants