feat(worktree): order row badges by salience and surface alarms when collapsed#8763
Merged
gregpriday merged 3 commits intoMay 20, 2026
Merged
Conversation
… salience - Add computeAlarmTier helper that reduces worktree alarm fields to a single salience tier (CI failed > auth-failed > behind > detached > none); only 'failure' CI maps above tier 0 so transient pending states don't churn spatial ordering on every push. - Add CollapsedAlarmPill chip that renders the highest-priority alarm inside the title row when the card is collapsed, so CI failures, auth failures, and behind-upstream counts stay visible without expanding the row. - Reorder NonMainSecondaryRow so the upstream-sync badge leads when its tier outranks the PR badge's CI tier; PR keeps its lead by default and on CI failure. Reorder is gated on threshold crossings (tiers), not poll ticks.
- Drop detached HEAD from computeAlarmTier; gitStateIndicator already labels it in the title row, so including it in the pill produced a double-label on collapsed cards. - Gate the CI-failed alarm on the linked PR being live (not closed/declined) so a stale ciStatus on a closed PR does not surface a phantom alarm in the collapsed row while the expanded row shows no PR badge. - Switch the auth-failed alarm input to the already-gated hasAuthFailedSignIn boolean so the collapsed pill, expanded ordering, and UpstreamSyncBadge treatment all agree on the GitHub-only provider gate. - Use computeAlarmTier in NonMainSecondaryRow for prTier and upstreamTier so the expanded badge ordering tracks the helper, not a duplicated inline cascade. - Add presence guards to the ordering tests so an absent badge can no longer satisfy an indexOf-based less-than assertion.
The prLinked() helper inline union didn't accept the closed/declined values mutated in the new stale-CI tests; widen the parameter to NormalizedPRState from the forge type so mutations to closed/declined typecheck cleanly.
7c1d6ac to
28620d9
Compare
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
Two things were broken in the worktree dashboard: collapsed rows hid actionable alarms entirely, and expanded rows stacked badges in a fixed positional order regardless of how critical each signal was.
CollapsedAlarmPillchip (CI failure > auth-failed > behind upstream), so a failing PR is visible without expanding the rowcomputeAlarmTierhelper insrc/lib/worktreeAlarmTier.ts, keeping the two in agreementResolves #8379
Changes
src/lib/worktreeAlarmTier.ts— pure helper that reduces CI state, gated auth-failed, and behind-count to a single tier (3 = CI failed, 2 = auth-failed, 1 = behind, 0 = none); detached HEAD excluded asgitStateIndicatoralready labels it in the title rowsrc/components/Worktree/WorktreeCard/CollapsedAlarmPill.tsx— new chip usingbg-status-error/10 text-status-errorfor CI tier andbg-status-warning/10 text-status-warningfor warning tiers;shrink-0,pointer-events-none,transition-colorsonlyWorktreeHeader— collapsed alarm rendered inside the titleflex-1container aftergitStateIndicator, gated onisCollapsed; CI state only considered when a live PR is linked; auth-failed only passed through when the provider is GitHubNonMainSecondaryRow—upstreamFirstboolean flips PR vsUpstreamSyncBadgeorder by salience; reorder gated on actual tier change, not poll ticksTesting
src/lib/__tests__/worktreeAlarmTier.test.ts— full priority matrix and cascade casessrc/components/Worktree/WorktreeCard/__tests__/CollapsedAlarmPill.test.tsx— chip styling per tierNonMainSecondaryRow.test.tsx— badge ordering by tier with presence guardsWorktreeHeader.test.tsx— collapsed pill rendering, closed-PR stale CI suppression, non-GitHub auth-failed suppression, detached double-label prevention