Repository navigation
fix(app): stop copying the device model dump into analytics payloads - #14388
Merged
Merged
Conversation
Device Connected and Device Paired were spreading BtDevice.toJson() onto PostHog beside the hashed fields. Name the payload explicitly. Failure-Class: new Co-authored-by: Cursor <[email protected]>
Register the analytics model-dump class for the Device Connected/Paired spread. The defect is copying a serialized model onto an event payload. Failure-Class: new Co-authored-by: Cursor <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Sep 18, 2026
Bring in #14408 (AGENTS.md budget), #14388 (device identity), and #14392 (Memory Created). Spine conflicts take main; analytics_manager keeps both the C7 emit seam and main's newer payload contracts. Co-authored-by: Cursor <[email protected]>
This was referenced Sep 18, 2026
Closed
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.
What changed and why
This is a live production exposure being closed. Mobile
Device ConnectedandDevice Pairedwere spreadingBtDevice.toJson()onto PostHog, so raw wearable device id, name, and serial number (plus rssi, locator, modelNumber, firmwareRevision, hardwareRevision, manufacturerName) were reaching analytics on those two events, sitting next to hashed identity fields that already existed. Both emit sites now send only named fields.Product invariants affected
none
How it was verified
flutter test test/utils/analytics/device_identity_analytics_test.dartfailed on Device Connected and Device Paired: payload keys includedname,id,rssi,locator,modelNumber,firmwareRevision,hardwareRevision,manufacturerName,serialNumber.test/providers/device_provider_test.dartpassed (22 tests).TZ=UTC bash app/test.sh→+2096 All tests passed!on the payload change; re-run after adding the failure-class JSON.dart format --line-length 120on the Dart we touched.scripts/failure-class prepareafter adding the JSON, thenmake preflight....model.toJson()analytics emits in app/backend/desktop. macOS Device Connected already namesdevice_vendor/device_type. Backendemit_product_eventcall sites use named maps. Memory Created still readsgetTranscript()for length/word/speaker counts; that is a separate follow-up, not this PR.Named fields kept, so a dashboard does not silently lose a column the dictionary already specified:
type— closed enum name; the onetoJsonkey the event dictionary already lists.device_vendor,hardware_family— closed analysis fields; also person properties used for vendor/family segmentation.transport_device_id,transport_id_kind,transport_id_stability— hashed BLE (or vendor) identity; the join key that already replaced rawid.hardware_id,hardware_id_kind,hardware_id_stable— hashed manufacturer serial when present; the join key that already replaced rawserialNumber.Dropped with the spread:
id,name,serialNumber,rssi,locator,modelNumber,firmwareRevision,hardwareRevision,manufacturerName. Firmware and model remain onDevice Session Endedasfirmware_revision/model. Did not add F1 events.Tests
app/test/utils/analytics/device_identity_analytics_test.dartasserts emitted payload keys againstBtDevice.toJson().keys, allowing onlytypeas a shared spelling. A synthetic spread still fails that guard, so reintroducing...device.toJson()fails without pinning today's event key list.Failure class (fixes)
Failure-Class: new
Failure-class transition narrative (only when needed)
New class
FC-analytics-payload-copies-model-dump. The violated contract is the spread of a model's serialized form into an analytics payload, not today's leaked field list. Closest existing misses, not reused:FC-public-projection-is-denylist-shaped(public HTTP share-link projection),FC-secret-printed-to-plugin-logs(plugin stdout),FC-identity-fallback-used-as-authorization-gate(suite admitted as the release).evidence_prsis[]because this PR is the first instance. Guard artifact is the payload-key test; scope hint isapp/lib/utils/analytics/**(fnmatch glob).New guards (only when adding a check or ratchet)
The Dart payload-key test is the regression that would have caught this leak (Device Connected / Device Paired spreading
BtDevice.toJson()in production). It is not a shared static primitive because the class is "don't copy the model dump onto an event", which a source-text grep misses the moment the spread is aliased or built through a helper.🤖 Generated with Claude Code