Skip to content

Conversation

@CSRessel
Copy link
Collaborator

Motivation

  • Standardize install/session lifecycle tracking and analytics payloads so Nori CLI reports (install, update, churn/resurrection) match the shared analytics endpoint and GA dashboards.
  • Make client identity deterministic and privacy-preserving so churn/resurrection measurements remain consistent after config resets while preserving opt-out control.
  • Ensure events are non-blocking and follow a unified flat JSON schema with session-scoped fields for downstream aggregation and performance constraints.

Description

  • Replace the previous user-id approach with a deterministic client UUID generated from SHA256("nori_salt:<hostname>:<username>") and persist it as client_id in the state file, and add an opt_out boolean to the state schema saved at $NORI_HOME/.nori-install.json.
  • Expand lifecycle events to emit app_install, app_update, user_resurrected (if last launch > 30 days), and session_start, generate an ephemeral session_id per run, and use semver comparison (via semver crate) to detect upgrades.
  • Rework analytics payloads to a flat JSON event with event, client_id, session_id, timestamp, and properties (version/os/arch/node_version/is_ci), send to NORI_ANALYTICS_URL (default https://noriskillsets.dev/api/analytics/track) with a 500ms timeout, fire-and-forget behavior, and silent failure handling.
  • Honor opt-out precedence: NORI_NO_ANALYTICS=1 wins, otherwise the opt_out field in .nori-install.json prevents network sends while still updating local state timestamps atomically (temp file + rename preserved).
  • Updated code, docs, and dependencies: added semver and uuid, updated installed crate implementation, tests, and docs.md to reflect the new schema and event types.

Testing

  • Ran formatting with just fmt and lint fixes with just fix -p nori-installed (ran automatically as part of the change process).
  • Ran unit tests with cargo test -p nori-installed, and all tests passed (28 passed; 0 failed).
  • Verified the updated behavior via the crate's unit tests for deterministic client id, upgrade detection, resurrection detection, state read/write, and analytics payload serialization (all test cases succeeded).

Codex Task

@CSRessel CSRessel changed the title feat(nori-installed): align install tracking with analytics schema feat(installed): Align install and session lifecycle with new schema Jan 20, 2026
@CSRessel
Copy link
Collaborator Author

Closing in favor of #226

@CSRessel CSRessel closed this Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants