Skip to content

Fix studio_telemetry Tracks event silently rejected by malformed name - #4418

Open
wojtekn wants to merge 2 commits into
trunkfrom
fix-studio-telemetry-tracks-event-name
Open

Fix studio_telemetry Tracks event silently rejected by malformed name#4418
wojtekn wants to merge 2 commits into
trunkfrom
fix-studio-telemetry-tracks-event-name

Conversation

@wojtekn

@wojtekn wojtekn commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

I used Claude Code to investigate why studio_telemetry was missing from Tracks Live View while studio_app_launch and studio_site_start were present, but it couldn't find anything. Then I traced it to the Tracks reject table, and used Claude to perform the rename, guard test, and doc updates. All changes were reviewed by me, and the type checker and unit tests were run locally.

Proposed Changes

The analytics opt-in/opt-out toggle event was being emitted correctly but never reached Tracks: its name, studio_telemetry, has only two segments (source + context) and violates the Tracks <source>_<context>_<action> naming convention, so every occurrence was silently routed to the tracks_rejects table and was invisible in the normal Live View. The two existing events happened to be well-formed, which masked the problem.

This renames the event to studio_setting_telemetry_change, matching the studio_<context>_change family planned for the settings/appearance events in STU-2121. The event now lands in Tracks as expected, so analytics preference changes become queryable.

To prevent the same class of bug, a CI guard asserts every TRACKS_EVENTS name follows the convention, and the analytics design doc now documents the naming rule as a hard ingestion gate (distinct from registration, which does not gate ingestion), using this event as the cautionary example.

⚠️ Server-side registration still required. The rename is what unblocks ingestion, but I till need to adjust registration to account for the name change.

Testing Instructions

  • npm run typecheck — passes.
  • npm test -- packages/common/lib/tests/record-tracks-event.test.ts apps/studio/src/modules/user-settings/lib/tests/analytics-settings.test.ts — passes (includes the new naming-convention guard).
  • On a real shipped (non-dev) build, toggle the analytics setting off then on in both the classic (v1) and agentic (v2) UIs, and confirm studio_setting_telemetry_change now appears in Tracks Live View (with status off/on) instead of the rejects table.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Rename to studio_setting_telemetry_change so it satisfies the Tracks
<source>_<context>_<action> convention; the two-segment studio_telemetry
was routed to tracks_rejects and never landed in Live View. Add a
TRACKS_EVENTS naming-convention guard test and document the convention
as a hard ingestion gate in the analytics design doc.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wojtekn
wojtekn marked this pull request as ready for review August 3, 2026 14:20
@wojtekn
wojtekn requested a review from a team August 3, 2026 14:20
@wojtekn
wojtekn requested a review from youknowriad August 3, 2026 16:10
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 7270113 vs trunk

app-size

Metric trunk 7270113 Diff Change
App Size (Mac) 1372.96 MB 1372.96 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 7270113 Diff Change
load 1041 ms 1028 ms 13 ms ⚪ 0.0%

site-startup

Metric trunk 7270113 Diff Change
siteCreation 6539 ms 6535 ms 4 ms ⚪ 0.0%
siteStartup 2371 ms 2395 ms +24 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants