: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(ai-research): name the dataset version in image references (#103772)
Robbied5e1884b04ca
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/versioned-crawl-history.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/versioned-crawl-history.test.tsindex 2796a3a8dc6d..1a6707fbaf93 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/versioned-crawl-history.test.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/versioned-crawl-history.test.ts@@ -23,6 +23,7 @@ describe('VersionedCrawlHistory', () => {const history = new VersionedCrawlHistory(shared, images)const september = 'imageurl:v2:7:2026-09:aaaaaaaaaaaaaaaaaaaaaa'const october = september.replace('2026-09', '2026-10')+ const septemberV3 = september.replace(':v2:', ':v3:')const origin = 'https://example.com'const policies = (['robots', 'tdmrep'] as const).map((kind) => ({kind,@@ -39,9 +40,15 @@ describe('VersionedCrawlHistory', () => {{ kind: 'url', key: september, nextFetchAtMs: 100, storageExpiresAtMs: 1000, outcome: 'fetched' },...policies,])- const result = await history.read([september, october, ...policies.map((item) => item.key)])+ const result = await history.read([september, october, septemberV3, ...policies.map((item) => item.key)])expect(result.has(september)).toBe(true)expect(result.has(october)).toBe(false)+ expect(result.has(septemberV3)).toBe(false)+ await history.write([+ { kind: 'url', key: septemberV3, nextFetchAtMs: 100, storageExpiresAtMs: 1000, outcome: 'fetched' },+ ])+ expect([...images.items.keys()]).toEqual([september, septemberV3])+ images.items.delete(septemberV3)expect([...shared.items.keys()]).toEqual(policies.map((item) => item.key))expect(policies.every((item) => result.get(item.key) === item)).toBe(true)expect([...images.items.keys()]).toEqual([september])diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/versioned-crawl-history.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/versioned-crawl-history.tsindex 3ec863afceb6..f9f5f5e5d560 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/versioned-crawl-history.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/versioned-crawl-history.ts@@ -1,5 +1,8 @@import { CrawlHistoryItem, CrawlHistoryStore } from './crawl-history'+/** A v2 or v3 reference carries its dataset version, so the two never share a frontier entry. */+const SCOPED_URL_REF = /^imageurl:v[23]:/+export class VersionedCrawlHistory implements CrawlHistoryStore {constructor(private readonly legacy: CrawlHistoryStore,@@ -7,16 +10,16 @@ export class VersionedCrawlHistory implements CrawlHistoryStore {) {}public async read(keys: string[]): Promise<Map<string, CrawlHistoryItem>> {- const scoped = keys.filter((key) => key.startsWith('imageurl:v2:'))- const legacy = keys.filter((key) => !key.startsWith('imageurl:v2:'))+ const scoped = keys.filter((key) => SCOPED_URL_REF.test(key))+ const legacy = keys.filter((key) => !SCOPED_URL_REF.test(key))const results = await Promise.all([this.legacy.read(legacy), this.v2.read(scoped)])return new Map(results.flatMap((result) => [...result]))}public async write(items: CrawlHistoryItem[]): Promise<void> {await Promise.all([- this.legacy.write(items.filter((item) => !item.key.startsWith('imageurl:v2:'))),- this.v2.write(items.filter((item) => item.key.startsWith('imageurl:v2:'))),+ this.legacy.write(items.filter((item) => !SCOPED_URL_REF.test(item.key))),+ this.v2.write(items.filter((item) => SCOPED_URL_REF.test(item.key))),])}}diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/content-ref.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/content-ref.test.tsnew file mode 100644index 000000000000..0682969cf29d--- /dev/null+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/content-ref.test.ts@@ -0,0 +1,25 @@+import { parseImageRef } from './content-ref'++describe('parseImageRef', () => {+ const hash = 'a'.repeat(22)++ it.each([+ ['image', 2, 'bytes'],+ ['imageurl', 2, 'url'],+ ['image', 3, 'bytes'],+ ['imageurl', 3, 'url'],+ ] as const)('parses a scoped %s ref of dataset v%s', (prefix, version, source) => {+ expect(parseImageRef(`${prefix}:v${version}:42:2026-09:${hash}`)).toEqual({+ teamId: '42',+ sessionMonth: '2026-09',+ hash,+ source,+ version,+ })+ })++ it('rejects a scoped ref of a dataset version it does not know', () => {+ expect(parseImageRef(`image:v4:42:2026-09:${hash}`)).toBeNull()+ expect(parseImageRef(`image:v1:42:2026-09:${hash}`)).toBeNull()+ })+})diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/content-ref.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/content-ref.tsindex 7d41e30db895..bbbb3aa29936 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/content-ref.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/content-ref.ts@@ -46,17 +46,18 @@ export function parseImageRef(s: string): {pseudoTeam?: stringhash: stringsource: 'bytes' | 'url'- version?: 2+ version?: 2 | 3sessionMonth?: string} | null {- const scoped = /^(image|imageurl):v2:([1-9][0-9]{0,15}):([0-9]{4}-(?:0[1-9]|1[0-2])):([A-Za-z0-9_-]{22})$/.exec(s)- if (scoped && isRawTeamId(scoped[2])) {+ const scoped =+ /^(image|imageurl):v([23]):([1-9][0-9]{0,15}):([0-9]{4}-(?:0[1-9]|1[0-2])):([A-Za-z0-9_-]{22})$/.exec(s)+ if (scoped && isRawTeamId(scoped[3])) {return {- teamId: scoped[2],- sessionMonth: scoped[3],- hash: scoped[4],+ teamId: scoped[3],+ sessionMonth: scoped[4],+ hash: scoped[5],source: scoped[1] === 'image' ? 'bytes' : 'url',- version: 2,+ version: scoped[2] === '3' ? 3 : 2,}}const content = CONTENT_REF_RE.exec(s)diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-batcher.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-batcher.tsindex fea4a7839752..754fa083b019 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-batcher.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/image-batcher.ts@@ -74,6 +74,7 @@ const REVOKED_PARTITION_CODES = new Set([/** The batch index is what lets offsets advance across the messages planning skipped. */interface PlannedScrub {sessionMonth?: string+ datasetVersion?: 2 | 3encryptedValue?: Bufferindex: numberref: string@@ -630,6 +631,7 @@ export class ImageBatcher {ref,teamId: parsed.teamId,sessionMonth: parsed.sessionMonth,+ datasetVersion: parsed.version,pseudoTeam: parsed.pseudoTeam,hash: parsed.hash,source: parsed.source,@@ -759,6 +761,7 @@ export class ImageBatcher {return {teamId: planned.teamId,sessionMonth: planned.sessionMonth,+ datasetVersion: planned.datasetVersion,hash: planned.hash,bytes,sourcePartition: planned.sourcePartition,@@ -767,6 +770,7 @@ export class ImageBatcher {}return {sessionMonth: planned.sessionMonth,+ datasetVersion: planned.datasetVersion,teamId: planned.teamId,pseudoTeam: planned.pseudoTeam,hash: planned.hash,@@ -901,7 +905,7 @@ export class ImageBatcher {const groupId =item.image.sessionMonth === undefined? String(item.image.teamId !== undefined)- : `${item.image.teamId}:${item.image.sessionMonth}`+ : `v${item.image.datasetVersion}:${item.image.teamId}:${item.image.sessionMonth}`const group = groups.get(groupId) ?? []group.push(item)groups.set(groupId, group)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.tsindex be07707de8a7..9d8abb75e4ed 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@@ -55,10 +55,10 @@ describe('ImageShardStore', () => {}})- it('writes an image of a v3 month to the v3 bucket under the v3 prefix', async () => {+ it('writes an image whose reference names the v3 dataset to the v3 bucket under the v3 prefix', async () => {await sodium.readyconst key: MlDataKey = {- identity: { teamId: 7, organizationId: 'test-org', sessionMonth: '2026-10' },+ identity: { teamId: 7, organizationId: 'test-org', sessionMonth: '2026-09' },plaintext: Buffer.alloc(32, 7),wrapped: Buffer.alloc(32, 8),}@@ -70,17 +70,24 @@ describe('ImageShardStore', () => {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 image = { teamId: '7', sessionMonth: '2026-09', hash: inlineImage.hash, bytes: inlineImage.bytes }+ await store.writeShard([{ ...image, datasetVersion: 3 }], key)+ await store.writeUrlImage({ ...urlImage, teamId: '7', sessionMonth: '2026-09', datasetVersion: 3 }, 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\//)+ expect(objectKey).toMatch(/^images\/v3\/2026-09\/7\//)}+ await expect(+ store.writeShard(+ [+ { ...image, datasetVersion: 3 },+ { ...image, hash: 'b'.repeat(22), datasetVersion: 2 },+ ],+ key+ )+ ).rejects.toThrow('one dataset version')})it.each([false, true])(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.tsindex 4dd707409422..e63fcf021568 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@@ -6,11 +6,12 @@ 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 {sessionMonth?: string+ /** From the reference, so an image sits in the dataset of the session that collected it. */+ datasetVersion?: 2 | 3teamId?: stringpseudoTeam?: stringhash: string@@ -20,6 +21,7 @@ export interface ScrubbedImage {export interface ScrubbedUrlImage {teamId?: stringsessionMonth?: string+ datasetVersion?: 2 | 3hash: stringbytes: BuffersourcePartition: number@@ -94,8 +96,8 @@ 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'+ private datasetOf(datasetVersion: 2 | 3 | undefined): 'v2' | 'v3' {+ return datasetVersion === 3 ? 'v3' : 'v2'}/**@@ -186,7 +188,10 @@ export class ImageShardStore {) {throw new Error('Image shards require one valid session month')}- const dataset = this.datasetOf(encryptionKey ? sessionMonth : undefined)+ if (encryptionKey && images.some((image) => image.datasetVersion !== images[0].datasetVersion)) {+ throw new Error('Image shards require one dataset version')+ }+ const dataset = this.datasetOf(encryptionKey ? images[0]?.datasetVersion : undefined)const bucket = this.buckets[dataset]const prefix = encryptionKey? `${this.prefix}/${dataset}/${sessionMonth}/${encryptionKey.identity.teamId}`@@ -292,7 +297,7 @@ 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 dataset = this.datasetOf(encryptionKey ? image.datasetVersion : undefined)const bucket = this.buckets[dataset]const key = encryptionKey? `${this.prefix}/${dataset}/${image.sessionMonth}/${encryptionKey.identity.teamId}/url/${image.hash}`diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/crypto.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/crypto.test.tsindex 749a320e1898..1846df657406 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/crypto.test.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/crypto.test.ts@@ -99,9 +99,10 @@ describe('ML payload encryption', () => {sessionId: `${timestamp.slice(0, 8)}-${timestamp.slice(8)}-7000-8000-000000000007`,},}- const ref = `imageurl:v2:${key.identity.teamId}:2026-09:aaaaaaaaaaaaaaaaaaaaaa`+ const ref = `imageurl:v3:${key.identity.teamId}:2026-09:aaaaaaaaaaaaaaaaaaaaaa`expect(() => validateImageOwner(ref, sessionKey)).not.toThrow()expect(() => validateImageOwner(ref.replace('2026-09', '2026-10'), sessionKey)).toThrow('ownership mismatch')+ expect(() => validateImageOwner(ref.replace(':v3:', ':v2:'), sessionKey)).toThrow('ownership mismatch')})it('decrypts the shared encryption vector', () => {diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/transport.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/transport.tsindex 8a4d0eb33c92..79e2c3a07353 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/transport.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/keys/transport.ts@@ -4,7 +4,10 @@ import { parseKafkaHeaders } from '~/common/kafka/consumer/consumer-v1'import { parseJSON } from '~/common/utils/json-parse'import { parseImageRef } from '~/ingestion/pipelines/sessionreplay/ml-mirror-image-scrub/content-ref'import { MlMirrorMetrics } from '~/ingestion/pipelines/sessionreplay/ml-mirror/metrics'-import { sessionStartMonth } from '~/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format'+import {+ mlDatasetVersion,+ sessionStartMonth,+} from '~/ingestion/pipelines/sessionreplay/ml-mirror/session-identifier-format'import { MlDataKey } from './crypto'import { MlKeyReader } from './reader'@@ -53,20 +56,21 @@ export function validateImageOwner(ref: string, key: MlDataKey | undefined): voiif (key) {if (!parsed ||- parsed.version !== 2 ||+ parsed.version !== mlDatasetVersion(key.identity.sessionId ?? '') ||parsed.teamId !== String(key.identity.teamId) ||parsed.sessionMonth !== sessionStartMonth(key.identity.sessionId ?? '')) {throw new Error('ML image reference ownership mismatch')}- } else if (parsed?.version === 2) {+ } else if (parsed?.version !== undefined) {throw new Error('An ML v2 image requires a v2 session key')}}+/** The wire version says whether a record has a session key; a keyed record's reference names a v2 or v3 dataset. */export function validateImageRefVersion(ref: string, version: 1 | 2): void {const parsed = parseImageRef(ref)- if (version === 2 ? parsed?.version !== 2 : parsed?.version === 2) {+ if (version === 2 ? parsed?.version === undefined : parsed?.version !== undefined) {throw new Error('ML image reference version mismatch')}}diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/parse-and-anonymize-step.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/parse-and-anonymize-step.tsindex 941c82d9af2a..a748317ac159 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/parse-and-anonymize-step.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/parse-and-anonymize-step.ts@@ -33,7 +33,7 @@ import {PSEUDONYM_TEAM,pseudonymize,} from './pseudonymize'-import { sessionStartMonth, usesRawSessionIdentifiers } from './session-identifier-format'+import { mlDatasetVersion, sessionStartMonth, usesRawSessionIdentifiers } from './session-identifier-format'const MESSAGE_TIMESTAMP_DIFF_THRESHOLD_DAYS = 7@@ -181,7 +181,7 @@ export function createParseAndAnonymizeMessageStep<try {referenceNamespace =sessionKeys && usesRawSessionIdentifiers(headers.session_id)- ? `v2:${input.team.teamId}:${sessionStartMonth(headers.session_id)}`+ ? `v${mlDatasetVersion(headers.session_id)}:${input.team.teamId}:${sessionStartMonth(headers.session_id)}`: undefinedimageTeamId = referenceNamespace ?? teamKeys?.teamIdresult = await getRustAnonymizer().anonymizeKafkaPayload(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.tsindex 56e3feeb5731..65f9c883656f 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, usesV3Dataset, usesV3ImageDataset } from './session-identifier-format'+import { mlSessionIdDropReason, usesV3Dataset } from './session-identifier-format'describe('mlSessionIdDropReason', () => {const startedAt = Date.UTC(2026, 8, 15, 12)@@ -28,9 +28,4 @@ describe('usesV3Dataset', () => {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.tsindex ebbc856113f1..204a64e32ce1 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,8 +1,6 @@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)) {@@ -22,8 +20,9 @@ export function usesV3Dataset(sessionId: string): boolean {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+/** The dataset version a session's image references carry, so an image lane stores them next to the session. */+export function mlDatasetVersion(sessionId: string): 2 | 3 {+ return usesV3Dataset(sessionId) ? 3 : 2}export const ML_SESSION_MAX_AGE_DAYS = 14diff --git a/products/ai_training/docs/replay-data.md b/products/ai_training/docs/replay-data.mdindex 2cca86e185e0..3757cc12bc44 100644--- a/products/ai_training/docs/replay-data.md+++ b/products/ai_training/docs/replay-data.md@@ -21,7 +21,7 @@ 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.+An image reference carries the dataset version of the session that collected it, so a v3 session's images are v3 whatever their month, and the image lanes never read a session ID.The three lanes require `AI_RESEARCH_REPLAY_S3_BUCKET` at startup, because a v3 session or image has no other place to go.## Consent@@ -185,7 +185,7 @@ A session that crosses a month boundary stays in its start month, including late| 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.+A reader finds the bucket of a block in its `block_url`, and resolves an `image:v3:` or `imageurl:v3:` reference in the v3 images bucket under the `/v3/` paths.Metadata catalogs expose raw `team_id`, `session_id`, `format_version`, and an encrypted `payload`.URLs, block locations, and replay indexes are inside that payload.@@ -208,7 +208,7 @@ Resolve image references before training because they contain team IDs.## Images and Kafka-V2 references are `image:v2:<team>:<month>:<hash>` and `imageurl:v2:<team>:<month>:<hash>`.+A reference names its dataset version: `image:v2:<team>:<month>:<hash>` and `imageurl:v2:<team>:<month>:<hash>` for a v2 session, `image:v3:...` and `imageurl:v3:...` for a v3 session. The version is part of the reference, so the fetch frontier and every dedup cache treat a v3 reference as new even when a v2 session already stored the same image, and the v3 dataset gets its own copy.Images do not deduplicate across teams or session months.Kafka records between the ML lanes travel in cleartext; only objects in S3 are sealed, and stored scrubbed images use team image keys.Consumers reject malformed UUIDv7 session identifiers before reading DynamoDB.diff --git a/rust/Cargo.lock b/rust/Cargo.lockindex cc03999ea979..e3533d086162 100644--- a/rust/Cargo.lock+++ b/rust/Cargo.lock@@ -9390,7 +9390,7 @@ dependencies = [[[package]]name = "posthog-replay-anonymizer"-version = "0.7.1"+version = "0.7.2"dependencies = ["ahash 0.8.12","anyhow",diff --git a/rust/replay-anonymizer/Cargo.toml b/rust/replay-anonymizer/Cargo.tomlindex f7679717796c..044f75fde08f 100644--- a/rust/replay-anonymizer/Cargo.toml+++ b/rust/replay-anonymizer/Cargo.toml@@ -1,6 +1,6 @@[package]name = "posthog-replay-anonymizer"-version = "0.7.1"+version = "0.7.2"edition = "2021"description = "PII scrubber for rrweb session-replay events: text/URL redaction, native image blur, and canvas/cv neutralization"license = "MIT"diff --git a/rust/replay-anonymizer/src/collect.rs b/rust/replay-anonymizer/src/collect.rsindex 634a6468f960..b4f7b70aa552 100644--- a/rust/replay-anonymizer/src/collect.rs+++ b/rust/replay-anonymizer/src/collect.rs@@ -63,9 +63,9 @@ pub fn is_image_ref(s: &str) -> bool {/// have it copied verbatim into anonymized output. Limit preserved refs to a numeric team ID/// or legacy pseudonym and a fixed-width hash.pub fn is_image_ref_strict(s: &str) -> bool {- if let Some(rest) = s- .strip_prefix("image:v2:")- .or_else(|| s.strip_prefix("imageurl:v2:"))+ if let Some(rest) = ["image:v2:", "image:v3:", "imageurl:v2:", "imageurl:v3:"]+ .iter()+ .find_map(|prefix| s.strip_prefix(prefix)){let parts: Vec<&str> = rest.split(':').collect();return parts.len() == 3@@ -284,7 +284,7 @@ mod tests {#[test]fn ref_matches_consumer_shape() {let hash = hash_image_bytes(TEST_KEY, b"x");- for prefix in ["image:v2", "imageurl:v2"] {+ for prefix in ["image:v2", "imageurl:v2", "image:v3", "imageurl:v3"] {assert!(is_image_ref_strict(&format!("{prefix}:42:2026-09:{hash}")));for invalid in ["42:2026-13",diff --git a/rust/replay-anonymizer/src/url_collect.rs b/rust/replay-anonymizer/src/url_collect.rsindex 4bb6dcb37f3c..e12e5d993046 100644--- a/rust/replay-anonymizer/src/url_collect.rs+++ b/rust/replay-anonymizer/src/url_collect.rs@@ -51,7 +51,7 @@ pub const MAX_URLS_PER_MESSAGE: usize = 512;/// Enables URL collection for one anonymize call.#[derive(Debug, Clone)]pub struct UrlCollection {- /// Use `v2:<raw_team_id>:<YYYY-MM>` or a 32-character lowercase hexadecimal pseudonym. `None` produces global URL refs.+ /// Use `v2:<raw_team_id>:<YYYY-MM>`, `v3:<raw_team_id>:<YYYY-MM>` or a 32-character lowercase hexadecimal pseudonym. `None` produces global URL refs.pub reference_namespace: Option<String>,/// Global key for the URL HMAC. The caller derives it under a URL-specific domain separator.pub url_key: String,