Skip to content

Bring a guest's work along when they sign up for an account - #2574

Open
joepio wants to merge 3 commits into
developfrom
fix/guest-work-after-portal-signup
Open

joepio wants to merge 3 commits into
developfrom
fix/guest-work-after-portal-signup

Conversation

@joepio

@joepio joepio commented Nov 17, 2026

Copy link
Copy Markdown
Member

Requested by Joep · project thread

What was wrong

Found while walking real user flows on a local stack (atomic-server + vite + atomic-saas portal).

  1. Open the app without an account, click Get started. You are a guest with a local "Welcome to Atomic" drive. Edit the Notes document.
  2. Sign up by email in the portal. It hands back to /app/welcome?from_portal=true.
  3. After the profile and recovery steps you land in a new, empty drive under a new identity. The Welcome drive is not in the drive switcher or under My drives, and opening the note gives "Resource not found ... not found locally".

The work looked lost, while planning/identity-bring-along.md says a guest's work always comes along and the guest checklist itself says "Save your work: sign up with your email".

Cause

NewIdentitySection.handleCreate replaced the guest agent with the freshly made one (store.setAgent) without handing the guest's drives over, and IdentityReconcileGate skips /app/welcome, so nothing else caught the switch. The guest key was not archived either.

Fix

No second mechanism: before the switch, handleCreate calls the existing prepareIdentitySwitch (archives the old key, applies the existing "has work" rule, hands a guest's drives over without asking). Once the new home drive exists it calls applyBroughtAlong, which imports the local-only drives and lists them in the new home. If that fails it only warns; the pending record stays and the reconcile gate retries. An identity that is not a guest is only archived, never handed over unasked, as on secret sign-in.

Verified

  • New NewIdentitySection.test.tsx (3 tests; 2 failed before the fix). With bringAlong.test.ts, views/getting-started and IdentityReconcileGate.test.tsx: 5 files, 57 tests pass. pnpm typecheck clean.
  • By hand in Chromium against the local stack: guest edits Notes, signs up by email, finishes onboarding. "Welcome to Atomic" is listed under My drives next to the new drive, opens, and the note still holds the guest's text.
  • Not covered: no Playwright e2e for this path yet (it needs the portal; bring-along.spec.ts is the model for the FOSS side).

No UI text or layout changed, so there are no screenshots.

Checklist

  • Changelog entry (browser/CHANGELOG.md)
  • Tests added
  • planning/identity-bring-along.md updated

NewIdentitySection replaced the guest agent without handing its drives over,
and the reconcile gate skips /app/welcome, so the guest's drives vanished after
portal sign-up. Use prepareIdentitySwitch before the switch and
applyBroughtAlong once the new home exists.
@joepio joepio self-assigned this Nov 17, 2026
@joepio
joepio marked this pull request as ready for review November 17, 2026 21:14
The hand-over ran inside account creation without a guard, so a refused grant
would have stopped the sign-up with an error. The guest key is archived first
and the reconcile gate retries, so continue and only warn.
@joepio

joepio commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

Self-review, read critically. The checks that ran on this PR are the Flutter package jobs only; the browser suite does not run on PRs. I dispatched main.yml on this branch: https://github.com/ontola/atomic-server/actions/runs/44201007557

Fixed in a follow-up commit (effaa6a)

  • The hand-over ran inside account creation without a guard, so a refused grant would have stopped the sign-up with an error. It now only warns and the sign-up goes on; the guest key is archived before anything is handed over and the reconcile gate retries. Test added.

For the reviewer

  • Consequence of the existing "has work" rule: someone who clicked Try Atomic before signing up gets the guest "Welcome to Atomic" drive in their new account next to their own drive, also when they only looked around, if the rule counts the starter content as work. That is what planning/identity-bring-along.md says should happen, but it is a visible change for everyone who tries the app first.
  • NewIdentitySection.test.tsx mocks the bring-along helpers, so it only pins the order of calls. The real proof is the journey test in ontola/atomic-saas#270 (red on develop, green on this branch) and the manual run.
  • An identity that is not a guest is now archived on this path where it was silently replaced before. Nothing is handed over for it.

This branch has not been deployed

No deployments
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