Skip to content

feat: setup wizard for new databases (discussion #523)#544

Merged
ericgriffin merged 26 commits into
mainfrom
worktree-523-setup-wizard
Jul 11, 2026
Merged

feat: setup wizard for new databases (discussion #523)#544
ericgriffin merged 26 commits into
mainfrom
worktree-523-setup-wizard

Conversation

@ericgriffin

@ericgriffin ericgriffin commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

Replaces the name-only welcome page with a multi-step setup wizard for new databases, per discussion #523. First run now offers a fork: set up a fresh logbook (profile, units, appearance, backups, cloud sync) or bring existing Submersion data (restore a backup file, connect cloud sync and pull the library, or open a folder that already contains a database). The same wizard is re-runnable from Settings -> Manage -> Setup assistant with data-sensitive steps hidden.

Design spec: docs/superpowers/specs/2026-07-10-setup-wizard-design.md
Implementation plan: docs/superpowers/plans/2026-07-10-setup-wizard.md

Changes

  • New lib/features/setup_wizard/ feature: pure-function step computation (computeSteps), immutable draft + SetupWizardNotifier, SetupApplyService, PageView shell, and step widgets (fork, profile, units, appearance, backup & sync, finish, existing-choice, restore, sync pull, open folder)
  • Draft-and-apply semantics: nothing persists until Finish; abandoning the wizard leaves the database untouched
  • Race-safe first-run apply: the defaults DiverSettings row seeded by createDiver is overwritten with the draft BEFORE setCurrentDiver, so the unawaited SettingsNotifier reload loads the drafted values instead of clobbering them
  • Units step preselects Metric/Imperial from the device locale (US/LR/MM -> Imperial) with per-unit fine-tuning; appearance step covers theme mode, color theme, map style, and language with a live locale preview (previewLocaleProvider + 2-line app.dart hook)
  • Backup & sync step drives backupSettingsProvider (schedule + cloud copy) and mirrors CloudSyncPage's provider activation contract (iCloud gated by availability, Dropbox by app key, S3 via the existing config page); cross-path pivots for "library found" / "no library found"
  • Existing-data paths reuse the restore machinery (restoreFromFilePath -> RestoreCompletePage -> restartApp()), sync pull (performSync + active-diver realignment), and storage adoption (switchToExistingDatabase + restart)
  • WizardStepDef / WizardStepIndicator moved to lib/shared/widgets/wizard/ (shared with the import wizard; its shell untouched)
  • Router: /welcome renders the wizard; new /settings/setup-assistant route + Manage-section tile; WelcomePage and the onboarding_welcome_* l10n keys removed
  • ~100 new setup_* l10n keys translated in all 11 locales
  • Docs updated: navigation, architecture, user guide first-dive, roadmap

Test Plan

  • flutter test passes (targeted suites: setup_wizard 27, import_wizard 627, core/router 35, settings 36, divers 100, backup 230 - 1055 total)
  • flutter analyze passes (whole project, no issues)
  • Manual testing on: macOS (debug build + launch smoke passed; interactive wizard walkthrough and real-provider sync connects still pending)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Introduces a new multi-step Setup Wizard to replace the legacy name-only onboarding for new databases, with a Settings re-entry route (“Setup assistant”). The wizard supports fresh-start configuration (profile, units, appearance, backups/sync) and existing-data acquisition paths (restore backup, cloud sync pull, open existing folder), and shares wizard UI primitives with the import wizard.

Changes:

  • Add setup_wizard feature (draft state + step computation, step widgets, and apply service) and wire it into routing (/welcome) plus Settings re-entry (/settings/setup-assistant).
  • Move/introduce shared wizard UI components (WizardStepDef, WizardStepIndicator) and update import-wizard references/tests to use the shared location.
  • Add/replace localization keys across locales and update user/developer docs to reflect the new first-run flow.

Reviewed changes

Copilot reviewed 75 out of 78 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/features/setup_wizard/presentation/widgets/steps/units_step_test.dart Widget tests for unit preset + fine-tuning behavior
test/features/setup_wizard/presentation/widgets/steps/finish_step_test.dart Widget test for applying draft and navigating to dashboard
test/features/setup_wizard/presentation/widgets/steps/existing_data_steps_test.dart Widget test for existing-data choice updating draft
test/features/setup_wizard/presentation/widgets/steps/backup_sync_step_test.dart Widget tests for backup toggles and provider-card gating
test/features/setup_wizard/presentation/widgets/steps/appearance_step_test.dart Widget test for theme/map/language draft updates + preview
test/features/setup_wizard/presentation/providers/setup_wizard_providers_test.dart Unit tests for notifier draft mutations and step computation
test/features/setup_wizard/presentation/pages/setup_wizard_page_test.dart Flow tests for first-run and settings-mode wizard navigation
test/features/setup_wizard/presentation/pages/first_run_redirect_test.dart Router redirect test to wizard when no divers exist
test/features/setup_wizard/domain/unit_preset_detector_test.dart Tests for locale→unit preset mapping
test/features/setup_wizard/domain/setup_wizard_models_test.dart Tests for step computation and unit-preset application
test/features/setup_wizard/data/setup_apply_service_test.dart Tests for first-run/settings-mode apply ordering and persistence
test/features/import_wizard/presentation/widgets/wizard_step_indicator_test.dart Update import path to shared wizard indicator
test/features/import_wizard/presentation/widgets/review_step_test.dart Update import path to shared WizardStepDef
test/features/import_wizard/presentation/widgets/review_step_pending_test.dart Update import path to shared WizardStepDef
test/features/import_wizard/presentation/widgets/import_summary_step_test.dart Update import path to shared WizardStepDef
test/features/import_wizard/presentation/widgets/import_progress_step_test.dart Update import path to shared WizardStepDef
test/features/import_wizard/presentation/pages/unified_import_wizard_test.dart Update import path to shared WizardStepDef
test/features/import_wizard/domain/services/step_skip_calculator_test.dart Update import path to shared WizardStepDef
test/features/import_wizard/domain/models/wizard_step_def_test.dart Update import path to shared WizardStepDef
test/features/import_wizard/domain/adapters/import_source_adapter_test.dart Update import path to shared WizardStepDef
lib/shared/widgets/wizard/wizard_step_indicator.dart New shared step indicator widget
lib/shared/widgets/wizard/wizard_step_def.dart New shared step definition model
lib/l10n/arb/app_zh.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_pt.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_nl.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_it.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_hu.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_he.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_fr.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_es.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_de.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_ar.arb Add setup wizard/manage setup assistant strings; remove onboarding welcome keys
lib/l10n/arb/app_localizations_zh.dart Generated localization updates for setup wizard strings
lib/l10n/arb/app_localizations_pt.dart Generated localization updates for setup wizard strings
lib/l10n/arb/app_localizations_nl.dart Generated localization updates for setup wizard strings
lib/l10n/arb/app_localizations_en.dart Generated localization updates for setup wizard strings
lib/features/setup_wizard/presentation/widgets/steps/welcome_fork_step.dart New welcome fork step (fresh vs existing vs skip)
lib/features/setup_wizard/presentation/widgets/steps/profile_step.dart New profile (name) step wiring into draft
lib/features/setup_wizard/presentation/widgets/steps/units_step.dart New units preset + per-unit override step
lib/features/setup_wizard/presentation/widgets/steps/appearance_step.dart New appearance step including live locale preview
lib/features/setup_wizard/presentation/widgets/steps/backup_sync_step.dart New backup schedule + sync provider connect step
lib/features/setup_wizard/presentation/widgets/steps/sync_connect_step.dart Existing-data sync connect + pull flow step
lib/features/setup_wizard/presentation/widgets/steps/restore_step.dart Existing-data restore-from-file flow step
lib/features/setup_wizard/presentation/widgets/steps/open_folder_step.dart Existing-data “open folder / adopt DB” flow step
lib/features/setup_wizard/presentation/widgets/steps/existing_choice_step.dart Existing-data source selection step
lib/features/setup_wizard/presentation/widgets/steps/finish_step.dart Finish/apply step + feature discovery actions
lib/features/setup_wizard/presentation/providers/setup_wizard_providers.dart Draft state + notifier (mode-keyed) + preview locale provider
lib/features/setup_wizard/presentation/pages/setup_wizard_page.dart Wizard shell: PageView navigation + step indicator + bottom bar
lib/features/setup_wizard/domain/unit_preset_detector.dart Locale-based unit preset detector
lib/features/setup_wizard/domain/setup_wizard_models.dart Draft model + step computation
lib/features/setup_wizard/data/setup_apply_service.dart Service to persist the wizard draft (first-run + settings mode)
lib/features/settings/presentation/pages/settings_page.dart Add Settings → Manage tile to launch setup assistant
lib/features/onboarding/presentation/pages/welcome_page.dart Remove legacy onboarding welcome page
lib/features/import_wizard/presentation/pages/unified_import_wizard.dart Update imports to shared wizard widgets
lib/features/import_wizard/domain/services/step_skip_calculator.dart Update import to shared WizardStepDef
lib/features/import_wizard/domain/adapters/import_source_adapter.dart Update import to shared WizardStepDef
lib/features/import_wizard/data/adapters/universal_adapter.dart Update import to shared WizardStepDef
lib/features/import_wizard/data/adapters/healthkit_adapter.dart Update import to shared WizardStepDef
lib/features/import_wizard/data/adapters/dive_computer_adapter.dart Update import to shared WizardStepDef
lib/core/router/app_router.dart Route /welcome → setup wizard; add /settings/setup-assistant
lib/app.dart Add preview-locale override hook for live language preview
docs/guide/README.md Update guide to describe setup wizard as first-run step
docs/guide/first-dive.md Update first-dive guide to match wizard-based onboarding
docs/FEATURE_ROADMAP.md Mark setup wizard as completed
docs/developer/navigation.md Document new routes and updated first-run redirect behavior
docs/developer/architecture.md Update feature directory listing to setup_wizard
docs/ARCHITECTURE.md Update architecture overview to reflect setup_wizard

Comment thread lib/features/setup_wizard/data/setup_apply_service.dart
Comment thread lib/features/setup_wizard/presentation/widgets/steps/backup_sync_step.dart Outdated
Comment thread lib/features/setup_wizard/presentation/pages/setup_wizard_page.dart
Addresses device-testing feedback on the wizard:

- S3 sync no longer bounces to the fork. context.push to
  /settings/cloud-sync/s3-config hit the router's zero-divers onboarding
  redirect (no diver exists until Finish) and resolved to /welcome. S3
  config now opens on the root navigator, bypassing go_router.
- Every step past the fork is reversible. The existing-data steps (Bring
  your data, Restore, Connect cloud sync, Open folder) had no bottom bar
  and no back affordance; they now show a top back bar. Form-zone steps
  keep their bottom-bar Back.
- Removed the Appearance step from the fresh path (theme/map/language stay
  in Settings), and the now-orphaned previewLocale hook.
Copilot AI review requested due to automatic review settings July 10, 2026 18:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 72 out of 75 changed files in this pull request and generated 2 comments.

Comment thread lib/features/setup_wizard/data/setup_apply_service.dart
@ericgriffin ericgriffin self-assigned this Jul 10, 2026
@ericgriffin ericgriffin moved this from Backlog to In review in Submersion Release Tracker Jul 10, 2026
…-backup toggle, PageController resync

- Settings re-entry now seeds the draft's backup schedule, cloud-backup
  flag, and active cloud provider from live state, so pressing Finish
  without touching the backup step no longer disables an existing schedule.
- _applyBackupChoices applies the cloud-copy flag in both directions
  (previously only ever enabled it, so it could never be turned off).
- The cloud-copy toggle now shows whenever a provider is connected (keying
  on the draft, which settings mode seeds) instead of only when connected
  in-session; the manage-in-settings link shows in re-entry mode.
- SetupWizardPage resyncs the PageController post-frame when the step list
  shrinks (adopt pivot), preventing a blank/out-of-range PageView frame.
- units_step_test pins the UI locale to English so it no longer depends on
  the de_DE device locale (used only for preset detection) rendering English.
Copilot AI review requested due to automatic review settings July 10, 2026 21:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 73 out of 76 changed files in this pull request and generated 1 comment.

Adds fake-driven widget tests for the previously-untested existing-data
steps (open folder, restore, cloud-sync pull) and the wizard shell's
existing-data navigation, plus per-unit control, finish error, and
connected-provider paths. Injects restore_step's file-picker behind a
default-real seam (mirroring storage's chooser param) so the restore
result flow is exercisable. Patch coverage on changed lines: ~90.4%.
Copilot AI review requested due to automatic review settings July 10, 2026 22:57
_startPull could throw (peerSyncFiles lists cloud files; performSync runs a
network sync) and crash the wizard or strand it on the spinner. Wrap the
flow in try/catch: on failure, return to the connect UI and surface the
error via the localized snackbar. (PR review.)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 76 out of 79 changed files in this pull request and generated 1 comment.

Comment thread lib/features/setup_wizard/presentation/widgets/steps/sync_connect_step.dart Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 23:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 76 out of 79 changed files in this pull request and generated 1 comment.

…ssage

Two more PR review points:
- _startPull now checks SyncState.status after performSync(): a captured
  sync error (not thrown) previously fell through to the misleading 'No
  library found' screen; it now returns to the connect UI with the error.
- On Apple platforms where iCloud is unsupported (signed out or a build
  without the entitlement), show a disabled iCloud tile explaining why,
  using the previously-unused setup_sync_icloudUnavailable string, instead
  of silently hiding it.
…/stats->/statistics)

The finish-screen feature links used /gear and /stats, which don't exist
(they 404'd to the Page Not Found screen). Point them at the real routes
(/equipment, /statistics). The five feature routes are now a public const
(kSetupFinishFeatureRoutes) guarded by a router test asserting each resolves
in the app route tree, so a bad link can't ship again.
…ting

Once a provider connected, the connected status replaced the provider
cards with no way to disconnect, so a user whose pull failed (or who picked
the wrong backend) was stuck. First-run mode now shows a 'Change provider'
action that clears the in-wizard selection and restores the cards; settings
mode keeps its 'Manage in Settings' link.
…zard

# Conflicts:
#	lib/features/import_wizard/data/adapters/universal_adapter.dart
The merge accidentally recorded the submodule at its stale checked-out
branch tip (7e8fd9a, pre-Perdix-3) instead of main's pinned commit
(150672e). That regressed the descriptor set, failing the native
test_descriptor_match_integration 'Perdix 3' assertion. Restore the gitlink
to match origin/main. Verified: all 7 C wrapper tests pass locally.
@ericgriffin ericgriffin merged commit 0cfe92d into main Jul 11, 2026
25 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Submersion Release Tracker Jul 11, 2026
@ericgriffin ericgriffin deleted the worktree-523-setup-wizard branch July 11, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants