-
Notifications
You must be signed in to change notification settings - Fork 119
Fix: Strip comments before macro expansion to prevent command parsing errors #193
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
Conversation
A bug fix that ensures comments don't interfere with macro expansion by removing them first. This prevents unwanted comment text from appearing in the final expanded command.
WalkthroughA new function, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ConfigLoader
participant MacroExpander
User->>ConfigLoader: Load config with command string
ConfigLoader->>ConfigLoader: StripComments(command string)
ConfigLoader->>MacroExpander: Expand macros in stripped command
MacroExpander-->>ConfigLoader: Expanded command
ConfigLoader-->>User: Config object with sanitized command
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (4)
🧰 Additional context used🧠 Learnings (1)proxy/process_test.go (1)🔇 Additional comments (7)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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
Documentation and Community
|
|
Thanks for submitting this, looks good! |
Problem
Comments containing macros in YAML configuration caused process startup failures with errors like:
Example Configuration That Failed
Root Cause
The issue was caused by order of operations:
${latest-llama}in the comment was expanded, which could make the comment broken into multiple lines after expansion. The comment start character was present only on the first line. The effective command would look as belowSanitizeCommand()only removes lines that start with#, so the expanded comment text remained"is"as a commandSolution
Reversed the order: Strip comments before macro expansion.
cmdandcmdStopfields before macro processingResult
Same configuration now produces clean command:
Testing
TestConfig_MacroInCommentStrippedBeforeExpansionthat reproduces the original bug scenarioImpact
fixes #190
Summary by CodeRabbit
Bug Fixes
Tests