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(replay): replace the summary dock with observation tab (#116052)

Hayne Ryu3de10cb063c7
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index aea4fb14f6fb..39af4da79b32 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -8458,14 +8458,6 @@ snapshots:
hash: v1.k794b7964.b8136fc7ff4b2794158921d793938bdd536bccbc0a66eeadf2d988386e27a2f0.5BXQa3xxRK-9zihaQbWZ4rHtM0lmb0uFKZaNcLbKiX8
replay-vision-cited-markdown--structured--light:
hash: v1.k794b7964.380bf20693c1029dce9ff64afc117eb5fd831449e81d541f4463ade2ec32b1e0.BBhrMSTk8RqH29BEuHYQeMRRlEos0ZQxgB1wPgvSMxQ
- replay-vision-observation-dock-card--monitor--dark:
- hash: v1.k794b7964.f5a7389165d89dbee30ee4f70b8402b7f4e2ba6399c4e1e24e5d506547093333.z-tVsiwO9nXXQh6YqnuCAe_czYCO3rNnWXIUR_USTpQ
- replay-vision-observation-dock-card--monitor--light:
- hash: v1.k794b7964.9ddb0bdb67069c2d8a260526493754585534ccb2baa324a4641f93830c5f8cc9.lciK3xITvCY7qzXgcz8Jzced9npaI5Zz6K9Ad2lgaY4
- replay-vision-observation-dock-card--monitor-scanned-with-an-older-prompt--dark:
- hash: v1.k794b7964.003151ca6fc67a011d60e2d6a8b35df6c9f1f575dd77cb9ea3e9020246d8c2ea.wxp_n4fCAywYLMn5j1UV81ahqaYTGZga2dBXfxXj4yI
- replay-vision-observation-dock-card--monitor-scanned-with-an-older-prompt--light:
- hash: v1.k794b7964.bbf23d6c5d0f02652f6d1e72c5584c6c26dc611d246b705c026dc7680eb88d4a.x-jjMPuldwNg6lVLxK8sbn_mygm62JkokyBM7GDl-qE
scenes-app-ai-observability-byok-model-picker-notice--models-failed-to-load--dark:
hash: v1.k794b7964.98bc8845e3e3f75e30cea176370096d4884ac4fd2d417624d7434f9ab9095d3d.COcAr1UABcQuIecfReyvt_gM2Wyc99yzD_Ixd6wkZUY
scenes-app-ai-observability-byok-model-picker-notice--models-failed-to-load--light:
@@ -13619,9 +13611,9 @@ snapshots:
scenes-app-replay-vision-observations-tab-in-the-player--scans-without-a-summary--light:
hash: v1.k794b7964.f03d17836d474260696ee9b0dbe75e4dbc1637ac37fe8a830081b4cd95e060f0.SVWM3NTyYoqlXNqZf39SUAs6dfdOatK1ucfwRJibnZ8
scenes-app-replay-vision-observations-tab-in-the-player--timeline-with-scans--dark:
- hash: v1.k794b7964.97c9e49a8217962497ffbda5c004cd0069b5a115a98872f724c85446c5d568a4.SSD4MfAskMOFmj6XeCTXbuLxFlgMory8Ws6NPJzNaVI
+ hash: v1.k794b7964.2f3ba76b8203e65e190fc2323f639035846f398775e8cf6b8111627c649c58d5.y5aUwxwHDAURTt0LB7lT69yksI2CXFjVpglkIiDSLoc
scenes-app-replay-vision-observations-tab-in-the-player--timeline-with-scans--light:
- hash: v1.k794b7964.f93b12b8e199f41e6df50dc5767d59d421673be2b4d271ab241441d8e0f97002.vEx84C0WijEvCk_qb1GPjKWdZ2_PvW90ykJttEPbYXM
+ hash: v1.k794b7964.70255654bc0206bc255e221b4c2b4005a4def155fb430239116a2f48c0ede321.b7yeyRMrtCRRrhIKktjGl7s_stw-uCvdAeQ2Wj--RRw
scenes-app-replay-vision-observationthumbnail--frame--dark:
hash: v1.k794b7964.25e0fc3a30206636572afe40dc1dece511909b329125acdd76d5cd6b70e4cebd.vUNWqzn2OcfR4oaaUWZaXz4aKxivNKx8scF34tw7JEE
scenes-app-replay-vision-observationthumbnail--frame--light:
diff --git a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx
index abdf8280a0db..36abda76a3bf 100644
--- a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx
+++ b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx
@@ -9,7 +9,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { MatchingEventsMatchType } from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'
import { userLogic } from 'scenes/userLogic'
-import { ObservationsDock } from 'products/replay_vision/frontend/components/ObservationsDock'
+import { SummarizeRecordingBar } from 'products/replay_vision/frontend/components/SummarizeRecordingBar'
import { visionSurfaceShown } from 'products/replay_vision/frontend/utils/visionSurface'
import { DebugReplayButton } from './player-meta/DebugReplayButton'
@@ -115,7 +115,7 @@ function SessionRecordingPlayerInternal({
<div className="relative flex flex-col flex-1 min-w-0 min-h-0">
<PurePlayer noMeta={noMeta} noBorder={noBorder} />
{visionSurfaceShown(logicProps) && (
- <ObservationsDock
+ <SummarizeRecordingBar
// The player modal covers the side panel, so the conversation would open out of sight.
extraActions={
showDebugReplayButton && logicProps.playerKey !== 'modal' ? <DebugReplayButton /> : null
diff --git a/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.test.ts b/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.test.ts
index 232b4b321e89..54a2f2230d55 100644
--- a/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.test.ts
+++ b/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.test.ts
@@ -22,14 +22,20 @@ describe('playerSidebarLogic', () => {
logic.actions.setDefaultTab(SessionRecordingSidebarTab.OVERVIEW)
}).toMatchValues({ activeTab: SessionRecordingSidebarTab.OVERVIEW })
+ await expectLogic(logic, () => {
+ logic.actions.setAutoTab(SessionRecordingSidebarTab.OBSERVATIONS)
+ }).toMatchValues({ activeTab: SessionRecordingSidebarTab.OBSERVATIONS })
+
await expectLogic(logic, () => {
logic.actions.setTab(SessionRecordingSidebarTab.NETWORK_WATERFALL)
}).toMatchValues({ activeTab: SessionRecordingSidebarTab.NETWORK_WATERFALL })
// Hosts re-announce their default on every remount, so a default arriving after a pick must
// not drag the viewer off the tab they're on.
+
await expectLogic(logic, () => {
logic.actions.setDefaultTab(SessionRecordingSidebarTab.OVERVIEW)
+ logic.actions.setAutoTab(SessionRecordingSidebarTab.OBSERVATIONS)
}).toMatchValues({ activeTab: SessionRecordingSidebarTab.NETWORK_WATERFALL })
})
diff --git a/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.ts b/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.ts
index 182ffa39fe03..36964d929e93 100644
--- a/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/sidebar/playerSidebarLogic.ts
@@ -16,6 +16,7 @@ const asSidebarTab = (value: unknown): SessionRecordingSidebarTab | null =>
export interface playerSidebarLogicValues {
pinnedProperties: string[] // sessionRecordingPinnedPropertiesLogic
activeTab: SessionRecordingSidebarTab
+ autoTab: SessionRecordingSidebarTab | null
defaultTab: SessionRecordingSidebarTab
overviewTab: OverviewTab
selectedTab: SessionRecordingSidebarTab | null
@@ -23,6 +24,9 @@ export interface playerSidebarLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface playerSidebarLogicActions {
+ setAutoTab: (tab: SessionRecordingSidebarTab | null) => {
+ tab: SessionRecordingSidebarTab | null
+ }
setDefaultTab: (tab: SessionRecordingSidebarTab) => {
tab: SessionRecordingSidebarTab
}
@@ -39,6 +43,7 @@ export interface playerSidebarLogicMeta {
__keaTypeGenInternalSelectorTypes: {
activeTab: (
selectedTab: SessionRecordingSidebarTab | null,
+ autoTab: SessionRecordingSidebarTab | null,
defaultTab: SessionRecordingSidebarTab
) => SessionRecordingSidebarTab
}
@@ -60,6 +65,7 @@ export const playerSidebarLogic = kea<playerSidebarLogicType>([
actions(() => ({
setTab: (tab: SessionRecordingSidebarTab) => ({ tab }),
setDefaultTab: (tab: SessionRecordingSidebarTab) => ({ tab }),
+ setAutoTab: (tab: SessionRecordingSidebarTab | null) => ({ tab }),
setOverviewTab: (tab: OverviewTab) => ({ tab }),
})),
@@ -73,17 +79,19 @@ export const playerSidebarLogic = kea<playerSidebarLogicType>([
SessionRecordingSidebarTab.INSPECTOR as SessionRecordingSidebarTab,
{ setDefaultTab: (_, { tab }) => tab },
],
+ autoTab: [null as SessionRecordingSidebarTab | null, { setAutoTab: (_, { tab }) => tab }],
// Persisted so the chosen Overview group carries over between recordings.
overviewTab: ['session' as OverviewTab, { persist: true }, { setOverviewTab: (_, { tab }) => tab }],
})),
selectors({
activeTab: [
- (s) => [s.selectedTab, s.defaultTab],
+ (s) => [s.selectedTab, s.autoTab, s.defaultTab],
(
selectedTab: SessionRecordingSidebarTab | null,
+ autoTab: SessionRecordingSidebarTab | null,
defaultTab: SessionRecordingSidebarTab
- ): SessionRecordingSidebarTab => selectedTab ?? defaultTab,
+ ): SessionRecordingSidebarTab => selectedTab ?? autoTab ?? defaultTab,
],
}),
diff --git a/products/replay_vision/README.md b/products/replay_vision/README.md
index c32ec04683bd..c58b739a15e1 100644
--- a/products/replay_vision/README.md
+++ b/products/replay_vision/README.md
@@ -51,7 +51,7 @@ A scanner can also carry its own optional `credit_limit` for the same period, so
Observations have their own scene under `/replay-vision/observations/…`.
An observation link carries the player's `?t=<seconds>` param, so a shared observation opens with its recording expanded and playing from the shared moment.
-Outside these scenes, the product also renders inside the session replay player: `ObservationsDock` shows what the team's scanners found about the recording being watched (standard players only — embedded, shared, and chromeless players skip every vision surface).
+Outside these scenes, the product also renders inside the session replay player: `SummarizeRecordingBar` under the player starts a summary, and the sidebar's Observations tab shows what the team's scanners found about the recording being watched. Summarizing switches the sidebar to that tab, and a recording that already has a summary lands there until the viewer picks another tab (standard players only — embedded, shared, and chromeless players skip every vision surface).
## Experiment-created scanners
diff --git a/products/replay_vision/frontend/components/ObservationCard.test.tsx b/products/replay_vision/frontend/components/ObservationCard.test.tsx
deleted file mode 100644
index 7d0ee0fbea46..000000000000
--- a/products/replay_vision/frontend/components/ObservationCard.test.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import { render, screen, waitFor } from '@testing-library/react'
-import { router } from 'kea-router'
-
-import { useMocks } from '~/mocks/jest'
-import { initKeaTests } from '~/test/init'
-
-import type { ReplayObservationApi } from '../generated/api.schemas'
-import { ObservationDockCard } from './ObservationCard'
-
-// A summary's observation belongs to an inline scanner, which the scanner viewset excludes. Fetching
-// one 404s, and replayScannerLogic answers a load failure by replacing the route with /replay-vision,
-// so a card that loads its scanner throws the user off the recording they are watching.
-describe('ObservationDockCard', () => {
- let scannerRetrieveCalls: number
-
- const observation = {
- id: 'obs-1',
- scanner_id: 'inline-scanner-1',
- session_id: 'sess-1',
- status: 'succeeded',
- scanner_snapshot: { name: '', scanner_type: 'summarizer' },
- scanner_result: { model_output: { scanner_type: 'summarizer', title: 'Checkout', summary: 'Bought a hat.' } },
- } as unknown as ReplayObservationApi
-
- beforeEach(() => {
- scannerRetrieveCalls = 0
- useMocks({
- get: {
- '/api/projects/:team/vision/scanners/:id/': () => {
- scannerRetrieveCalls += 1
- return [404, { detail: 'Not found.' }]
- },
- },
- })
- initKeaTests()
- router.actions.push('/replay/sess-1')
- })
-
- it('renders a summary without navigating away from the recording', async () => {
- const startPath = router.values.location.pathname
-
- render(<ObservationDockCard observation={observation} />)
-
- // findByText rejects if the summary never renders, so this is the assertion.
- await screen.findByText('Bought a hat.')
-
- // The redirect is what the user sees, so assert the route rather than only the request count.
- // Both need a flush: the fetch and the resulting replace are async.
- await waitFor(() => expect(scannerRetrieveCalls).toBe(0))
- expect(router.values.location.pathname).toBe(startPath)
- })
-
- // A monitor verdict is meaningless without its question, so the prompt must stay on the card and not
- // hide behind the details page.
- it('shows the prompt beside a monitor verdict', async () => {
- const monitor = {
- id: 'obs-2',
- scanner_id: 'inline-scanner-2',
- session_id: 'sess-1',
- status: 'succeeded',
- scanner_snapshot: {
- name: '',
- scanner_type: 'monitor',
- scanner_config: { prompt: 'Did the user complete checkout?' },
- },
- scanner_result: { model_output: { scanner_type: 'monitor', verdict: 'yes' } },
- } as unknown as ReplayObservationApi
-
- render(<ObservationDockCard observation={monitor} />)
-
- await screen.findByText('Did the user complete checkout?')
- })
-})
diff --git a/products/replay_vision/frontend/components/ObservationCard.tsx b/products/replay_vision/frontend/components/ObservationCard.tsx
index be67c03e6564..47a88b001739 100644
--- a/products/replay_vision/frontend/components/ObservationCard.tsx
+++ b/products/replay_vision/frontend/components/ObservationCard.tsx
@@ -1,5 +1,5 @@
import { IconCopy, IconSparkles } from '@posthog/icons'
-import { LemonButton, LemonTag, Link, Spinner, Tooltip } from '@posthog/lemon-ui'
+import { LemonButton, LemonTag, Spinner, Tooltip } from '@posthog/lemon-ui'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
@@ -7,23 +7,15 @@ import type { ReplayObservationApi } from '../generated/api.schemas'
import {
type ClassifierScannerConfig,
type ScorerScannerConfig,
- SUCCEEDED_OUTPUT_LABEL,
configFromSnapshot,
failureKindDescription,
ineligibleKindDescription,
parseFailureReason,
parseIneligibleReason,
} from '../replay_scanners/types'
-import { markSimilarSearchIntent, similarSearchUrl } from '../search/observationQueries'
-import { RECORDING_ORIGIN, observationFromOriginUrl } from '../utils/breadcrumbs'
import { citedTextToPlainText, parseCitedSegments } from '../utils/citations'
-import { VERDICT_LABEL, confidenceLevel, isSummaryScannerType, readReasoning, scannerLabel } from '../utils/observation'
-import { CitedMarkdown } from './CitedMarkdown'
+import { VERDICT_LABEL, confidenceLevel, isSummaryScannerType, readReasoning } from '../utils/observation'
import { LabeledRow } from './LabeledRow'
-import { ObservationProgressBar } from './ObservationProgressBar'
-import { ObservationPrompt } from './ObservationPrompt'
-import { ObservationRetryButton } from './ObservationRetryButton'
-import { ScannerTypeBadge } from './ScannerTypeBadge'
import { TimestampCitation } from './TimestampCitation'
export function ObservationStatusTag({
@@ -389,124 +381,3 @@ export function IneligibleDetail({ errorReason }: { errorReason: string }): JSX.
</div>
)
}
-
-export function ObservationDockCard({
- observation,
- onSeek,
- onRetry,
- retrying = false,
- returnPath,
-}: {
- observation: ReplayObservationApi
- onSeek?: (timestampMs: number) => void
- onRetry?: () => void
- retrying?: boolean
- /** The page the player is on, so the observation's back button returns to it. */
- returnPath?: string
-}): JSX.Element {
- const snapshot = observation.scanner_snapshot
- const scannerType = snapshot?.scanner_type
- const result = readResult(observation)
- // The prompt is the question the scan judged, so it gives the verdict its meaning. Show it inline here so a
- // reader does not have to open the details page to know what "Yes" answered.
- const prompt = snapshot ? (configFromSnapshot(snapshot)?.prompt ?? null) : null
- const similarUrl = observation.status === 'succeeded' ? similarSearchUrl(observation) : null
- // Summarizers excluded: their primary output already is the full text
- const reasoning =
- observation.status === 'succeeded' && !isSummaryScannerType(scannerType) ? readReasoning(observation) : null
-
- return (
- <div className="border rounded p-3 bg-surface-primary space-y-2">
- <div className="flex items-center justify-between gap-2">
- <div className="flex items-center gap-2 min-w-0">
- {observation.status !== 'succeeded' && (
- <ObservationStatusTag status={observation.status} errorReason={observation.error_reason} />
- )}
- <span className="font-semibold text-sm truncate">{scannerLabel(observation)}</span>
- {scannerType && (
- <span className="shrink-0">
- <ScannerTypeBadge scannerType={scannerType} size="small" />
- </span>
- )}
- </div>
- <div className="flex items-center gap-2 shrink-0">
- {observation.status === 'succeeded' && result && <ObservationConfidence result={result} />}
- <Link
- data-attr="vision-observation-open"
- to={observationFromOriginUrl(observation.id, RECORDING_ORIGIN, returnPath)}
- className="text-xs whitespace-nowrap"
- >
- View details
- </Link>
- {similarUrl && (
- <Link
- to={similarUrl}
- onClick={() => markSimilarSearchIntent(observation)}
- className="text-xs whitespace-nowrap"
- data-attr="vision-dock-find-similar"
- >
- Find similar
- </Link>
- )}
- </div>
- </div>
-
- {observation.status === 'failed' && observation.error_reason && (
- <div className="space-y-2">
- <FailureDetail errorReason={observation.error_reason} />
- {onRetry && (
- <ObservationRetryButton
- status={observation.status}
- errorReason={observation.error_reason}
- onRetry={onRetry}
- loading={retrying}
- dataAttr="vision-dock-retry-observation"
- />
- )}
- </div>
- )}
-
- {observation.status === 'ineligible' && observation.error_reason && (
- <div className="space-y-2">
- <IneligibleDetail errorReason={observation.error_reason} />
- {onRetry && (
- <ObservationRetryButton
- status={observation.status}
- errorReason={observation.error_reason}
- onRetry={onRetry}
- loading={retrying}
- dataAttr="vision-dock-retry-observation"
- />
- )}
- </div>
- )}
-
- {observation.status === 'succeeded' && snapshot && result && (
- <>
- <LabeledRow label={scannerType ? SUCCEEDED_OUTPUT_LABEL[scannerType] : 'Result'}>
- <ObservationPrimaryOutput
- observation={observation}
- compact
- showPrompt={false}
- onSeek={onSeek}
- expandSummary
- copyable
- />
- </LabeledRow>
- {prompt && !isSummaryScannerType(scannerType) && (
- <ObservationPrompt prompt={prompt} question={observation.prompt_question} />
- )}
- {reasoning && (
- <LabeledRow label="Model reasoning">
- <CitedMarkdown text={reasoning} segments={result.reasoning_segments} onSeek={onSeek} />
- </LabeledRow>
- )}
- </>
- )}
-
- {(observation.status === 'pending' || observation.status === 'running') && (
- <ObservationProgressBar observationId={observation.id} sessionId={observation.session_id} />
- )}
- </div>
- )
-}
diff --git a/products/replay_vision/frontend/components/ObservationDockCard.stories.tsx b/products/replay_vision/frontend/components/ObservationDockCard.stories.tsx
deleted file mode 100644
index 7b45356cba8b..000000000000
--- a/products/replay_vision/frontend/components/ObservationDockCard.stories.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import type { Meta, StoryObj } from '@storybook/react'
-
-import type { ReplayObservationApi } from '../generated/api.schemas'
-import { ObservationDockCard } from './ObservationCard'
-
-const PROMPT = [
- 'Did the user struggle to complete checkout?',
- '',
- 'Answer yes if the user retried the payment form, went back to an earlier step, or left the page within a',
- 'minute of seeing an error message. Answer no if the order went through without going back.',
-].join('\n')
-
-const observation = (overrides: Partial<ReplayObservationApi> = {}): ReplayObservationApi =>
- ({
- id: '00000000-0000-0000-0000-0000000000e1',
- scanner_id: '00000000-0000-0000-0000-00000000000a',
- scanner_origin: 'configured',
- session_id: '01966b3f-70a1-7c52-a4d5-3f9b2e8c1d07',
- status: 'succeeded',
- error_reason: '',
- workflow_id: 'vision-observation-1',
- scanner_snapshot: {
- name: 'Confused checkout',
- scanner_type: 'monitor',
- scanner_version: 3,
- model: 'gemini-3.8-flash',
- provider: 'google',
- emits_signals: true,
- scanner_config: { prompt: PROMPT },
- },
- scanner_result: {
- model_output: {
- scanner_type: 'monitor',
- confidence: 0.82,
- verdict: 'yes',
- reasoning:
- 'The user entered a coupon code three times, got a validation error each time, then submitted the payment form twice before leaving the page.',
- },
- signals_count: 1,
- },
- prompt_question: 'Did the user struggle to complete checkout?',
- prompt_valence: 'bad',
- triggered_by: 'schedule',
- triggered_by_user: null,
- distinct_id: 'user_2m1x9d',
- recording_subject_email: '[email protected]',
- previous_observation_id: null,
- next_observation_id: null,
- label: null,
- viewed: true,
- media: [],
- summary_line: '',
- started_at: '2026-05-11T09:00:00Z',
- completed_at: '2026-05-11T09:01:00Z',
- created_at: '2026-05-11T09:00:00Z',
- ...overrides,
- }) as ReplayObservationApi
-
-const meta: Meta<typeof ObservationDockCard> = {
- title: 'Replay Vision/Observation dock card',
- component: ObservationDockCard,
- decorators: [
- (Story) => (
- // The dock sits under the player, so the card gets the player column's width.
- <div className="w-120">
- <Story />
- </div>
- ),
- ],
-}
-export default meta
-
-type Story = StoryObj<typeof ObservationDockCard>
-
-export const Monitor: Story = { args: { observation: observation() } }
-
-// Scanned before the prompt changed, so the scanner's current question no longer describes it.
-export const MonitorScannedWithAnOlderPrompt: Story = {
- args: { observation: observation({ id: '00000000-0000-0000-0000-0000000000e2', prompt_question: null }) },
-}
diff --git a/products/replay_vision/frontend/components/ObservationsDock.tsx b/products/replay_vision/frontend/components/SummarizeRecordingBar.tsx
similarity index 56%
rename from products/replay_vision/frontend/components/ObservationsDock.tsx
rename to products/replay_vision/frontend/components/SummarizeRecordingBar.tsx
index 09bcb4c60a12..291dfc343c35 100644
--- a/products/replay_vision/frontend/components/ObservationsDock.tsx
+++ b/products/replay_vision/frontend/components/SummarizeRecordingBar.tsx
@@ -1,13 +1,10 @@
import { useActions, useValues } from 'kea'
-import { router } from 'kea-router'
import posthog from 'posthog-js'
-import { useRef, useState } from 'react'
+import { useState } from 'react'
import { IconChevronDown, IconInfo, IconLogomark, IconNotebook } from '@posthog/icons'
-import { LemonButton, Spinner, Tooltip } from '@posthog/lemon-ui'
+import { LemonButton, Tooltip } from '@posthog/lemon-ui'
-import { Resizer } from 'lib/components/Resizer/Resizer'
-import { ResizerLogicProps, resizerLogic } from 'lib/components/Resizer/resizerLogic'
import { LemonMenuItem, LemonMenuOverlay } from 'lib/lemon-ui/LemonMenu/LemonMenu'
import { sessionRecordingDataCoordinatorLogic } from 'scenes/session-recordings/player/sessionRecordingDataCoordinatorLogic'
import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
@@ -21,39 +18,24 @@ import { observationsDockLogic } from '../logics/observationsDockLogic'
import { visionQuotaLogic } from '../logics/visionQuotaLogic'
import { LIMIT_REACHED_TOOLTIP } from '../replay_scanners/scannerCopy'
import { getReplayVisionEditDisabledReason } from '../utils/accessControl'
-import { currentReturnPath } from '../utils/breadcrumbs'
-import {
- BUILT_IN_SUMMARY_LABEL,
- dockObservations,
- isSummaryObservation,
- isUnsuccessfulScan,
-} from '../utils/observation'
+import { BUILT_IN_SUMMARY_LABEL, isSummaryObservation } from '../utils/observation'
import { quotaUx } from '../utils/quotaProjection'
import { ScanBlock, recordingScanBlock } from '../utils/scanEligibility'
-import { VisionDocsLink, visionDocsUrl } from './DocsLink'
-import { ObservationDockCard } from './ObservationCard'
+import { visionDocsUrl } from './DocsLink'
-const COLLAPSED_HEIGHT = 44
-const DEFAULT_EXPANDED_HEIGHT = 480
-const MIN_EXPANDED_HEIGHT = 120
-const MAX_EXPANDED_HEIGHT = 800
-
-export function ObservationsDock({
+export function SummarizeRecordingBar({
extraActions,
}: {
/** Recording actions the host places beside the summarize button. */
extraActions?: React.ReactNode
}): JSX.Element | null {
const { sessionRecordingId, logicProps } = useValues(sessionRecordingPlayerLogic)
- // The dock is a sibling of the player frame, so it kept its summarize button on screen even when
- // the frame had swapped itself for the "Recording not found" or "deleted" screen — a control that
- // could never summarize a recording that is not there. There is nothing to scan, so drop the dock.
const { isNotFound, isRecordingDeleted } = useValues(sessionRecordingDataCoordinatorLogic(logicProps))
if (!sessionRecordingId || isNotFound || isRecordingDeleted) {
return null
}
- return <ObservationsDockContent sessionId={sessionRecordingId} extraActions={extraActions} />
+ return <SummarizeRecordingBarContent sessionId={sessionRecordingId} extraActions={extraActions} />
}
/**
@@ -108,7 +90,7 @@ function SummarizeButton({ sessionId, scanBlock }: { sessionId: string; scanBloc
: 'Summarize this recording'
const label = summarizePending ? 'Summarizing…' : idleLabel
const summarizerTooltip = summarizePending
- ? 'Watching this recording. The summary appears below when it is ready.'
+ ? 'Watching this recording. The summary appears in the Observations tab when it is ready.'
: defaultSummarizer
? `Runs your "${defaultSummarizer.name}" scanner on this recording.`
: 'Writes a summary using a built-in prompt.'
@@ -209,7 +191,7 @@ function SummarizeButton({ sessionId, scanBlock }: { sessionId: string; scanBloc
}
/**
- * The dock sits on every standard replay player, so it reaches people who have never heard of Replay
+ * The bar sits on every standard replay player, so it reaches people who have never heard of Replay
* vision and meet the summarize button with no idea what it is or what it will spend.
*/
function SummarizeExplainer(): JSX.Element {
@@ -236,128 +218,33 @@ function SummarizeExplainer(): JSX.Element {
)
}
-function ObservationsDockContent({
+function SummarizeRecordingBarContent({
sessionId,
extraActions,
}: {
sessionId: string
extraActions?: React.ReactNode
}): JSX.Element {
- const logic = observationsDockLogic({ sessionId })
- const { observations, observationsLoading, dockOpen, retryingObservationIds, defaultSummarizer, summarizePending } =
- useValues(logic)
- const { setDockOpen, retryObservation } = useActions(logic)
- // sessionRecordingPlayerLogic is keyed by playerKey+sessionRecordingId; seek the exact mounted
- // player by its bound props rather than a propless default instance.
- const { logicProps, sessionPlayerMetaData } = useValues(sessionRecordingPlayerLogic)
- const returnPath = currentReturnPath(useValues(router).location)
- const seekToTime = (ms: number): void => {
- sessionRecordingPlayerLogic.findMounted(logicProps)?.actions.seekToTime(ms)
- }
+ const { defaultSummarizer } = useValues(observationsDockLogic({ sessionId }))
+ const { sessionPlayerMetaData } = useValues(sessionRecordingPlayerLogic)
const scanBlock = recordingScanBlock(sessionPlayerMetaData)
- // Why the button the bar just rendered cannot run, whatever summarizer it points at. Shown as a
- // visible line so the reason no longer hides behind a hover, which is what left people clicking a
- // control that could never fire. A running summary is not a block, so it is left out.
- const blockedReason = useSummarizeBlockedReason(scanBlock)
- const summarizeBlockedReason = summarizePending ? null : blockedReason(defaultSummarizer)
-
- const dockRef = useRef<HTMLDivElement>(null)
- const resizerProps: ResizerLogicProps = {
- logicKey: 'vision-observations-dock',
- placement: 'top',
- containerRef: dockRef,
- }
- const { desiredSize, isResizeInProgress } = useValues(resizerLogic(resizerProps))
-
- const shown = dockObservations(observations)
- // Collapsed, the dock is one bar with a caret, so a scan that left no result would sit behind it
- // unseen. The count says there is something to open for; the card inside says which scan and why.
- const unsuccessfulCount = shown.filter(isUnsuccessfulScan).length
- const hasContent = shown.length > 0 || observationsLoading
- const expandedHeight = Math.max(
- MIN_EXPANDED_HEIGHT,
- Math.min(MAX_EXPANDED_HEIGHT, desiredSize ?? DEFAULT_EXPANDED_HEIGHT)
- )
+ const summarizeBlockedReason = useSummarizeBlockedReason(scanBlock)(defaultSummarizer)
return (
<div
- ref={dockRef}
- className={`relative border-t bg-surface-primary overflow-hidden flex flex-col ${
- isResizeInProgress ? '' : 'transition-[max-height] duration-300 ease-out'
- }`}
- style={{ maxHeight: dockOpen ? expandedHeight : COLLAPSED_HEIGHT }}
+ className="flex items-center gap-2 lg:gap-3 h-11 px-3 shrink-0 border-t bg-surface-primary"
+ // Frozen: dashboards and selectors still find the bar under its old name.
data-attr="vision-observations-dock"
>
- {dockOpen && <Resizer {...resizerProps} />}
- <div className="flex items-center gap-2 lg:gap-3 h-11 px-3 shrink-0">
- <SummarizeButton sessionId={sessionId} scanBlock={scanBlock} />
- <SummarizeExplainer />
- {extraActions}
- {summarizeBlockedReason &&
- !hasContent && (
- // Collapsed with nothing to expand, the disabled button's tooltip is the only place
- // the reason is explained, so the bar says it outright. A scan-block has a short
- // label to lead with; a quota or access block carries only its full sentence.
- <Tooltip title={summarizeBlockedReason}>
- <span className="ml-auto text-muted text-xs truncate" data-attr="vision-dock-skipped">
- {scanBlock ? `Skipped: ${scanBlock.label.toLowerCase()}` : summarizeBlockedReason}
- </span>
- </Tooltip>
- )}
- {hasContent && (
- <div className="ml-auto flex items-center gap-2 min-w-0">
- {!dockOpen && unsuccessfulCount > 0 && (
- <span className="text-muted text-xs truncate" data-attr="vision-dock-no-result-count">
- No result from {unsuccessfulCount} {unsuccessfulCount === 1 ? 'scan' : 'scans'}
- </span>
- )}
- <LemonButton
- size="small"
- icon={<IconChevronDown className={dockOpen ? 'rotate-180' : ''} />}
- onClick={() => setDockOpen(!dockOpen)}
- tooltip={dockOpen ? 'Collapse' : 'Expand'}
- aria-label={dockOpen ? 'Collapse summary' : 'Expand summary'}
- data-attr="vision-dock-toggle"
- // This click also sets the auto-expand preference, so which way it went is
- // the signal for whether people keep summaries open by default.
- data-ph-capture-attribute-dock-action={dockOpen ? 'collapse' : 'expand'}
- />
- </div>
- )}
- </div>
- {dockOpen && (
- <div className="flex-1 overflow-y-auto px-3 pb-3 space-y-2">
- {observationsLoading && shown.length === 0 ? (
- <div className="flex items-center gap-2 text-muted py-4">
- <Spinner /> Loading summaries…
- </div>
- ) : shown.length === 0 && scanBlock ? (
- <div className="text-muted text-sm py-4">
- Replay vision skipped this recording, so it has no summary. {scanBlock.reason}{' '}
- <VisionDocsLink page="observations" dataAttr="vision-skipped-docs-link-dock">
- Learn how observations work
- </VisionDocsLink>
- </div>
- ) : shown.length === 0 ? (
- <div className="text-muted text-sm py-4">
- No summary yet. Summarize this recording to generate one.{' '}
- <VisionDocsLink page="observations" dataAttr="vision-empty-docs-link-dock">
- Learn how observations work
- </VisionDocsLink>
- </div>
- ) : (
- shown.map((observation) => (
- <ObservationDockCard
- key={observation.id}
- observation={observation}
- onSeek={seekToTime}
- onRetry={() => retryObservation(observation.id)}
- retrying={retryingObservationIds.includes(observation.id)}
- returnPath={returnPath}
- />
- ))
- )}
- </div>
+ <SummarizeButton sessionId={sessionId} scanBlock={scanBlock} />
+ <SummarizeExplainer />
+ {extraActions}
+ {summarizeBlockedReason && (
+ <Tooltip title={summarizeBlockedReason}>
+ <span className="ml-auto text-muted text-xs truncate" data-attr="vision-dock-skipped">
+ {scanBlock ? `Skipped: ${scanBlock.label.toLowerCase()}` : summarizeBlockedReason}
+ </span>
+ </Tooltip>
)}
</div>
)
diff --git a/products/replay_vision/frontend/logics/observationsDockLogic.test.ts b/products/replay_vision/frontend/logics/observationsDockLogic.test.ts
index 8f44e3170165..ca6102db643e 100644
--- a/products/replay_vision/frontend/logics/observationsDockLogic.test.ts
+++ b/products/replay_vision/frontend/logics/observationsDockLogic.test.ts
@@ -1,9 +1,11 @@
import { expectLogic } from 'kea-test-utils'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
+import { playerSidebarLogic } from 'scenes/session-recordings/player/sidebar/playerSidebarLogic'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
+import { SessionRecordingSidebarTab } from '~/types'
import type { ReplayObservationApi, ReplayScannerApi } from '../generated/api.schemas'
import { OBSERVE_POLL_GRACE_MS } from './observationPolling'
@@ -87,10 +89,9 @@ describe('observationsDockLogic', () => {
},
})
initKeaTests()
- // Persisted, so a collapse in one test would otherwise decide the next test's starting state.
+ // Persisted, so a summarizer picked in one test would otherwise decide the next test's starting state.
preferences = visionDockPreferenceLogic()
preferences.mount()
- preferences.actions.setSummaryDockAutoExpand(true)
preferences.actions.setPreferredSummarizerId(null)
logic = observationsDockLogic({ sessionId: 'sess-1' })
logic.mount()
@@ -146,7 +147,7 @@ describe('observationsDockLogic', () => {
it('warns rather than promising a result when an already-summarized row is unreadable', async () => {
// The slot check runs unscoped, so `already_scanned` can come back for a row RBAC hides from the
- // dock, or the reload can fail. The old copy claimed a result over an empty dock; guard that the
+ // tab, or the reload can fail. The old copy claimed a result over an empty tab; guard that the
// reload happens first and the message admits nothing is shown.
inlineScanOutcome = 'already_scanned'
// Consume the mount-time load so its response can't overwrite the reload below.
@@ -157,14 +158,14 @@ describe('observationsDockLogic', () => {
await new Promise((resolve) => setTimeout(resolve, 0))
releaseInlineScan()
- await expectLogic(logic).toDispatchActions(['summarizeFailure', 'loadObservationsSuccess'])
- await expectLogic(logic).toMatchValues({ dockOpen: true, observations: [] })
+ await expectLogic(logic).toDispatchActions(['showObservations', 'summarizeFailure', 'loadObservationsSuccess'])
+ await expectLogic(logic).toMatchValues({ observations: [] })
expect(lemonToast.warning).toHaveBeenCalled()
expect(lemonToast.info).not.toHaveBeenCalled()
})
it('confirms the result when the already-summarized row is readable', async () => {
- // The reload surfaces the inline scanner's row (matched by scan_id), so the dock can point at it.
+ // The reload surfaces the inline scanner's row (matched by scan_id), so the toast can point at it.
inlineScanOutcome = 'already_scanned'
await expectLogic(logic).toDispatchActions(['loadObservationsSuccess'])
observationResults = [
@@ -175,35 +176,31 @@ describe('observationsDockLogic', () => {
await new Promise((resolve) => setTimeout(resolve, 0))
releaseInlineScan()
- await expectLogic(logic).toDispatchActions(['summarizeFailure', 'loadObservationsSuccess'])
- await expectLogic(logic).toMatchValues({ dockOpen: true, observations: observationResults })
+ await expectLogic(logic).toDispatchActions(['showObservations', 'summarizeFailure', 'loadObservationsSuccess'])
+ await expectLogic(logic).toMatchValues({ observations: observationResults })
expect(lemonToast.info).toHaveBeenCalled()
expect(lemonToast.warning).not.toHaveBeenCalled()
})
- it('opens the dock for a recording that already has a summary', async () => {
- observationResults = [summaryObservation()]
-
- logic.actions.loadObservations()
-
+ it('lands the sidebar on Observations only when a recording opens with a summary', async () => {
+ const sidebar = playerSidebarLogic()
+ sidebar.mount()
await expectLogic(logic).toDispatchActions(['loadObservationsSuccess'])
- await expectLogic(logic).toMatchValues({ dockOpen: true })
- })
- it('leaves the dock closed on the next recording once the user collapses it', async () => {
- // The preference has to outlive the dock logic, which is keyed by session. Held per key, a
- // collapse would be forgotten the moment the user clicks the next recording in the playlist.
observationResults = [summaryObservation()]
logic.actions.loadObservations()
await expectLogic(logic).toDispatchActions(['loadObservationsSuccess'])
+ await expectLogic(sidebar).toMatchValues({ activeTab: SessionRecordingSidebarTab.INSPECTOR })
- logic.actions.setDockOpen(false)
+ logic.unmount()
+ logic.mount()
+ await expectLogic(logic).toDispatchActions(['loadObservationsSuccess'])
+ await expectLogic(sidebar).toMatchValues({ activeTab: SessionRecordingSidebarTab.OBSERVATIONS })
- const nextRecording = observationsDockLogic({ sessionId: 'sess-2' })
- nextRecording.mount()
- await expectLogic(nextRecording).toDispatchActions(['loadObservationsSuccess'])
- await expectLogic(nextRecording).toMatchValues({ dockOpen: false })
- nextRecording.unmount()
+ logic.unmount()
+ await expectLogic(sidebar).toMatchValues({ activeTab: SessionRecordingSidebarTab.INSPECTOR })
+ logic.mount()
+ sidebar.unmount()
})
const loadScanners = async (scanners: ReplayScannerApi[]): Promise<void> => {
diff --git a/products/replay_vision/frontend/logics/observationsDockLogic.ts b/products/replay_vision/frontend/logics/observationsDockLogic.ts
index 1c994be5faf0..e828787ee096 100644
--- a/products/replay_vision/frontend/logics/observationsDockLogic.ts
+++ b/products/replay_vision/frontend/logics/observationsDockLogic.ts
@@ -1,11 +1,28 @@
-import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import {
+ MakeLogicType,
+ actions,
+ afterMount,
+ beforeUnmount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
import { ApiError } from 'lib/api-error'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import type { ToastButton } from 'lib/lemon-ui/LemonToast/LemonToast'
import { metricCount } from 'lib/operationalMetrics'
+import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'
+import { playerSidebarLogic } from 'scenes/session-recordings/player/sidebar/playerSidebarLogic'
import { teamLogic } from 'scenes/teamLogic'
+import { SessionRecordingSidebarTab } from '~/types'
+
import { visionObservationsList, visionScannersInlineScanCreate, visionScannersObserveCreate } from '../generated/api'
import type { ReplayScannerApi, ReplayObservationApi } from '../generated/api.schemas'
import { isSummarizerScanner } from '../replay_scanners/types'
@@ -30,11 +47,9 @@ export interface ObservationsDockLogicProps {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface observationsDockLogicValues {
preferredSummarizerId: string | null // visionDockPreferenceLogic
- summaryDockAutoExpand: boolean // visionDockPreferenceLogic
scanners: ReplayScannerApi[] // visionScannersListLogic
scannersLoading: boolean // visionScannersListLogic
defaultSummarizer: ReplayScannerApi | null
- dockOpen: boolean
filteredScanners: ReplayScannerApi[]
focusedObservationId: string | null
followMoments: boolean
@@ -56,12 +71,18 @@ export interface observationsDockLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface observationsDockLogicActions {
+ setSidebarOpen: (open: boolean) => {
+ open: boolean
+ } // playerSettingsLogic
+ setAutoTab: (tab: SessionRecordingSidebarTab | null) => {
+ tab: SessionRecordingSidebarTab | null
+ } // playerSidebarLogic
+ setTab: (tab: SessionRecordingSidebarTab) => {
+ tab: SessionRecordingSidebarTab
+ } // playerSidebarLogic
setPreferredSummarizerId: (scannerId: string | null) => {
scannerId: string | null
} // visionDockPreferenceLogic
- setSummaryDockAutoExpand: (autoExpand: boolean) => {
- autoExpand: boolean
- } // visionDockPreferenceLogic
focusObservation: (observationId: string) => {
observationId: string
}
@@ -96,9 +117,6 @@ export interface observationsDockLogicActions {
retryObservationSuccess: (observationId: string) => {
observationId: string
}
- setDockOpen: (open: boolean) => {
- open: boolean
- }
setFollowMoments: (follow: boolean) => {
follow: boolean
}
@@ -111,6 +129,9 @@ export interface observationsDockLogicActions {
setScannerSearch: (search: string) => {
search: string
}
+ showObservations: () => {
+ value: true
+ }
summarize: () => {
value: true
}
@@ -163,9 +184,16 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
visionScannersListLogic,
['scanners', 'scannersLoading'],
visionDockPreferenceLogic,
- ['summaryDockAutoExpand', 'preferredSummarizerId'],
+ ['preferredSummarizerId'],
+ ],
+ actions: [
+ visionDockPreferenceLogic,
+ ['setPreferredSummarizerId'],
+ playerSidebarLogic,
+ ['setTab', 'setAutoTab'],
+ playerSettingsLogic,
+ ['setSidebarOpen'],
],
- actions: [visionDockPreferenceLogic, ['setSummaryDockAutoExpand', 'setPreferredSummarizerId']],
})),
actions({
@@ -178,7 +206,7 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
retryObservation: (observationId: string) => ({ observationId }),
retryObservationSuccess: (observationId: string) => ({ observationId }),
retryObservationFailure: (observationId: string) => ({ observationId }),
- setDockOpen: (open: boolean) => ({ open }),
+ showObservations: true,
focusObservation: (observationId: string) => ({ observationId }),
setFollowMoments: (follow: boolean) => ({ follow }),
setHoveredMark: (timestampMs: number | null) => ({ timestampMs }),
@@ -230,12 +258,6 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
summarizeSettled: () => false,
},
],
- dockOpen: [
- false,
- {
- setDockOpen: (_, { open }) => open,
- },
- ],
scannerPickerOpen: [
false,
{
@@ -344,15 +366,9 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
actions.loadObservations
)
}
- // A summary is only readable once the dock is open, so a recording that already has one opens it
- // rather than hiding it behind the caret. Collapsing the dock turns this off until it is expanded
- // again, otherwise the next recording in the playlist would re-open what the user just closed.
- const openDockForExistingSummary = (): void => {
- if (values.dockOpen || !values.summaryDockAutoExpand) {
- return
- }
+ const landOnExistingSummary = (): void => {
if (values.observations.some((o) => isSummaryObservation(o) && o.status === 'succeeded')) {
- actions.setDockOpen(true)
+ actions.setAutoTab(SessionRecordingSidebarTab.OBSERVATIONS)
}
}
// The button stays pending for as long as the run it started has something left to report: a
@@ -385,6 +401,7 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
// Run a summary, through one of the team's own scanners or the built-in prompt. A named scanner
// is just `observe`, which already owns its double-click guard and its already-run check.
const runSummary = async (scannerId: string | null): Promise<void> => {
+ actions.showObservations()
if (scannerId) {
// Flagged as the summary's run, so only this one settles the button.
actions.observe(scannerId, true)
@@ -416,7 +433,6 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
// the row may not be readable here, and the reload can also fail. Confirm the row
// is in hand before naming it, and leave a way to re-read when it stays hidden.
actions.summarizeFailure()
- actions.setDockOpen(true)
// Both retries re-read the same rows, but they follow different failures: a row the
// reload could not see, and a reload that did not complete. Keep them apart.
const tryAgain = (dataAttr: string): ToastButton => ({
@@ -431,9 +447,9 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
const results = reloaded.results ?? []
actions.loadObservationsSuccess(results)
if (response.scan_id && results.some((o) => o.scanner_id === response.scan_id)) {
- // The row is readable below. A failed or ineligible one still shows its retry
- // control there, so the user has a way to run the summary again.
- lemonToast.info('This recording already has a result below.')
+ // The row is readable in the tab. A failed or ineligible one still shows its
+ // retry control there, so the user has a way to run the summary again.
+ lemonToast.info('This recording already has a result in the Observations tab.')
} else {
lemonToast.warning(
'This recording was already summarized, but the result is not available here.',
@@ -456,7 +472,6 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
// against the shared inline scanner — so the poll window has a row to wait for.
cache.summarizeScannerId = response.scan_id
actions.summarizeSuccess()
- actions.setDockOpen(true)
afterScanStarted()
} else {
// Nothing started and nothing to read, so the poll window would watch for a row
@@ -501,8 +516,12 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
cache.focusScannerId = null
actions.focusObservation(started.id)
}
- openDockForExistingSummary()
+ if (!cache.openingLoadDone) {
+ cache.openingLoadDone = true
+ landOnExistingSummary()
+ }
settleSummarizeIfDone()
+
reschedulePoll()
},
// Settles here too: with no summary row loaded, `pollUntil` is the only poll condition
@@ -513,8 +532,10 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
reschedulePoll()
},
- // Every open and close runs through here, so the preference tracks the last one the user made.
- setDockOpen: ({ open }) => actions.setSummaryDockAutoExpand(open),
+ showObservations: () => {
+ actions.setSidebarOpen(true)
+ actions.setTab(SessionRecordingSidebarTab.OBSERVATIONS)
+ },
observe: async ({ scannerId, forSummary }) => {
// The button waits on the summary, so every path here that starts no scan has to
@@ -548,7 +569,6 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
lemonToast.info('This scanner has already been run on this recording.')
actions.observeFailure()
failSummarize()
- actions.setDockOpen(true)
return
}
cache.observeInFlight = forSummary ? 'summary' : 'scan'
@@ -596,7 +616,12 @@ export const observationsDockLogic = kea<observationsDockLogicType>([
}
}),
- afterMount(({ actions }) => {
+ afterMount(({ actions, cache }) => {
+ cache.openingLoadDone = false
actions.loadObservations()
}),
+
+ beforeUnmount(({ actions }) => {
+ actions.setAutoTab(null)
+ }),
])
diff --git a/products/replay_vision/frontend/logics/visionDockPreferenceLogic.ts b/products/replay_vision/frontend/logics/visionDockPreferenceLogic.ts
index 730a259c8d87..6cf986fc3839 100644
--- a/products/replay_vision/frontend/logics/visionDockPreferenceLogic.ts
+++ b/products/replay_vision/frontend/logics/visionDockPreferenceLogic.ts
@@ -3,7 +3,6 @@ import { MakeLogicType, actions, kea, path, reducers } from 'kea'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface visionDockPreferenceLogicValues {
preferredSummarizerId: string | null
- summaryDockAutoExpand: boolean
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -11,9 +10,6 @@ export interface visionDockPreferenceLogicActions {
setPreferredSummarizerId: (scannerId: string | null) => {
scannerId: string | null
}
- setSummaryDockAutoExpand: (autoExpand: boolean) => {
- autoExpand: boolean
- }
}
export type visionDockPreferenceLogicType = MakeLogicType<
@@ -21,29 +17,16 @@ export type visionDockPreferenceLogicType = MakeLogicType<
visionDockPreferenceLogicActions
>
-/**
- * How the summary dock behaves, across recordings.
- *
- * Propless and persisted on purpose. `observationsDockLogic` is keyed by session, so a preference
- * kept there would reset on every recording the user opens: it would re-expand a dock they just
- * collapsed, and forget the summarizer they just picked.
- */
+// Persisted across recordings. The path is the storage key, so renaming this logic resets the pick.
+
export const visionDockPreferenceLogic = kea<visionDockPreferenceLogicType>([
path(['products', 'replay_vision', 'frontend', 'logics', 'visionDockPreferenceLogic']),
actions({
- setSummaryDockAutoExpand: (autoExpand: boolean) => ({ autoExpand }),
setPreferredSummarizerId: (scannerId: string | null) => ({ scannerId }),
}),
reducers({
- summaryDockAutoExpand: [
- true,
- { persist: true },
- {
- setSummaryDockAutoExpand: (_: boolean, { autoExpand }: { autoExpand: boolean }) => autoExpand,
- },
- ],
// Holds a scanner id, BUILT_IN_SUMMARIZER, or null for "never chose". Resolved against the
// team's current scanner list by `resolveSummarizer`, so a stale id falls back on its own.
preferredSummarizerId: [
diff --git a/products/replay_vision/frontend/utils/observation.test.ts b/products/replay_vision/frontend/utils/observation.test.ts
index c6f08cbd1a8a..8a9c5c83e694 100644
--- a/products/replay_vision/frontend/utils/observation.test.ts
+++ b/products/replay_vision/frontend/utils/observation.test.ts
@@ -1,5 +1,5 @@
import type { ReplayObservationApi } from '../generated/api.schemas'
-import { dockObservations, observationClipboardText, scannerLabel } from './observation'
+import { observationClipboardText, scannerLabel } from './observation'
function makeObservation(
scannerType: string,
@@ -45,33 +45,6 @@ describe('observation utils', () => {
})
})
- describe('dockObservations', () => {
- const obs = (
- id: string,
- scannerType: string,
- status: ReplayObservationApi['status']
- ): ReplayObservationApi => ({ ...makeObservation(scannerType, null, status), id })
-
- // The dock is the only vision surface under the player, and a scan that settled without a
- // result is exactly what a person needs it for: nothing else there says why none arrived.
- // Succeeded scanner runs stay in the sidebar, so the dock does not restate what it already has.
- it.each<[string, ReplayObservationApi[], string[]]>([
- ['a summary is shown', [obs('s1', 'summarizer', 'succeeded')], ['s1']],
- ['a failed summary is shown once, not twice', [obs('s1', 'summarizer', 'failed')], ['s1']],
- ['a failed scanner is shown', [obs('m1', 'monitor', 'failed')], ['m1']],
- ['an ineligible scanner is shown', [obs('m1', 'monitor', 'ineligible')], ['m1']],
- ['a succeeded scanner stays in the sidebar', [obs('m1', 'monitor', 'succeeded')], []],
- ['a running scanner stays in the sidebar', [obs('m1', 'monitor', 'running')], []],
- [
- 'summaries come before scans that left no result',
- [obs('m1', 'monitor', 'failed'), obs('s1', 'summarizer', 'succeeded')],
- ['s1', 'm1'],
- ],
- ])('%s', (_, observations, expectedIds) => {
- expect(dockObservations(observations).map((o) => o.id)).toEqual(expectedIds)
- })
- })
-
describe('scannerLabel', () => {
// A one-off scan's scanner is unnamed, so falling back to the snapshot name renders a blank
// label in the player dock, the sidebar, and search, which are the surfaces that flow is made of.
diff --git a/products/replay_vision/frontend/utils/observation.ts b/products/replay_vision/frontend/utils/observation.ts
index 4a1f329560f2..d87602c65c4d 100644
--- a/products/replay_vision/frontend/utils/observation.ts
+++ b/products/replay_vision/frontend/utils/observation.ts
@@ -66,32 +66,12 @@ export function isSummaryScannerType(scannerType: string | null | undefined): bo
return scannerType === 'summarizer' || scannerType === 'experiment'
}
-/** Summary output, which is the dock's primary content. */
+/** Summary output. */
+
export function isSummaryObservation(obs: ReplayObservationApi): boolean {
return isSummaryScannerType(obs.scanner_snapshot?.scanner_type)
}
-/** A scan that settled without a result: the scanner failed, or the recording did not qualify. */
-export function isUnsuccessfulScan(obs: ReplayObservationApi): boolean {
- return obs.status === 'failed' || obs.status === 'ineligible'
-}
-
-/**
- * What the dock shows below the player: every summary, plus any other scanner that left no result.
- *
- * A succeeded scanner observation stays in the sidebar tab, which is where the team reads its own
- * scanners. One that failed or was ineligible is different: nothing below the player would otherwise
- * say why no result arrived, so the run is only discoverable by opening the sidebar and looking.
- */
-export function dockObservations(observations: ReplayObservationApi[]): ReplayObservationApi[] {
- // A summarizer that failed is already carried by the first filter, so the second skips summaries
- // rather than listing them twice.
- return [
- ...observations.filter(isSummaryObservation),
- ...observations.filter((obs) => !isSummaryObservation(obs) && isUnsuccessfulScan(obs)),
- ]
-}
-
/** Summarizer output: the one-line headline. */
export function readTitle(obs: ReplayObservationApi): string | null {
const raw = readModelOutput(obs)?.title