open-design/apps
lefarcen 31700c046c
fix(analytics): fill missing DS event fields + submit_revision + studio apply (#2717)
Four follow-up gaps surfaced from comparing the v2 spec field lists
against live PostHog data on a DS-create + DS-detail walkthrough:

1. **`design_system_apply_result` had no `page_name=studio` carrier.**
   PR #2706 wired the home variant (NewProjectPanel picker) but the
   in-project header picker (`ProjectDesignSystemPicker`, lives in
   ProjectView chrome) PATCHed `project.designSystemId` without
   emitting an apply row. The funnel only saw applies from the
   home-side, not from running projects switching their DS.

   Fix: `ProjectView.handleChangeDesignSystemId` emits
   `design_system_apply_result` with `page_name=studio`,
   `action=select_design_system` or `clear_selection`,
   `design_system_selection_mode=manual`, and the DS's
   origin/status mapped from the picker's `DesignSystemSummary`.

2. **`design_system_create_result.project_id` was always missing.**
   The contract had `project_id` optional but the emit site never
   populated it, even though a successful generate path opens a
   workspace project (`project.id` is in scope right after
   `ensureDesignSystemWorkspace`). `created_as_project: true` rows
   carried no project id at all.

   Fix: `emitCreateResult` signature gains a `projectId` parameter;
   the success branch passes `project.id`, failure branches pass
   `undefined`.

3. **`design_system_review_result` only emitted on Looks good /
   Needs work clicks (`review_action: looks_good|needs_work`).**
   The spec also defines `submit_revision` and `regenerate` actions.
   When a user clicks Needs work → types feedback → sends, the send
   IS the `submit_revision` lifecycle moment, but no row fired.
   Dashboards couldn't separate "picked Needs work but never sent"
   from "picked Needs work and dispatched a revision request".

   Fix: `sendProjectChatMessage` checks for `feedbackSection` (set
   by the Needs work onClick) and emits `review_action:
   submit_revision`, `result: submitted`, with the section slug and
   the feedback length bucket. `regenerate` stays out of scope —
   the current UI has no explicit regenerate button; the Generate
   path always creates a fresh DS.

4. **`page_view{page_name=design_system_project}` carried no
   `project_id`.** Both the generation-active and the
   design_system_preview emissions had `system.id` but not the
   workspace project id, so the funnel couldn't join the DS detail
   page_view to the project the user actually edits inside.

   Fix: both `trackPageView` calls pass `workspaceProjectId`; the
   useEffect deps add `workspaceProjectId` so a delayed ensure
   (workspace mounts after first render) re-emits with the now-
   known id.

Validation:

  pnpm --filter @open-design/web typecheck   clean
  pnpm --filter @open-design/web test         1844/1844
2026-05-22 19:04:12 +08:00
..
daemon Improve deck home previews and plugin gallery performance (#2698) 2026-05-22 17:47:28 +08:00
desktop Fix release updater smoke recovery (#2687) 2026-05-22 16:18:33 +08:00
landing-page Merge origin/main into release/v0.8.0 2026-05-21 13:17:52 +08:00
packaged fix: harden Windows packaged updater flow (#2595) 2026-05-21 22:32:02 +08:00
telemetry-worker chore: pin dependency versions and harden CI caches (#2189) 2026-05-19 13:58:27 +08:00
web fix(analytics): fill missing DS event fields + submit_revision + studio apply (#2717) 2026-05-22 19:04:12 +08:00
AGENTS.md refactor(daemon): split agent runtime definitions (#1063) 2026-05-11 15:01:55 +08:00