Skip to content

Fix spacetime login --token falling through to web login#4579

Merged
bfops merged 12 commits intomasterfrom
bot/fix-login-token-fallthrough
Mar 7, 2026
Merged

Fix spacetime login --token falling through to web login#4579
bfops merged 12 commits intomasterfrom
bot/fix-login-token-fallthrough

Conversation

@clockwork-labs-bot
Copy link
Collaborator

@clockwork-labs-bot clockwork-labs-bot commented Mar 6, 2026

Bug

PR #4367 (login/logout UX overhaul) accidentally removed the early return Ok(()) after saving a token via spacetime login --token. This caused the command to fall through into the web login flow (spacetimedb_login_and_save), which fails when no browser or server is available.

Impact

All tests that use spacetime login --token are broken:

  • 4 replication tests (test_enable_disable_replication, test_enable_replication_on_suspended_database, test_enable_replication_fails_if_not_suspended, test_prefer_leader)
  • 5 teams tests (test_permissions_clear_org, test_permissions_delete_org, test_org_permissions_mut_sql_org_members, test_org_permissions_private_tables, test_permissions_publish_org_members)

Fix

One line: restore return Ok(()) after the --token branch.

PR #4367 (login/logout UX overhaul) accidentally removed the early
return after saving a token via `spacetime login --token`. This caused
the command to fall through into the web login flow, which fails when
no browser/server is available.

This breaks all Private repo smoketests that use `spacetime login --token`
(replication tests, teams tests — 9 failures total).
clockwork-labs-bot and others added 2 commits March 6, 2026 16:27
Verifies that `spacetime login --token <token>` exits immediately
after saving the token, without falling through to the interactive
web login flow. Without the fix, this test would hang or fail in CI.
clockwork-labs-bot and others added 2 commits March 6, 2026 16:41
The previous test succeeded on the base branch because Command::output()
blocks forever when the login flow hangs waiting for a browser callback.

Now spawns the process and polls with try_wait() + 15s timeout. Without
the fix, the command falls through to web login and hangs → timeout →
test fails. With the fix, it exits immediately → test passes.

Also unsets BROWSER to ensure the web login flow cannot succeed.
Without the fix, the fallthrough to web login would open a browser
on developer machines running the test suite. --no-browser prevents
this while still causing the command to hang (waiting for callback),
which the timeout detects.
bfops and others added 3 commits March 6, 2026 13:58
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
…fallthrough' of github.com:clockworklabs/SpacetimeDB into bot/fix-login-token-fallthrough
Copy link
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

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

LGTM. I've confirmed that the new test fails on master (it triggers the timeout)

Copy link
Collaborator

@jdetter jdetter left a comment

Choose a reason for hiding this comment

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

Haven't tested this myself but it looks fine 👍

@bfops bfops disabled auto-merge March 7, 2026 05:52
@bfops bfops enabled auto-merge March 7, 2026 05:52
@bfops bfops added this pull request to the merge queue Mar 7, 2026
Merged via the queue into master with commit c5fa5d6 Mar 7, 2026
35 checks passed
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.

3 participants