Skip to content

Conversation

@Darya-Tolmeneva
Copy link

This update extends the gRPC executor to include Details from gRPC status responses, returning them as JSON-serializable objects for better error visibility.
Additionally, a typo was fixed where Systemout was mistakenly used instead of Systemerr during stderr JSON parsing.

@yesnault yesnault requested a review from Copilot October 27, 2025 15:34
Copy link

Copilot AI left a 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 Details field to the Result struct to capture gRPC error details as JSON-serializable objects
  • Implemented logic in OnReceiveTrailers to extract and marshal gRPC status details
  • Fixed incorrect field assignment where Systemout was used instead of Systemerr when parsing stderr JSON

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +98 to +104
jsonBytes, err := json.Marshal(d)
if err != nil {
continue
}
var detailMap map[string]interface{}
if err := json.Unmarshal(jsonBytes, &detailMap); err != nil {
continue
Copy link

Copilot AI Oct 27, 2025

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.

Suggested change
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
}

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +107
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)
}
Copy link

Copilot AI Oct 27, 2025

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant