Skip to content

fix(desktop): clear all onboarding state on sign-out via one shared key list - #10108

Merged
kodjima33 merged 7 commits into
mainfrom
fix/signout-onboarding-clear
Jul 20, 2026
Merged

kodjima33 merged 7 commits into
mainfrom
fix/signout-onboarding-clear

Conversation

@skanderkaroui

@skanderkaroui skanderkaroui commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

fix(desktop): clear all onboarding state on sign-out via one shared key list

Deleting an account (or signing out) and re-onboarding on the same Mac showed the previous run's onboarding answers still filled in. AuthService.signOut() and AppState.resetOnboardingAndRestart() each kept a hand-maintained onboarding-key list, so keys present at only one site — hasSeenRewindIntro, hasTriggeredAccessibility, hasTriggeredBluetooth, and the onboarding-chat exploration state (onboardingExplorationText/Completed, onboardingMidOnboarding, onboardingToolCompleted, onboardingGoalCompleted) — leaked across accounts.

Root cause: two divergent hand-maintained lists (split authority over the same cleanup contract). Durable guard: OnboardingFlow.persistedStateKeys + clearPersistedState(in:) is the single list both sites iterate; both sites also call OnboardingChatPersistence.clear(). Deliberate exclusions (hasCompletedOnboarding, screenAnalysisEnabled, chat keys) are documented at the list. Static call-site tripwires pin both sites to the shared helpers — an earlier version of this fix was silently reverted by a merge resolving toward a wholesale reformat while an isolation-only test stayed green.

Product invariants affected

  • INV-AUTH-1 — AuthService.signOut() is touched only to route onboarding-key cleanup through the shared helpers; session-death ownership (AuthSessionCoordinator, invalidateSession vs nuclear signOut()) is unchanged.

Failure class (fixes)

Failure-Class: FC-split-mutation-authority

Verification

  • ./scripts/dev-feedback.py --once swift 'OnboardingPersistenceClearingTests' — 4/4 pass locally and on the qualification Mac (67s).
  • make preflight (full deterministic check manifest, same as CI Hygiene) green on the qualification Mac.
  • Line-count ratchet: AuthService.swift shrank; owning baseline shard ratcheted down in the same PR.

Review in cubic

OnboardingFlow.persistedStateKeys + clearPersistedState(in:) become the single
authoritative list of account-scoped onboarding UserDefaults keys, with the
deliberate exclusions (hasCompletedOnboarding, screenAnalysisEnabled, chat
keys) documented at the list.

Failure-Class: FC-split-mutation-authority
signOut() kept its own hand-rolled key list that missed hasSeenRewindIntro,
hasTriggeredAccessibility, hasTriggeredBluetooth, and the onboarding-chat
exploration keys (onboardingExplorationText/Completed, onboardingMidOnboarding,
onboardingToolCompleted, onboardingGoalCompleted). Deleting an account (which
signs out) then re-onboarding on the same Mac showed the previous run's
answers still filled in. Route cleanup through
OnboardingFlow.clearPersistedState() + OnboardingChatPersistence.clear().

Failure-Class: FC-split-mutation-authority
resetOnboardingAndRestart() drops its second hand-maintained key list and
uses OnboardingFlow.clearPersistedState(), keeping only the documented
hasCompletedOnboarding belt-and-suspenders removal.

Failure-Class: FC-split-mutation-authority
Behavioral test that clearPersistedState removes every shared key, list-
membership assertions for the keys sign-out historically missed, and static
call-site tripwires pinning both clearing sites to the shared helpers — an
earlier version of this fix was silently reverted by a merge resolving toward
a wholesale reformat, and an isolation-only test stayed green.
signOut()'s hand-rolled onboarding key list collapsed into the shared
clearing helpers, shrinking the frozen oversized file; the down-only
ratchet requires the owning shard to follow.
…ring helper

The nuclear-vs-light contract is unchanged: signOut() still wipes onboarding
(now via OnboardingFlow.clearPersistedState()) and performLightSessionInvalidation
still must not; the tripwire pins the new canonical call instead of the retired
hand-rolled onboardingStep string.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed by automated PR reviewer — scoped, correct, CI acceptable. Approving + merging.

@kodjima33
kodjima33 merged commit 8e5406b into main Jul 20, 2026
20 checks passed
@kodjima33
kodjima33 deleted the fix/signout-onboarding-clear branch July 20, 2026 14:38
Git-on-my-level added a commit that referenced this pull request Jul 22, 2026
…n redesign (#10340)

## Summary

Restores onboarding functionality that the Second Brain redesign
(#10218) dropped, re-implemented on top of the new conversational design
(no old UI brought back). Each fix is its own commit:

- **Auto-detect user name** (#9919) — seed the name field from the known
`givenName`, kick a backend name fetch, and adopt an async name arrival
(Apple sends the name only on first auth), so onboarding greets by name
instead of a generic placeholder. Also re-hydrates name/language/role
drafts on resume.
- **Clear onboarding state on sign-out** (#10108) —
`sbOnboardingResumeStep` + `onboardingRole` were added by the redesign
but left out of the shared clearing list, leaking the prior user's
resume step + role to the next account on the same Mac. Added both, plus
a regression test.
- **Drag-to-grant Full Disk Access** (#9742) — the drag-to-grant helper
was wired for Screen Recording but not FDA; now both use it.
- **Connector brand marks + Claude Code restart** (#10210 / #10205) —
connect rows show each connector's brand icon, and Claude Code shows a
restart prompt once connected so running sessions reload the new MCP
config.
- **Remove post-onboarding walkthrough** — the coach-mark tour that ran
after onboarding (spotlighting each nav pill) is deleted; a
just-onboarded user lands straight on Home.
- **Pin the drag-to-grant card under System Settings** — the permission
drag card was pinned to the screen's bottom quarter; it now anchors
directly beneath the live Settings window (flipping above it when
there's no room below) so it follows the window and never covers the
drop target.

## Verification

Build/manual verification pending — depends on #10334 (restores the
`Package.swift`/`Package.resolved` that a stray "fixture" commit gutted
on `main`, which currently breaks the desktop Swift build). This PR
carries no Package changes; once #10334 lands and this rebases, it
builds on the repaired manifest.

## Product invariants affected

- INV-INT-1

## Failure class (fixes)

Failure-Class: none


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/10340?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
…ey list (BasedHardware#10108)

* fix(desktop): add shared account-scoped onboarding clearing list

OnboardingFlow.persistedStateKeys + clearPersistedState(in:) become the single
authoritative list of account-scoped onboarding UserDefaults keys, with the
deliberate exclusions (hasCompletedOnboarding, screenAnalysisEnabled, chat
keys) documented at the list.

Failure-Class: FC-split-mutation-authority

* fix(desktop): clear all onboarding state on sign-out via the shared list

signOut() kept its own hand-rolled key list that missed hasSeenRewindIntro,
hasTriggeredAccessibility, hasTriggeredBluetooth, and the onboarding-chat
exploration keys (onboardingExplorationText/Completed, onboardingMidOnboarding,
onboardingToolCompleted, onboardingGoalCompleted). Deleting an account (which
signs out) then re-onboarding on the same Mac showed the previous run's
answers still filled in. Route cleanup through
OnboardingFlow.clearPersistedState() + OnboardingChatPersistence.clear().

Failure-Class: FC-split-mutation-authority

* fix(desktop): onboarding reset iterates the shared clearing list

resetOnboardingAndRestart() drops its second hand-maintained key list and
uses OnboardingFlow.clearPersistedState(), keeping only the documented
hasCompletedOnboarding belt-and-suspenders removal.

Failure-Class: FC-split-mutation-authority

* test(desktop): regression coverage for onboarding persistence clearing

Behavioral test that clearPersistedState removes every shared key, list-
membership assertions for the keys sign-out historically missed, and static
call-site tripwires pinning both clearing sites to the shared helpers — an
earlier version of this fix was silently reverted by a merge resolving toward
a wholesale reformat, and an isolation-only test stayed green.

* docs(desktop): changelog for onboarding state clearing fix

* chore(desktop): ratchet AuthService.swift line-count baseline down

signOut()'s hand-rolled onboarding key list collapsed into the shared
clearing helpers, shrinking the frozen oversized file; the down-only
ratchet requires the owning shard to follow.

* test(desktop): INV-AUTH-1 tripwire follows the shared onboarding clearing helper

The nuclear-vs-light contract is unchanged: signOut() still wipes onboarding
(now via OnboardingFlow.clearPersistedState()) and performLightSessionInvalidation
still must not; the tripwire pins the new canonical call instead of the retired
hand-rolled onboardingStep string.
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.

2 participants