-
Notifications
You must be signed in to change notification settings - Fork 561
fix panic when digger is misconfigured #1975
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
WalkthroughThe Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (10)
✨ Finishing Touches
🧪 Generate Unit Tests
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
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.
PR Summary
Added robust error handling for YAML configuration parsing in libs/digger_config/yaml.go
to prevent panics when users misconfigure workflow steps.
- Enhanced
StepYaml.UnmarshalYAML
method with proper type validation for the 'run' field, replacing potential panic with descriptive error messages
1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile
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)
libs/digger_config/yaml.go
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
🔇 Additional comments (1)
libs/digger_config/yaml.go (1)
3-6
: Import addition looks good
fmt
is now required for the new error message – import is correctly added and will be kept in-order bygoimports
.
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: 0
🧹 Nitpick comments (2)
libs/digger_config/digger_config_test.go (2)
322-358
: Condense the two assertions intoassert.ErrorContains
for clarityYou already check that an error is returned and that its text matches a substring.
assert.ErrorContains
captures both intentions in a single call and avoids the extraerr.Error()
dereference.- _, _, _, err := LoadDiggerConfig(tempDir, true, nil) - assert.Error(t, err, "expected error to be raised") - assert.Contains(t, err.Error(), "step.run must be a string") + _, _, _, err := LoadDiggerConfig(tempDir, true, nil) + assert.ErrorContains(t, err, "step.run must be a string")
322-322
: Rename test to follow Go error-centric wordingGo code “returns an error” rather than “throws”.
ConsiderTestProjectWithMisconfiguredRunStepReturnsError
to stay consistent with Go idioms and the rest of the file.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
libs/digger_config/digger_config_test.go
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
libs/digger_config/digger_config_test.go (1)
libs/digger_config/digger_config.go (1)
LoadDiggerConfig
(214-243)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
- GitHub Check: Build
Summary by CodeRabbit