Skip to content

feat!: track analytics for OTA Snap updates#4049

Merged
Mrtenz merged 2 commits into
mainfrom
mrtenz/snap-ota-analytics
Jun 25, 2026
Merged

feat!: track analytics for OTA Snap updates#4049
Mrtenz merged 2 commits into
mainfrom
mrtenz/snap-ota-analytics

Conversation

@Mrtenz

@Mrtenz Mrtenz commented Jun 25, 2026

Copy link
Copy Markdown
Member

Changes

  • Emit SnapController:snapUpdated in #handleRegistryUpdate() after each successful OTA update. As a side effect, this also fixes missing notifications to CronjobController (cronjob re-registration) and WebSocketService (connection teardown) on OTA updates.
  • Add ota: boolean to the SnapControllerSnapUpdatedEvent payload to distinguish OTA updates from user-initiated ones.
  • Update the snapUpdated analytics subscriber to track the Snap Updated event for OTA updates (previously all preinstalled Snap updates were silently skipped).
  • Add ota, client_version, and client_type properties to the Snap Updated analytics event.
  • Add clientConfig: ClientConfig to SnapControllerArgs (same shape as SnapRegistryControllerArgs) to give the controller access to the client type and version.

Breaking changes

  • The SnapController constructor now requires a clientConfig parameter.

Note

Medium Risk
Breaking constructor and messenger event contract changes require host app updates; analytics and lifecycle side effects on OTA updates are new behavior for preinstalled snaps.

Overview
SnapController:snapUpdated gains a fifth payload field ota so listeners can tell over-the-air registry updates apart from user-driven ones. After a successful preinstalled snap OTA in #handleRegistryUpdate, the controller now publishes that event with ota: true (and preinstalled: true), which also drives cronjob re-registration and WebSocket teardown that previously did not run on OTA.

The Snap Updated analytics handler no longer skips every preinstalled update: it still skips when preinstalled && !ota, but records OTA with ota: true. All tracked Snap Updated events now include ota, client_version, and client_type from a new required constructor arg clientConfig (same ClientConfig shape as the registry controller).

Breaking: SnapController must be constructed with clientConfig, and any code that publishes or asserts on snapUpdated must pass the ota boolean.

Reviewed by Cursor Bugbot for commit 7ea3aad. Bugbot is set up for automated code reviews on this repo. Configure here.

Emits `SnapController:snapUpdated` after automatic (OTA) updates of preinstalled Snaps. Adds `ota`, `client_version`, and `client_type` properties to the `Snap Updated` analytics event, and adds `clientConfig` to `SnapControllerArgs` so the controller has access to the client type and version.
@Mrtenz Mrtenz changed the title feat: track analytics for OTA Snap updates feat!: track analytics for OTA Snap updates Jun 25, 2026
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.59%. Comparing base (c67053b) to head (7ea3aad).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4049   +/-   ##
=======================================
  Coverage   98.58%   98.59%           
=======================================
  Files         425      425           
  Lines       12410    12413    +3     
  Branches     1969     1969           
=======================================
+ Hits        12235    12238    +3     
  Misses        175      175           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Mrtenz Mrtenz marked this pull request as ready for review June 25, 2026 12:33
@Mrtenz Mrtenz requested a review from a team as a code owner June 25, 2026 12:33
@Mrtenz Mrtenz added this pull request to the merge queue Jun 25, 2026
Merged via the queue into main with commit beeab74 Jun 25, 2026
132 checks passed
@Mrtenz Mrtenz deleted the mrtenz/snap-ota-analytics branch June 25, 2026 15:00
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