Skip to content

Conversation

@rbro112
Copy link
Member

@rbro112 rbro112 commented Oct 14, 2025

Creates a PENDING record for all comparisons as part of the POST compare endpoint (manual triggering). This ensures that when a user is redirected to the compare page after triggering a comparison, they no longer see an empty state and instead see the processing state.

Resolves EME-388

@rbro112 rbro112 requested a review from a team as a code owner October 14, 2025 18:24
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 14, 2025
Copy link
Member Author

rbro112 commented Oct 14, 2025

@rbro112 rbro112 changed the title Create PENDING record for comparisons in POST handler to prevent empty state in compare page bug(preprod): Create PENDING record for comparisons in POST handler to prevent empty state in compare page Oct 14, 2025
@linear
Copy link

linear bot commented Oct 14, 2025

status: str
message: str
existing_comparisons: list[SizeAnalysisComparison] | None
comparisons: list[SizeAnalysisComparison] | None
Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't used by the frontend currently, so no need to update any FE types

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 80.00000% with 7 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/preprod/size_analysis/tasks.py 69.56% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #101454    +/-   ##
=========================================
  Coverage   81.02%    81.03%            
=========================================
  Files        8701      8703     +2     
  Lines      385942    386279   +337     
  Branches    24409     24409            
=========================================
+ Hits       312726    313010   +284     
- Misses      72865     72918    +53     
  Partials      351       351            

comparison.state = PreprodArtifactSizeComparison.State.PROCESSING
comparison.save()
else:
comparison = PreprodArtifactSizeComparison.objects.create(
Copy link
Member

Choose a reason for hiding this comment

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

Could this be considered an error case now instead of creating a new object? Seems like we should always expect a PENDING comparison to exist so that the frontend page is navigable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I agree, will update

"base_artifact_size_metric_id": base_size_metric.id,
},
)

Copy link
Member

Choose a reason for hiding this comment

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

I can't tag the line number but I think the error handling we have should now update the comparison to PreprodArtifactSizeComparison.State.FAILED for cases like except File.DoesNotExist. Right now it just returns from the function and the comparison is left PENDING. Eventually our timeout logic will catch it but will take a while.

@rbro112 rbro112 merged commit b881f87 into master Oct 14, 2025
65 checks passed
@rbro112 rbro112 deleted the ryan/create_pending_record_for_comparisons_in_post_handler_to_prevent_empty_state_in_compare_page branch October 14, 2025 23:49
rbro112 added a commit that referenced this pull request Oct 15, 2025
…aking size comparisons (#101553)

I added PENDING records for manual comparisons yesterday in
#101454, but I forgot to add for
CI triggered comparisons. This adds PENDING comparisons for CI
comparisons and fixes a few other minor bugs.

Also improves our tests to validate that the DB models are properly
created after running comparison tasks/functions, which should catch
similar bugs like these in the future.
chromy pushed a commit that referenced this pull request Oct 17, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants