Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(ai-research): write sessions started after the v3 cutoff to the v3 buckets (#103749)

Robbie929dbd842b7e
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-shard-store.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-shard-store.test.ts
index cfb200599390..be07707de8a7 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-shard-store.test.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-shard-store.test.ts
@@ -26,7 +26,13 @@ describe('ImageShardStore', () => {
it.each([undefined, '42'])('writes the matching image index and prefers raw team ID %s', async (teamId) => {
const send = jest.fn().mockResolvedValue({})
- const store = new ImageShardStore({ send } as unknown as S3Client, 'bucket', 'images', 1_000, 'node')
+ const store = new ImageShardStore(
+ { send } as unknown as S3Client,
+ { v2: 'bucket', v3: 'bucket-v3' },
+ 'images',
+ 1_000,
+ 'node'
+ )
await store.writeShard([{ ...inlineImage, teamId }])
const prefix = teamId ? 'images/v2' : 'images'
const shard = send.mock.calls[0][0] as PutObjectCommand
@@ -49,6 +55,34 @@ describe('ImageShardStore', () => {
}
})
+ it('writes an image of a v3 month to the v3 bucket under the v3 prefix', async () => {
+ await sodium.ready
+ const key: MlDataKey = {
+ identity: { teamId: 7, organizationId: 'test-org', sessionMonth: '2026-10' },
+ plaintext: Buffer.alloc(32, 7),
+ wrapped: Buffer.alloc(32, 8),
+ }
+ const send = jest.fn().mockResolvedValue({})
+ const store = new ImageShardStore(
+ { send } as unknown as S3Client,
+ { v2: 'bucket', v3: 'bucket-v3' },
+ 'images',
+ 1_000,
+ 'node'
+ )
+ await store.writeShard(
+ [{ teamId: '7', sessionMonth: '2026-10', hash: inlineImage.hash, bytes: inlineImage.bytes }],
+ key
+ )
+ await store.writeUrlImage({ ...urlImage, teamId: '7', sessionMonth: '2026-10' }, key)
+ const writes = send.mock.calls.map(([command]) => [command.input.Bucket, command.input.Key])
+ expect(writes).toHaveLength(4)
+ for (const [bucket, objectKey] of writes) {
+ expect(bucket).toBe('bucket-v3')
+ expect(objectKey).toMatch(/^images\/v3\/2026-10\/7\//)
+ }
+ })
+
it.each([false, true])(
'publishes encrypted hash lookups and preserves referenced shards on failure: %s',
async (failLookup) => {
@@ -64,7 +98,13 @@ describe('ImageShardStore', () => {
}
return Promise.resolve({})
})
- const store = new ImageShardStore({ send } as unknown as S3Client, 'bucket', 'images', 1_000, 'node')
+ const store = new ImageShardStore(
+ { send } as unknown as S3Client,
+ { v2: 'bucket', v3: 'bucket-v3' },
+ 'images',
+ 1_000,
+ 'node'
+ )
const write = store.writeShard(
[
{
@@ -126,7 +166,7 @@ describe('ImageShardStore', () => {
)
const store = new ImageShardStore(
{ send } as unknown as S3Client,
- 'bucket',
+ { v2: 'bucket', v3: 'bucket-v3' },
'images',
30_000,
'node',
@@ -158,7 +198,14 @@ describe('ImageShardStore', () => {
opts.abortSignal.addEventListener('abort', () => reject(new Error('aborted')))
})
)
- const store = new ImageShardStore({ send } as unknown as S3Client, 'bucket', 'prefix', 5, 'node', noSleep)
+ const store = new ImageShardStore(
+ { send } as unknown as S3Client,
+ { v2: 'bucket', v3: 'bucket-v3' },
+ 'prefix',
+ 5,
+ 'node',
+ noSleep
+ )
await expect(store.writeShard([inlineImage])).rejects.toThrow('aborted')
@@ -171,7 +218,7 @@ describe('ImageShardStore', () => {
const send = jest.fn().mockRejectedValueOnce(s3Failure(status)).mockResolvedValue({})
const store = new ImageShardStore(
{ send } as unknown as S3Client,
- 'bucket',
+ { v2: 'bucket', v3: 'bucket-v3' },
'prefix',
1_000,
'node',
@@ -190,7 +237,7 @@ describe('ImageShardStore', () => {
const send = jest.fn().mockRejectedValue(s3Failure(status))
const store = new ImageShardStore(
{ send } as unknown as S3Client,
- 'bucket',
+ { v2: 'bucket', v3: 'bucket-v3' },
'prefix',
1_000,
'node',
@@ -218,7 +265,7 @@ describe('ImageShardStore', () => {
: Promise.resolve()
},
} as unknown as S3Client
- const store = new ImageShardStore(s3, 'bucket', 'prefix', 5_000)
+ const store = new ImageShardStore(s3, { v2: 'bucket', v3: 'bucket-v3' }, 'prefix', 5_000)
await expect(store.writeShard([inlineImage])).rejects.toThrow('index write failed')
expect(deleted).toHaveLength(1)
@@ -227,7 +274,13 @@ describe('ImageShardStore', () => {
it('creates a URL object once with its source position', async () => {
const send = jest.fn().mockResolvedValueOnce({})
- const store = new ImageShardStore({ send } as unknown as S3Client, 'bucket', 'images', 1_000, 'node')
+ const store = new ImageShardStore(
+ { send } as unknown as S3Client,
+ { v2: 'bucket', v3: 'bucket-v3' },
+ 'images',
+ 1_000,
+ 'node'
+ )
await expect(store.writeUrlImage(urlImage)).resolves.toBe('created')
@@ -245,7 +298,13 @@ describe('ImageShardStore', () => {
$metadata: { httpStatusCode: 412 },
})
const send = jest.fn().mockRejectedValueOnce(exists)
- const store = new ImageShardStore({ send } as unknown as S3Client, 'bucket', 'images', 1_000, 'node')
+ const store = new ImageShardStore(
+ { send } as unknown as S3Client,
+ { v2: 'bucket', v3: 'bucket-v3' },
+ 'images',
+ 1_000,
+ 'node'
+ )
await expect(store.writeUrlImage(urlImage)).resolves.toBe('already_exists')
@@ -259,7 +318,13 @@ describe('ImageShardStore', () => {
$metadata: { httpStatusCode: 409 },
})
const send = jest.fn().mockRejectedValueOnce(conflict).mockResolvedValueOnce({})
- const store = new ImageShardStore({ send } as unknown as S3Client, 'bucket', 'images', 1_000, 'node')
+ const store = new ImageShardStore(
+ { send } as unknown as S3Client,
+ { v2: 'bucket', v3: 'bucket-v3' },
+ 'images',
+ 1_000,
+ 'node'
+ )
await expect(store.writeUrlImage(urlImage)).resolves.toBe('created')
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-shard-store.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-shard-store.ts
index f4f8b187c2ac..4dd707409422 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-shard-store.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-shard-store.ts
@@ -4,7 +4,9 @@ import { randomUUID } from 'node:crypto'
import pLimit from 'p-limit'
import { logger } from '~/common/utils/logger'
+import { MlDatasetBuckets } from '~/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-parquet-store'
import { MlDataKey, encryptEnvelope } from '~/ingestion/pipelines/sessionreplay/ml-mirror/keys/crypto'
+import { usesV3ImageDataset } from '~/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format'
import { parquetRecordsToBuffer } from '~/ingestion/pipelines/sessionreplay/shared/parquet'
export interface ScrubbedImage {
@@ -81,7 +83,7 @@ export class ImageShardStore {
constructor(
private readonly s3: S3Client,
- private readonly bucket: string,
+ private readonly buckets: MlDatasetBuckets,
private readonly prefix: string,
private readonly writeTimeoutMs: number,
nodeId?: string,
@@ -92,6 +94,10 @@ export class ImageShardStore {
this.nodeId = nodeId || process.env.HOSTNAME || randomUUID().slice(0, 8)
}
+ private datasetOf(sessionMonth: string | undefined): 'v2' | 'v3' {
+ return sessionMonth && usesV3ImageDataset(sessionMonth) ? 'v3' : 'v2'
+ }
+
/**
* One S3 request, bounded by a timeout and repeated while the failure could still clear.
*
@@ -180,8 +186,10 @@ export class ImageShardStore {
) {
throw new Error('Image shards require one valid session month')
}
+ const dataset = this.datasetOf(encryptionKey ? sessionMonth : undefined)
+ const bucket = this.buckets[dataset]
const prefix = encryptionKey
- ? `${this.prefix}/v2/${sessionMonth}/${encryptionKey.identity.teamId}`
+ ? `${this.prefix}/${dataset}/${sessionMonth}/${encryptionKey.identity.teamId}`
: rawTeamIds
? `${this.prefix}/v2`
: this.prefix
@@ -210,7 +218,7 @@ export class ImageShardStore {
// Shard before index: an index pointing at a missing shard breaks reads; a dangling shard only wastes storage.
await this.send(
new PutObjectCommand({
- Bucket: this.bucket,
+ Bucket: bucket,
Key: shardKey,
Body: encryptionKey
? encryptEnvelope(encryptionKey, 'image-shard', shardBody, { ref: shardKey, codec: 'none' })
@@ -221,7 +229,7 @@ export class ImageShardStore {
try {
await this.send(
new PutObjectCommand({
- Bucket: this.bucket,
+ Bucket: bucket,
Key: `${prefix}/index/${stamp}.${encryptionKey ? 'encrypted' : 'parquet'}`,
Body: encryptionKey
? encryptEnvelope(encryptionKey, 'image-index', indexBody, { ref: shardKey, codec: 'none' })
@@ -231,7 +239,7 @@ export class ImageShardStore {
)
} catch (e) {
// Reclaim the orphaned shard so a repeatedly-failing index write doesn't leak a fresh blob per replay.
- await this.send(new DeleteObjectCommand({ Bucket: this.bucket, Key: shardKey })).catch(() => {})
+ await this.send(new DeleteObjectCommand({ Bucket: bucket, Key: shardKey })).catch(() => {})
throw e
}
if (encryptionKey) {
@@ -242,7 +250,7 @@ export class ImageShardStore {
const lookupKey = `${prefix}/lookup/${row.hash}.encrypted`
await this.send(
new PutObjectCommand({
- Bucket: this.bucket,
+ Bucket: bucket,
Key: lookupKey,
Body: encryptEnvelope(
encryptionKey,
@@ -284,14 +292,16 @@ export class ImageShardStore {
if (encryptionKey && (!image.sessionMonth || !/^[0-9]{4}-(0[1-9]|1[0-2])$/.test(image.sessionMonth))) {
throw new Error('URL images require a valid session month')
}
+ const dataset = this.datasetOf(encryptionKey ? image.sessionMonth : undefined)
+ const bucket = this.buckets[dataset]
const key = encryptionKey
- ? `${this.prefix}/v2/${image.sessionMonth}/${encryptionKey.identity.teamId}/url/${image.hash}`
+ ? `${this.prefix}/${dataset}/${image.sessionMonth}/${encryptionKey.identity.teamId}/url/${image.hash}`
: `${this.prefix}/url/${image.hash}`
for (let attempt = 0; attempt < URL_WRITE_MAX_ATTEMPTS; attempt++) {
try {
await this.send(
new PutObjectCommand({
- Bucket: this.bucket,
+ Bucket: bucket,
Key: key,
Body: encryptionKey
? encryptEnvelope(encryptionKey, 'image-url', image.bytes, { ref: key, codec: 'none' })
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-batcher.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-batcher.test.ts
index 16eaf3e12be9..f55ada572a58 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-batcher.test.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-batcher.test.ts
@@ -145,7 +145,7 @@ describe('BlockMetadataBatcher', () => {
send: jest.fn().mockRejectedValueOnce(new Error('index upload failed')).mockResolvedValue({}),
} as unknown as S3Client
const batcher = new BlockMetadataBatcher(
- new BlockMetadataParquetStore(s3, 'bucket', 'block-metadata'),
+ new BlockMetadataParquetStore(s3, { v2: 'bucket', v3: 'ml-bucket-v3' }, 'block-metadata'),
offsets,
{ flushIntervalMs: 1000, maxRows: 1 },
0,
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-parquet-store.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-parquet-store.test.ts
index f53992b0ab7b..a05ed06b1ca3 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-parquet-store.test.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-parquet-store.test.ts
@@ -65,6 +65,33 @@ describe('BlockMetadataParquetStore', () => {
} as unknown as S3Client
})
+ it('writes v3 sessions to the v3 bucket and keeps earlier sessions in v2 when both are configured', async () => {
+ const envelopes = ['2026-09-21T16:59:59.999Z', '2026-09-21T17:00:00Z'].map((date) => {
+ const hex = Date.parse(date).toString(16).padStart(12, '0')
+ return {
+ ...TrainingEncryptionVector.envelope,
+ context: {
+ ...TrainingEncryptionVector.envelope.context,
+ sessionId: `${hex.slice(0, 8)}-${hex.slice(8)}-7000-8000-000000000007`,
+ },
+ }
+ })
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod'
+ )
+ await store.writeEncrypted(envelopes)
+ await store.writeEncryptedReplayIndex(envelopes.map((envelope) => ({ kind: 'page', rowCount: 1, envelope })))
+ expect(puts.map((put) => [put.Bucket, put.Key?.split('/').slice(0, 3).join('/')])).toEqual([
+ ['ml-bucket', 'block-metadata/v2/2026-09'],
+ ['ml-bucket-v3', 'block-metadata/v3/2026-09'],
+ ['ml-bucket', 'block-metadata-replay-index/v2/2026-09'],
+ ['ml-bucket-v3', 'block-metadata-replay-index/v3/2026-09'],
+ ])
+ })
+
it('splits encrypted metadata by session month rather than upload time', async () => {
const envelopes = ['2026-09-30T23:59:59.999Z', '2026-10-01T00:00:00Z'].map((date) => {
const hex = Date.parse(date).toString(16).padStart(12, '0')
@@ -76,10 +103,15 @@ describe('BlockMetadataParquetStore', () => {
},
}
})
- await new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod').writeEncrypted(envelopes)
+ await new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod'
+ ).writeEncrypted(envelopes)
expect(puts.map((put) => put.Key?.split('/').slice(0, 3).join('/'))).toEqual([
- 'block-metadata/v2/2026-09',
- 'block-metadata/v2/2026-10',
+ 'block-metadata/v3/2026-09',
+ 'block-metadata/v3/2026-10',
])
for (const [index, put] of puts.entries()) {
const records = await readRows(put.Body)
@@ -91,7 +123,12 @@ describe('BlockMetadataParquetStore', () => {
await sodium.ready
const starts = ['2026-09-30T23:59:59.999Z', '2026-10-01T00:00:00Z']
const eventTimestamp = Date.parse('2026-10-01T00:00:01Z')
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod'
+ )
for (const [index, start] of starts.entries()) {
const hex = Date.parse(start).toString(16).padStart(12, '0')
const sessionId = `${hex.slice(0, 8)}-${hex.slice(8)}-7000-8000-000000000007`
@@ -113,7 +150,7 @@ describe('BlockMetadataParquetStore', () => {
}
await store.writeEncryptedReplayIndex(encryptReplayIndex(metadata, key))
const month = start.slice(0, 7)
- const objects = puts.filter((put) => put.Key!.startsWith(`block-metadata-replay-index/v2/${month}/`))
+ const objects = puts.filter((put) => put.Key!.startsWith(`block-metadata-replay-index/v3/${month}/`))
expect(objects).toHaveLength(2)
const labels = await readRows(objects.find((put) => put.Key!.includes('/kind=json_ld/'))!.Body)
expect(labels).toHaveLength(1)
@@ -141,7 +178,12 @@ describe('BlockMetadataParquetStore', () => {
if (failed) {
jest.mocked(s3.send).mockImplementationOnce(() => Promise.reject(new Error('upload failed')))
}
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
const write = store.writeEncrypted([TrainingEncryptionVector.envelope])
if (failed) {
await expect(write).rejects.toThrow('upload failed')
@@ -222,13 +264,23 @@ describe('BlockMetadataParquetStore', () => {
})
it('rejects plaintext v2 metadata before writing any objects', async () => {
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
await expect(store.write([{ ...row('session', '42'), format_version: 2 }])).rejects.toThrow('encrypted storage')
expect(puts).toHaveLength(0)
})
it('writes one dt-partitioned Parquet object that round-trips', async () => {
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
await store.write([row('s1', 't1'), row('s2', 't1')])
expect(puts).toHaveLength(1)
@@ -242,7 +294,12 @@ describe('BlockMetadataParquetStore', () => {
})
it('indexes cross-block pairs by session start day and preserves window and fractional timestamps', async () => {
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
const start = Date.parse('2025-01-01T23:59:00Z')
const snapshotTimestamp = start + 60_000.5
const full = {
@@ -301,7 +358,12 @@ describe('BlockMetadataParquetStore', () => {
})
it('propagates index upload failures so Kafka offsets cannot advance', async () => {
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
jest.mocked(s3.send).mockImplementationOnce(() => Promise.reject(new Error('index unavailable')))
await expect(
store.write([
@@ -333,7 +395,12 @@ describe('BlockMetadataParquetStore', () => {
],
},
])('keeps block metadata when index fields are unusable: %j', async (override) => {
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
await store.write([
{
...row('s1', 't1'),
@@ -347,7 +414,12 @@ describe('BlockMetadataParquetStore', () => {
})
it('sorts rows by (team_id, session_id)', async () => {
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
await store.write([row('s9', 't3'), row('s1', 't1'), row('s5', 't2'), row('s2', 't1')])
const rows = await readRows(puts[0].Body)
const keys = rows.map((r) => `${r.team_id}|${r.session_id}`)
@@ -355,14 +427,24 @@ describe('BlockMetadataParquetStore', () => {
})
it('writes nothing for an empty batch', async () => {
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
await store.write([])
expect(puts).toHaveLength(0)
})
it('propagates upload failures so the caller can replay from Kafka', async () => {
s3 = { send: jest.fn(() => Promise.reject(new Error('s3 down'))) } as unknown as S3Client
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
await expect(store.write([row('s1', 't1')])).rejects.toThrow('s3 down')
})
})
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-parquet-store.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-parquet-store.ts
index 941240bd869b..0926541abde4 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-parquet-store.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/block-metadata-parquet-store.ts
@@ -11,7 +11,7 @@ import { MlEncryptedEnvelope } from './keys/crypto'
import { MlParquetSinkMetrics } from './metrics'
import { rowsToParquetBuffer } from './parquet-writer'
import { EncryptedReplayIndex, replayIndexPartitions, replayIndexToParquetBuffer } from './replay-index'
-import { sessionStartMonth } from './session-identifier-format'
+import { sessionStartMonth, usesV3Dataset } from './session-identifier-format'
const cmp = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0)
@@ -19,13 +19,19 @@ const DAY_MS = 86_400_000
// The `dt=` partition is a UTC date, so measure lag and span in whole UTC days to match it.
const utcDay = (ms: number): number => Math.floor(ms / DAY_MS)
+/** A session's start selects its dataset, and each dataset has a bucket of its own. */
+export interface MlDatasetBuckets {
+ v2: string
+ v3: string
+}
+
export class BlockMetadataParquetStore {
private seq = 0
private readonly nodeId: string
constructor(
private readonly s3Client: S3Client,
- private readonly bucket: string,
+ private readonly buckets: MlDatasetBuckets,
private readonly prefix: string,
nodeId?: string
) {
@@ -48,42 +54,52 @@ export class BlockMetadataParquetStore {
if (envelopes.length === 0) {
return
}
- const months = new Map<string, MlEncryptedEnvelope[]>()
+ const partitions = new Map<string, { bucket: string; envelopes: MlEncryptedEnvelope[] }>()
for (const envelope of envelopes) {
- const month = sessionStartMonth(envelope.context.sessionId ?? '')
- const group = months.get(month) ?? []
- group.push(envelope)
- months.set(month, group)
+ const { dataset, month } = this.datasetOf(envelope.context.sessionId ?? '')
+ const partition = `${this.prefix}/${dataset}/${month}`
+ const group = partitions.get(partition) ?? { bucket: this.buckets[dataset], envelopes: [] }
+ group.envelopes.push(envelope)
+ partitions.set(partition, group)
}
- for (const [month, group] of months) {
- const bytes = await this.writeEncryptedPartition(`${this.prefix}/v2/${month}`, group)
- MlParquetSinkMetrics.observeWrite(group.length, bytes)
+ for (const [partition, group] of partitions) {
+ const bytes = await this.writeEncryptedPartition(group.bucket, partition, group.envelopes)
+ MlParquetSinkMetrics.observeWrite(group.envelopes.length, bytes)
}
}
public async writeEncryptedReplayIndex(indexes: EncryptedReplayIndex[]): Promise<void> {
- const partitions = new Map<string, EncryptedReplayIndex[]>()
+ const partitions = new Map<string, { bucket: string; indexes: EncryptedReplayIndex[] }>()
for (const index of indexes) {
const { kind, envelope } = index
- const month = sessionStartMonth(envelope.context.sessionId ?? '')
- const partition = `${this.prefix}-replay-index/v2/${month}/kind=${kind}`
- const group = partitions.get(partition) ?? []
- group.push(index)
+ const { dataset, month } = this.datasetOf(envelope.context.sessionId ?? '')
+ const partition = `${this.prefix}-replay-index/${dataset}/${month}/kind=${kind}`
+ const group = partitions.get(partition) ?? { bucket: this.buckets[dataset], indexes: [] }
+ group.indexes.push(index)
partitions.set(partition, group)
}
for (const [partition, group] of partitions) {
await this.writeEncryptedPartition(
+ group.bucket,
partition,
- group.map((index) => index.envelope)
+ group.indexes.map((index) => index.envelope)
)
MlParquetSinkMetrics.incReplayIndexRows(
- group[0].kind,
- group.reduce((count, index) => count + index.rowCount, 0)
+ group.indexes[0].kind,
+ group.indexes.reduce((count, index) => count + index.rowCount, 0)
)
}
}
- private async writeEncryptedPartition(prefix: string, envelopes: MlEncryptedEnvelope[]): Promise<number> {
+ private datasetOf(sessionId: string): { dataset: 'v2' | 'v3'; month: string } {
+ return { dataset: usesV3Dataset(sessionId) ? 'v3' : 'v2', month: sessionStartMonth(sessionId) }
+ }
+
+ private async writeEncryptedPartition(
+ bucket: string,
+ prefix: string,
+ envelopes: MlEncryptedEnvelope[]
+ ): Promise<number> {
let body: Buffer
try {
const schema = new ParquetSchema({
@@ -103,7 +119,7 @@ export class BlockMetadataParquetStore {
)
await this.s3Client.send(
new PutObjectCommand({
- Bucket: this.bucket,
+ Bucket: bucket,
Key: `${prefix}/part-${this.nodeId}-${Date.now()}-${++this.seq}.parquet`,
Body: body,
ContentType: 'application/vnd.apache.parquet',
@@ -131,7 +147,7 @@ export class BlockMetadataParquetStore {
this.seq += 1
await this.s3Client.send(
new PutObjectCommand({
- Bucket: this.bucket,
+ Bucket: this.buckets.v2,
Key: `${indexPrefix}/${partition}/part-${this.nodeId}-${Date.now()}-${this.seq}.parquet`,
Body: indexBody,
ContentType: 'application/vnd.apache.parquet',
@@ -144,7 +160,7 @@ export class BlockMetadataParquetStore {
key = this.objectKey(prefix, new Date(bounds.minMs).toISOString().slice(0, 10))
await this.s3Client.send(
new PutObjectCommand({
- Bucket: this.bucket,
+ Bucket: this.buckets.v2,
Key: key,
Body: body,
ContentType: 'application/vnd.apache.parquet',
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/key-store.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/key-store.test.ts
index 8c31cfa215a4..ddecaf730085 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/key-store.test.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/key-store.test.ts
@@ -1035,7 +1035,7 @@ describe('ML session key batches', () => {
const batcher = new BlockMetadataBatcher(
new BlockMetadataParquetStore(
{ send: upload } as unknown as S3Client,
- 'ml-bucket',
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
'block-metadata',
'pod'
),
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/metadata-roundtrip.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/metadata-roundtrip.test.ts
index 419afcf31ac8..a94756c276da 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/metadata-roundtrip.test.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/metadata-roundtrip.test.ts
@@ -111,7 +111,12 @@ describe('ML metadata producer → sink round-trip', () => {
return Promise.resolve({})
}),
} as unknown as S3Client
- const store = new BlockMetadataParquetStore(s3, 'ml-bucket', 'block-metadata', 'pod-1')
+ const store = new BlockMetadataParquetStore(
+ s3,
+ { v2: 'ml-bucket', v3: 'ml-bucket-v3' },
+ 'block-metadata',
+ 'pod-1'
+ )
const offsetStore: OffsetStore = { offsetsStore: jest.fn() }
const batcher = new BlockMetadataBatcher(
store,
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-format-file-storage.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-format-file-storage.test.ts
index a045b351a275..db7c941bf50d 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-format-file-storage.test.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-format-file-storage.test.ts
@@ -32,7 +32,11 @@ describe('SessionFormatFileStorage', () => {
it('routes sessions to separate objects and byte ranges in mixed batches', async () => {
const legacy = storage('rrweb/object')
const raw = storage('rrweb_2/object')
- const mixed = new SessionFormatFileStorage(legacy, () => raw)
+ const mixed = new SessionFormatFileStorage(
+ legacy,
+ () => raw,
+ () => raw
+ )
for (let batch = 0; batch < 2; batch++) {
const writer = mixed.newBatch()
for (const entry of cases.cases) {
@@ -59,9 +63,8 @@ describe('SessionFormatFileStorage', () => {
const legacy = storage('rrweb/object')
const september = storage('rrweb_2/2026-09/object')
const october = storage('rrweb_2/2026-10/object')
- const writer = new SessionFormatFileStorage(legacy, (month) =>
- month === '2026-09' ? september : october
- ).newBatch()
+ const byMonth = (month?: string): SessionBatchFileStorage => (month === '2026-09' ? september : october)
+ const writer = new SessionFormatFileStorage(legacy, byMonth, byMonth).newBatch()
for (const [date, prefix] of [
['2026-09-30T23:59:59.999Z', '2026-09'],
['2026-10-01T00:00:00Z', '2026-10'],
@@ -81,6 +84,32 @@ describe('SessionFormatFileStorage', () => {
expect(october.buffers).toHaveLength(1)
})
+ it('routes a session that started at the v3 cutoff to v3 storage and one just before to v2', async () => {
+ const raw = storage('rrweb_2/2026-09/object')
+ const v3 = storage('rrweb_3/2026-09/object')
+ const writer = new SessionFormatFileStorage(
+ storage('rrweb/object'),
+ () => raw,
+ () => v3
+ ).newBatch()
+ for (const [date, prefix] of [
+ ['2026-09-21T16:59:59.999Z', 'rrweb_2/2026-09/object'],
+ ['2026-09-21T17:00:00Z', 'rrweb_3/2026-09/object'],
+ ]) {
+ const hex = Date.parse(date).toString(16).padStart(12, '0')
+ const result = await writer.writeSession({
+ buffer: Buffer.from('abc'),
+ sessionId: `${hex.slice(0, 8)}-${hex.slice(8)}-7000-8000-000000000001`,
+ teamId: 7,
+ retentionPeriod: '30d',
+ })
+ expect(result.url).toBe(`${prefix}?range=bytes=0-2`)
+ }
+ await writer.finish()
+ expect(raw.buffers).toHaveLength(1)
+ expect(v3.buffers).toHaveLength(1)
+ })
+
it('waits for both uploads before reporting a failure', async () => {
const legacy = storage('rrweb/object')
const raw = storage('rrweb_2/object')
@@ -91,7 +120,11 @@ describe('SessionFormatFileStorage', () => {
completeRaw = resolve
})
)
- const writer = new SessionFormatFileStorage(legacy, () => raw).newBatch()
+ const writer = new SessionFormatFileStorage(
+ legacy,
+ () => raw,
+ () => raw
+ ).newBatch()
for (const entry of cases.cases.slice(0, 2)) {
await writer.writeSession({
buffer: Buffer.from('abc'),
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-format-file-storage.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-format-file-storage.ts
index de92599fa7ce..5c2c8999d718 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-format-file-storage.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-format-file-storage.ts
@@ -5,22 +5,26 @@ import {
WriteSessionResult,
} from '~/ingestion/pipelines/sessionreplay/sessions/session-batch-file-storage'
-import { sessionStartMonth, usesRawSessionIdentifiers } from './session-identifier-format'
+import { sessionStartMonth, usesRawSessionIdentifiers, usesV3Dataset } from './session-identifier-format'
class SessionFormatFileWriter implements SessionBatchFileWriter {
private readonly writers = new Map<string, SessionBatchFileWriter>()
constructor(
private readonly legacyStorage: SessionBatchFileStorage,
- private readonly rawStorage: (month?: string) => SessionBatchFileStorage
+ private readonly rawStorage: (month?: string) => SessionBatchFileStorage,
+ private readonly v3Storage: (month?: string) => SessionBatchFileStorage
) {}
public writeSession(data: WriteSessionData): Promise<WriteSessionResult> {
- const rawIdentifiers = usesRawSessionIdentifiers(data.sessionId)
- const partition = rawIdentifiers ? sessionStartMonth(data.sessionId) : 'legacy'
+ const v3 = usesV3Dataset(data.sessionId)
+ const rawIdentifiers = v3 || usesRawSessionIdentifiers(data.sessionId)
+ const month = rawIdentifiers ? sessionStartMonth(data.sessionId) : undefined
+ const partition = v3 ? `v3/${month}` : (month ?? 'legacy')
let writer = this.writers.get(partition)
if (!writer) {
- writer = (rawIdentifiers ? this.rawStorage(partition) : this.legacyStorage).newBatch()
+ const storage = v3 ? this.v3Storage(month) : rawIdentifiers ? this.rawStorage(month) : this.legacyStorage
+ writer = storage.newBatch()
this.writers.set(partition, writer)
}
return writer.writeSession(data)
@@ -39,15 +43,20 @@ class SessionFormatFileWriter implements SessionBatchFileWriter {
export class SessionFormatFileStorage implements SessionBatchFileStorage {
constructor(
private readonly legacyStorage: SessionBatchFileStorage,
- private readonly rawStorage: (month?: string) => SessionBatchFileStorage
+ private readonly rawStorage: (month?: string) => SessionBatchFileStorage,
+ private readonly v3Storage: (month?: string) => SessionBatchFileStorage
) {}
public newBatch(): SessionBatchFileWriter {
- return new SessionFormatFileWriter(this.legacyStorage, this.rawStorage)
+ return new SessionFormatFileWriter(this.legacyStorage, this.rawStorage, this.v3Storage)
}
public async checkHealth(): Promise<boolean> {
- const health = await Promise.all([this.legacyStorage.checkHealth(), this.rawStorage().checkHealth()])
+ const health = await Promise.all([
+ this.legacyStorage.checkHealth(),
+ this.rawStorage().checkHealth(),
+ this.v3Storage().checkHealth(),
+ ])
return health.every(Boolean)
}
}
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format.test.ts
index 2aba350485d9..56e3feeb5731 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format.test.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format.test.ts
@@ -1,4 +1,4 @@
-import { mlSessionIdDropReason } from './session-identifier-format'
+import { mlSessionIdDropReason, usesV3Dataset, usesV3ImageDataset } from './session-identifier-format'
describe('mlSessionIdDropReason', () => {
const startedAt = Date.UTC(2026, 8, 15, 12)
@@ -19,3 +19,18 @@ describe('mlSessionIdDropReason', () => {
expect(mlSessionIdDropReason('6ba7b810-9dad-41d1-80b4-00c04fd430c8', startedAt)).toBe('session_id_not_uuid_v7')
})
})
+
+describe('usesV3Dataset', () => {
+ it.each([
+ ['just before 18:00 Europe/London on 2026-09-21', '2026-09-21T16:59:59.999Z', false],
+ ['at 18:00 Europe/London on 2026-09-21', '2026-09-21T17:00:00Z', true],
+ ])('%s', (_, date, v3) => {
+ const hex = Date.parse(date).toString(16).padStart(12, '0')
+ expect(usesV3Dataset(`${hex.slice(0, 8)}-${hex.slice(8)}-7000-8000-000000000001`)).toBe(v3)
+ })
+
+ it('keeps the month of the cutoff in v2 for images and moves the next month to v3', () => {
+ expect(usesV3ImageDataset('2026-09')).toBe(false)
+ expect(usesV3ImageDataset('2026-10')).toBe(true)
+ })
+})
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format.ts
index 1938685365a2..ebbc856113f1 100644
--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format.ts
+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format.ts
@@ -1,4 +1,8 @@
export const RAW_SESSION_IDENTIFIERS_START_MS = Date.parse('2026-09-15T12:00:00Z')
+/** 18:00 Europe/London on 2026-09-21, the first session start that lands in the v3 dataset. */
+export const V3_DATASET_START_MS = Date.parse('2026-09-21T17:00:00Z')
+/** An image carries a session month and no session ID, so the image dataset changes version at the first month boundary after the session cutoff. */
+export const V3_IMAGE_DATASET_START_MONTH = '2026-10'
export function sessionStartTimestampFromUuidV7(sessionId: string): number | null {
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(sessionId)) {
@@ -13,6 +17,15 @@ export function usesRawSessionIdentifiers(sessionId: string): boolean {
return startedAt !== null && startedAt >= RAW_SESSION_IDENTIFIERS_START_MS && startedAt < Date.UTC(10000, 0, 1)
}
+export function usesV3Dataset(sessionId: string): boolean {
+ const startedAt = sessionStartTimestampFromUuidV7(sessionId)
+ return startedAt !== null && startedAt >= V3_DATASET_START_MS && startedAt < Date.UTC(10000, 0, 1)
+}
+
+export function usesV3ImageDataset(sessionMonth: string): boolean {
+ return sessionMonth >= V3_IMAGE_DATASET_START_MONTH
+}
+
export const ML_SESSION_MAX_AGE_DAYS = 14
export const ML_SESSION_MAX_FUTURE_DAYS = 1
const DAY_MS = 24 * 60 * 60 * 1000
diff --git a/nodejs/src/servers/ingestion-session-replay-ml-image-scrub-server.ts b/nodejs/src/servers/ingestion-session-replay-ml-image-scrub-server.ts
index db74bb909010..1226326c1ca0 100644
--- a/nodejs/src/servers/ingestion-session-replay-ml-image-scrub-server.ts
+++ b/nodejs/src/servers/ingestion-session-replay-ml-image-scrub-server.ts
@@ -62,9 +62,14 @@ export class IngestionSessionReplayMlImageScrubServer extends MlMirrorConsumerSe
await this.keyManager.start()
}
const s3Client = requireS3Client(buildSessionRecordingS3Client(this.config))
+ if (!this.config.AI_RESEARCH_REPLAY_S3_BUCKET) {
+ throw new Error(
+ 'AI_RESEARCH_REPLAY_S3_BUCKET must be set: images of months after the v3 cutoff write there'
+ )
+ }
const store = new ImageShardStore(
s3Client,
- this.config.SESSION_RECORDING_V2_S3_BUCKET,
+ { v2: this.config.SESSION_RECORDING_V2_S3_BUCKET, v3: this.config.AI_RESEARCH_REPLAY_S3_BUCKET },
this.config.SESSION_RECORDING_ML_IMAGE_SCRUB_PREFIX,
this.config.SESSION_RECORDING_ML_IMAGE_SCRUB_S3_WRITE_TIMEOUT_MS
)
diff --git a/nodejs/src/servers/ingestion-session-replay-ml-mirror-server.ts b/nodejs/src/servers/ingestion-session-replay-ml-mirror-server.ts
index 31e6bfd98384..bbe9b9d7d5b8 100644
--- a/nodejs/src/servers/ingestion-session-replay-ml-mirror-server.ts
+++ b/nodejs/src/servers/ingestion-session-replay-ml-mirror-server.ts
@@ -75,10 +75,24 @@ export class IngestionSessionReplayMlMirrorServer extends MlMirrorConsumerServer
const s3Client = buildSessionRecordingS3Client(this.config)
const bucket = this.config.SESSION_RECORDING_V2_S3_BUCKET
const prefix = this.config.AI_RESEARCH_REPLAY_S3_PREFIX
+ const v3Bucket = this.config.AI_RESEARCH_REPLAY_S3_BUCKET
+ const v3Prefix = this.config.AI_RESEARCH_REPLAY_S3_V3_PREFIX
+ if (!v3Bucket) {
+ throw new Error(
+ 'AI_RESEARCH_REPLAY_S3_BUCKET must be set: sessions started after the v3 cutoff write there'
+ )
+ }
const pseudonymSecret = await resolvePseudonymKey(this.config)
// A session keeps its storage prefix across flushes and late arrivals.
+ const rawStorage = (month?: string) =>
+ new S3SessionBatchFileStorage(
+ s3Client!,
+ bucket,
+ month ? `${prefix}/${month}` : prefix,
+ this.config.SESSION_RECORDING_V2_S3_TIMEOUT_MS
+ )
const fileStorage = s3Client
? new SessionFormatFileStorage(
new S3SessionBatchFileStorage(
@@ -87,11 +101,12 @@ export class IngestionSessionReplayMlMirrorServer extends MlMirrorConsumerServer
this.config.SESSION_RECORDING_V2_S3_PREFIX,
this.config.SESSION_RECORDING_V2_S3_TIMEOUT_MS
),
+ rawStorage,
(month) =>
new S3SessionBatchFileStorage(
s3Client,
- bucket,
- month ? `${prefix}/${month}` : prefix,
+ v3Bucket,
+ month ? `${v3Prefix}/${month}` : v3Prefix,
this.config.SESSION_RECORDING_V2_S3_TIMEOUT_MS
)
)
diff --git a/nodejs/src/servers/ingestion-session-replay-ml-parquet-sink-server.ts b/nodejs/src/servers/ingestion-session-replay-ml-parquet-sink-server.ts
index 281db1042db0..4726d5114a2e 100644
--- a/nodejs/src/servers/ingestion-session-replay-ml-parquet-sink-server.ts
+++ b/nodejs/src/servers/ingestion-session-replay-ml-parquet-sink-server.ts
@@ -43,9 +43,14 @@ export class IngestionSessionReplayMlParquetSinkServer extends MlMirrorConsumerS
await this.keyManager.start()
}
const s3Client = requireS3Client(buildSessionRecordingS3Client(this.config))
+ if (!this.config.AI_RESEARCH_REPLAY_S3_BUCKET) {
+ throw new Error(
+ 'AI_RESEARCH_REPLAY_S3_BUCKET must be set: sessions started after the v3 cutoff write there'
+ )
+ }
const store = new BlockMetadataParquetStore(
s3Client,
- this.config.SESSION_RECORDING_V2_S3_BUCKET,
+ { v2: this.config.SESSION_RECORDING_V2_S3_BUCKET, v3: this.config.AI_RESEARCH_REPLAY_S3_BUCKET },
this.config.SESSION_RECORDING_ML_METADATA_PREFIX
)
diff --git a/products/ai_training/docs/replay-data.md b/products/ai_training/docs/replay-data.md
index 2df2ef38f29b..2cca86e185e0 100644
--- a/products/ai_training/docs/replay-data.md
+++ b/products/ai_training/docs/replay-data.md
@@ -14,12 +14,15 @@ The session UUIDv7 timestamp selects the version:
- Before the cutoff: v1 uses HMAC team and session IDs.
- At or after the cutoff: v2 uses raw team and session IDs and encrypted payloads.
+- At or after **Monday, 2026-09-21 at 17:00 UTC** (18:00 in Europe/London): v3 keeps the v2 identifiers and keys, and stores its objects in the v3 buckets under `rrweb_3/` and the `/v3/` dataset paths.
- The ML mirror drops a session if its ID is not UUIDv7 or its start year is beyond 9999.
Event timestamps, arrival times, retries, and flushes do not change the version.
Both versions can occur in one ingestion batch.
Their replay blocks, images, and metadata use separate storage paths.
The version applies to the whole session, including a session that crosses the cutoff.
+An image carries a session month and no session ID, so the image dataset moves to v3 at the first month boundary after the v3 cutoff: images of `2026-09` stay in v2 and images of `2026-10` onward are v3.
+The three lanes require `AI_RESEARCH_REPLAY_S3_BUCKET` at startup, because a v3 session or image has no other place to go.
## Consent
@@ -181,6 +184,9 @@ A session that crosses a month boundary stays in its start month, including late
| Inline image indexes | `scrubbed-images/v2/<month>/<team>/index/` | Team and session month |
| URL images | `scrubbed-images/v2/<month>/<team>/url/<hash>` | Team and session month |
+A v3 session uses the same layout in the v3 buckets: blocks under `rrweb_3/<month>/`, and the metadata catalog, the evaluation index and every image path with `/v3/` in place of `/v2/`.
+A reader finds the bucket of a block in its `block_url`, and resolves an image reference in the v3 images bucket when the reference's month is `2026-10` or later.
+
Metadata catalogs expose raw `team_id`, `session_id`, `format_version`, and an encrypted `payload`.
URLs, block locations, and replay indexes are inside that payload.
Neither the catalog nor its encrypted payload includes a distinct-ID field.
@@ -237,7 +243,7 @@ New key manager and v2 storage settings use the `AI_RESEARCH_REPLAY_*` prefix:
- `ROW_CACHE_MAX` and `ROW_CACHE_LIFETIME_MS` bound the stored key row cache. The lifetime applies to a session key row and is capped; a team image key row is held for up to 48 hours. A value that is not a positive integer stops the consumer at startup and names the setting.
- `IMAGE_FETCH_V2_DYNAMODB_TABLE` selects the fresh v2 frontier.
- `S3_PREFIX` selects v2 replay storage and defaults to `rrweb_2`.
-- `S3_BUCKET` names the v3 bucket, which holds only AISR03 frames. It is empty until the cutover by session start timestamp selects it, and v2 keeps its own bucket.
+- `S3_BUCKET` names the v3 bucket, which holds only AISR03 frames. A session that started at or after the v3 cutoff writes there, and v2 keeps its own bucket. The mirror, the sink and the image scrubber stop at startup when it is empty.
- `S3_V3_PREFIX` selects the block prefix inside the v3 bucket and defaults to `rrweb_3`. Each dataset version has its own prefix, so a bucket policy grants only the versions it holds.
The v2 producer requires `AI_RESEARCH_REPLAY_KEY_TABLE` and `AI_RESEARCH_REPLAY_KMS_KEY_ARN` at startup.