Skip to content

Conversation

@mki-c2c
Copy link
Contributor

@mki-c2c mki-c2c commented Aug 13, 2025

fix for #77

serialization of requests log was handled differently in ExceptionDetail and DetailedResponse

therefore some error content was lost.

@mki-c2c mki-c2c requested a review from f-necas August 14, 2025 07:23
Copy link
Collaborator

@f-necas f-necas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very fluent in python but seems ok.

@f-necas f-necas requested a review from Copilot August 25, 2025 12:00
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 fixes inconsistent error handling for GS errors by standardizing the serialization of operations data across different response paths. The issue was that operations were being serialized differently in error handling versus success responses, causing some error content to be lost.

  • Standardizes operations serialization to use dictionary format consistently
  • Removes redundant serialization logic from DetailedResponse model
  • Updates get_json_responses method to handle mixed data types

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
backend/maelstro/middleware.py Removes manual dict() conversion, passes operations directly
backend/maelstro/main.py Removes manual dict() conversion for consistency
backend/maelstro/core/operations.py Updates get_json_responses to handle mixed data types and serialize properly
backend/maelstro/common/models.py Changes DetailedResponse to accept dict operations and removes redundant serializer

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 90 to 93
return [
r.model_dump() if isinstance(r, OperationsRecord) else r
for r in self.responses
]
Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mixed type handling with isinstance check suggests inconsistent data types in self.responses. Consider validating that all items in self.responses are either OperationsRecord instances or dictionaries to make the code more predictable and maintainable.

Suggested change
return [
r.model_dump() if isinstance(r, OperationsRecord) else r
for r in self.responses
]
result = []
for r in self.responses:
if not isinstance(r, OperationsRecord):
raise TypeError(f"Non-OperationsRecord found in responses: {type(r)}")
result.append(r.model_dump())
return result

Copilot uses AI. Check for mistakes.
@mki-c2c mki-c2c merged commit bc592e6 into main Aug 27, 2025
4 checks passed
@mki-c2c mki-c2c deleted the GSREN-475_report_missing_datastore branch August 27, 2025 12:10
github-actions bot pushed a commit that referenced this pull request Aug 27, 2025
* Fix error handling by harmonizing operations in DetailedResponse and ExceptionDetail

* Fix code for CI

* Review comment by copilot

(cherry picked from commit bc592e6)
@github-actions
Copy link

💚 All backports created successfully

Status Branch Result
0.1.x

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

f-necas pushed a commit that referenced this pull request Aug 27, 2025
* Fix error handling by harmonizing operations in DetailedResponse and ExceptionDetail

* Fix code for CI

* Review comment by copilot

(cherry picked from commit bc592e6)

Co-authored-by: Moritz Kirmse <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants