Skip to content

refactor(auth): stop calling Supabase directly for logout, login checks and live status - #312

Merged
riglar merged 2 commits into
devfrom
refactor/drop-direct-supabase-calls
Nov 12, 2026
Merged

riglar merged 2 commits into
devfrom
refactor/drop-direct-supabase-calls

Conversation

@riglar

@riglar riglar commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

What

Part of moving the CLI off direct Supabase calls, so that every request goes through the DeviceCloud API. This PR removes the three uses that need no API changes.

dcd logout

  • It now just deletes the stored session.
  • The old code called Supabase signOut({ scope: 'local' }). That never revoked anything on the server, so the round trip did nothing useful. One side effect: setSession with an expired access token could trigger a token refresh just to sign out.
  • Behaviour is the same as before. You stay signed in to the web app and to any other CLI.

dcd login diagnostic

  • If the API rejected a freshly minted token, login also called Supabase's /auth/v1/user to say whose fault it was.
  • That probe is gone. The error still names the token's issuer, which is enough to spot a token from the wrong environment.

Live result status (dcd cloud, dcd status)

  • Logged-in users had a Supabase Realtime socket. It was only a speed-up on top of HTTP polling.
  • The socket is removed. Everyone now polls every 20s. That is what API-key users already got. Logged-in users used to poll every 60s plus get realtime pushes.
  • Polls that find no change still get an empty 304, so the extra polls cost little.
  • The "● realtime connected" footer is gone. The countdown to the next refresh stays.
  • The --api-key tip no longer promises live updates.

Not in this PR

Token refresh and the storage upload still talk to Supabase. Both need API work first.

Testing

  • pnpm typecheck, pnpm lint (no new warnings), pnpm test:unit (567 passing), pnpm build
  • Removed the realtime stubs from session-refresh.test.ts. The token-refresh-during-poll tests still cover the polling path.

🤖 Generated with Claude Code

…ks and live status

- dcd logout now just deletes the stored session. It never revoked
  anything server-side, so the Supabase round trip did nothing useful.
- dcd login no longer probes Supabase's /auth/v1/user when the API
  rejects a new token. The error still names the token's issuer.
- dcd cloud / status no longer open a Supabase Realtime socket. It was
  only a speed-up over polling. Logged-in users now poll every 20s, the
  same as API-key users (was 60s plus realtime pushes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/services/results-polling.service.ts Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@riglar
riglar merged commit 14ae83d into dev Nov 12, 2026
11 checks passed
@riglar
riglar deleted the refactor/drop-direct-supabase-calls branch November 12, 2026 15:30
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