-
Notifications
You must be signed in to change notification settings - Fork 934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend prompt match introduced by Cumulus 5.9 #3264
base: master
Are you sure you want to change the base?
Conversation
Could you provide a few prompts (one working with the previous regexp and one working only with the new regexp)? |
This PR is stale because it has been open 90 days with no activity. |
WalkthroughThe pull request introduces a modification to the Changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
lib/oxidized/model/cumulus.rb
(1 hunks)
🔇 Additional comments (3)
lib/oxidized/model/cumulus.rb (3)
4-4
: Add test cases for the prompt pattern.As requested in the PR comments, please provide examples of prompts that:
- Work with the previous regex
- Only work with this new regex
- Should not match
This will help validate the changes and serve as documentation for future reference.
Would you like me to help create a test file with these cases?
4-4
: Document the supported prompt formats.Please update the documentation to describe:
- The prompt formats supported by this regex
- Examples of valid prompts
- Which Cumulus versions have been tested
Consider adding these details to:
- A comment above this line
- The model's documentation
- The CHANGELOG.md as mentioned in the PR checklist
4-4
: Verify compatibility with Cumulus 5.9.Since this change was introduced for Cumulus 5.9, please confirm:
- The exact prompt format used in Cumulus 5.9
- Whether this pattern maintains backward compatibility
✅ Verification successful
The prompt pattern is version-agnostic and maintains compatibility
The implemented prompt pattern
/^((\#?.*\[?\??\w*)@(.*)):/
is designed to be flexible and version-independent, supporting various Cumulus prompt formats through:
- Optional characters and flexible matching
- Support for different configuration methods (traditional, NCLU, NVUE)
- No version-specific restrictions
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any existing Cumulus version checks or version-specific handling rg -l "cumulus.*5\.9|version.*cumulus" .Length of output: 42
Script:
#!/bin/bash # Search for Cumulus test files and documentation echo "=== Searching for test files ===" fd -t f -e rb cumulus spec/ fd -t f -e rb cumulus test/ echo -e "\n=== Searching for documentation ===" fd -t f -e md cumulus docs/ fd -t f README.md . -x grep -l "cumulus" {} echo -e "\n=== Checking prompt examples in code ===" rg -A 3 -B 3 "prompt.*cumulus" .Length of output: 550
Script:
#!/bin/bash echo "=== Cumulus Documentation ===" cat docs/Model-Notes/Cumulus.md echo -e "\n=== Cumulus Model Implementation ===" cat lib/oxidized/model/cumulus.rbLength of output: 5267
@@ -1,7 +1,7 @@ | |||
class Cumulus < Oxidized::Model | |||
using Refinements | |||
|
|||
prompt /^(([\w.-]*)@(.*)):/ | |||
prompt /^((\#?.*\[?\??\w*)@(.*)):/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the greedy pattern in the prompt regex.
The current regex pattern \#?.*\[?\??\w*
contains a greedy .*
that could incorrectly consume characters meant for the username part. This might cause the pattern to fail matching valid prompts.
Consider using this more precise pattern:
- prompt /^((\#?.*\[?\??\w*)@(.*)):/
+ prompt /^((\#?\w*\[?\??\w*)@(.*)):/
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
prompt /^((\#?.*\[?\??\w*)@(.*)):/ | |
prompt /^((\#?\w*\[?\??\w*)@(.*)):/ |
Pre-Request Checklist
rubocop --auto-correct
)rake test
)Description
Summary by CodeRabbit