fix(snapshots): Fix staff auth blocking initial size comparison selection#112739
Merged
NicoHinderling merged 2 commits intomasterfrom Apr 13, 2026
Merged
fix(snapshots): Fix staff auth blocking initial size comparison selection#112739NicoHinderling merged 2 commits intomasterfrom
NicoHinderling merged 2 commits intomasterfrom
Conversation
…tion Previously, the size comparison POST endpoint applied staff re-auth checks whenever existing comparisons were found, regardless of whether the user was selecting a build pair or explicitly re-running. This caused staff users to hit a 403 StaffRequired error on the build selection page. Split the behavior using a ?rerun=true query parameter: - Without ?rerun: returns existing comparisons or allows retry of all-failed comparisons without staff auth - With ?rerun=true: staff-gated delete and re-run for the admin "Rerun Comparison" button Co-Authored-By: Claude <noreply@anthropic.com>
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 |
Contributor
Backend Test FailuresFailures on
|
… flow Update test_post_comparison_existing_failed_comparison to expect auto-retry behavior (status=created) when all comparisons are failed. Add tests for the rerun=true staff auth flow: active staff succeeds, non-staff gets 403, inactive staff gets StaffRequired.
mtopo27
approved these changes
Apr 13, 2026
wedamija
pushed a commit
that referenced
this pull request
Apr 13, 2026
…tion (#112739) ## Summary The size comparison POST endpoint was applying staff re-auth checks whenever existing comparisons were found, regardless of context. This caused staff users to hit a `403 StaffRequired` error on the build selection page when selecting a pair that already had comparison results. **Fix:** Use a `?rerun=true` query parameter to distinguish the "Rerun Comparison" admin flow from normal comparison triggers. ### Logic paths | Scenario | `?rerun` | Existing state | Behavior | |---|---|---|---| | Build selection page | no | no comparison exists | Creates new comparison | | Build selection page | no | SUCCESS/PENDING exists | Returns `status: "exists"`, navigates to results | | Build selection page | no | all FAILED | Deletes failed, re-creates (retry without staff gate) | | Retry button (failed comparison) | no | all FAILED | Deletes failed, re-creates (retry without staff gate) | | "Rerun Comparison" admin button | yes | active superuser/staff | Deletes and re-runs | | "Rerun Comparison" admin button | yes | `is_staff` but not re-authed | `StaffRequired` (triggers re-auth modal) | | "Rerun Comparison" admin button | yes | non-staff | 403 | ### Files changed - **Backend**: `project_preprod_size_analysis_compare.py` — branching logic based on `?rerun` query param - **Frontend**: `buildComparison.tsx` — rerun mutation now sends `?rerun=true` --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The size comparison POST endpoint was applying staff re-auth checks whenever existing comparisons were found, regardless of context. This caused staff users to hit a
403 StaffRequirederror on the build selection page when selecting a pair that already had comparison results.Fix: Use a
?rerun=truequery parameter to distinguish the "Rerun Comparison" admin flow from normal comparison triggers.Logic paths
?rerunstatus: "exists", navigates to resultsis_staffbut not re-authedStaffRequired(triggers re-auth modal)Files changed
project_preprod_size_analysis_compare.py— branching logic based on?rerunquery parambuildComparison.tsx— rerun mutation now sends?rerun=true