fix(telemetry): installation_id is always the machine id (per-install id → install_id)#1159
Draft
deepme987 wants to merge 1 commit into
Draft
fix(telemetry): installation_id is always the machine id (per-install id → install_id)#1159deepme987 wants to merge 1 commit into
deepme987 wants to merge 1 commit into
Conversation
… id -> install_id installation_id is documented as the machine key (SHA-256(machine_id+salt)), but ~24 main-process emit sites pass the per-install record id (inst-<ts>) under installation_id, which overrides the machine-id default. So installation_id means the MACHINE on renderer/onboarding events and the install-RECORD on main events (boot/execution/canvas/install.completed), and the two cannot join -- the install->boot->canvas funnel is structurally un-stitchable on installation_id even after the v1.0.24 default landed. Enforce the invariant centrally in capture(): installation_id is ALWAYS the machine id; any per-call installation_id is redirected to a secondary install_id (preserved for the minority of per-install analyses, e.g. multi-install machines). One change covers all current and future call sites and stops the override from recurring. boot_id (per-launch) and user_id (per-person) are untouched -- different scopes.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
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.
Quick Read
installation_idis documented as the machine key (SHA-256(machine_id+salt), one per machine). But ~24 main-process emit sites pass the per-install record id (inst-<ts>, frominstallations.json) asinstallation_id, which overrides the machine-id default. So the field means machine on renderer/onboarding events and install-record on main events — they share no value, so the install → boot → canvas funnel can't join on it even after v1.0.24 stamped the machine id everywhere.This fixes it in one place:
capture()now guaranteesinstallation_idis always the machine id, and redirects any per-call install id to a secondaryinstall_id.The bug (audited)
identify()correctly setsdefaultEventProperties.installation_id = machine_id.installation_id: installationIdwhereinstallationIdis theinst-<ts>record id (boot_started/completed/failed,canvas_rendered,install.completed,install.phase,execution.*,snapshot.*,op.result, …). Per-call props win the merge → the machine default is overwritten.inst-<ts>; cross-boundary overlap is 0 (method.selected → install.completed= 0/239). The funnel reads ~100% false drop at the install boundary.The fix
In
capture(), before merging defaults:installation_idis always the machine id (the documented invariant, now enforced).install_id— available for the minority of per-install analyses (multi-install machines,instance.switched), just not overloaded onto the canonical key.install_idintroduced.Why central, not 24 call sites
The bug exists because call sites can override
installation_id. Fixing 24 sites is large, error-prone, and a 25th site re-breaks it. Enforcing the invariant in the single capture path makes it complete and self-protecting. Header identity-model doc updated to match.Scope / what to know
installation_idflips frominst-<ts>to the machine hash; the install id rides along asinstall_id.boot_id(per-launch, feat(telemetry): boot_completed + boot_id for a per-attempt boot-success rate #1156) anduser_id(per-person, login) are untouched — different scopes, different purposes.installation_idbecome true per-machine (e.g. "weekly active machines" stops counting installs, drops the multi-install over-count). Any query that genuinely wanted per-install switches toinstall_id. Most analyses want per-machine, so this is the intended direction.Testing
telemetry.test.ts: a per-install id underinstallation_idis redirected toinstall_idwhileinstallation_idstays the machine id; a renderer event (no install id) and an explicit-machine-id event are left untouched. 76 telemetry tests green; eslint + typecheck clean on the changed file.Related
Completes the desktop identity-stitch line (#1147 stamped the machine id as a default; #1156 added
boot_id). This is the last blocker on a clean, single-key install → boot → canvas funnel.