Skip to content

feat(preprod): Disable header actions when size analysis is incomplete (EME-782)#107231

Merged
runningcode merged 5 commits intomasterfrom
no/eme-782-disable-header-actions-when-size-analysis-missing
Jan 30, 2026
Merged

feat(preprod): Disable header actions when size analysis is incomplete (EME-782)#107231
runningcode merged 5 commits intomasterfrom
no/eme-782-disable-header-actions-when-size-analysis-missing

Conversation

@runningcode
Copy link
Contributor

@runningcode runningcode commented Jan 29, 2026

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:
Screenshot 2026-01-29 at 14 47 54
Screenshot 2026-01-29 at 14 48 00

@linear
Copy link

linear bot commented Jan 29, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 29, 2026
}

const areActionsEnabled = isSizeInfoCompleted(buildDetailsData?.size_info);
const canRerunStatusChecks =
Copy link
Contributor Author

@runningcode runningcode Jan 29, 2026

Choose a reason for hiding this comment

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

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"?

Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, rebased and added the isSizeInfoRetryable which checks FAILED and NOT_RAN

@runningcode runningcode marked this pull request as ready for review January 29, 2026 14:18
@runningcode runningcode requested a review from a team as a code owner January 29, 2026 14:18
const handleCompareClick = () => {
if (!areActionsEnabled) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Copy link
Contributor

@chromy chromy left a comment

Choose a reason for hiding this comment

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

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.
@runningcode runningcode force-pushed the no/eme-782-disable-header-actions-when-size-analysis-missing branch from 313b41f to b0aeec6 Compare January 29, 2026 14:44
</Button>
</Link>
{t('Compare Build')}
</Button>
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Copy link
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 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();
Copy link
Contributor

Choose a reason for hiding this comment

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

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)

Fix in Cursor Fix in Web

@runningcode runningcode merged commit 0989a4d into master Jan 30, 2026
53 checks passed
@runningcode runningcode deleted the no/eme-782-disable-header-actions-when-size-analysis-missing branch January 30, 2026 09:04
priscilawebdev pushed a commit that referenced this pull request Feb 2, 2026
…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"
/>
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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