nodejs/src/session-recording/README.md
This module handles ingestion of session recording data, processing it, and storing it for later playback.
The SessionRecordingIngester consumes session recording events from Kafka and:
Start the required services (Kafka, MinIO, Postgres, Redis, ClickHouse):
hogli dev:setup
Or manually:
docker compose -f docker-compose.dev.yml up
Set up the test database (creates test_posthog DB and runs migrations):
pnpm setup:test
pnpm jest src/session-recording/consumer.e2e.test.ts
Tests will fail if required infrastructure is not available, with a message indicating which services are missing.
To skip E2E tests when running the full suite:
pnpm jest --testPathIgnorePatterns=e2e
The E2E tests validate the full pipeline by:
Add a new entry to the testCases array in consumer.e2e.test.ts:
name: Short identifier used in the snapshot namedescription: What the test verifiescreatePayloads: Function returning PayloadConfig[] with test dataexpectedOutcome: 'written' (data should appear in S3) or 'dropped' (rejected)Run tests with the update flag to generate the new snapshot:
pnpm jest src/session-recording/consumer.e2e.test.ts -u
Review the generated snapshot in __snapshots__/ to ensure it captures expected behavior.
If refactoring changes the output format (but behavior is correct), update snapshots:
pnpm jest src/session-recording/consumer.e2e.test.ts -u
Always review snapshot diffs carefully - they should reflect intentional changes only.