Conversation
…ing sequences The `<cmd>` placeholder in wrapper patterns (e.g., `command <cmd>`) was matching token sequences starting with flags (e.g., `-v`). This caused `command -v a` to be captured as a wrapped command `[-v, a]`, which matched no rules and defaulted to `Ask`. The direct rule `allow: 'command -v|-V *'` was then overridden by `merge_results` picking the more restrictive action. Since `<cmd>` represents "a command to execute", it should not match flag-starting tokens — flags are options to the wrapper, not commands. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue in the pattern matching engine where the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #206 +/- ##
==========================================
- Coverage 89.57% 89.56% -0.02%
==========================================
Files 49 49
Lines 9808 9811 +3
==========================================
+ Hits 8786 8787 +1
- Misses 1022 1024 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request refines the behavior of the <cmd> placeholder in pattern matching by preventing it from capturing token sequences that start with a flag (i.e., tokens beginning with '-'). The changes include updating the documentation to reflect this new restriction, modifying the match_engine logic in src/rules/pattern_matcher/mod.rs to implement this check, and updating existing unit tests while adding new unit and integration tests to thoroughly verify this corrected behavior.
Why
<cmd>placeholder matched token sequences starting with flags (-prefixed tokens), causing explicitlyallowed commands to be downgraded toaskthrough wrapper evaluationcommand -v|-V *isallowed, but thecommand <cmd>wrapper matchedcommand -v a, capturing[-v, a]as<cmd>. The inner command-v amatched no rules and defaulted toAsk, whichmerge_resultspicked as the more restrictive final resultWhat
<cmd>placeholder rejects capture of token sequences whose first token starts with-.<cmd>represents "a command to execute", so flags should be treated as wrapper options rather than command names.Example: