Skip to content

Tidy the Providers dialog and confirm a reconnect - #2134

Merged
ppXD merged 1 commit into
mainfrom
fix/tidy-the-providers-dialog-and-confirm-a-reconnect
Oct 19, 2026
Merged

ppXD merged 1 commit into
mainfrom
fix/tidy-the-providers-dialog-and-confirm-a-reconnect

Conversation

@ppXD

@ppXD ppXD commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • The Providers dialog no longer piles up history. A disconnected credential that nothing leans on (no repositories, in-service group hooks or act-as identities) folds into one "N earlier connections - disconnected" line. The line expands to rows with Remove, and for a sign-in also Reconnect. Reconnect re-authorizes in place and takes only membership, so a Member who cannot start a plain "Connect with OAuth" can still get back to a working connection.
  • A dead or refused credential that still holds repositories or group hooks says what holds it ("2 repositories and 1 group hook still use it"). It leads with Move them to (the existing relink-bindings command), with Reconnect / Replace token second. The target is the first YourConnection the relink-suggestions endpoint returns and is never filtered by instance on the client, so the server-side same-host widening applies as soon as it ships.
  • Every row says "authorized X ago" (the provider's last confirmation), with the connected date in the tooltip. A working sign-in's Reconnect moves into the row menu as Re-authorize. A landed Reconnect or Replace token confirms in the row ("Reconnected - GitLab authorized just now"). The note is cleared when the credential is later disconnected or revoked, or its token is replaced again. A refused reconnect shows the callback's own sentence.
  • Server: DELETE /api/credentials/{id} (RemoveDisconnectedCredentialCommand) soft-deletes a disconnected credential nothing leans on. The owner needs only membership; anyone else needs credentials.manage. It refuses a live row, a row with dependents, and one a reconnect revived mid-removal (compare-and-swap write). A refused Remove re-reads the list, so a row that changed under the person stops reading as history.
  • GET /api/credentials gains additive dependentCount, boundConnectionWebhookCount and actAsIdentityCount. An older server that sends none keeps the old unfolded list with no Remove.

Test plan

  • Unit: CredentialRemoval refusal rule; credentialHealth (isHistory, canMoveBindingsOff including hook-only and identity-only, dependentsLabel combinations)
  • Integration (real Postgres): Remove refusals (live row, row with dependents, someone else's without credentials.manage, reconnect mid-removal); the list's per-kind counts equal the dependents read
  • E2E (HTTP): revoke, list and DELETE through the real pipeline; the list keeps every field an older client reads and adds the new counts
  • Frontend: fold and expand, Remove, Reconnect from the fold (Member, Admin, token, provider with no OAuth app), the move-them primary action (own connection only, never a team token, per-credential suggestions, re-read after a move, hook-only), authorized time, the Re-authorize overflow, confirmations cleared on disconnect or replace, a refused Remove refreshes the list, and an older server (no new fields) still renders
  • Frontend suite 2791/2791, pnpm lint 0 errors, tsc --noEmit, pnpm build
  • Staging: with a Member account holding one disconnected OAuth credential, open the fold and Reconnect; confirm the row returns as a working connection

@ppXD
ppXD changed the base branch from fix/let-connections-to-one-host-take-over-each-others-repositories to main October 19, 2026 23:55
Every Disconnect leaves a dead credential row behind, so a person who
reconnected a few times saw four rows for one account. Reconnect on the
working row re-authorizes in place and changes nothing visible (the row
still read "connected 1 min ago"), so it looked like it did nothing.

Dialog:
- A disconnected credential nothing leans on folds into one quiet
  "N earlier connections - disconnected" line, which expands to rows with
  Remove. The list reports dependentCount (repositories, in-service group
  hooks, act-as identities); a server that sends none keeps the old list.
  A folded sign-in keeps Reconnect: re-authorizing one's own dead sign-in
  in place is the only way back for a Member, who cannot start a plain
  connect.
- A dead or refused credential that still holds repositories or group
  hooks says what holds it ("2 repositories and 1 group hook still use
  it") and leads with "Move them to <your working connection>"
  (relink-bindings), Reconnect / Replace token second. The offer is read
  from the existing relink suggestions, never filtered by instance on the
  client, and only shown to a caller who may relink. The list also
  reports the hook and act-as identity counts on their own, so a row held
  by nothing but a hook still gives its reason.
- Every row says "authorized X ago" (the provider's last confirmation,
  lastValidatedDate), with the connected date in the tooltip.
- A working sign-in's Reconnect moves into its overflow menu as
  Re-authorize; it stays a button for refused and expiring rows.
- A landed Reconnect or Replace token says so in the row, and the note is
  dropped when the credential is disconnected or its token is replaced
  again; a refused reconnect shows the callback's own sentence,
  not only its code. A refused Remove reads the list again, so a row
  that changed under the person stops reading as history.

Server: DELETE /api/credentials/{id} (RemoveDisconnectedCredentialCommand)
soft-deletes a disconnected credential nothing leans on, as a departed
member's retired credential is. Own person on membership, anyone else
credentials.manage. A live row, one with dependents, and one a reconnect
revived mid-removal are refused; the write is a compare-and-swap.
@ppXD
ppXD force-pushed the fix/tidy-the-providers-dialog-and-confirm-a-reconnect branch from bea3099 to fdbb5f0 Compare October 19, 2026 23:55
@ppXD
ppXD merged commit 5a5afb6 into main Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant