Centralize onboarding completion#806
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7021a126b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Greptile SummaryThis PR centralizes the onboarding completion decision into Rust, replacing the per-platform
Confidence Score: 5/5Safe to merge — the centralization is well-structured and the migration backfill correctly handles existing users. The Rust-side mark_onboarding_complete / needs_onboarding contract is clean and idempotent. The backfill logic is guarded by wallet presence and absence of in-flight progress, and the set_inner(notify: false) call at initialization avoids spurious reconcile loops. Both iOS and Android react to DatabaseUpdated to re-read the flag, making the host-side transition deterministic. The removal of StartupRestoreRecovery and allow_auto_advance simplifies state that was previously hard to reason about, and test coverage for the new backfill path is adequate. No files require special attention. The set_inner FFI-exposure concern in global_flag.rs was already filed in a prior review thread. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant UI as OnboardingContainer (iOS/Android)
participant OM as RustOnboardingManager
participant FS as FlowState
participant DB as GlobalFlagTable
participant AM as AppManager
UI->>OM: dispatch(AcceptTerms)
OM->>FS: apply_user_action(AcceptTerms)
FS-->>OM: TransitionCommand::CompleteOnboarding(target)
OM->>OM: complete_onboarding(target)
OM->>OM: select_latest_or_new_wallet() / select_wallet()
OM->>DB: mark_onboarding_complete()
DB->>DB: "set_inner(CompletedOnboarding=true, notify=true)"
DB-->>AM: DatabaseUpdated reconcile event
AM->>AM: "needsOnboarding = rust.needsOnboarding() → false"
AM-->>UI: startupMode transitions to READY
OM->>OM: sync_onboarding_progress(None)
OM->>UI: "Message::Complete → callback sets startupMode=READY (idempotent)"
Note over DB,AM: On first Database::new() (startup / reset)
DB->>DB: backfill_onboarding_complete_from_legacy_state()
DB->>DB: read AcceptedTerms (legacy key)
DB->>DB: "if terms+wallets+no progress → set CompletedOnboarding=true (notify=false)"
AM->>AM: "needsOnboarding = rust.needsOnboarding() (reads backfilled value)"
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant UI as OnboardingContainer (iOS/Android)
participant OM as RustOnboardingManager
participant FS as FlowState
participant DB as GlobalFlagTable
participant AM as AppManager
UI->>OM: dispatch(AcceptTerms)
OM->>FS: apply_user_action(AcceptTerms)
FS-->>OM: TransitionCommand::CompleteOnboarding(target)
OM->>OM: complete_onboarding(target)
OM->>OM: select_latest_or_new_wallet() / select_wallet()
OM->>DB: mark_onboarding_complete()
DB->>DB: "set_inner(CompletedOnboarding=true, notify=true)"
DB-->>AM: DatabaseUpdated reconcile event
AM->>AM: "needsOnboarding = rust.needsOnboarding() → false"
AM-->>UI: startupMode transitions to READY
OM->>OM: sync_onboarding_progress(None)
OM->>UI: "Message::Complete → callback sets startupMode=READY (idempotent)"
Note over DB,AM: On first Database::new() (startup / reset)
DB->>DB: backfill_onboarding_complete_from_legacy_state()
DB->>DB: read AcceptedTerms (legacy key)
DB->>DB: "if terms+wallets+no progress → set CompletedOnboarding=true (notify=false)"
AM->>AM: "needsOnboarding = rust.needsOnboarding() (reads backfilled value)"
Reviews (2): Last reviewed commit: "Skip onboarding backfill with progress" | Re-trigger Greptile |
5fd2340 to
d90d503
Compare
Persist completed onboarding in redb from Rust and expose one needs-onboarding decision to the mobile shells. Remove the separate accepted-terms startup path so iOS and Android no longer duplicate eligibility checks.
Remove the generated UniFFI bindings and API surface for set_inner (Kotlin/Swift): deleted external/uniffi calls, interface/class methods, and associated checksum checks. Regenerated bindings reflect that set_inner is now internal/private. Rust GlobalFlagTable was cleaned up by moving/merging get_bool_config, set_bool_config, and toggle_bool_config (removed duplicate block) and keeping set_inner as an internal method. No behavioral changes intended — this is a binding/regeneration cleanup after making set_inner non-public.
d90d503 to
6da79d0
Compare
* Centralize onboarding completion Persist completed onboarding in redb from Rust and expose one needs-onboarding decision to the mobile shells. Remove the separate accepted-terms startup path so iOS and Android no longer duplicate eligibility checks. * Remove set_inner binding and regenerate UniFFI code Remove the generated UniFFI bindings and API surface for set_inner (Kotlin/Swift): deleted external/uniffi calls, interface/class methods, and associated checksum checks. Regenerated bindings reflect that set_inner is now internal/private. Rust GlobalFlagTable was cleaned up by moving/merging get_bool_config, set_bool_config, and toggle_bool_config (removed duplicate block) and keeping set_inner as an internal method. No behavioral changes intended — this is a binding/regeneration cleanup after making set_inner non-public. * Skip onboarding backfill with progress
No description provided.