diff --git a/src/lib/programs/__tests__/audit-seed.test.ts b/src/lib/programs/__tests__/audit-seed.test.ts index 56e3dd6d9..eba25cb74 100644 --- a/src/lib/programs/__tests__/audit-seed.test.ts +++ b/src/lib/programs/__tests__/audit-seed.test.ts @@ -15,6 +15,19 @@ describe('AUDIT_SEED_CHECKS', () => { expect(new Set(ids(AUDIT_SEED_CHECKS)).size).toBe(AUDIT_SEED_CHECKS.length); }); + it('keeps cross-runtime identity and session checks together', () => { + const order = ids(AUDIT_SEED_CHECKS); + const distinctId = order.indexOf('cross-runtime-distinct-id'); + const sessionId = order.indexOf('cross-runtime-session-id'); + + expect(distinctId).toBeGreaterThan(-1); + expect(sessionId).toBe(distinctId + 1); + expect(AUDIT_SEED_CHECKS[sessionId]).toMatchObject({ + area: 'Identification', + status: 'pending', + }); + }); + it('sweeps PostHog for open findings before writing the report', () => { const order = ids(AUDIT_SEED_CHECKS); const sweep = order.indexOf('live-data-findings'); diff --git a/src/lib/programs/audit/seed.ts b/src/lib/programs/audit/seed.ts index 017055f1d..ded38b7c2 100644 --- a/src/lib/programs/audit/seed.ts +++ b/src/lib/programs/audit/seed.ts @@ -4,7 +4,7 @@ import { logToFile } from '@utils/debug'; import { AUDIT_CHECKS_FILE, type AuditCheck } from './types.js'; /** - * The 10 source-tree checks the audit runs, plus one row for the PostHog-side + * The 11 source-tree checks the audit runs, plus one row for the PostHog-side * sweep and two workflow rows at the end (so the skill's * `audit_resolve_checks` calls for `write-report` and `upload-notebook` * succeed — the skill writes the report to disk, then mirrors it into a @@ -54,6 +54,12 @@ export const AUDIT_SEED_CHECKS: AuditCheck[] = [ label: 'Same distinct_id across client and server', status: 'pending', }, + { + id: 'cross-runtime-session-id', + area: 'Identification', + label: 'Same $session_id across client and server', + status: 'pending', + }, { id: 'identify-reset-on-logout', area: 'Identification',