Skip to content

fix(workspace): credential source badges, sign-out feedback, live wallet refresh#82

Merged
Aayam Bansal (aayambansal) merged 1 commit into
mainfrom
fix/settings-ui-clarity
Jul 5, 2026
Merged

fix(workspace): credential source badges, sign-out feedback, live wallet refresh#82
Aayam Bansal (aayambansal) merged 1 commit into
mainfrom
fix/settings-ui-clarity

Conversation

@aayambansal

Copy link
Copy Markdown
Member

Three Settings-panel fixes in the workspace app.

Fixes #73
Fixes #76
Fixes #77

Credentials — provider key source badges (#73)

The /provider payload already carries source (env | api | custom | config) for every connected provider — the wire type in @synsci/sdk/v2/client (Provider["source"]), which main now explicitly preserves while redacting keys (#80). The panel renders a pill badge next to each connected provider (local, env, config, custom, same badge styling as the Compute panel) with a title explaining where the key lives. Since only source: "api" keys sit in the local auth store, the remove button is disabled for the other sources, with a tooltip saying the key comes from an env var / dashboard sync or openscience.json and has to be removed there — instead of the old silent no-op where the provider reappeared as connected after the delete.

The list endpoint's generated response type omits source (its OpenAPI schema is the models.dev catalog shape), so the component reads it through a narrow typed accessor keyed to the SDK's Provider["source"] union, defaulting to api (current behavior) if absent.

General — sign-out feedback + reconnect guidance (#76)

signOut was try/finally with no catch, and the SDK client defaults to throwOnError: false, so a failed logout surfaced neither as a rejection nor in the UI. It now checks res.error, converts it to an Error, and toasts failures through the shared showToast mechanism (same pattern as Connectors/Skills/Specialists). Whenever the account is signed out — including right after a successful sign-out — the Account card shows muted guidance copy: run openscience connect login in a terminal to reconnect this machine.

Usage — live wallet refresh + honest loading states (#77)

  • The panel now refetches account/usage/preferences on window focus (listener added in onMount, removed in onCleanup), so a dashboard top-up ("buy credits" opens a new tab) shows up as soon as the user returns. Refetches keep the previous values until new data arrives, so there's no flashing.
  • Plan / Wallet balance / Billing render while loading and when signed out, instead of presenting the "Free" / "byok" fallbacks as if they were real account data. The footer copy also distinguishes loading ("Checking your Atlas account…") and signed-out (connect-login guidance) from the managed/BYOK explanations.

Verification

  • bun run typecheck — clean at repo root (6/6 tasks).
  • bun run --cwd frontend/workspace build — passes.
  • prettier --check clean on all lines added here (the three files carry some pre-existing formatting drift that was deliberately left untouched to keep the diff scoped).

Manual-verification reasoning (no UI e2e in CI yet):

  • Credentials panel can't tell local keys from synced ones; remove silently no-ops for non-local keys #73: the server route (backend/cli/src/server/routes/provider.ts) returns Provider.Info objects for connected providers, which always include source (env from env loading, api from Auth.all(), config/custom from config merging in backend/cli/src/provider/provider.ts); the badge map covers the full Provider["source"] union so every connected provider gets a badge, and the ?? "api" fallback preserves today's remove behavior if the field were ever missing.
  • No sign-in from the workspace and sign-out failures are silent #76: account.logout returns { error } on non-2xx (hey-api client, throwOnError defaults to false) and rejects on network failure — both paths now land in the same catch and toast. The guidance copy keys off account()?.session === false, which is set both by GET /account when signed out and locally after a successful logout.
  • Usage panel shows stale wallet balance and fake defaults while loading #77: GET /account returns session: false, balance_usd: -1, billing_mode: null when signed out, so the signed-out branches are reachable and the existing balance >= 0 guard already treats -1 as unknown; account() === undefined only holds before the first response, so the loading placeholders can't mask real data.

…let refresh

- Credentials: badge each connected provider key with where it lives
  (local auth store, env/dashboard sync, or openscience.json) and gate
  the remove action to local keys — removing an env- or config-backed
  key silently no-oped before.
- General: catch sign-out failures (including error payloads the SDK
  client returns without throwing) and surface them as a toast; show
  connect-login guidance whenever the machine is signed out.
- Usage: refetch account/usage on window focus so a dashboard top-up
  shows up on return, and render explicit loading/signed-out
  placeholders instead of defaulting to Free/byok.
@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openscience Ready Ready Preview, Comment Jul 5, 2026 11:45am

Request Review

@aayambansal Aayam Bansal (aayambansal) merged commit 633359b into main Jul 5, 2026
11 checks passed
@aayambansal Aayam Bansal (aayambansal) deleted the fix/settings-ui-clarity branch July 5, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant