-
Notifications
You must be signed in to change notification settings - Fork 246
fix: return values correctly not nil #3004
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
|
Claude finished @chatton's task in 1m 29s —— View job Code Review Complete ✅Tasks
SummaryThis PR correctly fixes a critical bug in the tracing decorator where return values were being discarded and replaced with nil/zero values in error cases. The fix is excellent and follows Go best practices. The added test coverage is comprehensive and well-designed. 🎯 Code Quality & ArchitectureStrengths:
Architecture observations:
✅ Error Handling & ResilienceExcellent error handling:
Before vs After: // BEFORE (incorrect):
batchData, err := t.inner.RetrieveBatch(ctx)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return nil, err // ❌ Discards potentially valid batchData
}
// AFTER (correct):
batchData, err := t.inner.RetrieveBatch(ctx)
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return batchData, err // ✅ Preserves batchData value
}🔒 SecurityNo security concerns identified:
⚡ Performance & Resource EfficiencyExcellent performance characteristics:
Minor observation (not blocking):
🧪 Testing & ReliabilityOutstanding test coverage:
Test pattern example (very well done): // Clear intent and comprehensive validation
batch, err := producer.RetrieveBatch(ctx)
require.Error(t, err)
require.Equal(t, "no transactions in batch", err.Error())
require.NotNil(t, batch, "batch should not be nil when inner returns value with error")
require.Same(t, expectedBatch, batch, "batch should be the same instance returned by inner")📚 Documentation & Developer ExperienceGood documentation:
Suggestion for future enhancement (not blocking): 🎯 Specific Review Comments
|
Summary of ChangesHello @chatton, 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 resolves an issue within the tracing decorator where it was incorrectly discarding valid return values by replacing them with Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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
|
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
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.
Code Review
This pull request addresses a critical bug in the tracing decorator where partially valid return values were being discarded in error scenarios, potentially causing panics. The fix correctly propagates these values along with the error, which is standard practice in Go. The changes in block/internal/executing/tracing.go are accurate and consistent across RetrieveBatch, CreateBlock, and ApplyBlock. I appreciate the addition of new tests in block/internal/executing/tracing_test.go that specifically cover these error-with-value scenarios, ensuring the fix is robust. I have one minor suggestion to improve the assertions in one of the new tests for better clarity and future-proofing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3004 +/- ##
==========================================
+ Coverage 57.89% 57.96% +0.06%
==========================================
Files 110 110
Lines 10526 10526
==========================================
+ Hits 6094 6101 +7
+ Misses 3781 3774 -7
Partials 651 651
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:
|
Overview
I think this can close off the main feature issues, for any follow up improvements we can make new issues.
closes #2956
Before this fix I tried enabling tracing but saw nothing and discovered there was a panic due to the values not being returned correctly in the error case in the decorator. Tracing should propagate correctly now