Phase 2 Task 41 — Dashboard redesign.
Backend:
- Extend GET /users/onboarding-status with email_verified and shop_setup_done.
- tried_ai_assistant kept in payload for backward-compat during deploy.
Frontend:
- New NextStepCard: surfaces the highest-priority incomplete onboarding item
with a primary CTA. Priority order: verify email > set up shop > run first
FlowPilot session > connect PSA > invite teammate > pick a plan (gated on
trial stage warning/urgent/expired). Returns null when all done OR
onboarding_dismissed.
- New SetupChecklist: unified single list (no SOLO/TEAM bifurcation), drops
the stale tried_ai_assistant / Script Builder item, surfaces "Pick a plan"
when trial stage is warning or later.
- Mounted on QuickStartPage below the hero with a "Show all setup steps"
toggle. The whole onboarding section auto-hides when there's nothing left
to nudge on, so the dashboard goes back to clean once setup is done.
- Removed the orphaned OnboardingChecklist component (was defined but never
mounted).
- New useOnboardingStatus hook so page + components share one fetch contract.
Tests:
- Backend: test_onboarding_status_includes_email_verified_and_shop_setup_done.
- Frontend (Vitest): 13 new tests across NextStepCard, SetupChecklist, and
QuickStartPage covering priority ordering, dismissal, the SOLO/TEAM
removal, the toggle reveal, and the trial-stage gate on Pick a plan.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Persists welcome-wizard Step 1/2/3 progress for self-serve signup Phase 2.
PATCH validates step cannot decrease, ignores `data` on action="skip", and
is idempotent on re-PATCH of the same step. POST /users/me/onboarding-dismiss-rest
backs the wizard's "Skip the rest" button.
Both routes added to _EMAIL_VERIFICATION_ALLOWLIST and _SUBSCRIPTION_GUARD_ALLOWLIST
so the wizard runs before email verification and during the trial. 4 integration
tests cover field writes, skip semantics, decrease guard, and dismiss-rest.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Phase 4 enabled RLS on the users table. All code paths that touch users
(or other RLS-protected tables) before require_tenant_context sets
app.current_account_id must use get_admin_db (BYPASSRLS):
- deps.py: get_current_user and get_current_active_user → get_admin_db
- auth.py: all endpoints → get_admin_db (login, register, refresh, etc.
run before tenant context exists; mutation endpoints also need session
consistency since current_user is in the admin session)
- accounts.py: transfer_ownership, leave_account, delete_account
→ get_admin_db (these mutate current_user directly)
- onboarding.py: dismiss_onboarding → get_admin_db (same reason)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>