: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(replay-vision): drop cited timestamps from watch feed thumbnails (#109510)
Kim Svatos Dugande07d80d2f19
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.tsindex 350c636b811a..ed81c62d0ebb 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts@@ -1,5 +1,5 @@import type { ReplayObservationApi, WatchFeedReasonApi } from '../../generated/api.schemas'-import { observationClipRange, watchCardHeadline, watchReasonCopy } from './WatchFeedCard'+import { watchCardHeadline, watchReasonCopy } from './WatchFeedCard'describe('WatchFeedCard helpers', () => {describe('watchReasonCopy', () => {@@ -133,23 +133,6 @@ describe('WatchFeedCard helpers', () => {scanner_result: { model_output: output },}) as unknown as ReplayObservationApi- describe('observationClipRange', () => {- it('reads the summary citation when the snapshot type is summarizer, even if the result omits scanner_type', () => {- const range = observationClipRange(- observation('summarizer', {- summary: 'Wrapped up (t 30) cleanly.',- reasoning: 'Debugged (t 90) at length.',- })- )- expect(range).toEqual({ startMs: 30_000, endMs: 30_000 })- })-- it('reads the reasoning citation for a non-summarizer type', () => {- const range = observationClipRange(observation('monitor', { reasoning: 'Retried (t 45) twice.' }))- expect(range).toEqual({ startMs: 45_000, endMs: 45_000 })- })- })-describe('watchCardHeadline', () => {it.each<{name: stringdiff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsxindex 222c8cd9ead5..eb6cfdd257a7 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx@@ -6,7 +6,6 @@ import { LemonButton, Link, Tooltip } from '@posthog/lemon-ui'import { TZLabel } from 'lib/components/TZLabel'import posthog from 'lib/posthog-typed'-import { colonDelimitedDuration } from 'lib/utils/durations'import { sessionPlayerModalLogic } from 'scenes/session-recordings/player/modal/sessionPlayerModalLogic'import { urls } from 'scenes/urls'@@ -16,7 +15,7 @@ import { ScannerTypeBadge } from '../../components/ScannerTypeBadge'import { UnviewedObservationTag } from '../../components/UnviewedObservationTag'import type { ReplayObservationApi, WatchFeedItemApi, WatchFeedReasonApi } from '../../generated/api.schemas'import { OBSERVATION_ORIGIN_PARAM, WATCH_FEED_ORIGIN } from '../../utils/breadcrumbs'-import { citedTextToPlainText, citedTimestampRange } from '../../utils/citations'+import { citedTextToPlainText } from '../../utils/citations'import { ScannerType } from '../types'const roundScore = (value: number): number => Math.round(value * 100) / 100@@ -138,22 +137,6 @@ export function watchReasonCopy(reason: WatchFeedReasonApi): string {}}-/** The moment span the observation cites, read from the type's cited field. */-export function observationClipRange(observation: ReplayObservationApi): { startMs: number; endMs: number } | null {- const result = readResult(observation)- if (!result) {- return null- }- const scannerType =- (observation.scanner_snapshot?.scanner_type as ScannerType | undefined) ??- (result.scanner_type as ScannerType | undefined)- const [text, segments] =- scannerType === 'summarizer'- ? [result.summary, result.summary_segments]- : [result.reasoning, result.reasoning_segments]- return typeof text === 'string' ? citedTimestampRange(text, segments) : null-}-/*** The card's bold headline, plus the prose that follows it. A summarizer authored a title, so its* summary rides along whole (with citation chips). Otherwise the first sentence of the prose the@@ -207,9 +190,8 @@ interface WatchFeedCardProps {export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Element {const { observation, reason } = itemconst { openSessionPlayer } = useActions(sessionPlayerModalLogic)- const clip = observationClipRange(observation)const result = readResult(observation)- // Fall back to the result's own scanner_type when the snapshot is absent, like observationClipRange,+ // Fall back to the result's own scanner_type when the snapshot is absent, like watchCardHeadline,// so a scan with no snapshot still places its outcome in the right spot.const scannerType =(observation.scanner_snapshot?.scanner_type as ScannerType | undefined) ??@@ -217,14 +199,10 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Elemeconst scannerName = (observation.scanner_snapshot?.name as string | undefined) || '(untitled scanner)'const person = observation.recording_subject_email || observation.distinct_idconst headline = watchCardHeadline(observation)- const clipDuration =- clip && clip.endMs > clip.startMs- ? colonDelimitedDuration(Math.ceil((clip.endMs - clip.startMs) / 1000), null)- : null- // t=0 when nothing is cited, so the observation page still opens with the player expanded. `from`- // marks the feed as the origin, so the observation's back button returns here rather than the scanner.+ // t=0 so the observation page opens with the player expanded. `from` marks the feed as the origin,+ // so the observation's back button returns here rather than the scanner.const observationUrl = combineUrl(urls.replayVisionObservation(observation.id), {- t: clip ? Math.floor(clip.startMs / 1000) : 0,+ t: 0,[OBSERVATION_ORIGIN_PARAM]: WATCH_FEED_ORIGIN,}).urlconst capture = (target: 'clip_modal' | 'observation'): void => {@@ -239,15 +217,10 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme}const watchClipInModal = (): void => {capture('clip_modal')- // The modal's own `initialTimestamp` is an absolute unix-ms time, but a clip start is an- // offset into the recording. The player reads `?t=<seconds>` as an offset on first load and- // the modal preserves existing search params, so set (or clear) `t` before opening.+ // The player reads `?t=<seconds>` as an offset on first load and the modal preserves existing+ // search params, so clear any stale `t` to start the clip from the beginning.const { location, searchParams, hashParams } = router.values- router.actions.replace(- location.pathname,- { ...searchParams, t: clip ? Math.floor(clip.startMs / 1000) : undefined },- hashParams- )+ router.actions.replace(location.pathname, { ...searchParams, t: undefined }, hashParams)openSessionPlayer({ id: observation.session_id })}@@ -258,7 +231,7 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme>{!observation.viewed && <span className="absolute inset-y-0 left-0 w-1 rounded-l bg-accent" aria-hidden />}{/* The thumbnail is the watch affordance, so the whole poster opens the clip modal.- The New tag and the duration sit outside the poster, which clips its own overflow. */}+ The New tag sits outside the poster, which clips its own overflow. */}<div className="relative hidden @md:block w-64 shrink-0 self-start"><buttontype="button"@@ -270,15 +243,9 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme<ObservationThumbnail observation={observation}><span className="flex items-center gap-1.5 rounded-full bg-black/70 px-3 py-1 text-xs font-semibold text-white"><IconPlayFilled aria-hidden />- {clipDuration ? `Watch ${clipDuration}` : 'Watch clip'}+ Watch clip</span></ObservationThumbnail>- {clip && (- <span className="absolute bottom-1 right-1 text-xs tabular-nums bg-bg-light border rounded px-1">- {colonDelimitedDuration(Math.floor(clip.startMs / 1000), null)} to{' '}- {colonDelimitedDuration(Math.floor(clip.endMs / 1000), null)}- </span>- )}</button>{/* Sits above the button, so it lets clicks through to open the clip. */}{!observation.viewed && (@@ -287,8 +254,8 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme</div><div className="flex-1 min-w-0 flex flex-col gap-1.5">{/* Stretched to cover the card: clicking anywhere opens the observation with the- player expanded at the first cited moment. Inner links and the thumbnail button- sit above it via `relative z-10`, so the anchors never nest. */}+ player expanded. Inner links and the thumbnail button sit above it via+ `relative z-10`, so the anchors never nest. */}<Linkto={observationUrl}onClick={() => capture('observation')}diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.tsindex e95ca42195c2..e7ebe356a360 100644--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts@@ -327,7 +327,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([...(items.length === 0 ? { empty_reason: values.emptyReason ?? 'unresolved' } : {}),})},- // A card writes `?t=<seconds>` so the player opens at the cited moment; clear it on close so a+ // The player reads `?t=<seconds>` as its start offset; clear it on close so a// link copied afterwards doesn't seek a recording the user is no longer looking at.[sessionPlayerModalLogic.actionTypes.closeSessionPlayer]: () => {const { location, searchParams, hashParams } = router.values