docs(signal): brainstorm + plan for internal usage analytics (NES-1613)#9104
docs(signal): brainstorm + plan for internal usage analytics (NES-1613)#9104edmonday wants to merge 3 commits into
Conversation
Captures the brainstorm decisions and deepened implementation plan for NES-1613 (Signal — internal admin-app usage analytics). Highlights: - Storage: own table behind api-analytics GraphQL surface; new libs/prisma/signals migrate-managed domain (analytics domain is introspect-only per .claude/rules/backend/database-schema-changes.md). - Privacy: deterministic daily salt via HMAC(SIGNALS_SALT_SECRET, utc_date) — no salt in the events DB; rotating the secret is the kill switch. - Hash: HMAC-SHA256(salt, host || \x1f || ip || \x1f || normalisedUA), with ua-parser normalisation and isbot filter. - Wire: eventType is String! + server allowlist (forward-compat across deploys); description has 2KB cap + recursive PII-key denylist. - Auth: gateway-JWT path mirroring api-media (useForwardedJWT + discriminated context union); read scope restricted to admin role. - Client: useTrackEvent fail-closed on useUser() loading; clientEventId nonce defeats Apollo mutation dedup. - v1 events: journey_create_clicked, journey_create_from_template, editor_overlay_opened (4 overlays), ai_translation_language_picked. Open decisions (D1–D4) flagged for team sign-off before Phase 1. Refs: NES-1613 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Schema iteration after team review of cross-app needs and query ergonomics: - appName: multi-app slicing from day 1 - route: which page produced the event - entityType + entityId: polymorphic primary entity (replaces per-app columns like journeyId; reuses cleanly across journeys-admin, videos-admin, etc.) - sessionId: per-tab UUID in sessionStorage; survives mobile IP rotation - deviceType, browserFamily, osFamily: coarse UA buckets persisted from the same ua-parser call already used for the hash input - clientEventId: persisted with @unique for free idempotency Editor overlay events split from one + description.overlay into four named event types: faster queries (no JSONB path), cleaner allowlist. Indexes: [appName, eventType, createdAt], [entityType, entityId, createdAt], [userHash, createdAt]. Success criterion rewritten — cross-day distinct-user counting is intentionally broken by the daily-rotating salt (privacy/utility trade); team agreed it's non-load-bearing for usage decisions. Replaced with daily distinct + total counts sliced by app/device/route/entity. Out-of-scope additions: dwell time, cross-day distinct counts, cursor pagination, country/region, appVersion. Schema can absorb dwell time later via heartbeat events using existing columns — no migration needed. Retention: 180-day default with a daily DELETE job. useTrackEvent reshaped to capture appName, route, entity, sessionId in the mutation variables. Refs: NES-1613 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro 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)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
View your CI Pipeline Execution ↗ for commit c342580
☁️ Nx Cloud last updated this comment at |
|
View your CI Pipeline Execution ↗ for commit c342580
☁️ Nx Cloud last updated this comment at |
Summary
Brainstorm + deepened implementation plan for Signal — internal admin-app usage analytics (NES-1613).
This PR is docs-only — no code changes. It captures team-aligned product decisions and a deepened technical plan so reviewers can challenge the design before Phase 1 implementation begins.
Files:
docs/brainstorms/2026-04-29-signal-usage-analytics-requirements.md— locked product decisions from the brainstormdocs/plans/2026-04-29-001-feat-signal-usage-analytics-plan.md— implementation plan (with v2 deepen-pass corrections + v3 schema iteration)Headline decisions
Open decisions (need team input before Phase 1)
Test plan
🤖 Generated with Claude Code