Fix spacetime login --token falling through to web login#4579
Merged
Conversation
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).
bfops
reviewed
Mar 6, 2026
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.
bfops
reviewed
Mar 6, 2026
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.
bfops
reviewed
Mar 6, 2026
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.
…clockworklabs/SpacetimeDB into bot/fix-login-token-fallthrough
bfops
reviewed
Mar 6, 2026
Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
…fallthrough' of github.com:clockworklabs/SpacetimeDB into bot/fix-login-token-fallthrough
bfops
approved these changes
Mar 6, 2026
Collaborator
bfops
left a comment
There was a problem hiding this comment.
LGTM. I've confirmed that the new test fails on master (it triggers the timeout)
jdetter
approved these changes
Mar 6, 2026
Collaborator
jdetter
left a comment
There was a problem hiding this comment.
Haven't tested this myself but it looks fine 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
PR #4367 (login/logout UX overhaul) accidentally removed the early
return Ok(())after saving a token viaspacetime 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 --tokenare broken:test_enable_disable_replication,test_enable_replication_on_suspended_database,test_enable_replication_fails_if_not_suspended,test_prefer_leader)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--tokenbranch.