feat(preprod): Add comparisonRunInfo data to response + new extra frontend models#109619
Conversation
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
8519219 to
592c7d3
Compare
592c7d3 to
643a57a
Compare
643a57a to
a2b351b
Compare
a873208 to
e46022d
Compare
e46022d to
221e217
Compare
| @@ -258,11 +259,21 @@ def on_results(images: list[SnapshotImageResponse]) -> dict[str, Any]: | |||
| ) | |||
|
|
|||
| result = response.dict() | |||
There was a problem hiding this comment.
Hmm, this is making me realize we should probably return this at line 278 and add the project_id & comparison_type to the SnapshotDetailsApiResponse model. That way we don't have this weird area of the response where we're using dictionaries despite using the response everywhere else
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| comparison_state = PreprodSnapshotComparison.State( | ||
| pending_or_failed_state | ||
| ).name.lower() | ||
| comparison_state = PreprodSnapshotComparison.State(pending_or_failed_state).name |
There was a problem hiding this comment.
Enum state names now uppercase, breaking codebase convention
Medium Severity
The change from .name.lower() to .name causes the state field in comparison_run_info to return uppercase values like "PENDING", "FAILED", "SUCCESS" instead of the lowercase "pending", "failed", "success" used consistently throughout the preprod module. Every other enum-name serialization in this module uses .name.lower() (e.g., PreprodArtifact.ArtifactType.to_str(), artifact_search.py, tasks.py), and State.as_choices() defines the display names as lowercase. This creates an API inconsistency that will likely cause mismatches when the upcoming frontend ComparisonState type consumes these values.
Additional Locations (1)
There was a problem hiding this comment.
that's fine for now, we can address this later
d20cb6e to
f82fff2
Compare



Summary
Enhances the preprod snapshot API response and frontend types to support richer comparison metadata:
comparison_run_infoto the API response containingstate,completed_at, andduration_msfrom thePreprodSnapshotComparisonmodel. Replaces the flatcomparison_statefield with a nested structurerenameddiff section to both backend models and frontend types for tracking renamed files in snapshot comparisonsComparisonState,DiffStatus, andSidebarItemdiscriminated union types for upcoming sidebar UI refactorerroredfield inComparisonSummaryto0to handle manifests generated before the errored section existedorg_idfrom the API response (redundant — already in the URL)Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.