Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/lib/programs/__tests__/audit-seed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 7 additions & 1 deletion src/lib/programs/audit/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
Loading