Event Tracking — QA Plan
1. Environment gating
| # | Scenario | Expected |
|---|---|---|
| 1.1 | Boot in NODE_ENV=development | Constructor logs “Event tracking disabled”; client === null |
| 1.2 | Boot in NODE_ENV=production with POSTHOG_API_KEY | Logs “Event tracking enabled”; client constructed |
| 1.3 | Boot in NODE_ENV=production without key | Warns; client null; events log-only |
2. Capture
| # | Scenario | Expected |
|---|---|---|
| 2.1 | track('foo', { bar: 1 }) in prod | Network call to PostHog within 10s; event visible in PostHog UI |
| 2.2 | track while PostHog returns 5xx | No throw; error logged |
| 2.3 | Burst 100 events in 1s | Auto-flush every 20 events; all captured |
3. Identify
| # | Scenario | Expected |
|---|---|---|
| 3.1 | identify(userId, { email }) in prod | Person record updated in PostHog |
| 3.2 | Identify in dev | No call |
4. Shutdown
| # | Scenario | Expected |
|---|---|---|
| 4.1 | App graceful stop after 5 events captured | onModuleDestroy flushes; all 5 land in PostHog |
| 4.2 | Hard kill | Pending events lost — known limitation |
5. Integration
| # | Scenario | Expected |
|---|---|---|
| 5.1 | Coach publishes announcement in prod | announcement_published event visible in PostHog |
| 5.2 | Payment events from PaymentObservability | Visible in PostHog with expected props |
6. Smoke
- In staging, capture a synthetic event and verify in PostHog within 30s.
- Check logs for
Event tracking enabledline on boot.