Skip to content

🐛 fix: decision pills no longer flash disabled while the viewer's role loads - #16755

Merged
clubanderson merged 2 commits into
v5from
fix/decision-pill-auth-flash
Nov 5, 2026
Merged

clubanderson merged 2 commits into
v5from
fix/decision-pill-auth-flash

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #16754

What

On a hard reload of the dashboard the Activity Monitor decision pills ("Let hive decide", "Approve and let hive merge", "Merge now as maintainer") flashed grey and unclickable, then came back one tracker poll later.

Why

stageTrackerActionCtx read window._hiveRole || 'read' / window._hiveUser, which showGHAuthState sets only after the async auth fetch resolves. The tracker's first paint lands before that, so every role-gated option was rendered aria-disabled with a sign-in / role reason, and nothing repainted the tracker when auth arrived.

How

  • Unknown is not read. New stageTrackerAuthPending() (auth not yet known, no role, no user). While pending, stageTrackerActionCtx returns an optimistic ctx (user: true, canHuman: true, canHold: null) — the existing canHold === null "unknown renders enabled" pattern extended to user/canHuman. Server-disabled options keep the server's reason; a click that beats auth gets the server's 403 toast. Row pills, the popover lead button and the selection bar all derive from this ctx, so the pending state is the same everywhere.
  • Repaint when auth lands. showGHAuthState marks window._hiveAuthKnown on both the logged-in and logged-out paths and calls renderStageTracker() (guarded) only when user/role actually changed. checkGHAuth also marks auth known when both endpoints fail, so the tracker never waits on auth forever.
  • Logged-out viewers still see the disabled pills with the sign-in reason once auth is known.

Test

stage_tracker_auth_pending_ctx_test.go runs the lifted helpers under node: pending ctx yields no role/sign-in-disabled options (row pill, popover, selection bar carry no aria-disabled); showGHAuthState(true, 'alice', …, 'merger') ends pending, repaints exactly once (not again on an unchanged re-check) and keeps the options enabled; a read-only viewer gets the role reason; logged-out after auth is known gets every option disabled with the reason.

…e loads

On a hard reload the stage tracker's first paint ran before the auth
fetch had named the viewer, so stageTrackerActionCtx read the missing
role as 'read' and every role-gated decision option rendered
aria-disabled with a sign-in reason until the next tracker poll.

- stageTrackerAuthPending: unknown is not read. While auth is pending the
  ctx is optimistic (user/canHuman true, canHold null), so the pills
  render enabled and a click that beats auth gets the server's 403.
- showGHAuthState marks auth known on both paths (and checkGHAuth when
  both endpoints fail) and repaints the tracker once when the user/role
  actually changed.
- Logged-out viewers still see the disabled pills with the sign-in
  reason once auth is known.

Fixes #16754

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 5, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16696 🐛 fix(dashboard): keep the Navigation label visible at phone widths same files src/pkg/dashboard/static/index.html

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • test (dashboard 1/4)
  • test (dashboard shuffle 1/3)

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Read the diff against the tree at v5 (e87d792). Looks correct to me.

What I checked:

  • Every exit of checkGHAuth (gh-auth.js:260-287) now ends in showGHAuthState or hiveAuthResolved()(), so _hiveAuthKnown is always set and stageTrackerAuthPending() cannot stay true indefinitely; _hiveRole/_hiveUser have no other writers in static-src/js or index.html.
  • hiveAuthResolved computes before without the k marker on the first call, so the first resolution always repaints (needed for the anonymous case, where user/role never change) and later unchanged re-checks do not.
  • The pending ctx shape satisfies all consumers in tracker-actions.js (ctx.canHold !== false && !!ctx.user at :274, :388, :668; write && !!ctx.user at :451, :484), so no gate reads authPending differently from the stated "optimistic until known" behaviour.

Trade-off worth naming for the record (not a defect): an anonymous viewer sees enabled pills for the duration of the auth fetch; a click in that window gets the server's 403, as the body says. static/index.html and static-src/js carry the same change.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@clubanderson
clubanderson merged commit 6741d85 into v5 Nov 5, 2026
81 of 82 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/decision-pill-auth-flash branch November 5, 2026 13:16
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decision pills flash disabled on dashboard reload until auth resolves

1 participant