Skip to content

fix(onboarding): restore user state on warm start - #71

Closed
acslater00 wants to merge 1 commit into
masterfrom
acslater00/fix-warm-start-onboarding
Closed

fix(onboarding): restore user state on warm start#71
acslater00 wants to merge 1 commit into
masterfrom
acslater00/fix-warm-start-onboarding

Conversation

@acslater00

Copy link
Copy Markdown

Summary

  • restore authenticated user state during preflight when a valid token already exists
  • carry that user through PreflightResolved into bootstrap state so sync completion can transition to chat
  • add a regression test covering the warm-start preflight path

Why

Warm starts could reach PowerSync Ready and then stall in onboarding. The root cause was that the fresh auth path populated bootstrap.State.User, but the preflight path only restored auth validity plus org/account state. After sync completed, onboarding rejected completion because User was still nil.

Implementation details

  • extend bootstrap.PreflightState with an optional User
  • in onboarding preflight, call GetUserID() after validating the access token and attach a minimal auth.User{ID: ...}
  • update ApplyPreflight to copy that user into bootstrap state
  • add a transition test asserting PreflightResolved carries user state forward

Verification

  • reproduced the bug locally by authenticating once, quitting, and launching again
  • confirmed logs showed sync completed without required onboarding state has_user=false ...
  • full go test was not runnable in this environment because the sandbox could not reach proxy.golang.org to fetch modules

Risk

  • low: this only affects the already-authenticated preflight path and only adds user hydration from the existing token
  • auth.User is populated minimally with ID because warm-start completion only requires presence of the user object

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions Bot added the Stale label May 3, 2026
@github-actions

Copy link
Copy Markdown

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions Bot closed this May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant