Repository navigation
🐛 fix: decision pills no longer flash disabled while the viewer's role loads - #16755
Conversation
…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>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. @clubanderson this PR is held at Failing checks:
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>
There was a problem hiding this comment.
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 inshowGHAuthStateorhiveAuthResolved()(), so_hiveAuthKnownis always set andstageTrackerAuthPending()cannot stay true indefinitely;_hiveRole/_hiveUserhave no other writers instatic-src/jsorindex.html. hiveAuthResolvedcomputesbeforewithout thekmarker 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.userat :274, :388, :668;write && !!ctx.userat :451, :484), so no gate readsauthPendingdifferently 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
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
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
stageTrackerActionCtxreadwindow._hiveRole || 'read'/window._hiveUser, whichshowGHAuthStatesets only after the async auth fetch resolves. The tracker's first paint lands before that, so every role-gated option was renderedaria-disabledwith a sign-in / role reason, and nothing repainted the tracker when auth arrived.How
stageTrackerAuthPending()(auth not yet known, no role, no user). While pending,stageTrackerActionCtxreturns an optimistic ctx (user: true, canHuman: true, canHold: null) — the existingcanHold === null"unknown renders enabled" pattern extended touser/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.showGHAuthStatemarkswindow._hiveAuthKnownon both the logged-in and logged-out paths and callsrenderStageTracker()(guarded) only when user/role actually changed.checkGHAuthalso marks auth known when both endpoints fail, so the tracker never waits on auth forever.Test
stage_tracker_auth_pending_ctx_test.goruns the lifted helpers under node: pending ctx yields no role/sign-in-disabled options (row pill, popover, selection bar carry noaria-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.