fix(analytics): persist unique CLI install IDs#1348
Conversation
Co-authored-by: Cursor <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Greptile SummaryThis PR persists a stable anonymous CLI install ID to
Confidence Score: 3/5The config-dir migration and ID-persistence machinery are well-engineered and safe; the event log feature ships silently broken. The anonymous-ID persistence, file-lock, atomic writes, and legacy migration all look correct. The main problem is that app/analytics/provider.py — specifically the Important Files Changed
Sequence DiagramsequenceDiagram
participant CLI
participant Analytics
participant _get_or_create_anonymous_id
participant _compute_anonymous_identity
participant Disk
CLI->>Analytics: Analytics()
Analytics->>_get_or_create_anonymous_id: _get_or_create_anonymous_id()
_get_or_create_anonymous_id->>_compute_anonymous_identity: under _anonymous_id_lock
_compute_anonymous_identity->>Disk: check _CONFIG_DIR and _FIRST_RUN_PATH
alt anonymous_id file exists and valid
Disk-->>_compute_anonymous_identity: return existing UUID
else legacy path exists and valid
Disk-->>_compute_anonymous_identity: migrate legacy UUID to new path
else no existing ID
_compute_anonymous_identity->>Disk: _write_new_anonymous_id under file lock
Disk-->>_compute_anonymous_identity: AnonymousIdentity disk
end
_compute_anonymous_identity-->>_get_or_create_anonymous_id: _AnonymousIdentity distinct_id persistence
_get_or_create_anonymous_id-->>Analytics: cache distinct_id and persistence
Analytics->>Analytics: _pop_user_id_load_failures capture USER_ID_LOAD_FAILED
Analytics-->>CLI: ready
CLI->>Analytics: capture event props
Analytics->>Analytics: _Envelope event props new_insert_id
Analytics->>Analytics: _worker_loop _send
Analytics->>Disk: POST /capture/ with distinct_id and $insert_id for one-time events
Note over Analytics,Disk: _log_event_line never called here is a bug
|
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Emit CLI and funnel analytics only after commands are accepted or flow milestones truly occur, so dashboard funnels do not count help, parse failures, templates, or failed verifications as product progress. Co-authored-by: Cursor <[email protected]>
|
🎲 Researchers are baffled. @davincios opened a PR, got it reviewed without drama, and merged clean. This violates known laws of open source. 🔬 👋 Join us on Discord - OpenSRE : hang out, contribute, or hunt for features and issues. Everyone's welcome. |

Summary
Test plan
Made with Cursor