-
Notifications
You must be signed in to change notification settings - Fork 166
Added Details to result and fixed typo in Run #886
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR enhances the gRPC executor by adding support for capturing and returning gRPC status details, and corrects a critical bug where stderr output was incorrectly parsed into the stdout JSON field.
- Added
Detailsfield to theResultstruct to capture gRPC error details as JSON-serializable objects - Implemented logic in
OnReceiveTrailersto extract and marshal gRPC status details - Fixed incorrect field assignment where
Systemoutwas used instead ofSystemerrwhen parsing stderr JSON
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| jsonBytes, err := json.Marshal(d) | ||
| if err != nil { | ||
| continue | ||
| } | ||
| var detailMap map[string]interface{} | ||
| if err := json.Unmarshal(jsonBytes, &detailMap); err != nil { | ||
| continue |
Copilot
AI
Oct 27, 2025
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.
The marshal-then-unmarshal pattern is inefficient. Consider using type assertion or reflection to convert the detail directly to map[string]interface{}, or store the original detail objects if they're already serializable.
| jsonBytes, err := json.Marshal(d) | |
| if err != nil { | |
| continue | |
| } | |
| var detailMap map[string]interface{} | |
| if err := json.Unmarshal(jsonBytes, &detailMap); err != nil { | |
| continue | |
| var detailMap map[string]interface{} | |
| // If d is already a map[string]interface{}, use it directly | |
| if m, ok := d.(map[string]interface{}); ok { | |
| detailMap = m | |
| } else { | |
| // Use mapstructure to decode struct fields into map | |
| err := mapstructure.Decode(d, &detailMap) | |
| if err != nil { | |
| continue | |
| } |
| for _, d := range stat.Details() { | ||
| jsonBytes, err := json.Marshal(d) | ||
| if err != nil { | ||
| continue | ||
| } | ||
| var detailMap map[string]interface{} | ||
| if err := json.Unmarshal(jsonBytes, &detailMap); err != nil { | ||
| continue | ||
| } | ||
| c.target.Details = append(c.target.Details, detailMap) | ||
| } |
Copilot
AI
Oct 27, 2025
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.
Silent error handling with 'continue' makes debugging difficult. Consider logging errors when detail marshaling fails so issues with specific detail types can be identified and addressed.
This update extends the gRPC executor to include
Detailsfrom gRPC status responses, returning them as JSON-serializable objects for better error visibility.Additionally, a typo was fixed where
Systemoutwas mistakenly used instead ofSystemerrduring stderr JSON parsing.