: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
fix(experiments): open experiment recordings at the exposure (#98917)
Marcel Poelkerf492df0d3d98
diff --git a/frontend/src/scenes/session-recordings/player/PlayerFrameOverlay.tsx b/frontend/src/scenes/session-recordings/player/PlayerFrameOverlay.tsxindex 4d408b612527..44a308449081 100644--- a/frontend/src/scenes/session-recordings/player/PlayerFrameOverlay.tsx+++ b/frontend/src/scenes/session-recordings/player/PlayerFrameOverlay.tsx@@ -79,8 +79,15 @@ const RECOVERABLE_SNAPSHOT_ERRORS = []const PlayerFrameOverlayContent = (): JSX.Element | null => {- const { currentPlayerState, endReached, logicProps, playerError, isWaitingForIngestion, sessionPlayerMetaData } =- useValues(sessionRecordingPlayerLogic)+ const {+ currentPlayerState,+ endReached,+ logicProps,+ playerError,+ isWaitingForIngestion,+ sessionPlayerMetaData,+ matchingEventSkipTarget,+ } = useValues(sessionRecordingPlayerLogic)const { setPlay, retryLoadingSnapshots } = useActions(sessionRecordingPlayerLogic)const handlePlay = (e: MouseEvent): void => {@@ -214,7 +221,13 @@ const PlayerFrameOverlayContent = (): JSX.Element | null => {content = <div className="text-3xl italic font-medium text-white">Skipping inactivity</div>}if (currentPlayerState === SessionPlayerState.SKIP_TO_MATCHING_EVENT) {- content = <div className="text-3xl italic font-medium text-white">Skipping to filtered event</div>+ content = (+ <div className="text-3xl italic font-medium text-white">+ {matchingEventSkipTarget === 'experiment-exposure'+ ? 'Skipping to experiment exposure'+ : 'Skipping to filtered event'}+ </div>+ )}return content ? (<divdiff --git a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsxindex b3c593fc6293..6994e7a1e125 100644--- a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx+++ b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx@@ -48,6 +48,7 @@ export function SessionRecordingPlayer(props: SessionRecordingPlayerProps): JSX.onRecordingDeleted,playNextRecording,skipToFirstMatchingEvent,+ exposureSkipExperimentId,} = propsconst playerRef = useRef<HTMLDivElement>(null)@@ -69,6 +70,7 @@ export function SessionRecordingPlayer(props: SessionRecordingPlayerProps): JSX.onRecordingDeleted,playNextRecording,skipToFirstMatchingEvent,+ exposureSkipExperimentId,}return (diff --git a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.test.ts b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.test.tsindex cbb968a256de..f4d5131af5f1 100644--- a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.test.ts+++ b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.test.ts@@ -17,6 +17,7 @@ import { DEFAULT_RECORDING_FILTERS } from 'scenes/session-recordings/playlist/seimport { useMocks } from '~/mocks/jest'import { RRWebRecordingConsoleLogPayload, SessionRecordingType } from '~/types'+import { makeExperimentSessionContextItem } from '../../__mocks__/experiment_session_context'import { BLOB_SOURCE_V2, overrideSessionRecordingMocks, setupSessionRecordingTest } from '../__mocks__/test-setup'const playerLogicProps = { sessionRecordingId: '1', playerKey: 'playlist' }@@ -454,6 +455,187 @@ describe('playerInspectorLogic', () => {})})+ describe('experiment exposure skip', () => {+ // Each test uses a fresh session id, so its own experiment-context mock applies and the+ // default recording_meta mock resolves the window (14:46:20.877, 11s).+ const EXPERIMENT_ID = 777++ const useExperimentContextMock = (+ sessionRecordingId: string,+ firstExposureTimestamp: string,+ gate?: Promise<void>+ ): void => {+ useMocks({+ get: {+ '/api/projects/:team_id/experiments/session_context/': async () => {+ await gate+ return [+ 200,+ {+ session_id: sessionRecordingId,+ results: [+ makeExperimentSessionContextItem({+ experiment_id: EXPERIMENT_ID,+ first_exposure_timestamp: firstExposureTimestamp,+ }),+ ],+ },+ ]+ },+ },+ })+ }++ const mount = (+ props: PlayerInspectorLogicProps+ ): {+ playerLogic: ReturnType<typeof sessionRecordingPlayerLogic.build>+ inspectorLogic: ReturnType<typeof playerInspectorLogic.build>+ } => {+ const playerLogic = sessionRecordingPlayerLogic(props)+ const inspectorLogic = playerInspectorLogic(props)+ playerLogic.mount()+ inspectorLogic.mount()+ return { playerLogic, inspectorLogic }+ }++ it('waits for the experiment context, then seeks to the exposure', async () => {+ // With no filtered events, skipping as soon as the recording is ready would find+ // nothing to seek to and use up the one-shot skip before the exposure is known.+ let releaseContext: () => void = () => {}+ const gate = new Promise<void>((resolve) => (releaseContext = resolve))+ useExperimentContextMock('exposure-wait', '2023-05-01T14:46:26.000Z', gate)++ const { playerLogic, inspectorLogic } = mount({+ sessionRecordingId: 'exposure-wait',+ playerKey: 'exposure-wait',+ exposureSkipExperimentId: EXPERIMENT_ID,+ matchingEventsMatchType: { matchType: 'none' },+ })++ await expectLogic(inspectorLogic).toDispatchActions([+ 'setSkipToFirstMatchingEvent',+ 'trySkipToFirstMatchingEvent',+ ])+ await expectLogic(playerLogic).toNotHaveDispatchedActions(['seekToTime'])++ releaseContext()+ await expectLogic(playerLogic).toDispatchActions([+ playerLogic.actionCreators.setSkippingToMatchingEvent(true, 'experiment-exposure'),+ playerLogic.actionCreators.seekToTime(5000),+ ])++ inspectorLogic.unmount()+ playerLogic.unmount()+ })++ it.each([+ ['a filtered event comes before the exposure', '2023-05-01T14:46:23.000Z', 2000],+ ['the exposure comes before a filtered event', '2023-05-01T14:46:29.000Z', 5000],+ ])('seeks to the earlier moment when %s', async (_label, filteredEventTimestamp, expectedSeekMs) => {+ const sessionRecordingId = `exposure-earliest-${expectedSeekMs}`+ useExperimentContextMock(sessionRecordingId, '2023-05-01T14:46:26.000Z')++ const { playerLogic, inspectorLogic } = mount({+ sessionRecordingId,+ playerKey: sessionRecordingId,+ exposureSkipExperimentId: EXPERIMENT_ID,+ matchingEventsMatchType: {+ matchType: 'uuid',+ matchedEvents: [{ uuid: 'filtered-event', timestamp: filteredEventTimestamp as string }],+ },+ })++ await expectLogic(playerLogic).toDispatchActions([+ playerLogic.actionCreators.seekToTime(expectedSeekMs as number),+ ])++ inspectorLogic.unmount()+ playerLogic.unmount()+ })++ it('waits for matching events that reload while the experiment context loads', async () => {+ let releaseContext: () => void = () => {}+ const contextGate = new Promise<void>((resolve) => (releaseContext = resolve))+ useExperimentContextMock('exposure-reload', '2023-05-01T14:46:26.000Z', contextGate)+ let releaseMatchingEvents: () => void = () => {}+ const matchingEventsGate = new Promise<void>((resolve) => (releaseMatchingEvents = resolve))+ useMocks({+ get: {+ '/api/environments/:team_id/session_recordings/matching_events': async () => {+ await matchingEventsGate+ return [200, { results: [{ uuid: 'current-event', timestamp: '2023-05-01T14:46:29.000Z' }] }]+ },+ },+ })++ const props: PlayerInspectorLogicProps = {+ sessionRecordingId: 'exposure-reload',+ playerKey: 'exposure-reload',+ exposureSkipExperimentId: EXPERIMENT_ID,+ matchingEventsMatchType: {+ matchType: 'uuid',+ matchedEvents: [{ uuid: 'previous-event', timestamp: '2023-05-01T14:46:23.000Z' }],+ },+ }+ const { playerLogic, inspectorLogic } = mount(props)+ await expectLogic(inspectorLogic).toDispatchActions([+ 'setSkipToFirstMatchingEvent',+ 'trySkipToFirstMatchingEvent',+ ])++ // What propsChanged receives when the playlist filters change under the recording+ playerInspectorLogic({+ ...props,+ matchingEventsMatchType: { matchType: 'backend', filters: DEFAULT_RECORDING_FILTERS },+ })+ await expectLogic(inspectorLogic).toDispatchActions(['loadMatchingEvents'])++ releaseContext()+ await expectLogic(inspectorLogic).toDispatchActions([+ 'loadExperimentContextSuccess',+ 'trySkipToFirstMatchingEvent',+ ])+ await expectLogic(playerLogic).toNotHaveDispatchedActions(['seekToTime'])++ releaseMatchingEvents()+ await expectLogic(playerLogic).toDispatchActions([playerLogic.actionCreators.seekToTime(5000)])++ inspectorLogic.unmount()+ playerLogic.unmount()+ })++ it('ignores exposures when the player is not opened from an experiment list', async () => {+ // The replay page, notebooks and the other embeds must keep starting at the beginning.+ let releaseContext: () => void = () => {}+ const gate = new Promise<void>((resolve) => (releaseContext = resolve))+ useExperimentContextMock('exposure-no-target', '2023-05-01T14:46:26.000Z', gate)++ const { playerLogic, inspectorLogic } = mount({+ sessionRecordingId: 'exposure-no-target',+ playerKey: 'exposure-no-target',+ matchingEventsMatchType: { matchType: 'none' },+ })++ await expectLogic(inspectorLogic).toDispatchActions([+ 'setSkipToFirstMatchingEvent',+ 'trySkipToFirstMatchingEvent',+ ])++ releaseContext()+ // The skip seeks synchronously inside this trySkipToFirstMatchingEvent, so a seek that+ // was going to happen has happened by the time the action is matched.+ await expectLogic(inspectorLogic).toDispatchActions([+ 'loadExperimentContextSuccess',+ 'trySkipToFirstMatchingEvent',+ ])+ await expectLogic(playerLogic).toNotHaveDispatchedActions(['seekToTime'])++ inspectorLogic.unmount()+ playerLogic.unmount()+ })+ })+describe('experiment variant markers', () => {it('synthesizes one marker per context item with a first-exposure timestamp', async () => {const contextLogic = sessionRecordingExperimentContextLogic({ sessionRecordingId: '1' })diff --git a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.tsindex 715bb45d2cab..38b149daa3d1 100644--- a/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts+++ b/frontend/src/scenes/session-recordings/player/inspector/playerInspectorLogic.ts@@ -61,13 +61,17 @@ import {RecordingEventType,} from '~/types'-import type { ExperimentSessionContextItemApi } from '../../../../../../products/experiments/frontend/generated/api.schemas'+import type {+ ExperimentSessionContextItemApi,+ ExperimentSessionContextResponseApi,+} from '../../../../../../products/experiments/frontend/generated/api.schemas'import type { FeatureFlagsSet } from '../../../../lib/logic/featureFlagLogic'import type { RecordingSegment, SessionPlayerData, SessionRecordingType } from '../../../../types'import { sessionRecordingExperimentContextLogic } from '../player-meta/sessionRecordingExperimentContextLogic'import { sessionRecordingDataCoordinatorLogic } from '../sessionRecordingDataCoordinatorLogic'import {DoctorDiagnostics,+ MatchingEventSkipTarget,SessionRecordingPlayerLogicProps,sessionRecordingPlayerLogic,} from '../sessionRecordingPlayerLogic'@@ -432,6 +436,7 @@ export interface playerInspectorLogicValues {uuidToIndex: Record<string, number> // sessionRecordingDataCoordinatorLogicwindowIdForTimestamp: (timestamp: number) => number | undefined // sessionRecordingDataCoordinatorLogicwindowIds: number[] // sessionRecordingDataCoordinatorLogic+ experimentContextSettled: boolean // sessionRecordingExperimentContextLogicexperimentItems: ExperimentSessionContextItemApi[] // sessionRecordingExperimentContextLogiccurrentPlayerTime: number // sessionRecordingPlayerLogiccurrentTimestamp: number | undefined // sessionRecordingPlayerLogic@@ -462,6 +467,7 @@ export interface playerInspectorLogicValues {items: InspectorListItem[]matchingEvents: MatchedRecordingEvent[] | nullmatchingEventsLoading: boolean+ matchingEventsSettled: booleanmetricEventItems: InspectorListItemMetricEvent[]notebookCommentItems: InspectorListItemNotebookComment[]playbackIndicatorIndex: number@@ -575,6 +581,20 @@ export interface playerInspectorLogicActions {| 'performance'| 'session-change'} // sessionRecordingEventUsageLogic+ loadExperimentContextFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ } // sessionRecordingExperimentContextLogic+ loadExperimentContextSuccess: (+ experimentContext: ExperimentSessionContextResponseApi | null,+ payload?: any+ ) => {+ experimentContext: ExperimentSessionContextResponseApi | null+ payload?: any+ } // sessionRecordingExperimentContextLogicseekToTime: (timeInMilliseconds: number,forcePlay?: boolean | undefined@@ -585,13 +605,17 @@ export interface playerInspectorLogicActions {setSkipToFirstMatchingEvent: (skipToFirstMatchingEvent: boolean) => {skipToFirstMatchingEvent: boolean} // sessionRecordingPlayerLogic- setSkippingToMatchingEvent: (isSkippingToMatchingEvent: boolean) => {+ setSkippingToMatchingEvent: (+ isSkippingToMatchingEvent: boolean,+ target?: MatchingEventSkipTarget | undefined+ ) => {isSkippingToMatchingEvent: boolean+ target: MatchingEventSkipTarget} // sessionRecordingPlayerLogicstartScrub: () => {value: true} // sessionRecordingPlayerLogic- loadMatchingEvents: () => any+ loadMatchingEvents: (_: void) => voidloadMatchingEventsFailure: (error: string,errorObject?: any@@ -601,10 +625,10 @@ export interface playerInspectorLogicActions {}loadMatchingEventsSuccess: (matchingEvents: MatchedRecordingEvent[] | null,- payload?: any+ payload?: void) => {matchingEvents: MatchedRecordingEvent[] | null- payload?: any+ payload?: void}markSkippedToFirstMatchingEvent: () => {value: true@@ -851,6 +875,8 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([['seekToTime', 'setSkippingToMatchingEvent', 'setSkipToFirstMatchingEvent', 'startScrub'],playerInspectorLogsLogic(props),['loadLogs', 'loadMoreLogs', 'markLogsInitialLoadRequested'],+ sessionRecordingExperimentContextLogic({ sessionRecordingId: props.sessionRecordingId }),+ ['loadExperimentContextSuccess', 'loadExperimentContextFailure'],],values: [miniFiltersLogic,@@ -889,7 +915,7 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([featureFlagLogic,['featureFlags'],sessionRecordingExperimentContextLogic({ sessionRecordingId: props.sessionRecordingId }),- ['experimentItems'],+ ['experimentItems', 'experimentContextSettled'],playerInspectorLogsLogic(props),['logs',@@ -943,12 +969,22 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([startScrub: () => true,},],+ // A failed load returns no events, so the loader's own value cannot tell "no matches" from+ // "not answered yet". The exposure skip waits for this answer before it picks a target.+ matchingEventsSettled: [+ false,+ {+ loadMatchingEvents: () => false,+ loadMatchingEventsSuccess: () => true,+ loadMatchingEventsFailure: () => true,+ },+ ],})),loaders(({ props }) => ({matchingEvents: [[] as MatchedRecordingEvent[] | null,{- loadMatchingEvents: async () => {+ loadMatchingEvents: async (_: void, breakpoint) => {const matchingEventsMatchType = props.matchingEventsMatchTypeconst matchType = matchingEventsMatchType?.matchTypeif (!matchingEventsMatchType || matchType === 'none' || matchType === 'name') {@@ -973,6 +1009,10 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([}const response = await api.recordings.getMatchingEvents(toParams(params))+ // kea-loaders still dispatches success for a superseded call. Drop this response+ // when a newer load started while it was in flight, so that it cannot overwrite+ // the newer events or settle the skip on the previous filters' events.+ breakpoint()return response.results},},@@ -2140,7 +2180,7 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([allItemsByItemType['events']?.length > 0,],})),- listeners(({ values, actions, cache }) => ({+ listeners(({ values, actions, cache, props }) => ({setItemExpanded: ({ index, expanded }) => {if (expanded) {const group = values.displayGroups[index]@@ -2171,6 +2211,15 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([loadMatchingEventsSuccess: () => {actions.trySkipToFirstMatchingEvent()},+ loadMatchingEventsFailure: () => {+ actions.trySkipToFirstMatchingEvent()+ },+ loadExperimentContextSuccess: () => {+ actions.trySkipToFirstMatchingEvent()+ },+ loadExperimentContextFailure: () => {+ actions.trySkipToFirstMatchingEvent()+ },loadRecordingMetaSuccess: () => {actions.trySkipToFirstMatchingEvent()},@@ -2188,27 +2237,55 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([actions.trySkipToFirstMatchingEvent()},trySkipToFirstMatchingEvent: () => {+ const exposureExperimentId = props.exposureSkipExperimentIdif (!values.skipToFirstMatchingEvent ||values.hasSkippedToFirstMatchingEvent ||!values.start ||- !values.matchingEvents?.length ||// seekToTime no-ops until the player has an initial timestamp — bail without// consuming the skip so a later trigger retries once the player is readyvalues.currentTimestamp == null) {return}+ // With an exposure target, wait for both sources so the earlier one wins. The skip+ // fires once, so acting on whichever source lands first would leave the playhead+ // past the other one.+ if (exposureExperimentId != null && (!values.experimentContextSettled || !values.matchingEventsSettled)) {+ return+ }++ const candidates: { timestamp: string; target: MatchingEventSkipTarget }[] = (+ values.matchingEvents ?? []+ ).map((event) => ({ timestamp: event.timestamp, target: 'filtered-event' }))+ const exposureTimestamp =+ exposureExperimentId != null+ ? values.experimentItems.find((item) => item.experiment_id === exposureExperimentId)+ ?.first_exposure_timestamp+ : null+ if (exposureTimestamp) {+ candidates.push({ timestamp: exposureTimestamp, target: 'experiment-exposure' })+ }+ if (!candidates.length) {+ // Without an exposure target a later matching-events load can still arm the skip.+ // With one, both sources have settled, so the empty verdict is final.+ if (exposureExperimentId != null) {+ actions.markSkippedToFirstMatchingEvent()+ }+ return+ }- const earliestMatchingEvent = values.matchingEvents.reduce((previous, current) =>- previous.timestamp < current.timestamp ? previous : current+ // Compared as parsed instants rather than as strings, because the two sources+ // serialize their timestamps in different shapes.+ const earliest = candidates.reduce((previous, current) =>+ dayjs(previous.timestamp).valueOf() <= dayjs(current.timestamp).valueOf() ? previous : current)- const { timestamp, timeInRecording } = timeRelativeToStart(earliestMatchingEvent, values.start)- // The matching-events query has slack around the recording window, so the earliest- // match can fall past the playable range — seeking there would pin the player to its- // final frame and immediately trigger end-reached (auto-advancing playlists). The- // verdict is terminal for this recording: consume the flag so a matching-events- // reload can't fire the skip mid-playback.+ const { timestamp, timeInRecording } = timeRelativeToStart(earliest, values.start)+ // The matching-events query has slack around the recording window, and the exposure can+ // come from a wider window still, so the earliest moment can fall past the playable+ // range — seeking there would pin the player to its final frame and immediately trigger+ // end-reached (auto-advancing playlists). The verdict is terminal for this recording:+ // consume the flag so a matching-events reload can't fire the skip mid-playback.if (values.end && timestamp.isAfter(values.end)) {actions.markSkippedToFirstMatchingEvent()return@@ -2217,7 +2294,7 @@ export const playerInspectorLogic = kea<playerInspectorLogicType>([actions.markSkippedToFirstMatchingEvent()if (seekTime > 1000) {- actions.setSkippingToMatchingEvent(true)+ actions.setSkippingToMatchingEvent(true, earliest.target)cache.disposables.add(() => {const timerId = setTimeout(() => actions.setSkippingToMatchingEvent(false), 1500)return () => clearTimeout(timerId)diff --git a/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingExperimentContextLogic.ts b/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingExperimentContextLogic.tsindex 6a8162d0a55a..45805863c340 100644--- a/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingExperimentContextLogic.ts+++ b/frontend/src/scenes/session-recordings/player/player-meta/sessionRecordingExperimentContextLogic.ts@@ -40,6 +40,7 @@ export interface sessionRecordingExperimentContextLogicValues {expandedExperimentIds: number[]experimentContext: ExperimentSessionContextResponseApi | nullexperimentContextLoading: boolean+ experimentContextSettled: booleanexperimentItems: ExperimentSessionContextItemApi[]hasExperimentContext: booleanhasMultipleVariantWarning: boolean@@ -116,6 +117,18 @@ export const sessionRecordingExperimentContextLogic = kea<sessionRecordingExperisetExperimentExpanded: (experimentId: number, expanded: boolean) => ({ experimentId, expanded }),}),reducers({+ // The loader answers a 404 with null, so `experimentContext === null` cannot tell "still+ // loading" from "loaded, nothing here". A consumer that must wait for the answer reads this+ // flag. It is a reducer rather than the success action, because the logic is keyed by+ // session id and other mounts (the sidebar, the meta tags) can settle it before a consumer+ // mounts, and then no success action arrives for that consumer to hear.+ experimentContextSettled: [+ false,+ {+ loadExperimentContextSuccess: () => true,+ loadExperimentContextFailure: () => true,+ },+ ],expandedExperimentIds: [[] as number[],{diff --git a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.tsindex efe0b4af9ca7..a86b68d0f1ab 100644--- a/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts+++ b/frontend/src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts@@ -169,8 +169,13 @@ export interface SessionRecordingPlayerLogicProps extends SessionRecordingDataCosetPinned?: (pinned: boolean) => voidplayNextRecording?: (automatic: boolean) => voidskipToFirstMatchingEvent?: boolean+ // The experiment whose recordings list the player was opened from. Its first in-session exposure+ // becomes a target for the initial skip, alongside any filtered events.+ exposureSkipExperimentId?: number}+export type MatchingEventSkipTarget = 'filtered-event' | 'experiment-exposure'+// Positions less than this far before the next FullSnapshot are treated as// renderable: recordings routinely start a few ms before their first// FullSnapshot (the recording start is min(event start, snapshot start)) and@@ -629,6 +634,7 @@ export interface sessionRecordingPlayerLogicValues {leadingUnplayableMs: numberlogicProps: SessionRecordingPlayerLogicPropsmaskingWindow: boolean+ matchingEventSkipTarget: MatchingEventSkipTargetpauseForced: booleanplayNextAnimationInterrupted: booleanplayNextRecording: ((automatic: boolean) => void) | undefined@@ -979,8 +985,12 @@ export interface sessionRecordingPlayerLogicActions {setSkippingInactivity: (isSkippingInactivity: boolean) => {isSkippingInactivity: boolean}- setSkippingToMatchingEvent: (isSkippingToMatchingEvent: boolean) => {+ setSkippingToMatchingEvent: (+ isSkippingToMatchingEvent: boolean,+ target?: MatchingEventSkipTarget+ ) => {isSkippingToMatchingEvent: boolean+ target: MatchingEventSkipTarget}setWasMarkedViewed: (wasMarkedViewed: boolean) => {wasMarkedViewed: boolean@@ -1247,7 +1257,10 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(clearPlayerError: true,retryLoadingSnapshots: true,setSkippingInactivity: (isSkippingInactivity: boolean) => ({ isSkippingInactivity }),- setSkippingToMatchingEvent: (isSkippingToMatchingEvent: boolean) => ({ isSkippingToMatchingEvent }),+ setSkippingToMatchingEvent: (+ isSkippingToMatchingEvent: boolean,+ target: MatchingEventSkipTarget = 'filtered-event'+ ) => ({ isSkippingToMatchingEvent, target }),syncPlayerSpeed: true,setCurrentTimestamp: (timestamp: number) => ({ timestamp }),setScale: (scale: number) => ({ scale }),@@ -1449,6 +1462,15 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(false,{ setSkippingToMatchingEvent: (_, { isSkippingToMatchingEvent }) => isSkippingToMatchingEvent },],+ // Held past the skip so the overlay keeps naming the right target while the skip animates.+ // Only a start carries a target; the matching stop leaves the last one in place.+ matchingEventSkipTarget: [+ 'filtered-event' as MatchingEventSkipTarget,+ {+ setSkippingToMatchingEvent: (state, { isSkippingToMatchingEvent, target }) =>+ isSkippingToMatchingEvent ? target : state,+ },+ ],scale: [1,{diff --git a/frontend/src/scenes/session-recordings/player/sidebar/PlayerSidebarExperimentsSection.tsx b/frontend/src/scenes/session-recordings/player/sidebar/PlayerSidebarExperimentsSection.tsxindex ec0ddc093297..698da8071a86 100644--- a/frontend/src/scenes/session-recordings/player/sidebar/PlayerSidebarExperimentsSection.tsx+++ b/frontend/src/scenes/session-recordings/player/sidebar/PlayerSidebarExperimentsSection.tsx@@ -343,7 +343,7 @@ function experimentIdFromPath(pathname: string): number | null {export function PlayerSidebarExperimentsSection(): JSX.Element | null {const { logicProps, sessionPlayerData } = useValues(sessionRecordingPlayerLogic)- const { seekToTimestamp } = useActions(sessionRecordingPlayerLogic)+ const { seekToTime } = useActions(sessionRecordingPlayerLogic)const experimentContextLogic = sessionRecordingExperimentContextLogic({sessionRecordingId: logicProps.sessionRecordingId,})@@ -399,6 +399,13 @@ export function PlayerSidebarExperimentsSection(): JSX.Element | null {}const recordingStartMs = sessionPlayerData?.start?.valueOf() ?? null+ // seekToTime rather than seekToTimestamp, because only seekToTime consumes a pending+ // auto-skip. A click made before that skip fires would otherwise be overridden by it.+ const seekToTimestamp = (timestampMs: number): void => {+ if (recordingStartMs != null) {+ seekToTime(timestampMs - recordingStartMs)+ }+ }const recordingEndMs =recordingStartMs != null && sessionPlayerData?.durationMs != null? recordingStartMs + sessionPlayerData.durationMsdiff --git a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsxindex 43a593b2b164..507165aa86d9 100644--- a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx+++ b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx@@ -167,6 +167,7 @@ function PlayerWrapper({filters,visiblePinnedRecordings: pinnedRecordings,matchingEventsMatchType,+ exposureSkipExperimentId,activeSessionRecording,allowHogQLFilters,totalFiltersCount,@@ -210,6 +211,7 @@ function PlayerWrapper({playerKey={props.logicKey ?? 'playlist'}sessionRecordingId={activeSessionRecording.id}matchingEventsMatchType={matchingEventsMatchType}+ exposureSkipExperimentId={exposureSkipExperimentId}autoPlay={props.autoPlay}onRecordingDeleted={() => {loadAllRecordings()diff --git a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.tsindex a2651f42ea6b..dd7202e79f82 100644--- a/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts+++ b/frontend/src/scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic.ts@@ -565,6 +565,7 @@ export interface sessionRecordingsPlaylistLogicValues {deleteConfirmationText: stringeventsHaveSessionId: Record<string, boolean>eventsHaveSessionIdLoading: boolean+ exposureSkipExperimentId: number | undefinedfilters: RecordingUniversalFiltershasNext: booleanhiddenRecordings: SessionRecordingType[]@@ -869,6 +870,7 @@ export interface sessionRecordingsPlaylistLogicMeta {__keaTypeGenInternalSelectorTypes: {logicProps: (arg: any) => SessionRecordingPlaylistLogicPropsallowEventPropertyExpansion: (featureFlags: FeatureFlagsSet) => boolean+ exposureSkipExperimentId: (filters: RecordingUniversalFilters) => number | undefinedmatchingEventsMatchType: (filters: RecordingUniversalFilters) => MatchingEventsMatchTypeactiveSessionRecordingId: (selectedRecordingId: string | null,@@ -1968,6 +1970,14 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic},],+ // The experiment this list is scoped to, if any. `experiment_exposure` is set by callers+ // (the experiment recordings tab) and is not editable in the filter UI, so its presence+ // means every recording in the list belongs to that experiment.+ exposureSkipExperimentId: [+ (s) => [s.filters],+ (filters: RecordingUniversalFilters): number | undefined => filters?.experiment_exposure?.experiment_id,+ ],+matchingEventsMatchType: [(s) => [s.filters],(filters: RecordingUniversalFilters): MatchingEventsMatchType => {