Fix studio_telemetry Tracks event silently rejected by malformed name - #4418
Open
wojtekn wants to merge 2 commits into
Open
Fix studio_telemetry Tracks event silently rejected by malformed name#4418wojtekn wants to merge 2 commits into
wojtekn wants to merge 2 commits into
Conversation
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>
Collaborator
📊 Performance Test ResultsComparing 7270113 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
I used Claude Code to investigate why
studio_telemetrywas missing from Tracks Live View whilestudio_app_launchandstudio_site_startwere 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 thetracks_rejectstable 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 thestudio_<context>_changefamily 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_EVENTSname 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.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).studio_setting_telemetry_changenow appears in Tracks Live View (withstatusoff/on) instead of the rejects table.Pre-merge Checklist