feat(preprod): Disable header actions when size analysis is incomplete (EME-782)#107231
Conversation
| } | ||
|
|
||
| const areActionsEnabled = isSizeInfoCompleted(buildDetailsData?.size_info); | ||
| const canRerunStatusChecks = |
There was a problem hiding this comment.
we can still click the retry button if the status is failed but we can't click the compare button.
Do we also want to be able to click retry when the state is "processing"?
There was a problem hiding this comment.
I think no. That will cause confusion (the results will overwrite each other).
However:
- NOT_RAN should be retrayable maybe.
- Can we have a isSizeInfoRetryable function next to isSizeInfoCompleted
There was a problem hiding this comment.
ok, rebased and added the isSizeInfoRetryable which checks FAILED and NOT_RAN
| const handleCompareClick = () => { | ||
| if (!areActionsEnabled) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Redundant disabled check in click handler
Low Severity
The early return guard if (!areActionsEnabled) { return; } in handleCompareClick is redundant because the Button component already has disabled={!areActionsEnabled}. The Button component's test suite confirms that disabled buttons don't trigger onClick handlers, making this check unnecessary duplication that adds code complexity without providing additional protection.
chromy
left a comment
There was a problem hiding this comment.
lgtm % one comment. Commit message should maybe also mention NOT_RAN since it lists all the others.
…e (EME-782) Disables the "Compare Build" button and "Rerun Status Checks" menu item when size analysis has not completed for a build. This prevents users from attempting comparisons or rerunning checks when the necessary size data is unavailable due to quota limits or skipped analysis jobs. Actions are disabled when size_info is: - undefined/null (never started) - PENDING (state 0) - PROCESSING (state 1) - FAILED (state 3) Actions are enabled only when size_info.state is COMPLETED (state 2). Disabled buttons display tooltips explaining why they are unavailable.
Enables the "Rerun Status Checks" action when size analysis is in FAILED state, allowing users to retry the analysis. The "Compare Build" button remains disabled until analysis completes successfully.
Adds the NOT_RAN (state 4) to the frontend size analysis state enum to match the backend. This state indicates that size analysis was not run for the build, typically due to quota limits or configuration. Updates logic to: - Enable "Rerun Status Checks" action when state is NOT_RAN - Show error message in main content when state is NOT_RAN
Adds a new helper function to check if size analysis can be retried, making the code more readable and maintainable. The function returns true for FAILED and NOT_RAN states.
static/app/views/preprod/buildDetails/header/buildDetailsHeaderContent.tsx
Outdated
Show resolved
Hide resolved
313b41f to
b0aeec6
Compare
| </Button> | ||
| </Link> | ||
| {t('Compare Build')} | ||
| </Button> |
There was a problem hiding this comment.
Button loses link behavior when LinkButton supports disabled
Low Severity
The Compare Build control changed from a Link wrapping a Button to a plain Button with programmatic router.push() navigation. This loses standard link behaviors like middle-click to open in new tab and right-click context menu link options. The LinkButton component is already imported in this file and supports the disabled prop (it sets to={undefined} internally when disabled). Using LinkButton instead would preserve link semantics and behaviors while still supporting the disabled state.
…e-analysis-missing
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
|
|
||
| export function BuildDetailsHeaderContent(props: BuildDetailsHeaderContentProps) { | ||
| const organization = useOrganization(); | ||
| const router = useRouter(); |
There was a problem hiding this comment.
New usage of deprecated useRouter hook
Low Severity
The PR introduces new usage of useRouter, which is explicitly marked as @deprecated in its source with the message: "Please do not use this. Use a specific hook instead. Including use{Location,Params,Routes,Navigate}." Since the code only uses router.push(), it could use useNavigate instead: const navigate = useNavigate() and then navigate(getCompareBuildPath(...)).
Additional Locations (1)
…e (EME-782) (#107231) ## Summary Disables retry and compare buttons on size analysis has not completed for a build. Compare button is completely disabled unless status is `COMPLETED`. retry button is enabled when status is `COMPLETED` or `FAILED`. (should we also enable this button for processing?) ## Behavior The following `size_info` states are possible (for reference) - `undefined`/`null` (size analysis never started/skipped) - `PENDING` (state 0 - queued for analysis) - `PROCESSING` (state 1 - analysis running) - `FAILED` (state 3 - analysis failed) - `NOT_RAN` (state 4 - analysis hasn't run yet) - `size_info.state === COMPLETED` (state 2 - has size data) Photos of what the UI looks like: <img width="283" height="129" alt="Screenshot 2026-01-29 at 14 47 54" src="https://github.com/user-attachments/assets/134617f6-bc0c-467e-9bb2-8e5f4710e314" /> <img width="279" height="280" alt="Screenshot 2026-01-29 at 14 48 00" src="https://github.com/user-attachments/assets/b8f07183-4546-41a8-b0a0-af6ea040ea97" />


Summary
Disables retry and compare buttons on size analysis has not completed for a build.
Compare button is completely disabled unless status is
COMPLETED.retry button is enabled when status is
COMPLETEDorFAILED. (should we also enable this button for processing?)Behavior
The following
size_infostates are possible (for reference)undefined/null(size analysis never started/skipped)PENDING(state 0 - queued for analysis)PROCESSING(state 1 - analysis running)FAILED(state 3 - analysis failed)NOT_RAN(state 4 - analysis hasn't run yet)size_info.state === COMPLETED(state 2 - has size data)Photos of what the UI looks like:

