feat(desktop): restore onboarding funnel instrumentation
Part of SUPER-1729 — https://linear.app/superset-sh/issue/SUPER-1729
Restores renderer-side onboarding funnel instrumentation for the 2-step flow. Analytics only — no UX, navigation, gating, or experiment changes (useNewWorkspaceScreenVariant and all new-workspace-screen exposure logic untouched). All events go through the existing track() helper in renderer/lib/analytics.
Events emitted
| Event | Properties | When |
|---|---|---|
onboarding_started | — | First entry into the onboarding flow; module-level guard prevents double-fire on remount/route bounce (once per renderer session) |
onboarding_step_started | step | Entering a step; deduped against the current step, re-fires on re-entry after abandonment |
onboarding_step_completed | step | Step 1: Continue click. Step 2: in finish() immediately before onboarding_finished |
onboarding_abandoned | step | Best-effort on layout unmount (deferred one tick so StrictMode double-mounts and route bounces don't count) and synchronously on beforeunload; suppressed once finished |
onboarding_error | step, action, reason | Clone failure (action: clone), completeOnboarding failure (action: complete_onboarding), gh auth exiting unauthenticated (action: gh_auth), provider API-key save failure (action: provider_connect) |
onboarding_finished | outcome: completed | Unchanged — same call site, name, and timing as before |
onboarding_provider_connected | provider, method | Pre-existing, unchanged |
reason is always a machine-readable code mapped from the error (repo_not_found, auth_failed, network_error, already_exists, clone_failed, host_not_ready, api_unreachable, request_failed, auth_incomplete, api_key_failed) — never URLs, repo names, paths, or messages.
Step slugs
- Step 1 (tools/providers checklist) →
providers— the historicalprovidersstep is the closest ancestor of this surface; the oldgh-cli/permissions/adopt-worktreessteps no longer exist as separate screens, and gh-CLI issues remain distinguishable viaonboarding_errorwithaction: gh_auth. - Step 2 (create/add a project) →
project— exact match with the historical slug.
Verification
bun run lint:fix→bun run lintexits 0;apps/desktopbun run typecheckclean. No colocated tests in the touched files.- Verified end-to-end via CDP against the real dev app (renderer on this workspace's
DESKTOP_VITE_PORT=3225, CDP 9615):posthog.capturewas wrapped viaPage.addScriptToEvaluateOnNewDocumentso no test events reached production PostHog;onboarded_atwas nulled for the dev user, the flow was walked with real UI clicks, thenonboarded_atrestored.
Captured sequence (in order, from window.__t5Events):
[{"event":"onboarding_started","props":null},
{"event":"onboarding_step_started","props":{"step":"providers"}},
{"event":"onboarding_step_completed","props":{"step":"providers"}}, // Continue click
{"event":"onboarding_step_started","props":{"step":"project"}},
{"event":"onboarding_error","props":{"step":"project","action":"clone","reason":"repo_not_found"}}, // clone of nonexistent repo
{"event":"onboarding_abandoned","props":{"step":"project"}}, // beforeunload path
{"event":"onboarding_step_started","props":{"step":"providers"}}, // re-entry via Back — note: no second onboarding_started
{"event":"onboarding_step_completed","props":{"step":"providers"}},
{"event":"onboarding_step_started","props":{"step":"project"}},
{"event":"onboarding_step_completed","props":{"step":"project"}},
{"event":"onboarding_finished","props":{"outcome":"completed"}}] // real clone; app then redirected to #/v2-workspaces
The abandonment leg was triggered with a dispatched beforeunload event (synthetic — a real reload wipes the in-page capture buffer); the layout-unmount path uses the same flush and its timer-cancel behavior is exercised by the Back/Continue route changes above, which correctly did not emit onboarding_abandoned. Everything else was end-to-end UI interaction on the live app.
Kept intentionally additive for easy rebasing against #6116/#6117.
Summary by cubic
Restores renderer-side onboarding funnel analytics for the 2-step flow to meet SUPER-1729. No UX, navigation, gating, or experiment changes; all events go through track().
- New Features
- Emits:
onboarding_started,onboarding_step_started,onboarding_step_completed,onboarding_abandoned,onboarding_error, and keepsonboarding_finished/onboarding_provider_connectedas-is. Deduped per session and step. - Abandon tracking: flushed on
beforeunload; scheduled on layout unmount and canceled on re-entry to avoid false positives. - Error tracking:
{ step, action, reason }with machine-readable reasons only (e.g.,repo_not_found,auth_failed,api_unreachable,clone_failed,api_key_failed). - Step slugs:
providers(tools/providers checklist) andproject(create/add project). - Integrated at key points: provider API key save failures, GH auth exit unauthenticated, clone failures/host not ready, and
completeOnboardingfailures.
- Emits:
Summary by CodeRabbit
- Analytics
- Added comprehensive onboarding progress tracking, including step entry, completion, abandonment, and overall completion.
- Added error tracking for provider API-key connections, GitHub authentication, project setup, cloning, and host readiness.
- Error reporting uses sanitized reason categories without exposing sensitive messages or paths.