test(auth): add missing SessionStateMachine tests for refresh cancellation and failure#934
Merged
grdsdev merged 3 commits intorefactor/auth-session-state-machinefrom Mar 25, 2026
Conversation
3 tasks
…StateMachine Co-authored-by: grdsdev <5923044+grdsdev@users.noreply.github.com> Agent-Logs-Url: https://github.com/supabase/supabase-swift/sessions/96bb2c8d-09ab-479b-89de-3bd718602e12
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
[WIP] [WIP] Address feedback on refactoring SessionManager to SessionStateMachine actor
test(auth): add missing SessionStateMachine tests for refresh cancellation and failure
Mar 25, 2026
…ine' into copilot/sub-pr-931-again
d624fb0
into
refactor/auth-session-state-machine
1 of 2 checks passed
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.
The
SessionStateMachinetest suite only covered the happy path and refresh coalescing. Two behaviors introduced by the actor refactor — cancellation preserving state and failure transitioning cleanly to unauthenticated — had no coverage.Added tests
testRefreshCancellation_shouldRestoreUsableState— cancels an in-flight refresh viaremove()and verifies the state machine ends up cleanly.unauthenticated(not stuck in.refreshing), then confirms recovery viaupdate(session)+validSession()succeeds.testRefreshFailure_storageAndStateConsistentAndRecoverable— exercises a refresh that throws at the HTTP layer, verifies the error propagates and state transitions to.unauthenticated, then confirmsupdate(session)+validSession()recovers correctly (auto-refresh recovery path).Both tests mirror the existing
withMainSerialExecutorpattern for deterministic concurrency on Apple platforms.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.