Skip to content

feat(preprod): Add comparisonRunInfo data to response + new extra frontend models#109619

Merged
NicoHinderling merged 4 commits intomasterfrom
02-27-feat_preprod_add_comparisonruninfo_data_to_response_new_extra_frontend_models
Mar 2, 2026
Merged

feat(preprod): Add comparisonRunInfo data to response + new extra frontend models#109619
NicoHinderling merged 4 commits intomasterfrom
02-27-feat_preprod_add_comparisonruninfo_data_to_response_new_extra_frontend_models

Conversation

@NicoHinderling
Copy link
Copy Markdown
Contributor

@NicoHinderling NicoHinderling commented Feb 27, 2026

Summary

Enhances the preprod snapshot API response and frontend types to support richer comparison metadata:

  • Comparison run info: Adds comparison_run_info to the API response containing state, completed_at, and duration_ms from the PreprodSnapshotComparison model. Replaces the flat comparison_state field with a nested structure
  • Renamed section: Adds a new renamed diff section to both backend models and frontend types for tracking renamed files in snapshot comparisons
  • Frontend type additions: Adds ComparisonState, DiffStatus, and SidebarItem discriminated union types for upcoming sidebar UI refactor
  • Backward compat fix: Defaults errored field in ComparisonSummary to 0 to handle manifests generated before the errored section existed
  • Removes org_id from 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.

@github-actions github-actions bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Feb 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🚨 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 #discuss-dev-infra channel.

@NicoHinderling NicoHinderling marked this pull request as ready for review February 27, 2026 22:20
@NicoHinderling NicoHinderling requested a review from a team as a code owner February 27, 2026 22:20
Base automatically changed from 02-27-feat_preprod_make_snapshots_endpoint_org_scoped to master February 27, 2026 23:01
@NicoHinderling NicoHinderling force-pushed the 02-27-feat_preprod_add_comparisonruninfo_data_to_response_new_extra_frontend_models branch from 8519219 to 592c7d3 Compare February 28, 2026 00:05
@NicoHinderling NicoHinderling force-pushed the 02-27-feat_preprod_add_comparisonruninfo_data_to_response_new_extra_frontend_models branch from 592c7d3 to 643a57a Compare February 28, 2026 00:18
@NicoHinderling NicoHinderling force-pushed the 02-27-feat_preprod_add_comparisonruninfo_data_to_response_new_extra_frontend_models branch from 643a57a to a2b351b Compare February 28, 2026 00:30
@NicoHinderling NicoHinderling force-pushed the 02-27-feat_preprod_add_comparisonruninfo_data_to_response_new_extra_frontend_models branch 2 times, most recently from a873208 to e46022d Compare March 2, 2026 18:16
@NicoHinderling NicoHinderling force-pushed the 02-27-feat_preprod_add_comparisonruninfo_data_to_response_new_extra_frontend_models branch from e46022d to 221e217 Compare March 2, 2026 18:23
@@ -258,11 +259,21 @@ def on_results(images: list[SnapshotImageResponse]) -> dict[str, Any]:
)

result = response.dict()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that's fine for now, we can address this later

@NicoHinderling NicoHinderling force-pushed the 02-27-feat_preprod_add_comparisonruninfo_data_to_response_new_extra_frontend_models branch from d20cb6e to f82fff2 Compare March 2, 2026 18:55
@NicoHinderling NicoHinderling merged commit 233e870 into master Mar 2, 2026
77 checks passed
@NicoHinderling NicoHinderling deleted the 02-27-feat_preprod_add_comparisonruninfo_data_to_response_new_extra_frontend_models branch March 2, 2026 19:37
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants