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.

refactor(replay-vision): rename the watch feed to highlights (#125108)

Tue Haulundfdebeeeefb86
diff --git a/common/storybook/storybook-timings.json b/common/storybook/storybook-timings.json
index 44d9d993bba7..d5bff975362a 100644
--- a/common/storybook/storybook-timings.json
+++ b/common/storybook/storybook-timings.json
@@ -2955,7 +2955,7 @@
"chromium": 20.984,
"webkit": 3.763
},
- "products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.stories.tsx": {
+ "products/replay_vision/frontend/replay_scanners/components/HighlightFeedEmptyState.stories.tsx": {
"chromium": 23.811,
"webkit": 5.359
},
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index b5144d94caab..0cdb1e443a8f 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -14738,18 +14738,18 @@ snapshots:
hash: v1.k794b7964.0056b7d379418048419e1af4fe26b3dedb57db977d907a994c35dfbb961c85c6.LZbOuzh4Jc8rJ_fNBfvGocKs0Cx7bOqjXlQ8F_XFJa8
scenes-app-replay-vision--experiment-variants-waiting-for-observations--light:
hash: v1.k794b7964.a1555dab4c0006028e8c240451c56c6aed5e31c8a8e68c893e3d6a07b562bba6.VYeYPsjZ_p0Rt4cbZzF7lbxjxurMjLXff9kJRsy49gU
- scenes-app-replay-vision--home-watch-feed--dark:
- hash: v1.k794b7964.8895978e3c94bcf7e223c6951c9feb12ca04177543d615e4b303a10f59ecdca9.tz7PmhgaOqvs8ZZXbuNNgbUPBnCaW1T9nCQXKf3rDYk
- scenes-app-replay-vision--home-watch-feed--light:
- hash: v1.k794b7964.917bf5474cc4fa89bfbbef376ec24a10c015a6a0806e562a18557628bb0652fa.zISmbhI7bi37HCk5YZh3Q3_khX6HV_vXCj8bCydkapg
- scenes-app-replay-vision--home-watch-feed-empty--dark:
- hash: v1.k794b7964.e8bf2a561963c96df9eb9dc6d005e192bdc64301c92c9654b7de4593ea8518c5.X43IWxVfHE9iboy6cY-VKIyo3R0N8Fej_PiO1JIyYZY
- scenes-app-replay-vision--home-watch-feed-empty--light:
- hash: v1.k794b7964.347da36a401fa205ffb5d2c388197fdf5a102eff3148438c2da416aeba65c2a7.TBRMQTWYMU9iHr1naonnIVacv_NqjtZOCWe3Yc6__UU
- scenes-app-replay-vision--home-watch-feed-only-newest--dark:
- hash: v1.k794b7964.42e9a57b761186ae53e6d6a9aad97b59bc0a71a572ee9c6977b733818930ced7.Ab1APElWbvJ9mvPg5s-ezcdcRb1VTakv0FDgE3i-VfA
- scenes-app-replay-vision--home-watch-feed-only-newest--light:
- hash: v1.k794b7964.b76b262f44c32205b44d80ca4d41dc262e4d52446cd9d627acfb053fdfefb67e.eKCkLSAbysz40mpn9JdPpdRfUsIXH7GdFyNqi4pjE8o
+ scenes-app-replay-vision--home-highlight-feed--dark:
+ hash: v1.k794b7964.f523bdb7bcfef034532b6c11e11478ec199cfcb3246d22e4d2ccad6b1b38fc4f.hMr887mIHYKTjQH27GMT76K56YyNe19BiWC4KQpw4nU
+ scenes-app-replay-vision--home-highlight-feed--light:
+ hash: v1.k794b7964.7594537d1642bffd9a9077cbff5b281290c9916d748b8f00877b6c9dadc100dd.IAOkUTKrN_QAilF3rLjKaGw9wW2tTctepVWE4UfgxcU
+ scenes-app-replay-vision--home-highlight-feed-empty--dark:
+ hash: v1.k794b7964.9cc31cd0b1956a94195b57c22dc1b8685e87d5102197f079ef7f48115dedb29c.GGIwoix1bj2E3mVcLak54LA6DobNO8SZavr6hURmWpg
+ scenes-app-replay-vision--home-highlight-feed-empty--light:
+ hash: v1.k794b7964.f5fdca66d1aac945dccd33803444618745291e781b0bc404beb36947f3c2c212.O4bNRE_ZWsm4FvTmW5NL3IsgtMCOCVnv0kxlWTbyZSQ
+ scenes-app-replay-vision--home-highlight-feed-only-newest--dark:
+ hash: v1.k794b7964.d6e53f27da260d677f44ff7fc08f195853096f76f391e22d54851c250b22b85f.PdrpRblQvx7y-RP5nRHwtSks6_bOLpzwGpllK-ao1u4
+ scenes-app-replay-vision--home-highlight-feed-only-newest--light:
+ hash: v1.k794b7964.dad343e2baa8a7ffbac56e70dac0182295a4c3e21b0141b00770d8a7fa96b774.AeywrD4S6EMXRptBuUrAHcbfR2rGKbJ-20XlzHocxK8
scenes-app-replay-vision--monitor-observations--dark:
hash: v1.k794b7964.9ec7ef6c17074e9547647fe71aa2613100208fa0c7ba87a3d97897b4f183a5c8.-UKB-w06mWDRH2yNgzIBhn3Qhn2MYlFTNXjhMce1hh4
scenes-app-replay-vision--monitor-observations--light:
@@ -14966,6 +14966,34 @@ snapshots:
hash: v1.k794b7964.5e1b09d0d33cb4da5d6396851c64fb90fe9a855e7d1688e384b4286e779b3609.ctbJIII0ZsxDI6XrCn5oonGesfRhzrEO6ITNCMYwef4
scenes-app-replay-vision--usage-tab--light:
hash: v1.k794b7964.43595c3fb6282a80ca8aee0346ecfef1fad1777b29589a3d22d49a2132bbcd43.wySv2DQ6AsDsfonNurSn167gw_V9XO8bshMw1dR8tpw
+ scenes-app-replay-vision-highlightfeedblockedbanner--quota-exhausted--dark:
+ hash: v1.k794b7964.e535872d607f48c58be28228332bf871f8d5f748662f3e0d086f7e2be529a2b7.W0CeP2ErAbtIggU1GdSmu22pNrgNBrjNlSU_4LVsgoc
+ scenes-app-replay-vision-highlightfeedblockedbanner--quota-exhausted--light:
+ hash: v1.k794b7964.e4c3b121ad7a311eabb7753806ff56a78261ffe5333b681774bc97a41038799a.l_10l7hX76ghatQYFxyOdS9WOWwtLVy6GcEp4Lwu5DE
+ scenes-app-replay-vision-highlightfeedemptystate--all-capped--dark:
+ hash: v1.k794b7964.827b25db6e216bda95ef8b687689225b9d47c06bd64dc14fd335bce5e3aac0ba.HM5-orj6rOqv8wFlfr_G-9_CSgINJNNGswvM47lbaRw
+ scenes-app-replay-vision-highlightfeedemptystate--all-capped--light:
+ hash: v1.k794b7964.bc518219001629e905129ef03223474b721177ca32b7f8fcb2f1a802115aa39a.xVwUOWCja2TydSxKns3_hy39jk6iDdQTqIGqq-dF8Xc
+ scenes-app-replay-vision-highlightfeedemptystate--all-disabled--dark:
+ hash: v1.k794b7964.8a46fd3ccf6f1981a60ac60d43153d2805ae156d72f63101a64e92d80d578f46.DKAgRtHQBN4Rmp55HdtfO9IYj9rjOXqLVtax-3ztPco
+ scenes-app-replay-vision-highlightfeedemptystate--all-disabled--light:
+ hash: v1.k794b7964.854972182cbc01b9ef8eb658b0bdc1e92ac08c753789d15da28118c3cf171a95.22f64HW7nHkI-oRECCPR0u7ccme8RAfjy4smEuvYH-o
+ scenes-app-replay-vision-highlightfeedemptystate--filtered--dark:
+ hash: v1.k794b7964.0474769b535df6aa12a7b084d282670d43cdee3e4d25bea774343b31a3507222.A6a1bLa4bPY6rWD63uU1Ofmk7qe4pTWenkVnAfFzk6I
+ scenes-app-replay-vision-highlightfeedemptystate--filtered--light:
+ hash: v1.k794b7964.a46eecfe214809eb57f9cee104966134dc9ee7e7c87c76ece00804cc4b7e01ed.3DugcLZ-jS3L-Dg8ID0zXVx-wumILKJQN5vD5sCANKA
+ scenes-app-replay-vision-highlightfeedemptystate--no-scanners--dark:
+ hash: v1.k794b7964.1a2bc2d84fde117a62c1e247a770c177eec921730810ba1ddc5fd561bd5b56a6.dO1Zy_3KvtfJSqlL7_4xMJ0YZ8EKNOc2vxiPo7-qk_A
+ scenes-app-replay-vision-highlightfeedemptystate--no-scanners--light:
+ hash: v1.k794b7964.f0fbceb29ededf3b34b97b3c6b86bd0797b25a9135aec3fd583a6aed09f45c9c.rJHV7Y1YCrhSMtSbCsM3cZHT2-wymEldFgLc2wAk-8k
+ scenes-app-replay-vision-highlightfeedemptystate--quiet-window--dark:
+ hash: v1.k794b7964.c4ed5fbd745303fc8ebcd4ac215fc9022b99c4188f963d99b15d721bb15935d8.abSotPtp69Hz28hRMRDyyrt-B_aHsEoVG3VNO5AaoyQ
+ scenes-app-replay-vision-highlightfeedemptystate--quiet-window--light:
+ hash: v1.k794b7964.1f589f91ce12f7c154679d17d97a21c8e203aa87397164cccc78157535b977d3.mqXpbhrKri8y-dR0YZWc5WLvWonGwASXYcUm9Oq57-0
+ scenes-app-replay-vision-highlightfeedemptystate--quota-exhausted--dark:
+ hash: v1.k794b7964.b1f47cd49f93204542abf607f565859a592273ca11d2c068f04b04bd32049409.bCvHC2nU8xUpEIg0RQV8CC56PFR60KqgxciVVZcJsIA
+ scenes-app-replay-vision-highlightfeedemptystate--quota-exhausted--light:
+ hash: v1.k794b7964.206cb4c6e3d6ae106a0e07edb31a30c597af6fa2917a5e19330d1b3dfdb3622a.l-tGYkbCyiZDHs4b-Mtid2RApqCeYCG9suhSo_sOp_c
scenes-app-replay-vision-observations-tab-in-the-player--scans-without-a-summary--dark:
hash: v1.k794b7964.541ee5233b1f6805324b95d5d01de4cfec0b0012e0cceb100339735c9dcbd338.a66QPGNk0yvyiiaTOmkd2k1leqmyN9g85cLMJ8EWdXE
scenes-app-replay-vision-observations-tab-in-the-player--scans-without-a-summary--light:
@@ -15058,34 +15086,6 @@ snapshots:
hash: v1.k794b7964.0dac77dbf97e99deb916b18c338f397b1c7c58d305dcb722c2c397f1efe2167f.CH2uxVc4xyfRne0meiJNYXeK1aiNC9KaBpAX_EVhWiQ
scenes-app-replay-vision-test-account-filter-settings-dialog--default--light:
hash: v1.k794b7964.4a45317cf1541935394cc4f27a9b29c17f0c8aeaebb6a832fd947dca51c1dacd.-SOqokEQ4yQf2ZbX4EM6nY2csQRt0E46XT4F1g_pTlE
- scenes-app-replay-vision-watchfeedblockedbanner--quota-exhausted--dark:
- hash: v1.k794b7964.e535872d607f48c58be28228332bf871f8d5f748662f3e0d086f7e2be529a2b7.ErHiOeF3vI_gUmyOuaU_wqe8g7F8R8ufcGnV1t8vChQ
- scenes-app-replay-vision-watchfeedblockedbanner--quota-exhausted--light:
- hash: v1.k794b7964.e4c3b121ad7a311eabb7753806ff56a78261ffe5333b681774bc97a41038799a.uAGUW2ndVlXKZN_0E1SDPUKGT-fw0Iyb7k91r7mofqw
- scenes-app-replay-vision-watchfeedemptystate--all-capped--dark:
- hash: v1.k794b7964.827b25db6e216bda95ef8b687689225b9d47c06bd64dc14fd335bce5e3aac0ba.KxHvg-8tw1ZADRo--7J6WfR_g2KH2T_iWxrgHsdWXv4
- scenes-app-replay-vision-watchfeedemptystate--all-capped--light:
- hash: v1.k794b7964.bc518219001629e905129ef03223474b721177ca32b7f8fcb2f1a802115aa39a.SDgQVN9PhcKY_x3slsioMgbWc-_Q5BEVxGeq-XPH_wM
- scenes-app-replay-vision-watchfeedemptystate--all-disabled--dark:
- hash: v1.k794b7964.8a46fd3ccf6f1981a60ac60d43153d2805ae156d72f63101a64e92d80d578f46.RJVLCBqwjMpnxhrzJtjRzDCLW3lO-TL3olfNaiSl3E8
- scenes-app-replay-vision-watchfeedemptystate--all-disabled--light:
- hash: v1.k794b7964.854972182cbc01b9ef8eb658b0bdc1e92ac08c753789d15da28118c3cf171a95.FF5FucA4taWLV3Qh5SS1SwobEt-YETag9DPhni3rfZw
- scenes-app-replay-vision-watchfeedemptystate--filtered--dark:
- hash: v1.k794b7964.0474769b535df6aa12a7b084d282670d43cdee3e4d25bea774343b31a3507222.Km4N8RA3EPJr8WkNaiJY9gIjm6eHvx0KvYnQGCy2ZiQ
- scenes-app-replay-vision-watchfeedemptystate--filtered--light:
- hash: v1.k794b7964.a46eecfe214809eb57f9cee104966134dc9ee7e7c87c76ece00804cc4b7e01ed.YQtNRdaka2JN1Uf-MG38xWtTxCVx0zFvXsCkq_BVS9c
- scenes-app-replay-vision-watchfeedemptystate--no-scanners--dark:
- hash: v1.k794b7964.1a2bc2d84fde117a62c1e247a770c177eec921730810ba1ddc5fd561bd5b56a6.-WrqvOi2Y6Wt2K2HgpXJb1f3X0Q5t-bee_q8rpu01LY
- scenes-app-replay-vision-watchfeedemptystate--no-scanners--light:
- hash: v1.k794b7964.f0fbceb29ededf3b34b97b3c6b86bd0797b25a9135aec3fd583a6aed09f45c9c.sjcRTwrc9JZz7_05WxzsN4bl_Ybjlo6am8hHKWvrqGk
- scenes-app-replay-vision-watchfeedemptystate--quiet-window--dark:
- hash: v1.k794b7964.c4ed5fbd745303fc8ebcd4ac215fc9022b99c4188f963d99b15d721bb15935d8.wZ2qbLFdR0hBmesjaQ0prKaHK4-j0dUW0DdP0danhEE
- scenes-app-replay-vision-watchfeedemptystate--quiet-window--light:
- hash: v1.k794b7964.1f589f91ce12f7c154679d17d97a21c8e203aa87397164cccc78157535b977d3.MfHogT00qi5y8x4FSB5fNPlsH5snNQP9JVY6dWPbAFE
- scenes-app-replay-vision-watchfeedemptystate--quota-exhausted--dark:
- hash: v1.k794b7964.b1f47cd49f93204542abf607f565859a592273ca11d2c068f04b04bd32049409.UtIhUrTC1d46S9kkqMXQEljNax3AtJYIxgAiUxeNWL8
- scenes-app-replay-vision-watchfeedemptystate--quota-exhausted--light:
- hash: v1.k794b7964.206cb4c6e3d6ae106a0e07edb31a30c597af6fa2917a5e19330d1b3dfdb3622a.84P18hlPeqHHEv8WDiFn8zetROCxHJqdgZGHZYrvDgM
scenes-app-saved-insights--empty-state--dark:
hash: v1.k794b7964.8186a1849accab762928456f98db977a9b097cf28199d7e1eb6c1e841500852c.SXNRf2LgiH3DkvhwUukZcGqDXngv1kGiEhGYUAhlKC8
scenes-app-saved-insights--empty-state--light:
diff --git a/frontend/src/initKea.ts b/frontend/src/initKea.ts
index 1995beca51fc..7bc782546093 100644
--- a/frontend/src/initKea.ts
+++ b/frontend/src/initKea.ts
@@ -115,7 +115,7 @@ const ERROR_FILTER_ALLOW_LIST_BY_LOGIC_PATH: Record<string, string> = {
loadFullReport: 'scenes.project-homepage.today.todayReportLogic',
loadPage: 'scenes.project-homepage.today.todayReportLogic',
loadReportDiff: 'scenes.inbox.logics.inboxReportDetailLogic',
- loadMembers: 'products.replay_vision.frontend.replay_scanners.watchFeedGroupLogic', // The feed card shows its own retry
+ loadMembers: 'products.replay_vision.frontend.replay_scanners.highlightFeedGroupLogic', // The feed card shows its own retry
loadTraceSpans: 'products.tracing.frontend.components.TraceDialog.traceDialogLogic', // The dialog shows its own retry
loadPreview: 'products.metrics.frontend.components.metricVariableEditorLogic', // The variable editor shows the error under the preview
loadSiteProfiles: 'products.webAnalytics.contentAutopilot.contentAutopilotLogic',
diff --git a/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx b/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx
index 5ad3de25a416..9abf0cc0db19 100644
--- a/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx
+++ b/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx
@@ -22,7 +22,7 @@ import { usePlayerMounted } from './usePlayerMounted'
export interface ReplayListColumnProps {
logicKey: string
recordingsList: ReactNode
- /** The What to watch list, when the picks experiment offers one. */
+ /** The Highlights list, when the picks experiment offers one. */
picksList?: ReactNode
picksMode: ReplayListPicksMode
unwatchedPicksCount?: number
@@ -79,7 +79,7 @@ function ReplayListColumnView({
value: 'picks' as const,
label: (
<span className="flex items-center gap-1">
- <span>What to watch</span>
+ <span>Highlights</span>
{unwatchedPicksCount > 0 && (
<LemonBadge.Number count={unwatchedPicksCount} size="small" status="muted" />
)}
diff --git a/frontend/src/scenes/session-recordings/playlist/ReplayListColumnWithPicks.tsx b/frontend/src/scenes/session-recordings/playlist/ReplayListColumnWithPicks.tsx
index 4ec2f02d568a..a51b55095610 100644
--- a/frontend/src/scenes/session-recordings/playlist/ReplayListColumnWithPicks.tsx
+++ b/frontend/src/scenes/session-recordings/playlist/ReplayListColumnWithPicks.tsx
@@ -1,9 +1,9 @@
import { useActions, useMountedLogic, useValues } from 'kea'
import { ReactNode } from 'react'
-import { WatchPicksList } from 'products/replay_vision/frontend/replay_scanners/components/WatchPicksList'
-import { watchPicksLogic } from 'products/replay_vision/frontend/replay_scanners/watchPicksLogic'
-import { watchPicksStarterLogic } from 'products/replay_vision/frontend/replay_scanners/watchPicksStarterLogic'
+import { HighlightPicksList } from 'products/replay_vision/frontend/replay_scanners/components/HighlightPicksList'
+import { highlightPicksLogic } from 'products/replay_vision/frontend/replay_scanners/highlightPicksLogic'
+import { highlightPicksStarterLogic } from 'products/replay_vision/frontend/replay_scanners/highlightPicksStarterLogic'
import { ReplayListColumn } from './ReplayListColumn'
@@ -14,16 +14,16 @@ export function ReplayListColumnWithPicks({
logicKey: string
recordingsList: ReactNode
}): JSX.Element {
- const picksLogic = useMountedLogic(watchPicksLogic)
+ const picksLogic = useMountedLogic(highlightPicksLogic)
const { effectiveListMode, unwatchedCount } = useValues(picksLogic)
const { setListMode } = useActions(picksLogic)
- useMountedLogic(watchPicksStarterLogic(picksLogic.props))
+ useMountedLogic(highlightPicksStarterLogic(picksLogic.props))
return (
<ReplayListColumn
logicKey={logicKey}
recordingsList={recordingsList}
- picksList={<WatchPicksList />}
+ picksList={<HighlightPicksList />}
picksMode={effectiveListMode}
unwatchedPicksCount={unwatchedCount}
onPicksSelected={(selected) => setListMode(selected ? 'picks' : 'recordings')}
diff --git a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx
index 1abe394b826a..2a86119e5de3 100644
--- a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx
+++ b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx
@@ -17,8 +17,8 @@ import { Playlist } from 'scenes/session-recordings/playlist/Playlist'
import { panelLayoutLogic } from '~/layout/panel-layout/panelLayoutLogic'
-import { WatchPicksListColumn } from 'products/replay_vision/frontend/replay_scanners/components/WatchPicksListColumn'
-import { watchPicksLogic } from 'products/replay_vision/frontend/replay_scanners/watchPicksLogic'
+import { HighlightPicksListColumn } from 'products/replay_vision/frontend/replay_scanners/components/HighlightPicksListColumn'
+import { highlightPicksLogic } from 'products/replay_vision/frontend/replay_scanners/highlightPicksLogic'
import { RecordingsUniversalFiltersEmbed } from '../filters/RecordingsUniversalFiltersEmbed'
import { playerSettingsLogic } from '../player/playerSettingsLogic'
@@ -90,7 +90,7 @@ export function SessionRecordingsPlaylist({
<BindLogic logic={sessionRecordingsPlaylistLogic} props={logicProps}>
{picksInList ? (
<BindLogic
- logic={watchPicksLogic}
+ logic={highlightPicksLogic}
props={{ logicKey: logicProps.logicKey ?? 'playlist', playlistLogicProps: logicProps }}
>
{layout}
@@ -121,7 +121,7 @@ function PlaylistColumn({ picksInList, ...props }: LayoutProps): JSX.Element {
)
}
if (picksInList) {
- return <WatchPicksListColumn recordingsList={<Playlist {...props} />} />
+ return <HighlightPicksListColumn recordingsList={<Playlist {...props} />} />
}
return <Playlist {...props} />
}
diff --git a/posthog/rate_limit.py b/posthog/rate_limit.py
index b3aa833ddc51..de99e63ff5ba 100644
--- a/posthog/rate_limit.py
+++ b/posthog/rate_limit.py
@@ -778,23 +778,23 @@ class ReplayVisionEstimateSustainedRateThrottle(_TeamBucketRateThrottle):
rate = "200/hour"
-# The watch feed windows, ranks and hydrates a slice of the team's observation history per call, and
+# The highlight feed windows, ranks and hydrates a slice of the team's observation history per call, and
# its primary caller is the session-authenticated home tab, which the default Burst/Sustained
# throttles bypass. Team-wide bucket so minting keys doesn't multiply the budget.
-class ReplayVisionWatchFeedBurstRateThrottle(_TeamBucketRateThrottle):
- scope = "replay_vision_watch_feed_burst"
+class ReplayVisionHighlightFeedBurstRateThrottle(_TeamBucketRateThrottle):
+ scope = "replay_vision_highlight_feed_burst"
rate = "60/minute"
-class ReplayVisionWatchFeedSustainedRateThrottle(_TeamBucketRateThrottle):
- scope = "replay_vision_watch_feed_sustained"
+class ReplayVisionHighlightFeedSustainedRateThrottle(_TeamBucketRateThrottle):
+ scope = "replay_vision_highlight_feed_sustained"
rate = "600/hour"
# Impression reports arrive while a reader scrolls, so they get their own per-user bucket and never use up the
# team's feed bucket.
-class ReplayVisionWatchFeedImpressionsRateThrottle(_UserBucketRateThrottle):
- scope = "replay_vision_watch_feed_impressions"
+class ReplayVisionHighlightFeedImpressionsRateThrottle(_UserBucketRateThrottle):
+ scope = "replay_vision_highlight_feed_impressions"
rate = "120/minute"
diff --git a/posthog/test/repo_invariants/signals_scout_tool_citations_baseline.txt b/posthog/test/repo_invariants/signals_scout_tool_citations_baseline.txt
index b619781fb072..020aa9b2225b 100644
--- a/posthog/test/repo_invariants/signals_scout_tool_citations_baseline.txt
+++ b/posthog/test/repo_invariants/signals_scout_tool_citations_baseline.txt
@@ -62,7 +62,7 @@ vision-scanners-observations-stats
vision-scanners-scan-session
vision-scanners-scan-sessions
vision-scanners-self-driving-stats
-vision-scanners-watch-feed
+vision-scanners-highlight-feed
web-analytics-weekly-digest
workflows-global-stats
workflows-list-invocations
diff --git a/products/replay_vision/backend/api/observations.py b/products/replay_vision/backend/api/observations.py
index f696eed1cb24..d939be8b7ffc 100644
--- a/products/replay_vision/backend/api/observations.py
+++ b/products/replay_vision/backend/api/observations.py
@@ -776,7 +776,7 @@ class ReplayObservationFilter(django_filters.FilterSet):
watch_group = django_filters.UUIDFilter(
method="_filter_watch_group",
help_text=(
- "Only observations the watch feed groups with this observation as near duplicates, including itself. "
+ "Only observations the highlight feed groups with this observation as near duplicates, including itself. "
"Pair it with the feed's `date_from` to list the sessions a feed card counts."
),
)
diff --git a/products/replay_vision/backend/api/scanners.py b/products/replay_vision/backend/api/scanners.py
index 6937e6434e27..3fc90691912b 100644
--- a/products/replay_vision/backend/api/scanners.py
+++ b/products/replay_vision/backend/api/scanners.py
@@ -60,9 +60,9 @@ from posthog.rate_limit import (
AISustainedRateThrottle,
ReplayVisionEstimateBurstRateThrottle,
ReplayVisionEstimateSustainedRateThrottle,
- ReplayVisionWatchFeedBurstRateThrottle,
- ReplayVisionWatchFeedImpressionsRateThrottle,
- ReplayVisionWatchFeedSustainedRateThrottle,
+ ReplayVisionHighlightFeedBurstRateThrottle,
+ ReplayVisionHighlightFeedImpressionsRateThrottle,
+ ReplayVisionHighlightFeedSustainedRateThrottle,
)
from products.access_control.backend.presentation.access_control import (
@@ -88,6 +88,8 @@ from products.replay_vision.backend.api.trigger import (
from products.replay_vision.backend.billing import observation_credits_for_model, projected_monthly_credits
from products.replay_vision.backend.built_in_scans import BUILT_IN_SCANS, BuiltInScanKey
from products.replay_vision.backend.consent import AI_CONSENT_REQUIRED_CODE
+from products.replay_vision.backend.highlight_feed import HIGHLIGHT_FEED_MIN_ITEMS
+from products.replay_vision.backend.highlight_feed_impressions import feed_impression_counts, record_feed_impressions
from products.replay_vision.backend.impact import (
DEFAULT_IMPACT_WINDOW_DAYS,
compute_scanner_impact,
@@ -179,10 +181,8 @@ from products.replay_vision.backend.session_limits import MAX_SESSION_ID_LENGTH
from products.replay_vision.backend.temporal.constants import VISION_SIGNALS_SOURCE_PRODUCT, VISION_SIGNALS_SOURCE_TYPE
from products.replay_vision.backend.temporal.metrics import record_estimate_outcome, record_scanner_limit_reached
from products.replay_vision.backend.temporal.read_meter_types import current_sweep_throttle_factor
-from products.replay_vision.backend.watch_feed import WATCH_FEED_MIN_ITEMS
-from products.replay_vision.backend.watch_feed_impressions import feed_impression_counts, record_feed_impressions
from products.replay_vision.backend.watch_rank import (
- rank_watch_feed_by_embedding,
+ rank_highlight_feed_by_embedding,
select_embedding_filler,
select_embedding_picks,
)
@@ -1647,18 +1647,18 @@ class ScannerStatsResponseSerializer(serializers.Serializer):
)
-WATCH_FEED_DEFAULT_LIMIT = 20
-WATCH_FEED_MAX_LIMIT = 50
-WATCH_FEED_DEFAULT_DATE_FROM = "-7d"
+HIGHLIGHT_FEED_DEFAULT_LIMIT = 20
+HIGHLIGHT_FEED_MAX_LIMIT = 50
+HIGHLIGHT_FEED_DEFAULT_DATE_FROM = "-7d"
# Widest window one request may rank.
-WATCH_FEED_MAX_WINDOW_DAYS = 90
+HIGHLIGHT_FEED_MAX_WINDOW_DAYS = 90
# The most picks one load ranks, and the furthest `offset` may reach.
-WATCH_FEED_CANDIDATE_CAP = 1000
-WATCH_FEED_IMPRESSIONS_MAX_IDS = 100
+HIGHLIGHT_FEED_CANDIDATE_CAP = 1000
+HIGHLIGHT_FEED_IMPRESSIONS_MAX_IDS = 100
# Loads in one bucket share their picks, so a reload or tab switch skips the pick query.
-WATCH_FEED_PICKS_BUCKET_S = 10 * 60
+HIGHLIGHT_FEED_PICKS_BUCKET_S = 10 * 60
# Outlives the bucket by long enough to cover a reader scrolling one load.
-WATCH_FEED_PICKS_CACHE_TTL_S = WATCH_FEED_PICKS_BUCKET_S + 15 * 60
+HIGHLIGHT_FEED_PICKS_CACHE_TTL_S = HIGHLIGHT_FEED_PICKS_BUCKET_S + 15 * 60
def refresh_feed_viewed(rows: list[dict[str, Any]], viewer_id: int, as_of: datetime) -> list[dict[str, Any]]:
@@ -1671,28 +1671,28 @@ def refresh_feed_viewed(rows: list[dict[str, Any]], viewer_id: int, as_of: datet
return [{**row, "feed_viewed": row["id"] in viewed} for row in rows]
-class WatchFeedCategory(models.TextChoices):
+class HighlightFeedCategory(models.TextChoices):
FAILURE = "failure"
STRUGGLE = "struggle"
REVENUE = "revenue"
-class WatchFeedReason(models.TextChoices):
+class HighlightFeedReason(models.TextChoices):
EMBEDDING_PICK = "embedding_pick"
UNVIEWED_RECENT = "unviewed_recent"
RECENT = "recent"
-class WatchFeedQuerySerializer(serializers.Serializer):
- """Query parameters of GET /vision/scanners/watch_feed/."""
+class HighlightFeedQuerySerializer(serializers.Serializer):
+ """Query parameters of GET /vision/scanners/highlight_feed/."""
date_from = serializers.CharField(
required=False,
- default=WATCH_FEED_DEFAULT_DATE_FROM,
+ default=HIGHLIGHT_FEED_DEFAULT_DATE_FROM,
help_text=(
"Only observations created at or after this time. Accepts ISO 8601, a relative date like `-7d`, "
"or `now`; values without an explicit offset are interpreted in the project's timezone. The window "
- f"between `date_from` and `date_to` may span at most {WATCH_FEED_MAX_WINDOW_DAYS} days."
+ f"between `date_from` and `date_to` may span at most {HIGHLIGHT_FEED_MAX_WINDOW_DAYS} days."
),
)
date_to = serializers.CharField(
@@ -1724,11 +1724,11 @@ class WatchFeedQuerySerializer(serializers.Serializer):
)
limit = serializers.IntegerField(
required=False,
- default=WATCH_FEED_DEFAULT_LIMIT,
+ default=HIGHLIGHT_FEED_DEFAULT_LIMIT,
min_value=1,
- max_value=WATCH_FEED_MAX_LIMIT,
+ max_value=HIGHLIGHT_FEED_MAX_LIMIT,
help_text=(
- f"Ceiling on feed items to return per page, at most {WATCH_FEED_MAX_LIMIT}. A page routinely "
+ f"Ceiling on feed items to return per page, at most {HIGHLIGHT_FEED_MAX_LIMIT}. A page routinely "
"returns fewer: a window is not padded to this number with clips that carry no finding."
),
)
@@ -1736,7 +1736,7 @@ class WatchFeedQuerySerializer(serializers.Serializer):
required=False,
default=0,
min_value=0,
- max_value=WATCH_FEED_CANDIDATE_CAP,
+ max_value=HIGHLIGHT_FEED_CANDIDATE_CAP,
help_text="How many ranked items to skip. Send `as_of` with every page after the first.",
)
as_of = serializers.DateTimeField(
@@ -1768,11 +1768,11 @@ class WatchFeedQuerySerializer(serializers.Serializer):
return [int(raw_id) for raw_id in raw_ids]
-class WatchFeedReasonSerializer(serializers.Serializer):
+class HighlightFeedReasonSerializer(serializers.Serializer):
"""Machine-readable reason an observation made the feed; the frontend renders the copy."""
kind = serializers.ChoiceField(
- choices=WatchFeedReason.choices,
+ choices=HighlightFeedReason.choices,
help_text=(
"Why the observation is in the feed: `embedding_pick` (the session reads like a failure, struggle, "
"or revenue moment and ranks in its scanner's top fifth), "
@@ -1780,7 +1780,7 @@ class WatchFeedReasonSerializer(serializers.Serializer):
),
)
watch_category = serializers.ChoiceField(
- choices=WatchFeedCategory.choices,
+ choices=HighlightFeedCategory.choices,
required=False,
help_text="What the session reads like, for `embedding_pick`.",
)
@@ -1802,17 +1802,17 @@ class WatchFeedReasonSerializer(serializers.Serializer):
)
-class WatchFeedItemSerializer(serializers.Serializer):
+class HighlightFeedItemSerializer(serializers.Serializer):
"""One feed entry: the observation plus why it ranked."""
observation = ReplayObservationSerializer(help_text="The observation, in the standard shape.")
- reason = WatchFeedReasonSerializer(help_text="Why this observation made the feed.")
+ reason = HighlightFeedReasonSerializer(help_text="Why this observation made the feed.")
-class WatchFeedResponseSerializer(serializers.Serializer):
- """Response of GET /vision/scanners/watch_feed/."""
+class HighlightFeedResponseSerializer(serializers.Serializer):
+ """Response of GET /vision/scanners/highlight_feed/."""
- results = WatchFeedItemSerializer(
+ results = HighlightFeedItemSerializer(
many=True,
help_text=(
"Succeeded observations in the window worth watching, most interesting first, each carrying the "
@@ -1829,8 +1829,8 @@ class WatchFeedResponseSerializer(serializers.Serializer):
)
-class WatchFeedImpressionsSerializer(serializers.Serializer):
- """Body of POST /vision/scanners/watch_feed_impressions/."""
+class HighlightFeedImpressionsSerializer(serializers.Serializer):
+ """Body of POST /vision/scanners/highlight_feed_impressions/."""
feed_load_id = serializers.UUIDField(
help_text="The client's id for the feed load that showed these cards. One load counts each card once.",
@@ -1838,9 +1838,9 @@ class WatchFeedImpressionsSerializer(serializers.Serializer):
observation_ids = serializers.ListField(
child=serializers.UUIDField(),
min_length=1,
- max_length=WATCH_FEED_IMPRESSIONS_MAX_IDS,
+ max_length=HIGHLIGHT_FEED_IMPRESSIONS_MAX_IDS,
help_text=(
- f"Observations the calling user saw in the Highlights feed, at most {WATCH_FEED_IMPRESSIONS_MAX_IDS}. "
+ f"Observations the calling user saw in the Highlights feed, at most {HIGHLIGHT_FEED_IMPRESSIONS_MAX_IDS}. "
"Ids the user cannot read are ignored."
),
)
@@ -2200,7 +2200,7 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vi
"creators",
"stats",
"self_driving_stats",
- "watch_feed",
+ "highlight_feed",
]
scope_object_write_actions = [
"create",
@@ -2428,19 +2428,19 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vi
return Response({"total": total, "enabled": enabled, "by_type": by_type})
@extend_schema(
- parameters=[WatchFeedQuerySerializer],
- responses={200: WatchFeedResponseSerializer},
+ parameters=[HighlightFeedQuerySerializer],
+ responses={200: HighlightFeedResponseSerializer},
)
@action(
detail=False,
methods=["get"],
pagination_class=None,
required_scopes=["replay_scanner:read", "session_recording:read"],
- throttle_classes=[ReplayVisionWatchFeedBurstRateThrottle, ReplayVisionWatchFeedSustainedRateThrottle],
+ throttle_classes=[ReplayVisionHighlightFeedBurstRateThrottle, ReplayVisionHighlightFeedSustainedRateThrottle],
)
- def watch_feed(self, request: Request, **kwargs: Any) -> Response:
+ def highlight_feed(self, request: Request, **kwargs: Any) -> Response:
"""Succeeded observations in the window worth watching, ranked for the Highlights tab."""
- query = WatchFeedQuerySerializer(data=request.query_params)
+ query = HighlightFeedQuerySerializer(data=request.query_params)
query.is_valid(raise_exception=True)
params = query.validated_data
# Observations expose recording-derived output, so reading them requires session_recording read.
@@ -2458,9 +2458,9 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vi
except ValueError as e:
raise ValidationError(str(e))
window_end = min(date_to, as_of) if date_to is not None else as_of
- if window_end - date_from > timedelta(days=WATCH_FEED_MAX_WINDOW_DAYS):
+ if window_end - date_from > timedelta(days=HIGHLIGHT_FEED_MAX_WINDOW_DAYS):
raise ValidationError(
- f"The window between date_from and date_to may span at most {WATCH_FEED_MAX_WINDOW_DAYS} days."
+ f"The window between date_from and date_to may span at most {HIGHLIGHT_FEED_MAX_WINDOW_DAYS} days."
)
# Scanner RBAC plus current experiment targeting; unreadable ids drop out silently so the
# response never confirms which of the requested scanners exist.
@@ -2513,13 +2513,13 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vi
# Keyed on the bucket `as_of` falls in, so loads in one bucket share picks, and on the dismissals and the
# readable experiments, so a dismissal or an access change ranks afresh.
picks_key = (
- "replay_vision:watch_picks:"
+ "replay_vision:highlight_picks:"
+ hashlib.sha256(
json.dumps(
[
self.team_id,
viewer_id,
- int(as_of.timestamp()) // WATCH_FEED_PICKS_BUCKET_S,
+ int(as_of.timestamp()) // HIGHLIGHT_FEED_PICKS_BUCKET_S,
params["date_from"],
params.get("date_to"),
list(map(str, dismissed_ids)),
@@ -2540,16 +2540,16 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vi
else:
# The embedding ranker reads only a small stored rank, so it picks over the whole window in SQL.
candidate_rows = select_embedding_picks(
- walkable, allowed_ids, viewed, self.user_access_control, self.team_id, WATCH_FEED_CANDIDATE_CAP
+ walkable, allowed_ids, viewed, self.user_access_control, self.team_id, HIGHLIGHT_FEED_CANDIDATE_CAP
)
# Picks in one feed group collapse into one card, so the floor counts groups.
pick_roots = {row["watch_group_root"] for row in candidate_rows}
- if len(pick_roots) < WATCH_FEED_MIN_ITEMS:
+ if len(pick_roots) < HIGHLIGHT_FEED_MIN_ITEMS:
candidate_rows += select_embedding_filler(
walkable, allowed_ids, viewed, self.user_access_control, self.team_id, pick_roots
)
# The first load in the bucket keeps the entry, so concurrent loads never replace it with later picks.
- cache.add(picks_key, (as_of, candidate_rows), WATCH_FEED_PICKS_CACHE_TTL_S)
+ cache.add(picks_key, (as_of, candidate_rows), HIGHLIGHT_FEED_PICKS_CACHE_TTL_S)
page_end = params["offset"] + params["limit"]
impressions = feed_impression_counts(
team_id=self.team_id,
@@ -2559,7 +2559,7 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vi
)
for row in candidate_rows:
row["feed_impressions"] = impressions.get(row["id"], 0)
- ranked = rank_watch_feed_by_embedding(candidate_rows)
+ ranked = rank_highlight_feed_by_embedding(candidate_rows)
has_more = len(ranked) > page_end
ranked = ranked[params["offset"] : page_end]
reasons_by_id = {entry.observation_id: entry.reason for entry in ranked}
@@ -2594,18 +2594,18 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vi
}
)
- @extend_schema(request=WatchFeedImpressionsSerializer, responses={204: None})
+ @extend_schema(request=HighlightFeedImpressionsSerializer, responses={204: None})
@action(
detail=False,
methods=["post"],
pagination_class=None,
# Per-user state, like an observation's `viewed`, so read scope is enough.
required_scopes=["replay_scanner:read", "session_recording:read"],
- throttle_classes=[ReplayVisionWatchFeedImpressionsRateThrottle],
+ throttle_classes=[ReplayVisionHighlightFeedImpressionsRateThrottle],
)
- def watch_feed_impressions(self, request: Request, **kwargs: Any) -> Response:
+ def highlight_feed_impressions(self, request: Request, **kwargs: Any) -> Response:
"""Record that the calling user saw these cards in the Highlights feed, so the feed ranks them lower next time."""
- body = WatchFeedImpressionsSerializer(data=request.data)
+ body = HighlightFeedImpressionsSerializer(data=request.data)
body.is_valid(raise_exception=True)
if not self.user_access_control.check_access_level_for_resource("session_recording", required_level="viewer"):
raise PermissionDenied("Reading replay observations requires session_recording read access.")
diff --git a/products/replay_vision/backend/watch_feed.py b/products/replay_vision/backend/highlight_feed.py
similarity index 78%
rename from products/replay_vision/backend/watch_feed.py
rename to products/replay_vision/backend/highlight_feed.py
index 227a9cc02760..b2b84f2d38b8 100644
--- a/products/replay_vision/backend/watch_feed.py
+++ b/products/replay_vision/backend/highlight_feed.py
@@ -8,11 +8,11 @@ from uuid import UUID
from posthog.dataclasses import frozen
# Filler pads a quiet feed to this many cards, so a window with nothing wrong still shows the newest clips.
-WATCH_FEED_MIN_ITEMS = 3
+HIGHLIGHT_FEED_MIN_ITEMS = 3
@frozen
-class WatchFeedEntry:
+class HighlightFeedEntry:
observation_id: UUID
reason: dict[str, Any]
# None opts the entry out of session spacing.
@@ -25,15 +25,15 @@ MAX_SCANNER_SHARE = 0.4
_SCANNER_SPREAD_FLOOR = 3
-def spread_scanners(ordered: list[tuple[Any, WatchFeedEntry]]) -> list[WatchFeedEntry]:
+def spread_scanners(ordered: list[tuple[Any, HighlightFeedEntry]]) -> list[HighlightFeedEntry]:
"""Hold each scanner to MAX_SCANNER_SHARE of the picks as it is placed.
Checked per place rather than over the whole list because the view slices the head: a feed of 5
obeys the same share as a feed of 50. Overflow trails the picks in score order — reordering
for breadth is the job here, shortening the feed is not.
"""
- placed: list[WatchFeedEntry] = []
- deferred: list[WatchFeedEntry] = []
+ placed: list[HighlightFeedEntry] = []
+ deferred: list[HighlightFeedEntry] = []
counts: dict[Any, int] = {}
for scanner_id, entry in ordered:
allowed = max(_SCANNER_SPREAD_FLOOR, math.ceil(MAX_SCANNER_SHARE * (len(placed) + 1)))
@@ -50,14 +50,14 @@ def spread_scanners(ordered: list[tuple[Any, WatchFeedEntry]]) -> list[WatchFeed
SESSION_SPACING = 5
-def space_sessions(entries: list[WatchFeedEntry]) -> list[WatchFeedEntry]:
+def space_sessions(entries: list[HighlightFeedEntry]) -> list[HighlightFeedEntry]:
"""Keep each session's cards at least SESSION_SPACING places apart, reordering but never dropping one.
A held card returns at the first place its session allows, so score order holds otherwise. A feed
with too few other sessions to space every repeat still ends with every card, in score order.
"""
- placed: list[WatchFeedEntry] = []
- waiting: list[WatchFeedEntry] = []
+ placed: list[HighlightFeedEntry] = []
+ waiting: list[HighlightFeedEntry] = []
for entry in entries:
waiting.append(entry)
while waiting:
@@ -71,16 +71,16 @@ def space_sessions(entries: list[WatchFeedEntry]) -> list[WatchFeedEntry]:
def finish_feed(
- picks: list[tuple[float, Any, Any, WatchFeedEntry]], filler_rows: list[dict[str, Any]]
-) -> list[WatchFeedEntry]:
+ picks: list[tuple[float, Any, Any, HighlightFeedEntry]], filler_rows: list[dict[str, Any]]
+) -> list[HighlightFeedEntry]:
"""Order `(score, created_at, scanner_id, entry)` picks with the scanner spread and session spacing,
then pad with `filler_rows` newest and unviewed first, trimmed to the feed's floor."""
ordered = sorted(picks, key=lambda item: (item[0], item[1]), reverse=True)
- filler: list[tuple[bool, Any, WatchFeedEntry]] = []
+ filler: list[tuple[bool, Any, HighlightFeedEntry]] = []
for row in filler_rows:
viewed = bool(row.get("feed_viewed"))
- entry = WatchFeedEntry(observation_id=row["id"], reason={"kind": "recent" if viewed else "unviewed_recent"})
+ entry = HighlightFeedEntry(observation_id=row["id"], reason={"kind": "recent" if viewed else "unviewed_recent"})
filler.append((not viewed, row["created_at"], entry))
filler.sort(key=lambda item: (item[0], item[1]), reverse=True)
placed = space_sessions(spread_scanners([(scanner_id, entry) for _, _, scanner_id, entry in ordered]))
- return placed + [entry for *_, entry in filler][: max(0, WATCH_FEED_MIN_ITEMS - len(placed))]
+ return placed + [entry for *_, entry in filler][: max(0, HIGHLIGHT_FEED_MIN_ITEMS - len(placed))]
diff --git a/products/replay_vision/backend/watch_feed_groups.py b/products/replay_vision/backend/highlight_feed_groups.py
similarity index 100%
rename from products/replay_vision/backend/watch_feed_groups.py
rename to products/replay_vision/backend/highlight_feed_groups.py
diff --git a/products/replay_vision/backend/watch_feed_impressions.py b/products/replay_vision/backend/highlight_feed_impressions.py
similarity index 100%
rename from products/replay_vision/backend/watch_feed_impressions.py
rename to products/replay_vision/backend/highlight_feed_impressions.py
diff --git a/products/replay_vision/backend/management/commands/backfill_replay_vision_watch_ranks.py b/products/replay_vision/backend/management/commands/backfill_replay_vision_watch_ranks.py
index 4ce8e84feb6f..73d7f3b981a7 100644
--- a/products/replay_vision/backend/management/commands/backfill_replay_vision_watch_ranks.py
+++ b/products/replay_vision/backend/management/commands/backfill_replay_vision_watch_ranks.py
@@ -12,7 +12,7 @@ from products.replay_vision.backend.watch_rank_backfill import (
class Command(BaseCommand):
- help = "Rank recent Replay Vision observations for What to watch from the embeddings search already stored"
+ help = "Rank recent Replay Vision observations for the highlight feed from the embeddings search already stored"
def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument("--team-id", type=int, action="append", help="Only this team; repeat for more")
diff --git a/products/replay_vision/backend/management/commands/run_replay_vision_watch_rank_consumer.py b/products/replay_vision/backend/management/commands/run_replay_vision_watch_rank_consumer.py
index dfb72cd6813e..82b99c6fe56e 100644
--- a/products/replay_vision/backend/management/commands/run_replay_vision_watch_rank_consumer.py
+++ b/products/replay_vision/backend/management/commands/run_replay_vision_watch_rank_consumer.py
@@ -12,7 +12,7 @@ from products.replay_vision.backend.watch_rank_consumer import WatchRankConsumer
class Command(BaseCommand):
- help = "Rank Replay Vision observations for What to watch from the embedding worker's results topic"
+ help = "Rank Replay Vision observations for the highlight feed from the embedding worker's results topic"
def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument("--health-port", type=int, default=8090, help="Port for /healthz and /readyz")
diff --git a/products/replay_vision/backend/migrations/0141_replayobservation_watch_rank_help_text.py b/products/replay_vision/backend/migrations/0141_replayobservation_watch_rank_help_text.py
new file mode 100644
index 000000000000..c510f6403f4f
--- /dev/null
+++ b/products/replay_vision/backend/migrations/0141_replayobservation_watch_rank_help_text.py
@@ -0,0 +1,21 @@
+# Generated by Django 5.2.18 on 2026-10-28 22:40
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("replay_vision", "0140_drop_replayobservationmedia_rec_start_ms"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="replayobservation",
+ name="watch_rank",
+ field=models.JSONField(
+ blank=True,
+ help_text="Highlight feed ranking derived from the observation's embedding; see `watch_rank.WatchRank`.",
+ null=True,
+ ),
+ ),
+ ]
diff --git a/products/replay_vision/backend/migrations/max_migration.txt b/products/replay_vision/backend/migrations/max_migration.txt
index 795ba326782c..2e883a49afae 100644
--- a/products/replay_vision/backend/migrations/max_migration.txt
+++ b/products/replay_vision/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0140_drop_replayobservationmedia_rec_start_ms
+0141_replayobservation_watch_rank_help_text
diff --git a/products/replay_vision/backend/models/replay_observation.py b/products/replay_vision/backend/models/replay_observation.py
index 1cdbeabf55c8..d12f22c4f51e 100644
--- a/products/replay_vision/backend/models/replay_observation.py
+++ b/products/replay_vision/backend/models/replay_observation.py
@@ -115,7 +115,7 @@ class ReplayObservation(UUIDModel):
watch_rank = models.JSONField(
null=True,
blank=True,
- help_text="What to watch ranking derived from the observation's embedding; see `watch_rank.WatchRank`.",
+ help_text="Highlight feed ranking derived from the observation's embedding; see `watch_rank.WatchRank`.",
)
created_task_id = models.UUIDField(
null=True,
diff --git a/products/replay_vision/backend/models/replay_observation_feed_dismissal.py b/products/replay_vision/backend/models/replay_observation_feed_dismissal.py
index 6e5462e903aa..ddb6dca4a4cc 100644
--- a/products/replay_vision/backend/models/replay_observation_feed_dismissal.py
+++ b/products/replay_vision/backend/models/replay_observation_feed_dismissal.py
@@ -12,7 +12,7 @@ class FeedDismissalReason(models.TextChoices):
class ReplayObservationFeedDismissal(TeamScopedRootMixin, UUIDModel):
- """One user marked this observation not useful in What to watch. Per user, like `ReplayObservationView`."""
+ """One user marked this observation not useful in Highlights. Per user, like `ReplayObservationView`."""
# The unique constraint leads with observation_id, so a separate index on it would only slow writes.
observation = models.ForeignKey(
diff --git a/products/replay_vision/backend/models/replay_observation_feed_impression.py b/products/replay_vision/backend/models/replay_observation_feed_impression.py
index a8467f918596..0efaba55addd 100644
--- a/products/replay_vision/backend/models/replay_observation_feed_impression.py
+++ b/products/replay_vision/backend/models/replay_observation_feed_impression.py
@@ -5,7 +5,7 @@ from posthog.models.utils import UUIDModel
class ReplayObservationFeedImpression(TeamScopedRootMixin, UUIDModel):
- """How often What to watch showed this observation to one user, so the feed can rank it lower each time."""
+ """How often Highlights showed this observation to one user, so the feed can rank it lower each time."""
# The unique constraint leads with observation_id, so a separate index on it would only slow writes.
observation = models.ForeignKey(
diff --git a/products/replay_vision/backend/temporal/activities/embed_observation.py b/products/replay_vision/backend/temporal/activities/embed_observation.py
index ec2fdcbaa2ce..22f04abdcb48 100644
--- a/products/replay_vision/backend/temporal/activities/embed_observation.py
+++ b/products/replay_vision/backend/temporal/activities/embed_observation.py
@@ -6,7 +6,7 @@ via `metadata.scanner_id` for later natural-language search. monitor/classifier/
document under `rendering="summary"`. Empty content is skipped. Failures surface to the workflow, which
logs and swallows them — the observation is already marked succeeded.
-The worker's results topic feeds What to watch ranking, see `watch_rank_consumer`.
+The worker's results topic feeds Highlight feed ranking, see `watch_rank_consumer`.
The structured result (monitor `verdict`, scorer `score`, classifier `tags`) is stamped into `metadata` so
search can filter by exact outcome inside the same ClickHouse ranking query, with no second-pass lookup.
diff --git a/products/replay_vision/backend/temporal/activities/emit_observation_signal.py b/products/replay_vision/backend/temporal/activities/emit_observation_signal.py
index 21239fcaca97..23cdaa79e1b4 100644
--- a/products/replay_vision/backend/temporal/activities/emit_observation_signal.py
+++ b/products/replay_vision/backend/temporal/activities/emit_observation_signal.py
@@ -134,5 +134,5 @@ def _emit_observation_signals(inputs: EmitObservationSignalInputs) -> list[Emitt
@track_activity(side_effect="signal")
def emit_observation_signal_summaries_activity(inputs: EmitObservationSignalInputs) -> list[EmittedSignal]:
"""Emit the observation's side-mission findings and return each emitted signal, in emission order — the
- watch feed names them on the card and weighs them by confidence when it ranks."""
+ highlight feed names them on the card and weighs them by confidence when it ranks."""
return _emit_observation_signals(inputs)
diff --git a/products/replay_vision/backend/temporal/scanners/base.py b/products/replay_vision/backend/temporal/scanners/base.py
index f5caf43925e1..763519132132 100644
--- a/products/replay_vision/backend/temporal/scanners/base.py
+++ b/products/replay_vision/backend/temporal/scanners/base.py
@@ -44,7 +44,7 @@ Segment = Annotated[TextSegment | ChipSegment, Field(discriminator="kind")]
# The side-mission calibration floor: templated into the prompt and enforced at emission.
MIN_SIGNAL_CONFIDENCE = 0.4
-# The watch feed lists up to three headlines on one line, so an overlong one reflows the whole card.
+# The highlight feed lists up to three headlines on one line, so an overlong one reflows the whole card.
SIGNAL_HEADLINE_MAX_LENGTH = 80
# Stable step names the producer (`mission_steps`) and consumers (`assemble`) key on.
diff --git a/products/replay_vision/backend/temporal/types.py b/products/replay_vision/backend/temporal/types.py
index a63516c8043a..a6e64e7f130b 100644
--- a/products/replay_vision/backend/temporal/types.py
+++ b/products/replay_vision/backend/temporal/types.py
@@ -40,7 +40,7 @@ class ScannerResult(BaseModel, frozen=True):
model_output: AnyScannerOutput
signals_count: int = Field(default=0, ge=0)
# The problem type of each signal actually emitted, in emission order and with repeats kept, so the
- # watch feed can count the kinds of issue a row carries. Empty on non-signal rows and on old rows.
+ # highlight feed can count the kinds of issue a row carries. Empty on non-signal rows and on old rows.
signal_problem_types: list[str] = Field(default_factory=list)
# The same signals with their headline and confidence, so the feed can name them rather than count them
# and can rank a weak finding below a strong one. Empty on non-signal rows and on rows scanned before
diff --git a/products/replay_vision/backend/tests/test_api.py b/products/replay_vision/backend/tests/test_api.py
index 75a41f5b9c29..3ef2e0d6e11f 100644
--- a/products/replay_vision/backend/tests/test_api.py
+++ b/products/replay_vision/backend/tests/test_api.py
@@ -36,9 +36,9 @@ from posthog.session_recordings.queries.test.session_replay_sql import produce_r
from products.access_control.backend.models.access_control import AccessControl
from products.experiments.backend.models.experiment import Experiment
from products.replay_vision.backend.api.scanners import (
- WATCH_FEED_PICKS_BUCKET_S,
+ HIGHLIGHT_FEED_PICKS_BUCKET_S,
+ HighlightFeedQuerySerializer,
ReplayScannerSerializer,
- WatchFeedQuerySerializer,
)
from products.replay_vision.backend.api.trigger import WorkflowStartOutcome, start_apply_scanner_workflow
from products.replay_vision.backend.billing import observation_credits_for_model
@@ -4764,7 +4764,7 @@ class TestInlineScanAction(_VisionAPITestCase):
start_workflow.assert_not_called()
-class TestWatchFeedQueryValidation(SimpleTestCase):
+class TestHighlightFeedQueryValidation(SimpleTestCase):
@parameterized.expand(
[
("empty_scanner_ids", {"scanner_ids": ""}),
@@ -4777,20 +4777,20 @@ class TestWatchFeedQueryValidation(SimpleTestCase):
]
)
def test_rejects_invalid_query(self, _name: str, params: dict[str, str]) -> None:
- serializer = WatchFeedQuerySerializer(data=params)
+ serializer = HighlightFeedQuerySerializer(data=params)
assert not serializer.is_valid()
def test_defaults_apply(self) -> None:
- serializer = WatchFeedQuerySerializer(data={})
+ serializer = HighlightFeedQuerySerializer(data={})
assert serializer.is_valid()
assert serializer.validated_data["date_from"] == "-7d"
assert serializer.validated_data["limit"] == 20
-class TestWatchFeedAPI(_VisionAPITestCase):
+class TestHighlightFeedAPI(_VisionAPITestCase):
@property
def feed_url(self) -> str:
- return f"{self.scanners_url}watch_feed/"
+ return f"{self.scanners_url}highlight_feed/"
def _succeeded_observation(
self,
@@ -4882,7 +4882,8 @@ class TestWatchFeedAPI(_VisionAPITestCase):
def test_a_later_loads_cached_picks_do_not_serve_an_earlier_loads_pages(self) -> None:
scanner = self._create_scanner(name="m")
bucket_start = datetime.fromtimestamp(
- (int(timezone.now().timestamp()) // WATCH_FEED_PICKS_BUCKET_S - 1) * WATCH_FEED_PICKS_BUCKET_S, tz=UTC
+ (int(timezone.now().timestamp()) // HIGHLIGHT_FEED_PICKS_BUCKET_S - 1) * HIGHLIGHT_FEED_PICKS_BUCKET_S,
+ tz=UTC,
)
earlier, later = bucket_start + timedelta(minutes=1), bucket_start + timedelta(minutes=5)
for index in range(12):
@@ -4951,7 +4952,7 @@ class TestWatchFeedAPI(_VisionAPITestCase):
}
)
- with patch("products.replay_vision.backend.api.scanners.WATCH_FEED_CANDIDATE_CAP", 2):
+ with patch("products.replay_vision.backend.api.scanners.HIGHLIGHT_FEED_CANDIDATE_CAP", 2):
items = self.client.get(self.feed_url).json()["results"]
picked = {item["observation"]["session_id"] for item in items if item["reason"]["kind"] == "embedding_pick"}
self.assertEqual(picked, {"busy-0", "quiet-0"})
@@ -4980,8 +4981,8 @@ class TestWatchFeedAPI(_VisionAPITestCase):
root_id = root_id or str(obs.id)
with (
- patch("products.replay_vision.backend.api.scanners.WATCH_FEED_CANDIDATE_CAP", cap),
- patch("products.replay_vision.backend.watch_rank.WATCH_PICK_GROUP_CANDIDATES", group_candidates),
+ patch("products.replay_vision.backend.api.scanners.HIGHLIGHT_FEED_CANDIDATE_CAP", cap),
+ patch("products.replay_vision.backend.watch_rank.HIGHLIGHT_PICK_GROUP_CANDIDATES", group_candidates),
):
items = self.client.get(self.feed_url).json()["results"]
picked = {item["observation"]["session_id"] for item in items if item["reason"]["kind"] == "embedding_pick"}
@@ -5033,7 +5034,7 @@ class TestWatchFeedAPI(_VisionAPITestCase):
for _ in range(2):
# The same load reporting twice, as a tab hidden and shown again does, counts once.
resp = self.client.post(
- f"{self.scanners_url}watch_feed_impressions/",
+ f"{self.scanners_url}highlight_feed_impressions/",
{"feed_load_id": str(load), "observation_ids": [str(rows["s-0"].id), str(foreign.id)]},
format="json",
)
@@ -5278,7 +5279,7 @@ class TestWatchFeedAPI(_VisionAPITestCase):
cache,
"get",
side_effect=lambda key, *args, **kwargs: (
- None if key.startswith("replay_vision:watch_picks:") else real_get(key, *args, **kwargs)
+ None if key.startswith("replay_vision:highlight_picks:") else real_get(key, *args, **kwargs)
),
)
with uncached_picks, CaptureQueriesContext(connection) as one:
diff --git a/products/replay_vision/backend/tests/test_scanners.py b/products/replay_vision/backend/tests/test_scanners.py
index 8b7df2f4be47..567620ee07a9 100644
--- a/products/replay_vision/backend/tests/test_scanners.py
+++ b/products/replay_vision/backend/tests/test_scanners.py
@@ -1052,7 +1052,7 @@ class TestSignalSideMission:
assert signal.description == clean
def test_signal_headline_strips_markers_and_holds_its_length(self) -> None:
- # The headline shares the description's marker leak, and a watch feed card lists three of them on one
+ # The headline shares the description's marker leak, and a highlight feed card lists three of them on one
# line, so a model that answers with a sentence instead of a phrase must not reflow the card.
marked = SignalFinding.model_validate({**self._VALID_SIGNAL, "headline": "Checkout CTA (t 844) does nothing"})
assert marked.headline == "Checkout CTA does nothing"
diff --git a/products/replay_vision/backend/tests/test_temporal.py b/products/replay_vision/backend/tests/test_temporal.py
index 062fa2a62a0b..a104d62730b4 100644
--- a/products/replay_vision/backend/tests/test_temporal.py
+++ b/products/replay_vision/backend/tests/test_temporal.py
@@ -4328,7 +4328,7 @@ async def test_apply_scanner_workflow_emits_the_signal_finding() -> None:
succeeded = next(arg for fn, arg in mocks.activity_calls if fn is mark_observation_succeeded_activity)
assert succeeded.scanner_result.signals_count == 1
- # The distinct problem types ride the row so the watch feed can name the kind of issue.
+ # The distinct problem types ride the row so the highlight feed can name the kind of issue.
assert succeeded.scanner_result.signal_problem_types == ["bug"]
# And the headline rides it too, so the card names the finding rather than counting it.
assert [(s.problem_type, s.headline) for s in succeeded.scanner_result.signal_summaries] == [
diff --git a/products/replay_vision/backend/tests/test_watch_rank.py b/products/replay_vision/backend/tests/test_watch_rank.py
index 73844ccb8881..082e4c80dc1e 100644
--- a/products/replay_vision/backend/tests/test_watch_rank.py
+++ b/products/replay_vision/backend/tests/test_watch_rank.py
@@ -12,15 +12,15 @@ from parameterized import parameterized
from posthog.exceptions import ClickHouseAtCapacity
from products.replay_vision.backend import watch_rank_backfill
+from products.replay_vision.backend.highlight_feed import SESSION_SPACING
from products.replay_vision.backend.models.replay_observation import ReplayObservation
from products.replay_vision.backend.tests.helpers import axis_anchors
-from products.replay_vision.backend.watch_feed import SESSION_SPACING
from products.replay_vision.backend.watch_rank import (
ANCHOR_VERSION,
ANCHORS,
- WATCH_PICK_MIN_SCANNER_ROWS,
+ HIGHLIGHT_PICK_MIN_SCANNER_ROWS,
classify,
- rank_watch_feed_by_embedding,
+ rank_highlight_feed_by_embedding,
)
from products.replay_vision.backend.watch_rank_backfill import _rank_scanner, _stored_vectors
@@ -66,7 +66,7 @@ def _with_percentiles(rows: list[dict[str, Any]]) -> list[dict[str, Any]]:
if row["watch_rank"] and row["watch_rank"].get("anchor_version") == ANCHOR_VERSION:
by_scanner.setdefault(row["scanner_id"], []).append(row)
for scanner_rows in by_scanner.values():
- if len(scanner_rows) < WATCH_PICK_MIN_SCANNER_ROWS:
+ if len(scanner_rows) < HIGHLIGHT_PICK_MIN_SCANNER_ROWS:
continue
scanner_rows.sort(key=lambda row: row["watch_rank"]["contrast"])
for position, row in enumerate(scanner_rows):
@@ -101,7 +101,7 @@ class TestPickIndexes(SimpleTestCase):
)
-class TestRankWatchFeedByEmbedding(SimpleTestCase):
+class TestRankHighlightFeedByEmbedding(SimpleTestCase):
def test_a_finding_that_reached_more_people_outranks_a_stronger_one_off(self) -> None:
rows = [_row(f"a-{index}", 0.01 * index, minutes_ago=index + 1) for index in range(10)]
rows += [_row("one-off", 0.9), _row("widespread", 0.5)]
@@ -109,7 +109,7 @@ class TestRankWatchFeedByEmbedding(SimpleTestCase):
for row in rows:
row["watch_percentile"] = {"one-off": 0.99, "widespread": 0.85}.get(str(row["id"]))
row["watch_group_people"] = 6 if row["id"] == "widespread" else 1
- ranked = rank_watch_feed_by_embedding(_with_percentiles(rows))
+ ranked = rank_highlight_feed_by_embedding(_with_percentiles(rows))
assert [entry.observation_id for entry in ranked][:2] == ["widespread", "one-off"]
assert ranked[0].reason["affected_people"] == 6
@@ -128,7 +128,7 @@ class TestRankWatchFeedByEmbedding(SimpleTestCase):
_row("b-top", 0.50, scanner="scanner-b", minutes_ago=1),
]
- ranked = rank_watch_feed_by_embedding(_with_percentiles(rows))
+ ranked = rank_highlight_feed_by_embedding(_with_percentiles(rows))
assert ranked[0].observation_id == "dup-copy"
assert ranked[0].reason == {
@@ -150,7 +150,7 @@ class TestRankWatchFeedByEmbedding(SimpleTestCase):
*[_row(f"a-{index}", 0.01 * index, minutes_ago=index + 3) for index in range(7)],
]
- ranked = rank_watch_feed_by_embedding(_with_percentiles(rows))
+ ranked = rank_highlight_feed_by_embedding(_with_percentiles(rows))
picks = {
str(entry.observation_id): entry.reason for entry in ranked if entry.reason["kind"] == "embedding_pick"
@@ -169,7 +169,7 @@ class TestRankWatchFeedByEmbedding(SimpleTestCase):
_row("c-top", 0.9, scanner="scanner-c", minutes_ago=2),
]
- ranked = [str(entry.observation_id) for entry in rank_watch_feed_by_embedding(_with_percentiles(rows))]
+ ranked = [str(entry.observation_id) for entry in rank_highlight_feed_by_embedding(_with_percentiles(rows))]
assert ranked[0] == "a-top"
assert ranked.index("b-top") - ranked.index("a-top") >= SESSION_SPACING
@@ -178,7 +178,7 @@ class TestRankWatchFeedByEmbedding(SimpleTestCase):
def test_rows_without_a_rank_fall_back_to_the_filler_floor(self) -> None:
rows = [_row(f"row-{index}", None, minutes_ago=index, viewed=index == 0) for index in range(20)]
- ranked = rank_watch_feed_by_embedding(_with_percentiles(rows))
+ ranked = rank_highlight_feed_by_embedding(_with_percentiles(rows))
assert [entry.observation_id for entry in ranked] == ["row-1", "row-2", "row-3"]
diff --git a/products/replay_vision/backend/tests/test_watch_semantics.py b/products/replay_vision/backend/tests/test_watch_semantics.py
index aeda370f5e00..34cb838c2d3e 100644
--- a/products/replay_vision/backend/tests/test_watch_semantics.py
+++ b/products/replay_vision/backend/tests/test_watch_semantics.py
@@ -11,6 +11,7 @@ import numpy as np
from asgiref.sync import async_to_sync, sync_to_async
from parameterized import parameterized
+from products.replay_vision.backend.highlight_feed_groups import feed_group_cache
from products.replay_vision.backend.models.replay_observation import ObservationTrigger, ReplayObservation
from products.replay_vision.backend.models.replay_observation_anchor_similarity import ReplayObservationAnchorSimilarity
from products.replay_vision.backend.models.replay_scanner import (
@@ -35,7 +36,6 @@ from products.replay_vision.backend.semantic_space import (
unit,
)
from products.replay_vision.backend.tests.helpers import axis_anchors, snapshot_for
-from products.replay_vision.backend.watch_feed_groups import feed_group_cache
from products.replay_vision.backend.watch_rank import ANCHOR_VERSION
from products.replay_vision.backend.watch_semantics import SemanticItem, assign_semantics, assign_semantics_batch
from products.replay_vision.backend.watch_semantics_backfill import backfill_team_semantics
diff --git a/products/replay_vision/backend/watch_rank.py b/products/replay_vision/backend/watch_rank.py
index 194cdbc7f3c2..8760f00d0224 100644
--- a/products/replay_vision/backend/watch_rank.py
+++ b/products/replay_vision/backend/watch_rank.py
@@ -34,6 +34,7 @@ from posthog.utils import dict_from_cursor_fetchall
from products.access_control.backend.facade.user_access_control import UserAccessControl
from products.replay_vision.backend.embeddings import OBSERVATION_EMBEDDING_MODEL
+from products.replay_vision.backend.highlight_feed import HIGHLIGHT_FEED_MIN_ITEMS, HighlightFeedEntry, finish_feed
from products.replay_vision.backend.models.replay_observation import (
ObservationStatus,
ReplayObservation,
@@ -43,7 +44,6 @@ from products.replay_vision.backend.models.replay_observation import (
)
from products.replay_vision.backend.models.replay_observation_anchor_similarity import ReplayObservationAnchorSimilarity
from products.replay_vision.backend.scanner_access import accessible_observations
-from products.replay_vision.backend.watch_feed import WATCH_FEED_MIN_ITEMS, WatchFeedEntry, finish_feed
WatchCategory = Literal["failure", "struggle", "revenue", "routine"]
@@ -95,22 +95,22 @@ CATEGORY_WEIGHT: dict[str, float] = {"failure": 1.0, "revenue": 1.0, "struggle":
# The feed surfaces a scanner's top fifth by score, once the scanner has enough ranked rows to
# make a percentile mean something.
-WATCH_PICK_MIN_PERCENTILE = 0.8
-WATCH_PICK_MIN_SCANNER_ROWS = 10
-WATCH_PICK_SEEN_PENALTY = 0.3
+HIGHLIGHT_PICK_MIN_PERCENTILE = 0.8
+HIGHLIGHT_PICK_MIN_SCANNER_ROWS = 10
+HIGHLIGHT_PICK_SEEN_PENALTY = 0.3
# Each earlier impression keeps this share of a pick's score, so a pick shown three times without a
# click sinks below a fresh one.
-WATCH_PICK_IMPRESSION_DECAY = 0.8
+HIGHLIGHT_PICK_IMPRESSION_DECAY = 0.8
# A pick's score grows by this factor times the log of the people its group reached, up to the cap, so a problem
# that hit six people outranks an equally strong one-off without burying everything else.
-WATCH_PICK_PEOPLE_BOOST = 0.25
-WATCH_PICK_PEOPLE_BOOST_CAP = 2.0
+HIGHLIGHT_PICK_PEOPLE_BOOST = 0.25
+HIGHLIGHT_PICK_PEOPLE_BOOST_CAP = 2.0
# Copies of one finding the pick query keeps, so a viewed or restricted top copy does not hide the group.
-WATCH_PICK_GROUP_CANDIDATES = 3
+HIGHLIGHT_PICK_GROUP_CANDIDATES = 3
# Group members older than the feed's longest window before the oldest pick can never fall inside a requested window.
-WATCH_FEED_MEMBER_LOOKBACK = timedelta(days=90)
+HIGHLIGHT_FEED_MEMBER_LOOKBACK = timedelta(days=90)
# How much wider the second pick fetch reads when the first is all copies of a few feed groups.
-WATCH_PICK_REFILL_FACTOR = 10
+HIGHLIGHT_PICK_REFILL_FACTOR = 10
_ANCHOR_CACHE_TTL_S = 7 * 24 * 3600
@@ -261,7 +261,7 @@ async def rank_observation(request: RankRequest) -> Literal["ranked", "already_r
def people_boost(people: int) -> float:
"""How much a pick's score grows with the number of people its feed group reached."""
- return min(WATCH_PICK_PEOPLE_BOOST_CAP, 1 + WATCH_PICK_PEOPLE_BOOST * math.log(max(people, 1)))
+ return min(HIGHLIGHT_PICK_PEOPLE_BOOST_CAP, 1 + HIGHLIGHT_PICK_PEOPLE_BOOST * math.log(max(people, 1)))
def _cap_feed_groups(rows: list[dict[str, Any]], cap: int) -> dict[Any, dict[str, Any]]:
@@ -272,7 +272,7 @@ def _cap_feed_groups(rows: list[dict[str, Any]], cap: int) -> dict[Any, dict[str
picked: dict[Any, dict[str, Any]] = {}
group_rows: Counter[str] = Counter()
for row in rows:
- if group_rows[row["watch_group_root"]] >= WATCH_PICK_GROUP_CANDIDATES:
+ if group_rows[row["watch_group_root"]] >= HIGHLIGHT_PICK_GROUP_CANDIDATES:
continue
group_rows[row["watch_group_root"]] += 1
picked[row["id"]] = row
@@ -293,7 +293,7 @@ def _pick_window_rows(
scanner_counts = (
ranked.values("scanner_id")
.annotate(scanner_rows=Count("id"))
- .filter(scanner_rows__gte=WATCH_PICK_MIN_SCANNER_ROWS)
+ .filter(scanner_rows__gte=HIGHLIGHT_PICK_MIN_SCANNER_ROWS)
.values("scanner_id", "scanner_rows")
)
scanner_top = (
@@ -330,9 +330,9 @@ def _pick_window_rows(
params = (
*counts_params,
*top_params,
- 1 - WATCH_PICK_MIN_PERCENTILE,
+ 1 - HIGHLIGHT_PICK_MIN_PERCENTILE,
list(ISSUE_CATEGORIES),
- WATCH_PICK_MIN_PERCENTILE,
+ HIGHLIGHT_PICK_MIN_PERCENTILE,
limit,
)
with connections[ranked.db].cursor() as cursor:
@@ -366,12 +366,12 @@ def select_embedding_picks(
).filter(contrast_type="number")
# Bounds the fetch, since a client-side cursor buffers every row. A window full of copies reads a wider slice
# once, still bounded, and a feed that stays short past it shows fewer picks rather than reading every row.
- fetch_limit = cap * (WATCH_PICK_GROUP_CANDIDATES + 1)
+ fetch_limit = cap * (HIGHLIGHT_PICK_GROUP_CANDIDATES + 1)
rows = _pick_window_rows(ranked, current_ranks, fetch_limit)
window_values = _cap_feed_groups(rows, cap)
if len(window_values) < cap and len(rows) == fetch_limit:
window_values = _cap_feed_groups(
- _pick_window_rows(ranked, current_ranks, fetch_limit * WATCH_PICK_REFILL_FACTOR), cap
+ _pick_window_rows(ranked, current_ranks, fetch_limit * HIGHLIGHT_PICK_REFILL_FACTOR), cap
)
if not window_values:
return []
@@ -381,7 +381,7 @@ def select_embedding_picks(
roots = {row["watch_group_root"] for row in window_values.values()}
# Postgres misjudges the JSON filters and would walk the whole window, so the members come from the group index
# alone. Group ids are random UUIDs, so no other team's row matches; the next query applies the team scope.
- oldest = min(row["created_at"] for row in window_values.values()) - WATCH_FEED_MEMBER_LOOKBACK
+ oldest = min(row["created_at"] for row in window_values.values()) - HIGHLIGHT_FEED_MEMBER_LOOKBACK
member_ids = list(
ReplayObservation.objects.filter(
status=ObservationStatus.SUCCEEDED, watch_rank__isnull=False, created_at__gte=oldest
@@ -439,17 +439,19 @@ def select_embedding_filler(
)
fields = ("id", "scanner_id", "session_id", "created_at", "watch_rank", "feed_viewed")
# Two short newest-first walks, because ordering by the viewed flag would sort the whole window.
- rows = list(base.filter(feed_viewed=False).order_by("-created_at", "-id").values(*fields)[:WATCH_FEED_MIN_ITEMS])
- if len(rows) < WATCH_FEED_MIN_ITEMS:
+ rows = list(
+ base.filter(feed_viewed=False).order_by("-created_at", "-id").values(*fields)[:HIGHLIGHT_FEED_MIN_ITEMS]
+ )
+ if len(rows) < HIGHLIGHT_FEED_MIN_ITEMS:
rows += list(
base.filter(feed_viewed=True)
.order_by("-created_at", "-id")
- .values(*fields)[: WATCH_FEED_MIN_ITEMS - len(rows)]
+ .values(*fields)[: HIGHLIGHT_FEED_MIN_ITEMS - len(rows)]
)
return rows
-def rank_watch_feed_by_embedding(rows: list[dict[str, Any]]) -> list[WatchFeedEntry]:
+def rank_highlight_feed_by_embedding(rows: list[dict[str, Any]]) -> list[HighlightFeedEntry]:
"""Rank candidate rows (`id`, `scanner_id`, `session_id`, `created_at`, `watch_rank`, `feed_viewed`,
and optionally `feed_impressions`) on the embedding rank the watch rank consumer wrote.
@@ -472,21 +474,21 @@ def rank_watch_feed_by_embedding(rows: list[dict[str, Any]]) -> list[WatchFeedEn
group = str(rank.get("group") or observation_id)
group_members.setdefault(group, []).append(observation_id)
# Only a member above the cutoff can stand for the group, so the seen penalty never disqualifies it.
- if percentile < WATCH_PICK_MIN_PERCENTILE:
+ if percentile < HIGHLIGHT_PICK_MIN_PERCENTILE:
continue
score = (
percentile
* CATEGORY_WEIGHT[rank["category"]]
* people_boost(row.get("watch_group_people") or 1)
- * WATCH_PICK_IMPRESSION_DECAY ** row.get("feed_impressions", 0)
+ * HIGHLIGHT_PICK_IMPRESSION_DECAY ** row.get("feed_impressions", 0)
)
if row.get("feed_viewed"):
- score -= WATCH_PICK_SEEN_PENALTY
+ score -= HIGHLIGHT_PICK_SEEN_PENALTY
if group not in best_in_group or score > best_in_group[group][0]:
best_in_group[group] = (score, row)
grouped_ids = {member for group in best_in_group for member in group_members[group]}
- picks: list[tuple[float, Any, Any, WatchFeedEntry]] = []
+ picks: list[tuple[float, Any, Any, HighlightFeedEntry]] = []
for group, (score, row) in best_in_group.items():
rank = row["watch_rank"]
reason = {
@@ -500,7 +502,7 @@ def rank_watch_feed_by_embedding(rows: list[dict[str, Any]]) -> list[WatchFeedEn
score,
row["created_at"],
row.get("scanner_id"),
- WatchFeedEntry(observation_id=row["id"], reason=reason, session_id=row["session_id"]),
+ HighlightFeedEntry(observation_id=row["id"], reason=reason, session_id=row["session_id"]),
)
)
# A pick stands for its whole feed group, so no member returns as filler.
diff --git a/products/replay_vision/backend/watch_rank_consumer.py b/products/replay_vision/backend/watch_rank_consumer.py
index 390f9730e86b..d8edf5c780b7 100644
--- a/products/replay_vision/backend/watch_rank_consumer.py
+++ b/products/replay_vision/backend/watch_rank_consumer.py
@@ -1,4 +1,4 @@
-"""Ranks observations for What to watch from the embedding worker's results topic.
+"""Ranks observations for the highlight feed from the embedding worker's results topic.
The scan emits each observation's text to the embedding worker over Kafka. The worker publishes every
embedded document to the results topic, and this consumer ranks the Replay Vision ones from their
@@ -34,7 +34,7 @@ from products.replay_vision.backend.embeddings import (
EMBEDDING_PRODUCT,
OBSERVATION_EMBEDDING_MODEL,
)
-from products.replay_vision.backend.watch_feed_groups import feed_group_cache
+from products.replay_vision.backend.highlight_feed_groups import feed_group_cache
from products.replay_vision.backend.watch_rank import RankRequest, rank_observation
from products.replay_vision.backend.watch_semantics import SemanticAssignment, assign_semantics
from products.replay_vision.backend.watch_themes import name_theme
@@ -65,22 +65,22 @@ Outcome = Literal["skipped", "ranked", "already_ranked", "missing", "failed", "d
MESSAGES_TOTAL = Counter(
"replay_vision_watch_rank_consumer_messages_total",
- "Embedding results the What to watch rank consumer handled, by outcome. A deferred result counts once per batch it is deferred in.",
+ "Embedding results the highlight feed rank consumer handled, by outcome. A deferred result counts once per batch it is deferred in.",
labelnames=["outcome"],
)
BATCH_DURATION = Histogram(
"replay_vision_watch_rank_consumer_batch_duration_seconds",
- "Time the What to watch rank consumer spent on one non-empty batch.",
+ "Time the highlight feed rank consumer spent on one non-empty batch.",
buckets=(0.1, 0.5, 1, 2.5, 5, 10, 30, 60, 120, 240, 300),
)
THEME_NAMING_TOTAL = Counter(
"replay_vision_watch_rank_consumer_theme_naming_total",
- "Theme naming outcomes of the What to watch rank consumer, including names dropped while every slot was busy.",
+ "Theme naming outcomes of the highlight feed rank consumer, including names dropped while every slot was busy.",
labelnames=["outcome"],
)
NAMING_IN_FLIGHT = Gauge(
"replay_vision_watch_rank_consumer_naming_in_flight",
- "Theme naming calls the What to watch rank consumer has in flight.",
+ "Theme naming calls the highlight feed rank consumer has in flight.",
)
# The worker writes compact JSON, and a quote inside a string value is escaped, so this marks our results.
diff --git a/products/replay_vision/backend/watch_semantics.py b/products/replay_vision/backend/watch_semantics.py
index 46955d6c8131..b664d51e9621 100644
--- a/products/replay_vision/backend/watch_semantics.py
+++ b/products/replay_vision/backend/watch_semantics.py
@@ -22,6 +22,7 @@ import numpy as np
from posthog.dataclasses import frozen
+from products.replay_vision.backend.highlight_feed_groups import feed_group_cache
from products.replay_vision.backend.models.replay_observation import ReplayObservation
from products.replay_vision.backend.models.replay_scanner import PromptValence, ScannerType
from products.replay_vision.backend.models.replay_scanner_semantics import (
@@ -38,7 +39,6 @@ from products.replay_vision.backend.semantic_space import (
semantic_vector,
unpack,
)
-from products.replay_vision.backend.watch_feed_groups import feed_group_cache
from products.replay_vision.backend.watch_rank import current_rank
from products.replay_vision.backend.watch_themes import ThemeAssignment, ThemeBatch, belongs_in_theme
diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.ts
index 6c615569d148..7797482e5dfa 100644
--- a/products/replay_vision/frontend/generated/api.schemas.ts
+++ b/products/replay_vision/frontend/generated/api.schemas.ts
@@ -2826,6 +2826,97 @@ export interface EstimateResponseApi {
sampling_rate: number
}
+/**
+ * * `embedding_pick` - Embedding Pick
+ * * `unviewed_recent` - Unviewed Recent
+ * * `recent` - Recent
+ */
+export type HighlightFeedReasonEnumApi = (typeof HighlightFeedReasonEnumApi)[keyof typeof HighlightFeedReasonEnumApi]
+
+export const HighlightFeedReasonEnumApi = {
+ EmbeddingPick: 'embedding_pick',
+ UnviewedRecent: 'unviewed_recent',
+ Recent: 'recent',
+} as const
+
+/**
+ * * `failure` - Failure
+ * * `struggle` - Struggle
+ * * `revenue` - Revenue
+ */
+export type HighlightFeedCategoryEnumApi =
+ (typeof HighlightFeedCategoryEnumApi)[keyof typeof HighlightFeedCategoryEnumApi]
+
+export const HighlightFeedCategoryEnumApi = {
+ Failure: 'failure',
+ Struggle: 'struggle',
+ Revenue: 'revenue',
+} as const
+
+/**
+ * Machine-readable reason an observation made the feed; the frontend renders the copy.
+ */
+export interface HighlightFeedReasonApi {
+ /** Why the observation is in the feed: `embedding_pick` (the session reads like a failure, struggle, or revenue moment and ranks in its scanner's top fifth), `unviewed_recent` (new to you), `recent` (nothing special, newest available).
+ *
+ * * `embedding_pick` - Embedding Pick
+ * * `unviewed_recent` - Unviewed Recent
+ * * `recent` - Recent */
+ kind: HighlightFeedReasonEnumApi
+ /** What the session reads like, for `embedding_pick`.
+ *
+ * * `failure` - Failure
+ * * `struggle` - Struggle
+ * * `revenue` - Revenue */
+ watch_category?: HighlightFeedCategoryEnumApi
+ /**
+ * Other sessions from the same scanner in the window that describe nearly the same thing, for `embedding_pick`. The feed shows one session per group.
+ * @nullable
+ */
+ similar_count?: number | null
+ /**
+ * Distinct people across the session's feed group in the window, for `embedding_pick`. A finding that reached more people ranks higher.
+ * @nullable
+ */
+ affected_people?: number | null
+}
+
+/**
+ * One feed entry: the observation plus why it ranked.
+ */
+export interface HighlightFeedItemApi {
+ /** The observation, in the standard shape. */
+ observation: ReplayObservationApi
+ /** Why this observation made the feed. */
+ reason: HighlightFeedReasonApi
+}
+
+/**
+ * Response of GET /vision/scanners/highlight_feed/.
+ */
+export interface HighlightFeedResponseApi {
+ /** Succeeded observations in the window worth watching, most interesting first, each carrying the reason it ranked. Every observation that carries a finding is returned; observations that carry none (`unviewed_recent`, `recent`) are returned only to pad a near-empty feed to three items, so a quiet window answers with a handful of rows rather than a full page of newest clips. */
+ results: HighlightFeedItemApi[]
+ /** Whether a later page holds more ranked items. Request it with `offset` set past this page. */
+ has_more: boolean
+ /** The time this feed ranks as of. Send it back with later pages. */
+ as_of: string
+}
+
+/**
+ * Body of POST /vision/scanners/highlight_feed_impressions/.
+ */
+export interface HighlightFeedImpressionsApi {
+ /** The client's id for the feed load that showed these cards. One load counts each card once. */
+ feed_load_id: string
+ /**
+ * Observations the calling user saw in the Highlights feed, at most 100. Ids the user cannot read are ignored.
+ * @minItems 1
+ * @maxItems 100
+ */
+ observation_ids: string[]
+}
+
/**
* Body of POST /vision/scanners/inline_scan/ - a prompt or built-in scan plus the sessions to point it at.
*/
@@ -2911,96 +3002,6 @@ export interface ScannerStatsResponseApi {
by_type: ScannerStatsByTypeApi
}
-/**
- * * `embedding_pick` - Embedding Pick
- * * `unviewed_recent` - Unviewed Recent
- * * `recent` - Recent
- */
-export type WatchFeedReasonEnumApi = (typeof WatchFeedReasonEnumApi)[keyof typeof WatchFeedReasonEnumApi]
-
-export const WatchFeedReasonEnumApi = {
- EmbeddingPick: 'embedding_pick',
- UnviewedRecent: 'unviewed_recent',
- Recent: 'recent',
-} as const
-
-/**
- * * `failure` - Failure
- * * `struggle` - Struggle
- * * `revenue` - Revenue
- */
-export type WatchFeedCategoryEnumApi = (typeof WatchFeedCategoryEnumApi)[keyof typeof WatchFeedCategoryEnumApi]
-
-export const WatchFeedCategoryEnumApi = {
- Failure: 'failure',
- Struggle: 'struggle',
- Revenue: 'revenue',
-} as const
-
-/**
- * Machine-readable reason an observation made the feed; the frontend renders the copy.
- */
-export interface WatchFeedReasonApi {
- /** Why the observation is in the feed: `embedding_pick` (the session reads like a failure, struggle, or revenue moment and ranks in its scanner's top fifth), `unviewed_recent` (new to you), `recent` (nothing special, newest available).
- *
- * * `embedding_pick` - Embedding Pick
- * * `unviewed_recent` - Unviewed Recent
- * * `recent` - Recent */
- kind: WatchFeedReasonEnumApi
- /** What the session reads like, for `embedding_pick`.
- *
- * * `failure` - Failure
- * * `struggle` - Struggle
- * * `revenue` - Revenue */
- watch_category?: WatchFeedCategoryEnumApi
- /**
- * Other sessions from the same scanner in the window that describe nearly the same thing, for `embedding_pick`. The feed shows one session per group.
- * @nullable
- */
- similar_count?: number | null
- /**
- * Distinct people across the session's feed group in the window, for `embedding_pick`. A finding that reached more people ranks higher.
- * @nullable
- */
- affected_people?: number | null
-}
-
-/**
- * One feed entry: the observation plus why it ranked.
- */
-export interface WatchFeedItemApi {
- /** The observation, in the standard shape. */
- observation: ReplayObservationApi
- /** Why this observation made the feed. */
- reason: WatchFeedReasonApi
-}
-
-/**
- * Response of GET /vision/scanners/watch_feed/.
- */
-export interface WatchFeedResponseApi {
- /** Succeeded observations in the window worth watching, most interesting first, each carrying the reason it ranked. Every observation that carries a finding is returned; observations that carry none (`unviewed_recent`, `recent`) are returned only to pad a near-empty feed to three items, so a quiet window answers with a handful of rows rather than a full page of newest clips. */
- results: WatchFeedItemApi[]
- /** Whether a later page holds more ranked items. Request it with `offset` set past this page. */
- has_more: boolean
- /** The time this feed ranks as of. Send it back with later pages. */
- as_of: string
-}
-
-/**
- * Body of POST /vision/scanners/watch_feed_impressions/.
- */
-export interface WatchFeedImpressionsApi {
- /** The client's id for the feed load that showed these cards. One load counts each card once. */
- feed_load_id: string
- /**
- * Observations the calling user saw in the Highlights feed, at most 100. Ids the user cannot read are ignored.
- * @minItems 1
- * @maxItems 100
- */
- observation_ids: string[]
-}
-
export type VisionAlertsListParams = {
/**
* Number of results to return per page.
@@ -3120,7 +3121,7 @@ export type VisionObservationsRetrieveParams = {
*/
verdict?: string
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string
}
@@ -3367,7 +3368,7 @@ export type VisionScannersObservationsListParams = {
*/
verdict?: string
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string
}
@@ -3430,7 +3431,7 @@ export type VisionScannersObservationsRetrieveParams = {
*/
verdict?: string
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string
}
@@ -3493,7 +3494,7 @@ export type VisionScannersObservationsSignalReportsListParams = {
*/
verdict?: string
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string
}
@@ -3580,12 +3581,12 @@ export type VisionScannersObservationsStatsRetrieveParams = {
*/
verdict?: string
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string
}
-export type VisionScannersWatchFeedRetrieveParams = {
+export type VisionScannersHighlightFeedRetrieveParams = {
/**
* The time the first page loaded. Later pages rank as of that time: observations, views, dismissals and impressions after it are ignored, so pages do not shift under a reader who scrolls.
*/
@@ -3632,7 +3633,7 @@ export type VisionScannersWatchFeedRetrieveParams = {
* * `experiment` - Experiment
* @minLength 1
*/
- scanner_type?: VisionScannersWatchFeedRetrieveScannerType
+ scanner_type?: VisionScannersHighlightFeedRetrieveScannerType
/**
* Comma-separated scanner tags to restrict the feed to. A team with many scanners uses these to follow one area without naming every scanner in it.
* @minLength 1
@@ -3640,10 +3641,10 @@ export type VisionScannersWatchFeedRetrieveParams = {
tags?: string
}
-export type VisionScannersWatchFeedRetrieveScannerType =
- (typeof VisionScannersWatchFeedRetrieveScannerType)[keyof typeof VisionScannersWatchFeedRetrieveScannerType]
+export type VisionScannersHighlightFeedRetrieveScannerType =
+ (typeof VisionScannersHighlightFeedRetrieveScannerType)[keyof typeof VisionScannersHighlightFeedRetrieveScannerType]
-export const VisionScannersWatchFeedRetrieveScannerType = {
+export const VisionScannersHighlightFeedRetrieveScannerType = {
Monitor: 'monitor',
Classifier: 'classifier',
Scorer: 'scorer',
diff --git a/products/replay_vision/frontend/generated/api.ts b/products/replay_vision/frontend/generated/api.ts
index 9b1dbd05a58f..b55fbab1bac1 100644
--- a/products/replay_vision/frontend/generated/api.ts
+++ b/products/replay_vision/frontend/generated/api.ts
@@ -23,6 +23,8 @@ import type {
EstimateRequestApi,
EstimateResponseApi,
ExperimentVariantsReadoutApi,
+ HighlightFeedImpressionsApi,
+ HighlightFeedResponseApi,
InlineScanRequestApi,
InlineScanResponseApi,
ObservationFeedDismissalApi,
@@ -69,6 +71,7 @@ import type {
VisionObservationsThumbnailRetrieveParams,
VisionQuotaApi,
VisionScannersBackfillsListParams,
+ VisionScannersHighlightFeedRetrieveParams,
VisionScannersImpactRetrieveParams,
VisionScannersListParams,
VisionScannersObservationsListParams,
@@ -76,10 +79,7 @@ import type {
VisionScannersObservationsSignalReportsListParams,
VisionScannersObservationsStatsRetrieveParams,
VisionScannersObservationsThumbnailRetrieveParams,
- VisionScannersWatchFeedRetrieveParams,
VisionSpendSeriesApi,
- WatchFeedImpressionsApi,
- WatchFeedResponseApi,
} from './api.schemas'
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
@@ -1596,6 +1596,59 @@ export const visionScannersEstimateCreate = async (
})
}
+export const getVisionScannersHighlightFeedRetrieveUrl = (
+ projectId: string,
+ params?: VisionScannersHighlightFeedRetrieveParams
+) => {
+ const normalizedParams = new URLSearchParams()
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? 'null' : String(value))
+ }
+ })
+
+ const stringifiedParams = normalizedParams.toString()
+
+ return stringifiedParams.length > 0
+ ? `/api/projects/${projectId}/vision/scanners/highlight_feed/?${stringifiedParams}`
+ : `/api/projects/${projectId}/vision/scanners/highlight_feed/`
+}
+
+/**
+ * Succeeded observations in the window worth watching, ranked for the Highlights tab.
+ */
+export const visionScannersHighlightFeedRetrieve = async (
+ projectId: string,
+ params?: VisionScannersHighlightFeedRetrieveParams,
+ options?: RequestInit
+): Promise<HighlightFeedResponseApi> => {
+ return apiMutator<HighlightFeedResponseApi>(getVisionScannersHighlightFeedRetrieveUrl(projectId, params), {
+ ...options,
+ method: 'GET',
+ })
+}
+
+export const getVisionScannersHighlightFeedImpressionsCreateUrl = (projectId: string) => {
+ return `/api/projects/${projectId}/vision/scanners/highlight_feed_impressions/`
+}
+
+/**
+ * Record that the calling user saw these cards in the Highlights feed, so the feed ranks them lower next time.
+ */
+export const visionScannersHighlightFeedImpressionsCreate = async (
+ projectId: string,
+ highlightFeedImpressionsApi: HighlightFeedImpressionsApi,
+ options?: RequestInit
+): Promise<void> => {
+ return apiMutator<void>(getVisionScannersHighlightFeedImpressionsCreateUrl(projectId), {
+ ...options,
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(highlightFeedImpressionsApi),
+ })
+}
+
export const getVisionScannersInlineScanCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/vision/scanners/inline_scan/`
}
@@ -1639,56 +1692,3 @@ export const visionScannersStatsRetrieve = async (
method: 'GET',
})
}
-
-export const getVisionScannersWatchFeedRetrieveUrl = (
- projectId: string,
- params?: VisionScannersWatchFeedRetrieveParams
-) => {
- const normalizedParams = new URLSearchParams()
-
- Object.entries(params || {}).forEach(([key, value]) => {
- if (value !== undefined) {
- normalizedParams.append(key, value === null ? 'null' : String(value))
- }
- })
-
- const stringifiedParams = normalizedParams.toString()
-
- return stringifiedParams.length > 0
- ? `/api/projects/${projectId}/vision/scanners/watch_feed/?${stringifiedParams}`
- : `/api/projects/${projectId}/vision/scanners/watch_feed/`
-}
-
-/**
- * Succeeded observations in the window worth watching, ranked for the Highlights tab.
- */
-export const visionScannersWatchFeedRetrieve = async (
- projectId: string,
- params?: VisionScannersWatchFeedRetrieveParams,
- options?: RequestInit
-): Promise<WatchFeedResponseApi> => {
- return apiMutator<WatchFeedResponseApi>(getVisionScannersWatchFeedRetrieveUrl(projectId, params), {
- ...options,
- method: 'GET',
- })
-}
-
-export const getVisionScannersWatchFeedImpressionsCreateUrl = (projectId: string) => {
- return `/api/projects/${projectId}/vision/scanners/watch_feed_impressions/`
-}
-
-/**
- * Record that the calling user saw these cards in the Highlights feed, so the feed ranks them lower next time.
- */
-export const visionScannersWatchFeedImpressionsCreate = async (
- projectId: string,
- watchFeedImpressionsApi: WatchFeedImpressionsApi,
- options?: RequestInit
-): Promise<void> => {
- return apiMutator<void>(getVisionScannersWatchFeedImpressionsCreateUrl(projectId), {
- ...options,
- method: 'POST',
- headers: { 'Content-Type': 'application/json', ...options?.headers },
- body: JSON.stringify(watchFeedImpressionsApi),
- })
-}
diff --git a/products/replay_vision/frontend/generated/api.zod.ts b/products/replay_vision/frontend/generated/api.zod.ts
index 5bd4a185378a..66150f6cc273 100644
--- a/products/replay_vision/frontend/generated/api.zod.ts
+++ b/products/replay_vision/frontend/generated/api.zod.ts
@@ -1473,6 +1473,26 @@ export const VisionScannersEstimateCreateBody = /* @__PURE__ */ zod
})
.describe('Body of POST \/vision\/scanners\/estimate\/ — a proposed, unsaved scanner config.')
+/**
+ * Record that the calling user saw these cards in the Highlights feed, so the feed ranks them lower next time.
+ */
+export const visionScannersHighlightFeedImpressionsCreateBodyObservationIdsMax = 100
+
+export const VisionScannersHighlightFeedImpressionsCreateBody = /* @__PURE__ */ zod
+ .object({
+ feed_load_id: zod
+ .uuid()
+ .describe("The client's id for the feed load that showed these cards. One load counts each card once."),
+ observation_ids: zod
+ .array(zod.uuid())
+ .min(1)
+ .max(visionScannersHighlightFeedImpressionsCreateBodyObservationIdsMax)
+ .describe(
+ 'Observations the calling user saw in the Highlights feed, at most 100. Ids the user cannot read are ignored.'
+ ),
+ })
+ .describe('Body of POST \/vision\/scanners\/highlight_feed_impressions\/.')
+
/**
* Scan named sessions against a prompt without saving a scanner first, for one-off questions.
*
@@ -1540,23 +1560,3 @@ export const VisionScannersInlineScanCreateBody = /* @__PURE__ */ zod
.describe(
'Body of POST \/vision\/scanners\/inline_scan\/ - a prompt or built-in scan plus the sessions to point it at.'
)
-
-/**
- * Record that the calling user saw these cards in the Highlights feed, so the feed ranks them lower next time.
- */
-export const visionScannersWatchFeedImpressionsCreateBodyObservationIdsMax = 100
-
-export const VisionScannersWatchFeedImpressionsCreateBody = /* @__PURE__ */ zod
- .object({
- feed_load_id: zod
- .uuid()
- .describe("The client's id for the feed load that showed these cards. One load counts each card once."),
- observation_ids: zod
- .array(zod.uuid())
- .min(1)
- .max(visionScannersWatchFeedImpressionsCreateBodyObservationIdsMax)
- .describe(
- 'Observations the calling user saw in the Highlights feed, at most 100. Ids the user cannot read are ignored.'
- ),
- })
- .describe('Body of POST \/vision\/scanners\/watch_feed_impressions\/.')
diff --git a/products/replay_vision/frontend/observations/ReplayObservation.tsx b/products/replay_vision/frontend/observations/ReplayObservation.tsx
index dc6d0c8b0317..7703e4a1100d 100644
--- a/products/replay_vision/frontend/observations/ReplayObservation.tsx
+++ b/products/replay_vision/frontend/observations/ReplayObservation.tsx
@@ -91,7 +91,7 @@ export function ReplayObservationSceneComponent(): JSX.Element {
// navigation (and the server-computed neighbor ids) stay within the filtered list.
const neighborParams = neighborFilterParams(searchParams)
const neighborsFiltered = Object.keys(neighborParams).some((key) => key !== 'order_by')
- // Prev/next keeps the return params too, so back still lands on the list view (or the watch feed)
+ // Prev/next keeps the return params too, so back still lands on the list view (or the highlight feed)
// the reader came from.
const observationUrl = (id: string): string =>
observationDetailUrl(id, {
diff --git a/products/replay_vision/frontend/observations/replayObservationLogic.test.ts b/products/replay_vision/frontend/observations/replayObservationLogic.test.ts
index 063d0e953ae0..55c8ecb5bba8 100644
--- a/products/replay_vision/frontend/observations/replayObservationLogic.test.ts
+++ b/products/replay_vision/frontend/observations/replayObservationLogic.test.ts
@@ -212,7 +212,11 @@ describe('replayObservationLogic', () => {
// A `from` origin sends back to where the reader was, not to the scanner that owns the row. `return_to`
// must stay on this site: anything else falls back to the origin's own page.
test.each([
- { label: 'the watch feed', params: { from: 'watch', t: 12 }, expected: '/replay-vision?tab=watch' },
+ {
+ label: 'the highlight feed',
+ params: { from: 'highlights', t: 12 },
+ expected: '/replay-vision?tab=highlights',
+ },
{ label: 'the recording', params: { from: 'recording' }, expected: '/replay/sess-1' },
{
label: 'the playlist it was opened from',
diff --git a/products/replay_vision/frontend/observations/replayObservationLogic.ts b/products/replay_vision/frontend/observations/replayObservationLogic.ts
index 7347c80be1c2..c39db39a00a5 100644
--- a/products/replay_vision/frontend/observations/replayObservationLogic.ts
+++ b/products/replay_vision/frontend/observations/replayObservationLogic.ts
@@ -20,11 +20,11 @@ import {
OBSERVATION_RETURN_PATH_PARAM,
POSTHOG_AI_ORIGIN,
RECORDING_ORIGIN,
- WATCH_FEED_ORIGIN,
+ HIGHLIGHT_FEED_ORIGIN,
isObservationOrigin,
safeReturnPath,
scannerBreadcrumb,
- watchFeedBreadcrumb,
+ highlightFeedBreadcrumb,
} from '../utils/breadcrumbs'
import { hasScannerPage, scannerLabel } from '../utils/observation'
import { parseNumericParam } from '../utils/urlParams'
@@ -115,8 +115,8 @@ function recordingBreadcrumb(observation: ReplayObservationApi, returnPath: stri
function parentBreadcrumbFor(observation: ReplayObservationApi, searchParams: Record<string, unknown>): Breadcrumb {
const origin = searchParams[OBSERVATION_ORIGIN_PARAM]
const returnPath = safeReturnPath(searchParams[OBSERVATION_RETURN_PATH_PARAM])
- if (origin === WATCH_FEED_ORIGIN) {
- return watchFeedBreadcrumb()
+ if (origin === HIGHLIGHT_FEED_ORIGIN) {
+ return highlightFeedBreadcrumb()
}
if (origin === RECORDING_ORIGIN) {
return recordingBreadcrumb(observation, returnPath)
diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
index 03cb2b612ed8..8400975fa575 100644
--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
@@ -917,7 +917,7 @@ const meta: Meta = {
'/api/projects/:team_id/vision/scanners/stats/': scannerStats,
'/api/projects/:team_id/vision/scanners/creators/': { creators: [alice, bob] },
// Two picks, then each filler kind. Only the first carries a key moment, so the rest show no time on the tile.
- '/api/projects/:team_id/vision/scanners/watch_feed/': {
+ '/api/projects/:team_id/vision/scanners/highlight_feed/': {
results: [
{
observation: observation({
@@ -1185,7 +1185,7 @@ const checkoutGroupMembers = [
// The home page lands on the Highlights feed. Each pick names its category, and the first stands for seven similar
// sessions. The viewer created one scanner, so the feed offers the scope tabs.
-export const HomeWatchFeed: StoryObj = {
+export const HomeHighlightFeed: StoryObj = {
decorators: [
mswDecorator({
get: {
@@ -1204,7 +1204,7 @@ export const HomeWatchFeed: StoryObj = {
previous: null,
results: checkoutGroupMembers,
},
- '/api/projects/:team_id/vision/scanners/watch_feed/': {
+ '/api/projects/:team_id/vision/scanners/highlight_feed/': {
has_more: false,
results: [
{
@@ -1267,11 +1267,11 @@ export const HomeWatchFeed: StoryObj = {
// A quiet window: nothing scored on any source, so the feed pads to three newest clips and says so
// rather than filling the page with them.
-export const HomeWatchFeedOnlyNewest: StoryObj = {
+export const HomeHighlightFeedOnlyNewest: StoryObj = {
decorators: [
mswDecorator({
get: {
- '/api/projects/:team_id/vision/scanners/watch_feed/': {
+ '/api/projects/:team_id/vision/scanners/highlight_feed/': {
results: [0, 1, 2].map((i) => ({
observation: observation({ id: `00000000-0000-0000-0000-0000000000f${i}` }),
reason: { kind: 'unviewed_recent' },
@@ -1282,10 +1282,10 @@ export const HomeWatchFeedOnlyNewest: StoryObj = {
],
}
-export const HomeWatchFeedEmpty: StoryObj = {
+export const HomeHighlightFeedEmpty: StoryObj = {
decorators: [
mswDecorator({
- get: { '/api/projects/:team_id/vision/scanners/watch_feed/': { results: [] } },
+ get: { '/api/projects/:team_id/vision/scanners/highlight_feed/': { results: [] } },
}),
],
}
diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx
index 289255fa9910..1699f9d41c01 100644
--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx
@@ -43,14 +43,15 @@ import { replayVisionEmptyState } from '../emptyState/replayVisionEmptyState'
import { visionQuotaLogic } from '../logics/visionQuotaLogic'
import { ObservationSearch } from '../search/ObservationSearch'
import { getReplayVisionDeleteDisabledReason, getReplayVisionEditDisabledReason } from '../utils/accessControl'
+import { HIGHLIGHTS_TAB } from '../utils/breadcrumbs'
import { creditsToUsd, formatCreditCount } from '../utils/credits'
import { quotaBannerState } from '../utils/quotaProjection'
import { CreateScannerButton } from './components/CreateScannerButton'
+import { HighlightFeedTab } from './components/HighlightFeedTab'
import { QuillCreateScannerButton } from './components/QuillCreateScannerButton'
import { ScannerStatusLabel } from './components/ScannerStatusLabel'
import { VisionMetrics } from './components/VisionMetrics'
import { VisionUsageTab } from './components/VisionUsageTab'
-import { WatchFeedTab } from './components/WatchFeedTab'
import { ReplayScannerTab } from './replayScannerSceneLogic'
import { type ScannersSorting, SCANNERS_PAGE_SIZE, replayScannersLogic } from './replayScannersLogic'
import { limitReachedTooltip } from './scannerCopy'
@@ -160,8 +161,8 @@ function FieldGuideBanner(): JSX.Element | null {
)
}
-const KNOWN_TABS: string[] = ['watch', 'scanners', ReplayScannerTab.Search, 'usage']
-const DEFAULT_TAB = 'watch'
+const KNOWN_TABS: string[] = [HIGHLIGHTS_TAB, 'scanners', ReplayScannerTab.Search, 'usage']
+const DEFAULT_TAB = HIGHLIGHTS_TAB
export const scene: SceneExport = {
component: ReplayScannersScene,
@@ -323,7 +324,7 @@ export function ReplayScannersScene(): JSX.Element {
onChange={(tab) => push(urls.replayVision(), tab === DEFAULT_TAB ? {} : { tab })}
tabs={[
{
- key: 'watch',
+ key: HIGHLIGHTS_TAB,
label: 'Highlights',
content: <></>,
},
@@ -333,8 +334,8 @@ export function ReplayScannersScene(): JSX.Element {
]}
/>
- {activeTab === 'watch' ? (
- <WatchFeedTab />
+ {activeTab === HIGHLIGHTS_TAB ? (
+ <HighlightFeedTab />
) : activeTab === ReplayScannerTab.Search ? (
<ObservationSearch className="mt-2 w-4/5 mx-auto" />
) : activeTab === 'usage' ? (
diff --git a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedBlockedBanner.stories.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedBlockedBanner.stories.tsx
new file mode 100644
index 000000000000..f3c1c48e3f8d
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedBlockedBanner.stories.tsx
@@ -0,0 +1,19 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import { HighlightFeedBlockedBanner } from './HighlightFeedBlockedBanner'
+
+const meta: Meta<typeof HighlightFeedBlockedBanner> = {
+ title: 'Scenes-App/Replay Vision/HighlightFeedBlockedBanner',
+ component: HighlightFeedBlockedBanner,
+ decorators: [
+ // LemonBanner is a CSS container, so the parent sets its width.
+ (Story) => (
+ <div className="w-200">
+ <Story />
+ </div>
+ ),
+ ],
+}
+export default meta
+
+export const QuotaExhausted: StoryObj<typeof HighlightFeedBlockedBanner> = { args: { reason: 'quota-exhausted' } }
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedBlockedBanner.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedBlockedBanner.tsx
similarity index 75%
rename from products/replay_vision/frontend/replay_scanners/components/WatchFeedBlockedBanner.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightFeedBlockedBanner.tsx
index 2acf0b55fd93..19d110eac102 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedBlockedBanner.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedBlockedBanner.tsx
@@ -5,12 +5,12 @@ import { LemonBanner } from '@posthog/lemon-ui'
import { urls } from 'scenes/urls'
-import { WATCH_FEED_BLOCKS, type WatchFeedBlockReason } from '../watchFeedEmptyState'
+import { HIGHLIGHT_FEED_BLOCKS, type HighlightFeedBlockReason } from '../highlightFeedEmptyState'
/** Sits above cards that are still in the window, to say the feed will not get new ones and why. */
-export function WatchFeedBlockedBanner({ reason }: { reason: WatchFeedBlockReason }): JSX.Element {
+export function HighlightFeedBlockedBanner({ reason }: { reason: HighlightFeedBlockReason }): JSX.Element {
const { push } = useActions(router)
- const block = WATCH_FEED_BLOCKS[reason]
+ const block = HIGHLIGHT_FEED_BLOCKS[reason]
return (
<LemonBanner
type="warning"
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.test.ts
similarity index 82%
rename from products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts
rename to products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.test.ts
index e15e98f45d9f..52c8a630d182 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.test.ts
@@ -1,24 +1,32 @@
-import type { ReplayObservationApi, WatchFeedReasonApi } from '../../generated/api.schemas'
+import type { ReplayObservationApi, HighlightFeedReasonApi } from '../../generated/api.schemas'
import {
- watchFeedRowSentence,
- watchFeedRowTitle,
+ highlightFeedRowSentence,
+ highlightFeedRowTitle,
observationKeyMomentMs,
- watchCardHeadline,
- watchReasonCopy,
- watchStartSeconds,
-} from './WatchFeedCard'
+ highlightCardHeadline,
+ highlightReasonCopy,
+ highlightStartSeconds,
+} from './HighlightFeedCard'
-describe('WatchFeedCard helpers', () => {
- describe('watchReasonCopy', () => {
- it.each<{ name: string; reason: WatchFeedReasonApi; expected: string }>([
+describe('HighlightFeedCard helpers', () => {
+ describe('highlightReasonCopy', () => {
+ it.each<{ name: string; reason: HighlightFeedReasonApi; expected: string }>([
{
name: 'names the category of an embedding pick with no similar sessions',
- reason: { kind: 'embedding_pick', watch_category: 'failure', similar_count: 0 } as WatchFeedReasonApi,
+ reason: {
+ kind: 'embedding_pick',
+ watch_category: 'failure',
+ similar_count: 0,
+ } as HighlightFeedReasonApi,
expected: 'Something failed in this session.',
},
{
name: 'counts the similar sessions behind an embedding pick',
- reason: { kind: 'embedding_pick', watch_category: 'struggle', similar_count: 1 } as WatchFeedReasonApi,
+ reason: {
+ kind: 'embedding_pick',
+ watch_category: 'struggle',
+ similar_count: 1,
+ } as HighlightFeedReasonApi,
expected: 'The user struggled in this session. 1 other session from this scanner looks similar.',
},
{
@@ -28,16 +36,16 @@ describe('WatchFeedCard helpers', () => {
watch_category: 'failure',
similar_count: 5,
affected_people: 4,
- } as WatchFeedReasonApi,
+ } as HighlightFeedReasonApi,
expected: 'Something failed in this session. 4 people had a similar session.',
},
{
name: 'renders a sentence for a reason kind this frontend does not know',
- reason: { kind: 'some_future_kind' } as unknown as WatchFeedReasonApi,
+ reason: { kind: 'some_future_kind' } as unknown as HighlightFeedReasonApi,
expected: 'Worth a look.',
},
])('$name', ({ reason, expected }) => {
- expect(watchReasonCopy(reason)).toBe(expected)
+ expect(highlightReasonCopy(reason)).toBe(expected)
})
})
@@ -59,19 +67,19 @@ describe('WatchFeedCard helpers', () => {
})
})
- describe('watchStartSeconds', () => {
+ describe('highlightStartSeconds', () => {
it.each<{ name: string; keyMomentMs: number | null; expected: number }>([
{ name: 'starts from the beginning without a key moment', keyMomentMs: null, expected: 0 },
{ name: 'starts a few seconds before the key moment', keyMomentMs: 42_900, expected: 39 },
{ name: 'never starts before the recording', keyMomentMs: 1_000, expected: 0 },
])('$name', ({ keyMomentMs, expected }) => {
- expect(watchStartSeconds(keyMomentMs)).toBe(expected)
+ expect(highlightStartSeconds(keyMomentMs)).toBe(expected)
})
})
- describe('watchFeedRowSentence', () => {
+ describe('highlightFeedRowSentence', () => {
it('derives the headline from the scan prose', () => {
- const sentence = watchFeedRowSentence(
+ const sentence = highlightFeedRowSentence(
observation('monitor', { reasoning: 'Retried the form twice. The submit then failed.' })
)
expect(sentence).toBe('Retried the form twice.')
@@ -82,11 +90,11 @@ describe('WatchFeedCard helpers', () => {
scanner_snapshot: { name: 'Confused checkout', scanner_type: 'monitor' },
scanner_result: { model_output: {} },
} as unknown as ReplayObservationApi
- expect(watchFeedRowSentence(bare)).toBe('Confused checkout')
+ expect(highlightFeedRowSentence(bare)).toBe('Confused checkout')
})
})
- describe('watchFeedRowTitle', () => {
+ describe('highlightFeedRowTitle', () => {
it.each<{ name: string; scannerType: string; output: Record<string, unknown>; expected: string }>([
{
name: "leads with a summarizer's authored title",
@@ -107,16 +115,16 @@ describe('WatchFeedCard helpers', () => {
expected: 'Retried the form twice.',
},
])('$name', ({ scannerType, output, expected }) => {
- expect(watchFeedRowTitle(observation(scannerType, output))).toBe(expected)
+ expect(highlightFeedRowTitle(observation(scannerType, output))).toBe(expected)
})
})
- describe('watchCardHeadline', () => {
+ describe('highlightCardHeadline', () => {
it.each<{
name: string
scannerType: string
output: Record<string, unknown>
- expected: ReturnType<typeof watchCardHeadline>
+ expected: ReturnType<typeof highlightCardHeadline>
}>([
{
name: 'keeps the authored summarizer title and rides the summary along as the body',
@@ -170,7 +178,7 @@ describe('WatchFeedCard helpers', () => {
expected: { title: 'Opened the .env editor.', body: { text: 'Saved it.' } },
},
])('$name', ({ scannerType, output, expected }) => {
- expect(watchCardHeadline(observation(scannerType, output))).toEqual(expected)
+ expect(highlightCardHeadline(observation(scannerType, output))).toEqual(expected)
})
})
})
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.tsx
similarity index 82%
rename from products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.tsx
index 70ca14b595ec..78a6c85cd43e 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.tsx
@@ -16,31 +16,31 @@ import { scannerTypeIcon } from '../../components/ScannerTypeBadge'
import { UnviewedObservationTag } from '../../components/UnviewedObservationTag'
import type {
ReplayObservationApi,
- WatchFeedCategoryEnumApi,
- WatchFeedItemApi,
- WatchFeedReasonApi,
+ HighlightFeedCategoryEnumApi,
+ HighlightFeedItemApi,
+ HighlightFeedReasonApi,
} from '../../generated/api.schemas'
-import { OBSERVATION_ORIGIN_PARAM, WATCH_FEED_ORIGIN } from '../../utils/breadcrumbs'
+import { OBSERVATION_ORIGIN_PARAM, HIGHLIGHT_FEED_ORIGIN } from '../../utils/breadcrumbs'
import { citedTextToPlainText } from '../../utils/citations'
import { hasScannerPage, scannerLabel } from '../../utils/observation'
+import { highlightFeedLogic } from '../highlightFeedLogic'
+import { CARD_SEEN_DWELL_MS, cardProperties } from '../highlightFeedTelemetry'
import { SCANNER_TYPE_TAG_TYPE, ScannerType } from '../types'
-import { watchFeedLogic } from '../watchFeedLogic'
-import { CARD_SEEN_DWELL_MS, cardProperties } from '../watchFeedTelemetry'
-import { WatchFeedDismissButton } from './WatchFeedDismissButton'
-import { WatchFeedGroupList, WatchFeedGroupToggle } from './WatchFeedGroup'
+import { HighlightFeedDismissButton } from './HighlightFeedDismissButton'
+import { HighlightFeedGroupList, HighlightFeedGroupToggle } from './HighlightFeedGroup'
/** Reason kinds that say nothing about the session. The backend returns these only to pad a near-empty
* feed, so a feed made up entirely of them means the window turned up no findings at all. */
export const FILLER_REASON_KINDS = new Set(['unviewed_recent', 'recent'])
-const WATCH_CATEGORY_COPY: Record<WatchFeedCategoryEnumApi, string> = {
+const WATCH_CATEGORY_COPY: Record<HighlightFeedCategoryEnumApi, string> = {
failure: 'Something failed in this session.',
struggle: 'The user struggled in this session.',
revenue: 'This session touches billing or a plan limit.',
}
/** What the reason kind says about the session. */
-export function watchReasonCopy(reason: WatchFeedReasonApi): string {
+export function highlightReasonCopy(reason: HighlightFeedReasonApi): string {
switch (reason.kind) {
case 'embedding_pick': {
const category = reason.watch_category
@@ -76,15 +76,15 @@ export function observationKeyMomentMs(observation: ReplayObservationApi): numbe
}
/** Where the player starts: a short lead-in before the key moment, or the recording's start without one. */
-export function watchStartSeconds(keyMomentMs: number | null): number {
+export function highlightStartSeconds(keyMomentMs: number | null): number {
return keyMomentMs === null ? 0 : Math.max(0, Math.floor(keyMomentMs / 1000) - KEY_MOMENT_LEAD_IN_S)
}
/** The observation page. `t` is always set, so the player opens expanded, and `from` makes the back button return to the feed. */
-export function watchFeedObservationUrl(observation: ReplayObservationApi): string {
+export function highlightFeedObservationUrl(observation: ReplayObservationApi): string {
return combineUrl(urls.replayVisionObservation(observation.id), {
- t: watchStartSeconds(observationKeyMomentMs(observation)),
- [OBSERVATION_ORIGIN_PARAM]: WATCH_FEED_ORIGIN,
+ t: highlightStartSeconds(observationKeyMomentMs(observation)),
+ [OBSERVATION_ORIGIN_PARAM]: HIGHLIGHT_FEED_ORIGIN,
}).url
}
@@ -95,7 +95,7 @@ export function watchFeedObservationUrl(observation: ReplayObservationApi): stri
* headline, with citation chips rendered as plain timestamps so a mid-sentence citation keeps
* its place, and the rest becomes the body, already plain.
*/
-export function watchCardHeadline(
+export function highlightCardHeadline(
observation: ReplayObservationApi
): { title: string; body: { text: string; segments?: unknown } | null } | null {
const result = readResult(observation)
@@ -132,13 +132,13 @@ export function watchCardHeadline(
return { title, body: rest ? { text: rest } : null }
}
-interface WatchFeedRowProps {
- item: WatchFeedItemApi
+interface HighlightFeedRowProps {
+ item: HighlightFeedItemApi
/** Zero-based place in the feed, captured so we can see how deep people read. */
position: number
}
-function WatchCardPerson({
+function HighlightCardPerson({
observation,
person,
}: {
@@ -152,7 +152,7 @@ function WatchCardPerson({
<Link
to={urls.personByDistinctId(observation.distinct_id)}
className="relative z-10 truncate min-w-0 text-muted"
- data-attr="vision-watch-feed-person"
+ data-attr="vision-highlight-feed-person"
>
{person}
</Link>
@@ -166,8 +166,8 @@ function WatchCardPerson({
}
/** The one sentence a row leads with when the scan wrote no short title, or the scanner's name for scans with no prose at all. */
-export function watchFeedRowSentence(observation: ReplayObservationApi): string {
- const headline = watchCardHeadline(observation)
+export function highlightFeedRowSentence(observation: ReplayObservationApi): string {
+ const headline = highlightCardHeadline(observation)
return headline?.title ?? scannerLabel(observation)
}
@@ -175,7 +175,7 @@ export function watchFeedRowSentence(observation: ReplayObservationApi): string
* The scanner behind a row: a circle in its type's color, then its name. Clicking it opens the
* scanner. The tooltip carries the scanner's question and verdict.
*/
-function WatchFeedScannerLink({
+function HighlightFeedScannerLink({
observation,
scannerName,
scannerType,
@@ -220,7 +220,7 @@ function WatchFeedScannerLink({
to={urls.replayVision(observation.scanner_id)}
subtle
className="relative z-10 flex max-w-full min-w-0 items-center gap-2 self-start text-sm text-secondary hover:text-default"
- data-attr="vision-watch-feed-scanner-chip"
+ data-attr="vision-highlight-feed-scanner-chip"
>
{chip}
</Link>
@@ -235,9 +235,9 @@ function WatchFeedScannerLink({
/**
* The title of a row. A summarizer's authored title is already short, so it leads. Other scans
- * lead with watchFeedRowSentence.
+ * lead with highlightFeedRowSentence.
*/
-export function watchFeedRowTitle(observation: ReplayObservationApi): string {
+export function highlightFeedRowTitle(observation: ReplayObservationApi): string {
const result = readResult(observation)
const scannerType =
(observation.scanner_snapshot?.scanner_type as ScannerType | undefined) ??
@@ -245,7 +245,7 @@ export function watchFeedRowTitle(observation: ReplayObservationApi): string {
if (scannerType === 'summarizer' && typeof result?.title === 'string' && result.title) {
return result.title
}
- return watchFeedRowSentence(observation)
+ return highlightFeedRowSentence(observation)
}
/**
@@ -253,21 +253,21 @@ export function watchFeedRowTitle(observation: ReplayObservationApi): string {
* picked, then the key-moment poster and a button that starts the player there. The whole card
* opens the observation page.
*/
-export function WatchFeedRow({ item, position }: WatchFeedRowProps): JSX.Element {
+export function HighlightFeedRow({ item, position }: HighlightFeedRowProps): JSX.Element {
const { observation, reason } = item
- const { feedLoad, dateFrom } = useValues(watchFeedLogic)
- const { cardSeen, dismissItem } = useActions(watchFeedLogic)
+ const { feedLoad, dateFrom } = useValues(highlightFeedLogic)
+ const { cardSeen, dismissItem } = useActions(highlightFeedLogic)
const rowRef = useAutoMarkRead(true, () => cardSeen(item, position), CARD_SEEN_DWELL_MS)
const result = readResult(observation)
- // Fall back to the result's own scanner_type when the snapshot is absent, like watchCardHeadline.
+ // Fall back to the result's own scanner_type when the snapshot is absent, like highlightCardHeadline.
const scannerType =
(observation.scanner_snapshot?.scanner_type as ScannerType | undefined) ??
(result?.scanner_type as ScannerType | undefined)
const scannerName = scannerLabel(observation)
const person = observation.recording_subject_email || observation.distinct_id
const keyMomentMs = observationKeyMomentMs(observation)
- const observationUrl = watchFeedObservationUrl(observation)
- const title = watchFeedRowTitle(observation)
+ const observationUrl = highlightFeedObservationUrl(observation)
+ const title = highlightFeedRowTitle(observation)
const filler = FILLER_REASON_KINDS.has(reason.kind)
const similarCount = reason.kind === 'embedding_pick' ? (reason.similar_count ?? 0) : 0
const groupProps = {
@@ -278,7 +278,7 @@ export function WatchFeedRow({ item, position }: WatchFeedRowProps): JSX.Element
cardContext: cardProperties(feedLoad, item, position, 'feed_tab'),
}
const captureOpened = (): void => {
- posthog.capture('replay_vision_watch_clip_clicked', {
+ posthog.capture('replay_vision_highlight_clip_clicked', {
...cardProperties(feedLoad, item, position, 'feed_tab'),
scanner_type: scannerType,
has_key_moment: keyMomentMs !== null,
@@ -289,17 +289,21 @@ export function WatchFeedRow({ item, position }: WatchFeedRowProps): JSX.Element
<article
ref={rowRef}
className="group relative flex min-w-0 flex-col gap-3 rounded-lg border bg-surface-primary p-4 hover:border-accent focus-within:border-accent"
- data-attr="vision-watch-feed-row"
+ data-attr="vision-highlight-feed-row"
>
<header className="flex min-w-0 items-center gap-2">
- <WatchFeedScannerLink observation={observation} scannerName={scannerName} scannerType={scannerType} />
+ <HighlightFeedScannerLink
+ observation={observation}
+ scannerName={scannerName}
+ scannerType={scannerType}
+ />
<span className="text-xs text-muted" aria-hidden>
·
</span>
<div className="min-w-0 flex-1">
- <WatchCardPerson observation={observation} person={person} />
+ <HighlightCardPerson observation={observation} person={person} />
</div>
- <WatchFeedDismissButton
+ <HighlightFeedDismissButton
className="relative z-10 shrink-0"
onDismiss={(dismissalReason) => dismissItem(item, position, dismissalReason)}
/>
@@ -309,7 +313,7 @@ export function WatchFeedRow({ item, position }: WatchFeedRowProps): JSX.Element
to={observationUrl}
onClick={captureOpened}
className="text-default after:absolute after:inset-0 after:content-['']"
- data-attr="vision-watch-feed-row-open"
+ data-attr="vision-highlight-feed-row-open"
>
<h3
className={`m-0 text-base line-clamp-2 group-hover:text-accent ${filler ? 'font-medium text-secondary' : 'font-semibold'}`}
@@ -319,7 +323,10 @@ export function WatchFeedRow({ item, position }: WatchFeedRowProps): JSX.Element
{title}
</h3>
</Link>
- <p className="m-0 flex items-start gap-1.5 text-sm text-secondary" data-attr="vision-watch-feed-why">
+ <p
+ className="m-0 flex items-start gap-1.5 text-sm text-secondary"
+ data-attr="vision-highlight-feed-why"
+ >
<Tooltip title="Why this recording">
<span className="mt-0.5 flex shrink-0">
<IconFlag className="text-accent" aria-hidden />
@@ -327,7 +334,7 @@ export function WatchFeedRow({ item, position }: WatchFeedRowProps): JSX.Element
</Tooltip>
<span className="line-clamp-3">
<span className="sr-only">Why this recording: </span>
- {watchReasonCopy(reason)}
+ {highlightReasonCopy(reason)}
</span>
</p>
</div>
@@ -345,15 +352,15 @@ export function WatchFeedRow({ item, position }: WatchFeedRowProps): JSX.Element
to={observationUrl}
onClick={captureOpened}
className="relative z-10"
- data-attr="vision-watch-feed-row-watch"
+ data-attr="vision-highlight-feed-row-watch"
>
{keyMomentMs !== null
? `Watch from ${colonDelimitedDuration(Math.floor(keyMomentMs / 1000), null)}`
: 'Watch session'}
</LemonButton>
- {similarCount > 0 && <WatchFeedGroupToggle {...groupProps} />}
+ {similarCount > 0 && <HighlightFeedGroupToggle {...groupProps} />}
</footer>
- {similarCount > 0 && <WatchFeedGroupList {...groupProps} />}
+ {similarCount > 0 && <HighlightFeedGroupList {...groupProps} />}
</article>
)
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedDismissButton.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedDismissButton.tsx
similarity index 68%
rename from products/replay_vision/frontend/replay_scanners/components/WatchFeedDismissButton.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightFeedDismissButton.tsx
index 0caf5e4d1d9b..77dc95d748e5 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedDismissButton.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedDismissButton.tsx
@@ -3,14 +3,14 @@ import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
import { IconBlock } from 'lib/lemon-ui/icons'
import type { FeedDismissalReasonEnumApi } from '../../generated/api.schemas'
-import { feedDismissalMenuItems } from '../watchFeedDismissal'
+import { feedDismissalMenuItems } from '../highlightFeedDismissal'
-interface WatchFeedDismissButtonProps {
+interface HighlightFeedDismissButtonProps {
onDismiss: (reason: FeedDismissalReasonEnumApi | null) => void
className?: string
}
-export function WatchFeedDismissButton({ onDismiss, className }: WatchFeedDismissButtonProps): JSX.Element {
+export function HighlightFeedDismissButton({ onDismiss, className }: HighlightFeedDismissButtonProps): JSX.Element {
return (
<LemonMenu placement="bottom-end" items={feedDismissalMenuItems(onDismiss)}>
<LemonButton
@@ -19,7 +19,7 @@ export function WatchFeedDismissButton({ onDismiss, className }: WatchFeedDismis
tooltip="Not useful"
aria-label="Not useful"
className={className}
- data-attr="vision-watch-feed-dismiss"
+ data-attr="vision-highlight-feed-dismiss"
/>
</LemonMenu>
)
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.stories.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedEmptyState.stories.tsx
similarity index 79%
rename from products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.stories.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightFeedEmptyState.stories.tsx
index 72778dc4c8c7..a4943cda3d05 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.stories.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedEmptyState.stories.tsx
@@ -1,12 +1,12 @@
import type { Meta, StoryObj } from '@storybook/react'
-import { WatchFeedEmptyState } from './WatchFeedEmptyState'
+import { HighlightFeedEmptyState } from './HighlightFeedEmptyState'
// One story per reason: the copy is the feature here, so a screenshot is the only way to check that
// each one reads as a different answer with a different next step.
-const meta: Meta<typeof WatchFeedEmptyState> = {
- title: 'Scenes-App/Replay Vision/WatchFeedEmptyState',
- component: WatchFeedEmptyState,
+const meta: Meta<typeof HighlightFeedEmptyState> = {
+ title: 'Scenes-App/Replay Vision/HighlightFeedEmptyState',
+ component: HighlightFeedEmptyState,
decorators: [
// The width has to come from the parent. LemonBanner is a CSS container, so its contents do
// not set its width, and the snapshot runner sizes the story root to hug its child — which
@@ -20,7 +20,7 @@ const meta: Meta<typeof WatchFeedEmptyState> = {
}
export default meta
-type Story = StoryObj<typeof WatchFeedEmptyState>
+type Story = StoryObj<typeof HighlightFeedEmptyState>
export const NoScanners: Story = { args: { reason: 'no-scanners' } }
export const AllDisabled: Story = { args: { reason: 'all-disabled' } }
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedEmptyState.tsx
similarity index 70%
rename from products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightFeedEmptyState.tsx
index ae48737ed81b..cd46093f1182 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedEmptyState.tsx
@@ -5,9 +5,9 @@ import { LemonButton } from '@posthog/lemon-ui'
import { urls } from 'scenes/urls'
-import { WATCH_FEED_BLOCKS, type WatchFeedEmptyReason, isWatchFeedBlock } from '../watchFeedEmptyState'
-import { feedWindowPhrase, longerFeedWindow, watchFeedLogic } from '../watchFeedLogic'
-import { WatchFeedIntro } from './WatchFeedIntro'
+import { HIGHLIGHT_FEED_BLOCKS, type HighlightFeedEmptyReason, isHighlightFeedBlock } from '../highlightFeedEmptyState'
+import { feedWindowPhrase, longerFeedWindow, highlightFeedLogic } from '../highlightFeedLogic'
+import { HighlightFeedIntro } from './HighlightFeedIntro'
function DashedNote({ children }: { children: React.ReactNode }): JSX.Element {
return (
@@ -18,20 +18,20 @@ function DashedNote({ children }: { children: React.ReactNode }): JSX.Element {
}
/**
- * The one screen the What to watch tab shows when it has no clips. Each reason gets the next step
+ * The one screen the Highlights tab shows when it has no clips. Each reason gets the next step
* that would actually fill the feed, so a reader is never told to wait on scanners that cannot run.
*/
-export function WatchFeedEmptyState({ reason }: { reason: WatchFeedEmptyReason }): JSX.Element {
- const { setOnlyMyScanners, setDateFrom } = useActions(watchFeedLogic)
- const { dateFrom } = useValues(watchFeedLogic)
+export function HighlightFeedEmptyState({ reason }: { reason: HighlightFeedEmptyReason }): JSX.Element {
+ const { setOnlyMyScanners, setDateFrom } = useActions(highlightFeedLogic)
+ const { dateFrom } = useValues(highlightFeedLogic)
const { push } = useActions(router)
if (reason === 'no-scanners') {
- return <WatchFeedIntro />
+ return <HighlightFeedIntro />
}
- if (isWatchFeedBlock(reason)) {
- const block = WATCH_FEED_BLOCKS[reason]
+ if (isHighlightFeedBlock(reason)) {
+ const block = HIGHLIGHT_FEED_BLOCKS[reason]
return (
<DashedNote>
<span>No sessions to show. {block.cause}</span>
@@ -57,7 +57,7 @@ export function WatchFeedEmptyState({ reason }: { reason: WatchFeedEmptyReason }
type="secondary"
size="small"
onClick={() => setOnlyMyScanners(false)}
- data-attr="vision-watch-feed-show-all-scanners"
+ data-attr="vision-highlight-feed-show-all-scanners"
>
Show all scanners
</LemonButton>
@@ -74,7 +74,7 @@ export function WatchFeedEmptyState({ reason }: { reason: WatchFeedEmptyReason }
type="secondary"
size="small"
onClick={() => setDateFrom(longerWindow.value)}
- data-attr="vision-watch-feed-longer-window"
+ data-attr="vision-highlight-feed-longer-window"
>
Show {longerWindow.label.toLowerCase()}
</LemonButton>
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedGroup.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedGroup.tsx
similarity index 81%
rename from products/replay_vision/frontend/replay_scanners/components/WatchFeedGroup.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightFeedGroup.tsx
index 0dc21dec314d..fc043d930ccd 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedGroup.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedGroup.tsx
@@ -12,16 +12,16 @@ import { urls } from 'scenes/urls'
import { ObservationThumbnail } from '../../components/ObservationThumbnail'
import { type ReplayObservationApi, VisionObservationsThumbnailRetrieveSize } from '../../generated/api.schemas'
import { scannerLabel } from '../../utils/observation'
+import { type HighlightFeedGroupLogicProps, highlightFeedGroupLogic } from '../highlightFeedGroupLogic'
import { ReplayScannerTab } from '../replayScannerSceneLogic'
-import { type WatchFeedGroupLogicProps, watchFeedGroupLogic } from '../watchFeedGroupLogic'
-import { observationKeyMomentMs, watchCardHeadline, watchFeedObservationUrl } from './WatchFeedCard'
+import { observationKeyMomentMs, highlightCardHeadline, highlightFeedObservationUrl } from './HighlightFeedCard'
/** The card's telemetry properties, so group events join the card they came from. */
type CardContext = Record<string, unknown>
-type WatchFeedGroupProps = WatchFeedGroupLogicProps & { similarCount: number; cardContext: CardContext }
+type HighlightFeedGroupProps = HighlightFeedGroupLogicProps & { similarCount: number; cardContext: CardContext }
-function WatchFeedGroupMember({
+function HighlightFeedGroupMember({
observation,
cardContext,
}: {
@@ -29,7 +29,7 @@ function WatchFeedGroupMember({
cardContext: CardContext
}): JSX.Element {
const keyMomentMs = observationKeyMomentMs(observation)
- const url = watchFeedObservationUrl(observation)
+ const url = highlightFeedObservationUrl(observation)
const captureOpened = (target: string) => (): void => {
posthog.capture('replay_vision_watch_group_member_opened', {
...cardContext,
@@ -38,9 +38,9 @@ function WatchFeedGroupMember({
})
}
const person = observation.recording_subject_email || observation.distinct_id
- const title = watchCardHeadline(observation)?.title ?? scannerLabel(observation)
+ const title = highlightCardHeadline(observation)?.title ?? scannerLabel(observation)
return (
- <li className="flex min-w-0 items-center gap-3" data-attr="vision-watch-feed-group-member">
+ <li className="flex min-w-0 items-center gap-3" data-attr="vision-highlight-feed-group-member">
<Link
to={url}
className="w-24 shrink-0 overflow-hidden rounded border border-primary"
@@ -82,9 +82,13 @@ function WatchFeedGroupMember({
}
/** Opens the other sessions in a card's feed group under the card, so a reader can see who else hit it. */
-export function WatchFeedGroupToggle({ similarCount, cardContext, ...logicProps }: WatchFeedGroupProps): JSX.Element {
- const { expanded } = useValues(watchFeedGroupLogic(logicProps))
- const { toggleExpanded } = useActions(watchFeedGroupLogic(logicProps))
+export function HighlightFeedGroupToggle({
+ similarCount,
+ cardContext,
+ ...logicProps
+}: HighlightFeedGroupProps): JSX.Element {
+ const { expanded } = useValues(highlightFeedGroupLogic(logicProps))
+ const { toggleExpanded } = useActions(highlightFeedGroupLogic(logicProps))
return (
<LemonButton
size="small"
@@ -103,26 +107,26 @@ export function WatchFeedGroupToggle({ similarCount, cardContext, ...logicProps
}}
aria-expanded={expanded}
className="relative z-10 ml-auto"
- data-attr="vision-watch-feed-group-toggle"
+ data-attr="vision-highlight-feed-group-toggle"
>
{similarCount === 1 ? '1 similar session' : `${similarCount} similar sessions`}
</LemonButton>
)
}
-export function WatchFeedGroupList({
+export function HighlightFeedGroupList({
similarCount,
cardContext,
...logicProps
-}: WatchFeedGroupProps): JSX.Element | null {
- const { expanded, members, membersLoading } = useValues(watchFeedGroupLogic(logicProps))
- const { loadMembers } = useActions(watchFeedGroupLogic(logicProps))
+}: HighlightFeedGroupProps): JSX.Element | null {
+ const { expanded, members, membersLoading } = useValues(highlightFeedGroupLogic(logicProps))
+ const { loadMembers } = useActions(highlightFeedGroupLogic(logicProps))
if (!expanded) {
return null
}
return (
// Sits above the card's full-size link, so a click here never opens the card's own session.
- <div className="relative z-10 flex flex-col gap-3 border-t pt-3" data-attr="vision-watch-feed-group">
+ <div className="relative z-10 flex flex-col gap-3 border-t pt-3" data-attr="vision-highlight-feed-group">
{membersLoading ? (
<div className="flex flex-col gap-3" aria-busy>
{Array.from({ length: Math.min(similarCount, 3) }, (_, i) => (
@@ -141,7 +145,7 @@ export function WatchFeedGroupList({
) : (
<ul className="m-0 flex list-none flex-col gap-3 p-0">
{members.shown.map((member) => (
- <WatchFeedGroupMember key={member.id} observation={member} cardContext={cardContext} />
+ <HighlightFeedGroupMember key={member.id} observation={member} cardContext={cardContext} />
))}
</ul>
)}
@@ -156,7 +160,7 @@ export function WatchFeedGroupList({
}).url
}
className="self-start text-sm"
- data-attr="vision-watch-feed-group-see-all"
+ data-attr="vision-highlight-feed-group-see-all"
onClick={() =>
posthog.capture('replay_vision_watch_group_see_all_clicked', {
...cardContext,
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedIntro.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedIntro.tsx
similarity index 82%
rename from products/replay_vision/frontend/replay_scanners/components/WatchFeedIntro.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightFeedIntro.tsx
index 956dbed76c7a..20b045f00d83 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedIntro.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedIntro.tsx
@@ -3,10 +3,10 @@ import { CreateScannerButton } from './CreateScannerButton'
import { ExampleObservations } from './ExampleObservations'
/**
- * What the What to watch tab shows a reader who has no scanners: what the feed is for, an example of
+ * What the Highlights tab shows a reader who has no scanners: what the feed is for, an example of
* the card it fills with, and the way to start one.
*/
-export function WatchFeedIntro(): JSX.Element {
+export function HighlightFeedIntro(): JSX.Element {
return (
<div className="flex flex-col gap-4">
<div className="flex flex-col items-center gap-2 text-center">
@@ -18,10 +18,10 @@ export function WatchFeedIntro(): JSX.Element {
<div className="flex flex-wrap items-center justify-center gap-2 mt-1">
<CreateScannerButton
acceptedLabel="Create your first scanner"
- dataAttr="vision-watch-feed-create-scanner"
+ dataAttr="vision-highlight-feed-create-scanner"
size="medium"
/>
- <VisionDocsLink page="creating-scanners" dataAttr="vision-watch-feed-docs-link">
+ <VisionDocsLink page="creating-scanners" dataAttr="vision-highlight-feed-docs-link">
Learn how scanners work
</VisionDocsLink>
</div>
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedTab.tsx
similarity index 87%
rename from products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightFeedTab.tsx
index 993b2de2d220..8936534571c2 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedTab.tsx
@@ -6,11 +6,11 @@ import { useInView } from 'react-intersection-observer'
import { IconChevronDown } from '@posthog/icons'
import { LemonButton, LemonMenu, LemonSkeleton, LemonTabs, Spinner } from '@posthog/lemon-ui'
-import { isWatchFeedBlock } from '../watchFeedEmptyState'
-import { FEED_DATE_OPTIONS, feedWindowOption, feedWindowPhrase, watchFeedLogic } from '../watchFeedLogic'
-import { WatchFeedBlockedBanner } from './WatchFeedBlockedBanner'
-import { FILLER_REASON_KINDS, WatchFeedRow } from './WatchFeedCard'
-import { WatchFeedEmptyState } from './WatchFeedEmptyState'
+import { isHighlightFeedBlock } from '../highlightFeedEmptyState'
+import { FEED_DATE_OPTIONS, feedWindowOption, feedWindowPhrase, highlightFeedLogic } from '../highlightFeedLogic'
+import { HighlightFeedBlockedBanner } from './HighlightFeedBlockedBanner'
+import { FILLER_REASON_KINDS, HighlightFeedRow } from './HighlightFeedCard'
+import { HighlightFeedEmptyState } from './HighlightFeedEmptyState'
function FeedSkeleton(): JSX.Element {
return (
@@ -24,8 +24,8 @@ function FeedSkeleton(): JSX.Element {
/** Loads the next page as the reader nears the end, and closes the feed once the ranking runs out. */
function FeedEnd({ itemCount }: { itemCount: number }): JSX.Element | null {
- const { feedHasMore, feedItemsLoading, feedMoreFailed } = useValues(watchFeedLogic)
- const { loadMoreFeed } = useActions(watchFeedLogic)
+ const { feedHasMore, feedItemsLoading, feedMoreFailed } = useValues(highlightFeedLogic)
+ const { loadMoreFeed } = useActions(highlightFeedLogic)
// Starts the request a little before the end is on screen, so a steady scroll rarely waits.
const { ref, inView } = useInView({ rootMargin: '600px 0px' })
@@ -53,13 +53,13 @@ function FeedEnd({ itemCount }: { itemCount: number }): JSX.Element | null {
)
}
return itemCount > 3 ? (
- <p className="text-sm text-secondary text-center m-0 py-4" data-attr="vision-watch-feed-end">
+ <p className="text-sm text-secondary text-center m-0 py-4" data-attr="vision-highlight-feed-end">
You're caught up. New sessions show up here as your scanners find them.
</p>
) : null
}
-export function WatchFeedTab(): JSX.Element {
+export function HighlightFeedTab(): JSX.Element {
const {
feedItems,
feedItemsLoading,
@@ -70,8 +70,8 @@ export function WatchFeedTab(): JSX.Element {
scopedToMine,
hasOwnScanners,
emptyReason,
- } = useValues(watchFeedLogic)
- const { setDateFrom, setOnlyMyScanners, loadFeed } = useActions(watchFeedLogic)
+ } = useValues(highlightFeedLogic)
+ const { setDateFrom, setOnlyMyScanners, loadFeed } = useActions(highlightFeedLogic)
const items = feedItems ?? []
// Every card carrying a no-evidence reason means the window produced no findings. A feed that mixes a
@@ -90,7 +90,7 @@ export function WatchFeedTab(): JSX.Element {
size="small"
type="tertiary"
sideIcon={<IconChevronDown />}
- data-attr="vision-watch-feed-range"
+ data-attr="vision-highlight-feed-range"
>
{feedWindowOption(dateFrom)?.label ?? dateFrom}
</LemonButton>
@@ -113,10 +113,10 @@ export function WatchFeedTab(): JSX.Element {
className="mx-auto w-full max-w-xl -mb-2 [&_ul>div]:gap-x-6"
activeKey={scopedToMine ? 'mine' : 'all'}
onChange={(key) => setOnlyMyScanners(key === 'mine')}
- data-attr="vision-watch-feed-scope"
+ data-attr="vision-highlight-feed-scope"
tabs={[
- { key: 'all', label: 'All scanners', 'data-attr': 'vision-watch-feed-scope-all' },
- { key: 'mine', label: 'My scanners', 'data-attr': 'vision-watch-feed-scope-mine' },
+ { key: 'all', label: 'All scanners', 'data-attr': 'vision-highlight-feed-scope-all' },
+ { key: 'mine', label: 'My scanners', 'data-attr': 'vision-highlight-feed-scope-mine' },
]}
rightSlotClassName="bg-transparent pr-0"
rightSlot={rangeMenu}
@@ -132,7 +132,7 @@ export function WatchFeedTab(): JSX.Element {
{feedReloading && (
<div
className="pointer-events-none absolute inset-0 z-10 flex justify-center pt-32"
- data-attr="vision-watch-feed-reloading"
+ data-attr="vision-highlight-feed-reloading"
role="status"
aria-label="Loading the feed"
>
@@ -153,8 +153,8 @@ export function WatchFeedTab(): JSX.Element {
</LemonButton>
</div>
)}
- {items.length > 0 && isWatchFeedBlock(emptyReason) && (
- <WatchFeedBlockedBanner reason={emptyReason} />
+ {items.length > 0 && isHighlightFeedBlock(emptyReason) && (
+ <HighlightFeedBlockedBanner reason={emptyReason} />
)}
{items.length > 0 ? (
<div
@@ -171,7 +171,7 @@ export function WatchFeedTab(): JSX.Element {
</p>
)}
{items.map((item, index) => (
- <WatchFeedRow
+ <HighlightFeedRow
key={`${feedLoad?.feedLoadId}-${item.observation.id}`}
item={item}
position={index}
@@ -180,7 +180,7 @@ export function WatchFeedTab(): JSX.Element {
<FeedEnd itemCount={items.length} />
</div>
) : feedFailed ? null : emptyReason ? (
- <WatchFeedEmptyState reason={emptyReason} />
+ <HighlightFeedEmptyState reason={emptyReason} />
) : (
// Still resolving why the feed is empty. The scanner list defaults to empty while
// it loads, so naming a reason now would show the no-scanners screen to a reader
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPickPreview.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPickPreview.tsx
similarity index 69%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPickPreview.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPickPreview.tsx
index ca56a3b5d999..01c911fb53c2 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPickPreview.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPickPreview.tsx
@@ -3,14 +3,20 @@ import { cn } from 'lib/utils/css-classes'
import { ObservationThumbnail } from '../../components/ObservationThumbnail'
import { ScannerTypeBadge } from '../../components/ScannerTypeBadge'
-import type { WatchFeedItemApi } from '../../generated/api.schemas'
+import type { HighlightFeedItemApi } from '../../generated/api.schemas'
import { citedTextToPlainText } from '../../utils/citations'
-import { watchPickSummary } from '../watchPickSummary'
-import { watchReasonCopy } from './WatchFeedCard'
+import { highlightPickSummary } from '../highlightPickSummary'
+import { highlightReasonCopy } from './HighlightFeedCard'
-export function WatchPickPreview({ item, className }: { item: WatchFeedItemApi; className?: string }): JSX.Element {
+export function HighlightPickPreview({
+ item,
+ className,
+}: {
+ item: HighlightFeedItemApi
+ className?: string
+}): JSX.Element {
const { observation, reason } = item
- const { title, scannerName, scannerType } = watchPickSummary(observation)
+ const { title, scannerName, scannerType } = highlightPickSummary(observation)
return (
<div className={cn('flex flex-col gap-1.5 py-1', className ?? 'w-64')}>
@@ -22,7 +28,7 @@ export function WatchPickPreview({ item, className }: { item: WatchFeedItemApi;
<span>·</span>
<TZLabel time={observation.created_at} showPopover={false} noStyles className="whitespace-nowrap" />
</span>
- <span className="text-xs leading-snug">{citedTextToPlainText(watchReasonCopy(reason), undefined)}</span>
+ <span className="text-xs leading-snug">{citedTextToPlainText(highlightReasonCopy(reason), undefined)}</span>
</div>
)
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPickRankBadge.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPickRankBadge.tsx
similarity index 92%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPickRankBadge.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPickRankBadge.tsx
index bac4d7a488d7..c38cbd6b7285 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPickRankBadge.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPickRankBadge.tsx
@@ -1,6 +1,6 @@
import { cn } from 'lib/utils/css-classes'
-export function WatchPickRankBadge({
+export function HighlightPickRankBadge({
rank,
size = 'medium',
}: {
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPickRow.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPickRow.tsx
similarity index 66%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPickRow.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPickRow.tsx
index f0147be68fc5..7c29b3c039b4 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPickRow.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPickRow.tsx
@@ -7,26 +7,26 @@ import { TZLabel } from 'lib/components/TZLabel'
import { cn } from 'lib/utils/css-classes'
import { ObservationThumbnail } from '../../components/ObservationThumbnail'
-import type { WatchFeedItemApi } from '../../generated/api.schemas'
+import type { HighlightFeedItemApi } from '../../generated/api.schemas'
import { citedTextToPlainText } from '../../utils/citations'
-import { CARD_SEEN_DWELL_MS } from '../watchFeedTelemetry'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { watchPickSummary } from '../watchPickSummary'
-import { watchReasonCopy } from './WatchFeedCard'
-import { WatchPickPreview } from './WatchPickPreview'
-import { WatchPickRankBadge } from './WatchPickRankBadge'
+import { CARD_SEEN_DWELL_MS } from '../highlightFeedTelemetry'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { highlightPickSummary } from '../highlightPickSummary'
+import { highlightReasonCopy } from './HighlightFeedCard'
+import { HighlightPickPreview } from './HighlightPickPreview'
+import { HighlightPickRankBadge } from './HighlightPickRankBadge'
-interface WatchPickRowProps {
- item: WatchFeedItemApi
+interface HighlightPickRowProps {
+ item: HighlightFeedItemApi
position: number
isActive: boolean
rank?: number
}
-export function WatchPickRow({ item, position, isActive, rank }: WatchPickRowProps): JSX.Element {
- const { watchPick, cardSeen } = useActions(watchPicksLogic)
+export function HighlightPickRow({ item, position, isActive, rank }: HighlightPickRowProps): JSX.Element {
+ const { highlightPick, cardSeen } = useActions(highlightPicksLogic)
const { observation, reason } = item
- const { title, scannerName } = watchPickSummary(observation)
+ const { title, scannerName } = highlightPickSummary(observation)
const rowRef = useAutoMarkRead(true, () => cardSeen(item, position), CARD_SEEN_DWELL_MS)
return (
@@ -35,16 +35,16 @@ export function WatchPickRow({ item, position, isActive, rank }: WatchPickRowPro
fullWidth
size="small"
active={isActive}
- onClick={() => watchPick(item, position)}
- tooltip={<WatchPickPreview item={item} />}
+ onClick={() => highlightPick(item, position)}
+ tooltip={<HighlightPickPreview item={item} />}
tooltipPlacement="right"
className="min-w-0"
- data-attr="vision-watch-pick"
+ data-attr="vision-highlight-pick"
>
<span className={cn('flex w-full min-w-0 items-center gap-3 py-1', observation.viewed && 'opacity-60')}>
<span className="relative w-28 shrink-0">
<ObservationThumbnail observation={observation} className="w-full" size="small" />
- {rank !== undefined && <WatchPickRankBadge rank={rank} size="small" />}
+ {rank !== undefined && <HighlightPickRankBadge rank={rank} size="small" />}
{!observation.viewed && (
<span className="absolute inset-y-0 left-0 w-1 rounded-l bg-accent" aria-hidden />
)}
@@ -65,7 +65,7 @@ export function WatchPickRow({ item, position, isActive, rank }: WatchPickRowPro
/>
</span>
<span className="truncate text-xs font-normal text-secondary">
- {citedTextToPlainText(watchReasonCopy(reason), undefined)}
+ {citedTextToPlainText(highlightReasonCopy(reason), undefined)}
</span>
</span>
</span>
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksBlockedState.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksBlockedState.tsx
similarity index 86%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksBlockedState.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksBlockedState.tsx
index 59b44a8ade11..a9b74a241c43 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksBlockedState.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksBlockedState.tsx
@@ -12,23 +12,23 @@ import type { ReplayScannerApi } from '../../generated/api.schemas'
import { visionQuotaLogic } from '../../logics/visionQuotaLogic'
import { getReplayVisionEditDisabledReason } from '../../utils/accessControl'
import { formatCreditsMaybeUsd } from '../../utils/credits'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { highlightPicksStaleLogic } from '../highlightPicksStaleLogic'
import { stoppedByFreeCredits } from '../scannerCopy'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { watchPicksStaleLogic } from '../watchPicksStaleLogic'
-import { WatchPicksStateFrame } from './WatchPicksStateFrame'
+import { HighlightPicksStateFrame } from './HighlightPicksStateFrame'
const RAISE_FACTOR = 1.5
const HedgehogAsleep = pngHoggie(asleepPng)
-export function WatchPicksBlockedState({
+export function HighlightPicksBlockedState({
reason,
size = 'small',
}: {
reason: 'all-disabled' | 'all-capped' | 'quota-exhausted'
size?: 'small' | 'large'
}): JSX.Element {
- const picksLogic = useMountedLogic(watchPicksLogic)
- const logic = watchPicksStaleLogic(picksLogic.props)
+ const picksLogic = useMountedLogic(highlightPicksLogic)
+ const logic = highlightPicksStaleLogic(picksLogic.props)
const { scanners, quota, busyScannerId } = useValues(logic)
const { showUsd } = useValues(visionQuotaLogic)
const { toggleScanner, raiseLimit } = useActions(logic)
@@ -37,14 +37,14 @@ export function WatchPicksBlockedState({
if (reason === 'all-disabled') {
return (
- <WatchPicksStateFrame
+ <HighlightPicksStateFrame
size={size}
image={HedgehogAsleep}
title="None of your scanners are running"
body="Turn one on and picks appear after the next matching recording."
- dataAttr="vision-watch-picks-block-disabled"
+ dataAttr="vision-highlight-picks-block-disabled"
footer={
- <Link to={urls.replayVision()} className="mt-1" data-attr="vision-watch-picks-block-open">
+ <Link to={urls.replayVision()} className="mt-1" data-attr="vision-highlight-picks-block-open">
Open Replay vision
</Link>
}
@@ -63,12 +63,12 @@ export function WatchPicksBlockedState({
disabledReason={editDisabledReason}
loading={busyScannerId === scanner.id}
onChange={(checked) => toggleScanner(scanner.id, checked)}
- data-attr="vision-watch-picks-block-toggle"
+ data-attr="vision-highlight-picks-block-toggle"
/>
</div>
))}
</div>
- </WatchPicksStateFrame>
+ </HighlightPicksStateFrame>
)
}
@@ -76,7 +76,7 @@ export function WatchPicksBlockedState({
const resetsAt = quota?.period_end
const freeSampleUsedUp = capped.length > 0 && capped.every((scanner) => stoppedByFreeCredits(scanner))
return (
- <LemonBanner type="warning" className="m-2" data-attr="vision-watch-picks-block-capped">
+ <LemonBanner type="warning" className="m-2" data-attr="vision-highlight-picks-block-capped">
<div className="flex flex-col gap-2">
<span className="font-semibold">
{reason === 'quota-exhausted'
@@ -112,14 +112,14 @@ export function WatchPicksBlockedState({
raiseLimit(scanner.id, next)
setRaising(null)
}}
- data-attr="vision-watch-picks-block-raise-confirm"
+ data-attr="vision-highlight-picks-block-raise-confirm"
>
Set {formatCreditsMaybeUsd(next, showUsd)} a month
</LemonButton>
<LemonButton
size="xsmall"
onClick={() => setRaising(null)}
- data-attr="vision-watch-picks-block-raise-cancel"
+ data-attr="vision-highlight-picks-block-raise-cancel"
>
Cancel
</LemonButton>
@@ -130,7 +130,7 @@ export function WatchPicksBlockedState({
type="secondary"
disabledReason={editDisabledReason}
onClick={() => setRaising(scanner.id)}
- data-attr="vision-watch-picks-block-raise"
+ data-attr="vision-highlight-picks-block-raise"
>
{freeOnly ? 'Set a budget' : 'Raise limit'}
</LemonButton>
@@ -141,7 +141,7 @@ export function WatchPicksBlockedState({
<Link
to={`${urls.replayVision()}?tab=usage`}
className="text-xs"
- data-attr="vision-watch-picks-block-usage"
+ data-attr="vision-highlight-picks-block-usage"
>
See usage
</Link>
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksEmptyState.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksEmptyState.tsx
similarity index 61%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksEmptyState.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksEmptyState.tsx
index 8748d56358d0..6d983e0f50e3 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksEmptyState.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksEmptyState.tsx
@@ -8,25 +8,25 @@ import { teamLogic } from 'scenes/teamLogic'
import { visionQuotaLogic } from '../../logics/visionQuotaLogic'
import { visionScannersListLogic } from '../../logics/visionScannersListLogic'
-import { resolveWatchFeedEmptyReason } from '../watchFeedEmptyState'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { WatchPicksBlockedState } from './WatchPicksBlockedState'
-import { WatchPicksQuietState } from './WatchPicksQuietState'
-import { WatchPicksReplayOffState } from './WatchPicksReplayOffState'
-import { WatchPicksStarter } from './WatchPicksStarter'
-
-export function WatchPicksEmptyState({ size }: { size: 'small' | 'large' }): JSX.Element {
+import { resolveHighlightFeedEmptyReason } from '../highlightFeedEmptyState'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { HighlightPicksBlockedState } from './HighlightPicksBlockedState'
+import { HighlightPicksQuietState } from './HighlightPicksQuietState'
+import { HighlightPicksReplayOffState } from './HighlightPicksReplayOffState'
+import { HighlightPicksStarter } from './HighlightPicksStarter'
+
+export function HighlightPicksEmptyState({ size }: { size: 'small' | 'large' }): JSX.Element {
const { scanners, scannersLoading } = useValues(visionScannersListLogic)
const { quota, quotaLoading } = useValues(visionQuotaLogic)
const { currentTeam } = useValues(teamLogic)
- const picksLogic = useMountedLogic(watchPicksLogic)
+ const picksLogic = useMountedLogic(highlightPicksLogic)
const { emptyStateShown } = useActions(picksLogic)
const large = size === 'large'
const loading = scannersLoading || quotaLoading
const reason = loading
? null
- : resolveWatchFeedEmptyReason({
+ : resolveHighlightFeedEmptyReason({
scanners,
quota,
sessionRecordingOptIn: currentTeam?.session_recording_opt_in ?? null,
@@ -43,14 +43,14 @@ export function WatchPicksEmptyState({ size }: { size: 'small' | 'large' }): JSX
return <LemonSkeleton className={cn('w-full rounded', large ? 'h-64' : 'h-40')} />
}
if (reason === 'replay-off') {
- return <WatchPicksReplayOffState size={size} />
+ return <HighlightPicksReplayOffState size={size} />
}
if (reason === 'no-scanners') {
- return <WatchPicksStarter size={size} />
+ return <HighlightPicksStarter size={size} />
}
if (reason === 'all-disabled' || reason === 'all-capped' || reason === 'quota-exhausted') {
- return <WatchPicksBlockedState reason={reason} size={size} />
+ return <HighlightPicksBlockedState reason={reason} size={size} />
}
- return <WatchPicksQuietState size={size} />
+ return <HighlightPicksQuietState size={size} />
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksExtraRows.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksExtraRows.tsx
similarity index 59%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksExtraRows.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksExtraRows.tsx
index a9a234d938e6..2ed238cf262f 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksExtraRows.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksExtraRows.tsx
@@ -1,16 +1,16 @@
import { useMountedLogic, useValues } from 'kea'
import { useEffect, useRef } from 'react'
-import type { WatchFeedItemApi } from '../../generated/api.schemas'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { watchPicksStaleLogic } from '../watchPicksStaleLogic'
-import { watchPicksStarterLogic } from '../watchPicksStarterLogic'
-import { WatchPickRow } from './WatchPickRow'
+import type { HighlightFeedItemApi } from '../../generated/api.schemas'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { highlightPicksStaleLogic } from '../highlightPicksStaleLogic'
+import { highlightPicksStarterLogic } from '../highlightPicksStarterLogic'
+import { HighlightPickRow } from './HighlightPickRow'
-export function WatchPicksExtraRows(): JSX.Element | null {
- const picksLogic = useMountedLogic(watchPicksLogic)
- const { nextBest } = useValues(watchPicksStaleLogic(picksLogic.props))
- const { scannedAnyway } = useValues(watchPicksStarterLogic(picksLogic.props))
+export function HighlightPicksExtraRows(): JSX.Element | null {
+ const picksLogic = useMountedLogic(highlightPicksLogic)
+ const { nextBest } = useValues(highlightPicksStaleLogic(picksLogic.props))
+ const { scannedAnyway } = useValues(highlightPicksStarterLogic(picksLogic.props))
const ref = useRef<HTMLDivElement>(null)
const rows = scannedAnyway ?? nextBest
@@ -24,7 +24,7 @@ export function WatchPicksExtraRows(): JSX.Element | null {
return null
}
return (
- <div ref={ref} className="flex flex-col gap-0.5 border-t p-1" data-attr="vision-watch-picks-extra-rows">
+ <div ref={ref} className="flex flex-col gap-0.5 border-t p-1" data-attr="vision-highlight-picks-extra-rows">
<span className="px-2 pt-1 text-xs font-semibold text-secondary">
{scannedAnyway ? 'Scanned, nothing notable' : 'Newest results, not ranked'}
</span>
@@ -32,9 +32,9 @@ export function WatchPicksExtraRows(): JSX.Element | null {
<span className="px-2 pb-1 text-xs text-secondary">No finished scans this week.</span>
) : (
rows.map((observation, index) => (
- <WatchPickRow
+ <HighlightPickRow
key={observation.id}
- item={{ observation, reason: { kind: 'recent' } } as WatchFeedItemApi}
+ item={{ observation, reason: { kind: 'recent' } } as HighlightFeedItemApi}
position={index}
isActive={false}
/>
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksList.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksList.tsx
similarity index 67%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksList.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksList.tsx
index 6e20c4ef3f73..5a225e5e8b6d 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksList.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksList.tsx
@@ -2,27 +2,27 @@ import { useActions, useMountedLogic, useValues } from 'kea'
import { LemonButton, LemonSkeleton } from '@posthog/lemon-ui'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { watchPicksStarterLogic } from '../watchPicksStarterLogic'
-import { WatchPickRow } from './WatchPickRow'
-import { WatchPicksEmptyState } from './WatchPicksEmptyState'
-import { WatchPicksExtraRows } from './WatchPicksExtraRows'
-import { WatchPicksStaleBanner } from './WatchPicksStaleBanner'
-import { WatchPicksStarterStatus } from './WatchPicksStarterStatus'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { highlightPicksStarterLogic } from '../highlightPicksStarterLogic'
+import { HighlightPickRow } from './HighlightPickRow'
+import { HighlightPicksEmptyState } from './HighlightPicksEmptyState'
+import { HighlightPicksExtraRows } from './HighlightPicksExtraRows'
+import { HighlightPicksStaleBanner } from './HighlightPicksStaleBanner'
+import { HighlightPicksStarterStatus } from './HighlightPicksStarterStatus'
const LIST_TOP_COUNT = 5
-export function WatchPicksList(): JSX.Element {
- const picksLogic = useMountedLogic(watchPicksLogic)
+export function HighlightPicksList(): JSX.Element {
+ const picksLogic = useMountedLogic(highlightPicksLogic)
const { picks, picksLoad, picksLoading, picksFailed, activeSessionId } = useValues(picksLogic)
const { loadPicks } = useActions(picksLogic)
- const { startedScanner, burstDone, burstStalled } = useValues(watchPicksStarterLogic(picksLogic.props))
+ const { startedScanner, burstDone, burstStalled } = useValues(highlightPicksStarterLogic(picksLogic.props))
const burstActive = startedScanner !== null && (!burstDone || burstStalled)
return (
<div
className="flex h-full w-full min-w-60 flex-col overflow-hidden rounded border bg-bg-light contain-inline-size"
- data-attr="vision-watch-picks-list"
+ data-attr="vision-highlight-picks-list"
>
<div className="min-h-0 flex-1 overflow-y-auto">
{picks === null && !picksFailed ? (
@@ -34,9 +34,9 @@ export function WatchPicksList(): JSX.Element {
) : picksFailed ? (
<div
className="flex flex-col items-center gap-2 p-4 text-center text-xs text-secondary"
- data-attr="vision-watch-picks-failed"
+ data-attr="vision-highlight-picks-failed"
>
- <span className="text-sm font-semibold text-default">Couldn't load what to watch</span>
+ <span className="text-sm font-semibold text-default">Couldn't load highlights</span>
<span>Something went wrong on our side. Try again in a moment.</span>
<LemonButton
type="secondary"
@@ -44,7 +44,7 @@ export function WatchPicksList(): JSX.Element {
className="mt-1"
loading={picksLoading}
onClick={loadPicks}
- data-attr="vision-watch-picks-retry"
+ data-attr="vision-highlight-picks-retry"
>
Try again
</LemonButton>
@@ -52,18 +52,18 @@ export function WatchPicksList(): JSX.Element {
) : !picks || picks.length === 0 ? (
startedScanner ? (
<>
- <WatchPicksStarterStatus />
- <WatchPicksExtraRows />
+ <HighlightPicksStarterStatus />
+ <HighlightPicksExtraRows />
</>
) : (
- <WatchPicksEmptyState size="small" />
+ <HighlightPicksEmptyState size="small" />
)
) : (
<>
- {burstActive ? <WatchPicksStarterStatus /> : <WatchPicksStaleBanner />}
+ {burstActive ? <HighlightPicksStarterStatus /> : <HighlightPicksStaleBanner />}
<div className="flex flex-col gap-0.5 p-1">
{picks.map((item, index) => (
- <WatchPickRow
+ <HighlightPickRow
key={`${picksLoad?.feedLoadId}-${item.observation.id}`}
item={item}
position={index}
@@ -72,7 +72,7 @@ export function WatchPicksList(): JSX.Element {
/>
))}
</div>
- <WatchPicksExtraRows />
+ <HighlightPicksExtraRows />
</>
)}
</div>
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksListColumn.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksListColumn.tsx
similarity index 54%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksListColumn.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksListColumn.tsx
index 844b29108ab1..1fbd523d4129 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksListColumn.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksListColumn.tsx
@@ -3,19 +3,19 @@ import { ReactNode } from 'react'
import { LemonBadge, LemonSegmentedButton } from '@posthog/lemon-ui'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { watchPicksStarterLogic } from '../watchPicksStarterLogic'
-import { WatchPicksList } from './WatchPicksList'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { highlightPicksStarterLogic } from '../highlightPicksStarterLogic'
+import { HighlightPicksList } from './HighlightPicksList'
-interface WatchPicksListColumnProps {
+interface HighlightPicksListColumnProps {
recordingsList: ReactNode
}
-export function WatchPicksListColumn({ recordingsList }: WatchPicksListColumnProps): JSX.Element {
- const picksLogic = useMountedLogic(watchPicksLogic)
+export function HighlightPicksListColumn({ recordingsList }: HighlightPicksListColumnProps): JSX.Element {
+ const picksLogic = useMountedLogic(highlightPicksLogic)
const { effectiveListMode, unwatchedCount } = useValues(picksLogic)
const { setListMode } = useActions(picksLogic)
- useMountedLogic(watchPicksStarterLogic(picksLogic.props))
+ useMountedLogic(highlightPicksStarterLogic(picksLogic.props))
return (
<>
@@ -30,18 +30,22 @@ export function WatchPicksListColumn({ recordingsList }: WatchPicksListColumnPro
value: 'picks',
label: (
<span className="flex items-center gap-1">
- <span>What to watch</span>
+ <span>Highlights</span>
{unwatchedCount > 0 && (
<LemonBadge.Number count={unwatchedCount} size="small" status="muted" />
)}
</span>
),
- 'data-attr': 'vision-watch-picks-mode-picks',
+ 'data-attr': 'vision-highlight-picks-mode-picks',
+ },
+ {
+ value: 'recordings',
+ label: 'All recordings',
+ 'data-attr': 'vision-highlight-picks-mode-recordings',
},
- { value: 'recordings', label: 'All recordings', 'data-attr': 'vision-watch-picks-mode-recordings' },
]}
/>
- {effectiveListMode === 'picks' ? <WatchPicksList /> : recordingsList}
+ {effectiveListMode === 'picks' ? <HighlightPicksList /> : recordingsList}
</>
)
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksQuietState.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksQuietState.tsx
similarity index 85%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksQuietState.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksQuietState.tsx
index c86ae5de70b2..f7996679e2c3 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksQuietState.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksQuietState.tsx
@@ -10,16 +10,16 @@ import { urls } from 'scenes/urls'
import { getReplayVisionEditDisabledReason } from '../../utils/accessControl'
import { formatCreditCount } from '../../utils/credits'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { highlightPicksStaleLogic } from '../highlightPicksStaleLogic'
import { SWEEP_INTERVAL_MINUTES } from '../scannerStatus'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { watchPicksStaleLogic } from '../watchPicksStaleLogic'
-import { WatchPicksStateFrame } from './WatchPicksStateFrame'
+import { HighlightPicksStateFrame } from './HighlightPicksStateFrame'
const HedgehogNoir = pngHoggie(noirPng)
-export function WatchPicksQuietState({ size }: { size: 'small' | 'large' }): JSX.Element {
- const picksLogic = useMountedLogic(watchPicksLogic)
- const logic = watchPicksStaleLogic(picksLogic.props)
+export function HighlightPicksQuietState({ size }: { size: 'small' | 'large' }): JSX.Element {
+ const picksLogic = useMountedLogic(highlightPicksLogic)
+ const logic = highlightPicksStaleLogic(picksLogic.props)
const {
backfillCandidates,
backfillScannerId,
@@ -37,7 +37,7 @@ export function WatchPicksQuietState({ size }: { size: 'small' | 'large' }): JSX
const estimateReady = backfillEstimate?.scannerId === backfillScannerId ? backfillEstimate : null
return (
- <WatchPicksStateFrame
+ <HighlightPicksStateFrame
size={size}
image={HedgehogNoir}
title="Nothing to watch yet"
@@ -52,9 +52,9 @@ export function WatchPicksQuietState({ size }: { size: 'small' | 'large' }): JSX
. New recordings are checked every {SWEEP_INTERVAL_MINUTES} minutes and picks appear here.
</>
}
- dataAttr="vision-watch-picks-quiet"
+ dataAttr="vision-highlight-picks-quiet"
footer={
- <Link to={urls.replayVision()} className="mt-1" data-attr="vision-watch-picks-empty-link">
+ <Link to={urls.replayVision()} className="mt-1" data-attr="vision-highlight-picks-empty-link">
Open Replay vision
</Link>
}
@@ -72,7 +72,7 @@ export function WatchPicksQuietState({ size }: { size: 'small' | 'large' }): JSX
value: scanner.id,
label: scanner.name,
}))}
- data-attr="vision-watch-picks-quiet-scanner"
+ data-attr="vision-highlight-picks-quiet-scanner"
/>
)}
<LemonButton
@@ -88,7 +88,7 @@ export function WatchPicksQuietState({ size }: { size: 'small' | 'large' }): JSX
: null)
}
onClick={() => backfillScannerId && startBackfill(backfillScannerId)}
- data-attr="vision-watch-picks-quiet-backfill"
+ data-attr="vision-highlight-picks-quiet-backfill"
>
Scan the last 7 days now
</LemonButton>
@@ -109,6 +109,6 @@ export function WatchPicksQuietState({ size }: { size: 'small' | 'large' }): JSX
Scanning {pluralize(started, 'recording')}. Results land here as they finish.
</span>
))}
- </WatchPicksStateFrame>
+ </HighlightPicksStateFrame>
)
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksReplayOffState.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksReplayOffState.tsx
similarity index 80%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksReplayOffState.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksReplayOffState.tsx
index 59ca010476e3..c1d2ea01f4fa 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksReplayOffState.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksReplayOffState.tsx
@@ -9,11 +9,11 @@ import { TeamMembershipLevel } from 'lib/constants'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
-import { WatchPicksStateFrame } from './WatchPicksStateFrame'
+import { HighlightPicksStateFrame } from './HighlightPicksStateFrame'
const HedgehogDirector = pngHoggie(directorPng)
-export function WatchPicksReplayOffState({ size }: { size: 'small' | 'large' }): JSX.Element {
+export function HighlightPicksReplayOffState({ size }: { size: 'small' | 'large' }): JSX.Element {
const { currentTeamLoading } = useValues(teamLogic)
const { updateCurrentTeam } = useActions(teamLogic)
// Same gate as the settings toggle that writes this field (`ReplayGeneral`).
@@ -23,17 +23,17 @@ export function WatchPicksReplayOffState({ size }: { size: 'small' | 'large' }):
})
return (
- <WatchPicksStateFrame
+ <HighlightPicksStateFrame
size={size}
image={HedgehogDirector}
title="Session replay is off"
body="Scanners watch recordings, so there is nothing for them to see until recording is on. Recordings you already have stay available."
- dataAttr="vision-watch-picks-replay-off"
+ dataAttr="vision-highlight-picks-replay-off"
footer={
<Link
to={urls.settings('environment-replay')}
className="mt-1"
- data-attr="vision-watch-picks-replay-off-settings"
+ data-attr="vision-highlight-picks-replay-off-settings"
>
Replay settings
</Link>
@@ -47,10 +47,10 @@ export function WatchPicksReplayOffState({ size }: { size: 'small' | 'large' }):
loading={currentTeamLoading}
disabledReason={restrictedReason ? 'Ask a project admin to turn on session replay' : null}
onClick={() => updateCurrentTeam({ session_recording_opt_in: true })}
- data-attr="vision-watch-picks-replay-off-enable"
+ data-attr="vision-highlight-picks-replay-off-enable"
>
Turn on session replay
</LemonButton>
- </WatchPicksStateFrame>
+ </HighlightPicksStateFrame>
)
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksStaleBanner.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksStaleBanner.tsx
similarity index 85%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksStaleBanner.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksStaleBanner.tsx
index ee76f2649a7c..88b91c2077e4 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksStaleBanner.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksStaleBanner.tsx
@@ -6,14 +6,14 @@ import { TZLabel } from 'lib/components/TZLabel'
import { pluralize } from 'lib/utils/strings'
import { getReplayVisionEditDisabledReason } from '../../utils/accessControl'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { highlightPicksStaleLogic } from '../highlightPicksStaleLogic'
import { scannerEditUrl } from '../scannerEditorSceneLogic'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { watchPicksStaleLogic } from '../watchPicksStaleLogic'
-import { WatchPicksBlockedState } from './WatchPicksBlockedState'
+import { HighlightPicksBlockedState } from './HighlightPicksBlockedState'
-export function WatchPicksStaleBanner(): JSX.Element | null {
- const picksLogic = useMountedLogic(watchPicksLogic)
- const logic = watchPicksStaleLogic(picksLogic.props)
+export function HighlightPicksStaleBanner(): JSX.Element | null {
+ const picksLogic = useMountedLogic(highlightPicksLogic)
+ const logic = highlightPicksStaleLogic(picksLogic.props)
const { picks } = useValues(picksLogic)
const {
staleReason,
@@ -32,7 +32,7 @@ export function WatchPicksStaleBanner(): JSX.Element | null {
return null
}
if (staleReason === 'all-disabled' || staleReason === 'all-capped' || staleReason === 'quota-exhausted') {
- return <WatchPicksBlockedState reason={staleReason} />
+ return <HighlightPicksBlockedState reason={staleReason} />
}
const newest = (picks ?? []).reduce<string | null>(
@@ -43,7 +43,7 @@ export function WatchPicksStaleBanner(): JSX.Element | null {
if (staleReason === 'drought') {
return (
- <LemonBanner type="warning" className="m-2" data-attr="vision-watch-picks-stale-drought">
+ <LemonBanner type="warning" className="m-2" data-attr="vision-highlight-picks-stale-drought">
<div className="flex flex-col gap-2 text-xs">
{droughtScanners.map((scanner) => {
const total = backfillTotals[scanner.id]
@@ -60,13 +60,13 @@ export function WatchPicksStaleBanner(): JSX.Element | null {
loading={busyScannerId === scanner.id}
disabledReason={editDisabledReason}
onClick={() => startBackfill(scanner.id)}
- data-attr="vision-watch-picks-stale-backfill"
+ data-attr="vision-highlight-picks-stale-backfill"
>
Scan the last 7 days now
</LemonButton>
<Link
to={scannerEditUrl(scanner.id, null)}
- data-attr="vision-watch-picks-stale-review"
+ data-attr="vision-highlight-picks-stale-review"
>
Review filters
</Link>
@@ -76,7 +76,7 @@ export function WatchPicksStaleBanner(): JSX.Element | null {
No recording in the last 7 days passes its filters.{' '}
<Link
to={scannerEditUrl(scanner.id, null)}
- data-attr="vision-watch-picks-stale-review"
+ data-attr="vision-highlight-picks-stale-review"
>
Review filters
</Link>
@@ -98,7 +98,7 @@ export function WatchPicksStaleBanner(): JSX.Element | null {
return (
<div
className="border-b bg-bg-light px-3 py-2 text-xs text-secondary"
- data-attr="vision-watch-picks-stale-caught-up"
+ data-attr="vision-highlight-picks-stale-caught-up"
>
<span className="font-semibold text-default">You are caught up.</span>{' '}
{newest && (
@@ -114,7 +114,7 @@ export function WatchPicksStaleBanner(): JSX.Element | null {
return (
<div
className="flex flex-col gap-1 border-b bg-bg-light px-3 py-2 text-xs"
- data-attr="vision-watch-picks-stale-quiet"
+ data-attr="vision-highlight-picks-stale-quiet"
>
<span className="font-semibold">Quiet week</span>
{quietWeek ? (
@@ -136,7 +136,7 @@ export function WatchPicksStaleBanner(): JSX.Element | null {
className="self-start"
loading={nextBestLoading}
onClick={loadNextBest}
- data-attr="vision-watch-picks-stale-next-best"
+ data-attr="vision-highlight-picks-stale-next-best"
>
Show the newest results anyway
</LemonButton>
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksStarter.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksStarter.tsx
similarity index 83%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksStarter.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksStarter.tsx
index 2e0530f6a45e..3a619921634c 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksStarter.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksStarter.tsx
@@ -10,17 +10,17 @@ import { urls } from 'scenes/urls'
import { visionQuotaLogic } from '../../logics/visionQuotaLogic'
import { getReplayVisionEditDisabledReason } from '../../utils/accessControl'
import { formatCreditCount, formatCreditNumber, formatCreditsMaybeUsd } from '../../utils/credits'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { BUDGET_PRESETS, QUICKSTART_SCANNER, TARGET_MONTHLY_SCANS } from '../watchPicksStarter'
-import { watchPicksStarterLogic } from '../watchPicksStarterLogic'
-import { WatchPicksStateFrame } from './WatchPicksStateFrame'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { BUDGET_PRESETS, QUICKSTART_SCANNER, TARGET_MONTHLY_SCANS } from '../highlightPicksStarter'
+import { highlightPicksStarterLogic } from '../highlightPicksStarterLogic'
+import { HighlightPicksStateFrame } from './HighlightPicksStateFrame'
const SCANS_PER_DAY = Math.round(TARGET_MONTHLY_SCANS / 30)
const HedgehogMagnifyingGlass = pngHoggie(magnifyingGlassPng)
-export function WatchPicksStarter({ size }: { size: 'small' | 'large' }): JSX.Element {
- const { props: picksProps } = useMountedLogic(watchPicksLogic)
- const logic = watchPicksStarterLogic(picksProps)
+export function HighlightPicksStarter({ size }: { size: 'small' | 'large' }): JSX.Element {
+ const { props: picksProps } = useMountedLogic(highlightPicksLogic)
+ const logic = highlightPicksStarterLogic(picksProps)
const { burstPlan, spendMode, freeAvailable, budget, starting, startError, freeCreditsLeft } = useValues(logic)
const { setBudget, chooseBudget, startScanner } = useActions(logic)
const { showUsd } = useValues(visionQuotaLogic)
@@ -44,17 +44,17 @@ export function WatchPicksStarter({ size }: { size: 'small' | 'large' }): JSX.El
],
]
return (
- <WatchPicksStateFrame
+ <HighlightPicksStateFrame
size={size}
image={HedgehogMagnifyingGlass}
title="Nothing to watch yet"
body={`Start ${QUICKSTART_SCANNER.name}, a scanner that reads each new recording and surfaces the ones worth watching.`}
- dataAttr="vision-watch-picks-starter"
+ dataAttr="vision-highlight-picks-starter"
footer={
<Link
to={urls.replayVisionNewScanner()}
className="mt-1"
- data-attr="vision-watch-picks-starter-own-goal"
+ data-attr="vision-highlight-picks-starter-own-goal"
>
Write my own goal
</Link>
@@ -78,7 +78,7 @@ export function WatchPicksStarter({ size }: { size: 'small' | 'large' }): JSX.El
options={BUDGET_PRESETS.map((preset) => ({
value: preset,
label: formatCreditNumber(preset),
- 'data-attr': 'vision-watch-picks-starter-budget',
+ 'data-attr': 'vision-highlight-picks-starter-budget',
}))}
/>
<span className="text-xs">{formatCreditsMaybeUsd(budget, showUsd)} a month</span>
@@ -93,7 +93,7 @@ export function WatchPicksStarter({ size }: { size: 'small' | 'large' }): JSX.El
loading={starting}
disabledReason={editDisabledReason}
onClick={startScanner}
- data-attr="vision-watch-picks-starter-start"
+ data-attr="vision-highlight-picks-starter-start"
>
{spendMode === 'free' ? 'Start free scanner' : `Start with ${formatCreditCount(budget)} a month`}
</LemonButton>
@@ -105,11 +105,11 @@ export function WatchPicksStarter({ size }: { size: 'small' | 'large' }): JSX.El
center
disabledReason={starting ? 'Starting' : null}
onClick={() => chooseBudget(spendMode === 'free')}
- data-attr="vision-watch-picks-starter-toggle-budget"
+ data-attr="vision-highlight-picks-starter-toggle-budget"
>
{spendMode === 'free' ? 'Set a monthly budget instead' : 'Use free credits instead'}
</LemonButton>
)}
- </WatchPicksStateFrame>
+ </HighlightPicksStateFrame>
)
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksStarterStatus.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksStarterStatus.tsx
similarity index 85%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksStarterStatus.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksStarterStatus.tsx
index 89befc86609d..8062cad319d6 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksStarterStatus.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksStarterStatus.tsx
@@ -6,13 +6,13 @@ import { LemonProgress } from 'lib/lemon-ui/LemonProgress'
import { pluralize } from 'lib/utils/strings'
import { urls } from 'scenes/urls'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { watchPicksStarterLogic } from '../watchPicksStarterLogic'
+import { highlightPicksLogic } from '../highlightPicksLogic'
+import { highlightPicksStarterLogic } from '../highlightPicksStarterLogic'
-export function WatchPicksStarterStatus(): JSX.Element | null {
- const picksLogic = useMountedLogic(watchPicksLogic)
+export function HighlightPicksStarterStatus(): JSX.Element | null {
+ const picksLogic = useMountedLogic(highlightPicksLogic)
const { picks } = useValues(picksLogic)
- const logic = watchPicksStarterLogic(picksLogic.props)
+ const logic = highlightPicksStarterLogic(picksLogic.props)
const { startedScanner, burstSessionIds, burstCounts, burstDone, burstStalled, scannedAnyway } = useValues(logic)
const { showScannedAnyway } = useActions(logic)
@@ -29,7 +29,7 @@ export function WatchPicksStarterStatus(): JSX.Element | null {
if (burstDone && !hasPicks) {
return (
- <div className="flex flex-col gap-1 p-2" data-attr="vision-watch-picks-starter-nothing">
+ <div className="flex flex-col gap-1 p-2" data-attr="vision-highlight-picks-starter-nothing">
<LemonBanner type="info">
<div className="flex flex-col gap-2">
<span className="font-semibold">
@@ -48,7 +48,7 @@ export function WatchPicksStarterStatus(): JSX.Element | null {
size="xsmall"
type="secondary"
onClick={showScannedAnyway}
- data-attr="vision-watch-picks-starter-show-anyway"
+ data-attr="vision-highlight-picks-starter-show-anyway"
>
Show them anyway
</LemonButton>
@@ -56,7 +56,7 @@ export function WatchPicksStarterStatus(): JSX.Element | null {
<LemonButton
size="xsmall"
to={urls.replayVisionNewScanner()}
- data-attr="vision-watch-picks-starter-another"
+ data-attr="vision-highlight-picks-starter-another"
>
Try another scanner
</LemonButton>
@@ -71,7 +71,7 @@ export function WatchPicksStarterStatus(): JSX.Element | null {
return burstStalled && burstCounts.pending > 0 ? (
<div
className="border-b bg-bg-light px-3 py-2 text-xs text-secondary"
- data-attr="vision-watch-picks-starter-stalled"
+ data-attr="vision-highlight-picks-starter-stalled"
>
{pluralize(burstCounts.pending, 'scan')} still running. They show up here when they finish.
</div>
@@ -81,7 +81,7 @@ export function WatchPicksStarterStatus(): JSX.Element | null {
return (
<div
className="flex flex-col gap-1 border-b bg-bg-light px-3 py-2 text-xs"
- data-attr="vision-watch-picks-starter-running"
+ data-attr="vision-highlight-picks-starter-running"
>
<div className="flex items-center justify-between gap-2">
<span className="flex items-center gap-1 font-semibold">
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksStateFrame.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksStateFrame.tsx
similarity index 88%
rename from products/replay_vision/frontend/replay_scanners/components/WatchPicksStateFrame.tsx
rename to products/replay_vision/frontend/replay_scanners/components/HighlightPicksStateFrame.tsx
index 77289f705c36..938bbf0b2737 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksStateFrame.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightPicksStateFrame.tsx
@@ -2,7 +2,7 @@ import { ComponentType, ReactNode } from 'react'
import { cn } from 'lib/utils/css-classes'
-interface WatchPicksStateFrameProps {
+interface HighlightPicksStateFrameProps {
size: 'small' | 'large'
image: ComponentType<{ className?: string }>
title: ReactNode
@@ -12,7 +12,7 @@ interface WatchPicksStateFrameProps {
dataAttr: string
}
-export function WatchPicksStateFrame({
+export function HighlightPicksStateFrame({
size,
image: Image,
title,
@@ -20,7 +20,7 @@ export function WatchPicksStateFrame({
children,
footer,
dataAttr,
-}: WatchPicksStateFrameProps): JSX.Element {
+}: HighlightPicksStateFrameProps): JSX.Element {
const large = size === 'large'
return (
<div
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedBlockedBanner.stories.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedBlockedBanner.stories.tsx
deleted file mode 100644
index 5cf9391243e3..000000000000
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedBlockedBanner.stories.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import type { Meta, StoryObj } from '@storybook/react'
-
-import { WatchFeedBlockedBanner } from './WatchFeedBlockedBanner'
-
-const meta: Meta<typeof WatchFeedBlockedBanner> = {
- title: 'Scenes-App/Replay Vision/WatchFeedBlockedBanner',
- component: WatchFeedBlockedBanner,
- decorators: [
- // LemonBanner is a CSS container, so the parent sets its width.
- (Story) => (
- <div className="w-200">
- <Story />
- </div>
- ),
- ],
-}
-export default meta
-
-export const QuotaExhausted: StoryObj<typeof WatchFeedBlockedBanner> = { args: { reason: 'quota-exhausted' } }
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedDismissal.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedDismissal.ts
similarity index 73%
rename from products/replay_vision/frontend/replay_scanners/watchFeedDismissal.ts
rename to products/replay_vision/frontend/replay_scanners/highlightFeedDismissal.ts
index 8ad5b8bbfb95..039476ea10cf 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedDismissal.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedDismissal.ts
@@ -3,7 +3,7 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import posthog from 'lib/posthog-typed'
import { visionObservationsFeedDismissalCreate, visionObservationsFeedDismissalDestroy } from '../generated/api'
-import type { FeedDismissalReasonEnumApi, WatchFeedItemApi } from '../generated/api.schemas'
+import type { FeedDismissalReasonEnumApi, HighlightFeedItemApi } from '../generated/api.schemas'
export const FEED_DISMISSAL_REASON_LABELS: Record<FeedDismissalReasonEnumApi, string> = {
not_a_real_problem: 'Not a real problem',
@@ -20,7 +20,7 @@ export function feedDismissalMenuItems(onDismiss: (reason: FeedDismissalReasonEn
items: reasons.map(([reason, label]) => ({
label,
onClick: () => onDismiss(reason),
- 'data-attr': `vision-watch-feed-dismiss-${reason}`,
+ 'data-attr': `vision-highlight-feed-dismiss-${reason}`,
})),
},
{
@@ -28,23 +28,26 @@ export function feedDismissalMenuItems(onDismiss: (reason: FeedDismissalReasonEn
{
label: 'Hide without a reason',
onClick: () => onDismiss(null),
- 'data-attr': 'vision-watch-feed-dismiss-no-reason',
+ 'data-attr': 'vision-highlight-feed-dismiss-no-reason',
},
],
},
]
}
-export function withoutFeedItem(items: WatchFeedItemApi[] | null, observationId: string): WatchFeedItemApi[] | null {
+export function withoutFeedItem(
+ items: HighlightFeedItemApi[] | null,
+ observationId: string
+): HighlightFeedItemApi[] | null {
return items?.filter((item) => item.observation.id !== observationId) ?? null
}
/** Puts an item back where it was, or at the end when the list has since shrunk below that place. */
export function withFeedItemRestored(
- items: WatchFeedItemApi[] | null,
- item: WatchFeedItemApi,
+ items: HighlightFeedItemApi[] | null,
+ item: HighlightFeedItemApi,
position: number
-): WatchFeedItemApi[] | null {
+): HighlightFeedItemApi[] | null {
if (!items || items.some((existing) => existing.observation.id === item.observation.id)) {
return items
}
@@ -55,7 +58,7 @@ export function withFeedItemRestored(
interface DismissFeedItemArgs {
teamId: number
- item: WatchFeedItemApi
+ item: HighlightFeedItemApi
reason: FeedDismissalReasonEnumApi | null
properties: Record<string, unknown>
restore: () => void
@@ -76,23 +79,23 @@ export async function dismissFeedItem({
lemonToast.error("Couldn't hide this session. Try again.")
return
}
- posthog.capture('replay_vision_watch_clip_dismissed', { ...properties, dismissal_reason: reason })
+ posthog.capture('replay_vision_highlight_clip_dismissed', { ...properties, dismissal_reason: reason })
const undo = async (): Promise<void> => {
try {
await visionObservationsFeedDismissalDestroy(String(teamId), observationId)
} catch {
lemonToast.error("Couldn't bring this session back.", {
- toastId: `vision-watch-feed-undo-failed-${observationId}`,
- button: { label: 'Try again', dataAttr: 'vision-watch-feed-dismiss-undo-retry', action: undo },
+ toastId: `vision-highlight-feed-undo-failed-${observationId}`,
+ button: { label: 'Try again', dataAttr: 'vision-highlight-feed-dismiss-undo-retry', action: undo },
})
return
}
- posthog.capture('replay_vision_watch_clip_dismiss_undone', properties)
+ posthog.capture('replay_vision_highlight_clip_dismiss_undone', properties)
restore()
}
// Keyed per observation, so a second dismissal gets its own toast instead of merging into the first.
lemonToast.success('Hidden from your feed', {
- toastId: `vision-watch-feed-dismissed-${observationId}`,
- button: { label: 'Undo', dataAttr: 'vision-watch-feed-dismiss-undo', action: undo },
+ toastId: `vision-highlight-feed-dismissed-${observationId}`,
+ button: { label: 'Undo', dataAttr: 'vision-highlight-feed-dismiss-undo', action: undo },
})
}
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedEmptyState.test.ts
similarity index 89%
rename from products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.ts
rename to products/replay_vision/frontend/replay_scanners/highlightFeedEmptyState.test.ts
index 7ec8acae4b77..d1f8e88a01b0 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedEmptyState.test.ts
@@ -1,15 +1,15 @@
import type { ReplayScannerApi, VisionQuotaApi } from '../generated/api.schemas'
-import { type WatchFeedEmptyReason, resolveWatchFeedEmptyReason } from './watchFeedEmptyState'
+import { type HighlightFeedEmptyReason, resolveHighlightFeedEmptyReason } from './highlightFeedEmptyState'
const scanner = (overrides: Partial<ReplayScannerApi> = {}): ReplayScannerApi =>
({ id: 'scanner-1', enabled: true, limit_reached: false, ...overrides }) as unknown as ReplayScannerApi
const quota = (exhausted: boolean): VisionQuotaApi => ({ exhausted }) as unknown as VisionQuotaApi
-describe('resolveWatchFeedEmptyReason', () => {
+describe('resolveHighlightFeedEmptyReason', () => {
// The precedence between these is the behavior under test: a reader told to clear their filters
// while every scanner is off would clear them and still face an empty feed.
- it.each<[string, ReplayScannerApi[], VisionQuotaApi | null, boolean, WatchFeedEmptyReason, (boolean | null)?]>([
+ it.each<[string, ReplayScannerApi[], VisionQuotaApi | null, boolean, HighlightFeedEmptyReason, (boolean | null)?]>([
['no scanners at all', [], quota(false), false, 'no-scanners'],
['recording turned off, even with no scanners', [], quota(false), false, 'replay-off', false],
['recording turned off, even with an exhausted budget', [scanner()], quota(true), false, 'replay-off', false],
@@ -57,7 +57,7 @@ describe('resolveWatchFeedEmptyReason', () => {
['a quiet window when the quota snapshot never answered', [scanner()], null, false, 'quiet-window'],
])('blames %s', (_name, scanners, quotaValue, hasFeedFilters, expected, sessionRecordingOptIn = null) => {
expect(
- resolveWatchFeedEmptyReason({ scanners, quota: quotaValue, sessionRecordingOptIn, hasFeedFilters })
+ resolveHighlightFeedEmptyReason({ scanners, quota: quotaValue, sessionRecordingOptIn, hasFeedFilters })
).toBe(expected)
})
})
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedEmptyState.ts
similarity index 73%
rename from products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.ts
rename to products/replay_vision/frontend/replay_scanners/highlightFeedEmptyState.ts
index 304c9f487f6f..f7bf3e47ba69 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedEmptyState.ts
@@ -1,10 +1,10 @@
import type { ReplayScannerApi, VisionQuotaApi } from '../generated/api.schemas'
/**
- * Why the What to watch feed came back with nothing. Each value is a different answer for the
+ * Why the highlight feed came back with nothing. Each value is a different answer for the
* reader, so they get different copy and a different next step.
*/
-export type WatchFeedEmptyReason =
+export type HighlightFeedEmptyReason =
| 'replay-off'
| 'no-scanners'
| 'quota-exhausted'
@@ -14,11 +14,11 @@ export type WatchFeedEmptyReason =
| 'quiet-window'
/** The reasons no new sessions can reach the feed, whether or not it still has older ones to show. */
-export type WatchFeedBlockReason = 'quota-exhausted' | 'all-disabled' | 'all-capped'
+export type HighlightFeedBlockReason = 'quota-exhausted' | 'all-disabled' | 'all-capped'
/** What blocks the feed, and where the reader lifts the block. Both the banner and the empty note use it. */
-export const WATCH_FEED_BLOCKS: Record<
- WatchFeedBlockReason,
+export const HIGHLIGHT_FEED_BLOCKS: Record<
+ HighlightFeedBlockReason,
{
cause: string
fix: string
@@ -33,32 +33,32 @@ export const WATCH_FEED_BLOCKS: Record<
fix: 'Turn one on to scan new recordings again.',
actionLabel: 'See scanners',
tab: 'scanners',
- dataAttr: 'vision-watch-feed-see-scanners',
- bannerDataAttr: 'vision-watch-feed-banner-see-scanners',
+ dataAttr: 'vision-highlight-feed-see-scanners',
+ bannerDataAttr: 'vision-highlight-feed-banner-see-scanners',
},
'quota-exhausted': {
cause: 'Your Replay Vision credits are used up for this period.',
fix: 'Raise the limit to scan new recordings again.',
actionLabel: 'See usage',
tab: 'usage',
- dataAttr: 'vision-watch-feed-see-usage',
- bannerDataAttr: 'vision-watch-feed-banner-see-usage',
+ dataAttr: 'vision-highlight-feed-see-usage',
+ bannerDataAttr: 'vision-highlight-feed-banner-see-usage',
},
'all-capped': {
cause: 'Every running scanner has reached its credit limit for this period.',
fix: "Raise a scanner's limit to scan new recordings again.",
actionLabel: 'See usage',
tab: 'usage',
- dataAttr: 'vision-watch-feed-see-usage',
- bannerDataAttr: 'vision-watch-feed-banner-see-usage',
+ dataAttr: 'vision-highlight-feed-see-usage',
+ bannerDataAttr: 'vision-highlight-feed-banner-see-usage',
},
}
-export function isWatchFeedBlock(reason: WatchFeedEmptyReason | null): reason is WatchFeedBlockReason {
- return reason !== null && reason in WATCH_FEED_BLOCKS
+export function isHighlightFeedBlock(reason: HighlightFeedEmptyReason | null): reason is HighlightFeedBlockReason {
+ return reason !== null && reason in HIGHLIGHT_FEED_BLOCKS
}
-export interface WatchFeedEmptyInput {
+export interface HighlightFeedEmptyInput {
scanners: ReplayScannerApi[]
/** Null when the snapshot has not answered, which reads here as "no block seen". */
quota: VisionQuotaApi | null
@@ -71,12 +71,12 @@ export interface WatchFeedEmptyInput {
* Resolves the one reason to show. A block the reader cannot lift from this tab is checked before
* their own filters, because clearing those would leave the feed just as empty.
*/
-export function resolveWatchFeedEmptyReason({
+export function resolveHighlightFeedEmptyReason({
scanners,
quota,
sessionRecordingOptIn,
hasFeedFilters,
-}: WatchFeedEmptyInput): WatchFeedEmptyReason {
+}: HighlightFeedEmptyInput): HighlightFeedEmptyReason {
if (sessionRecordingOptIn === false) {
return 'replay-off'
}
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedGroupLogic.test.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.test.ts
similarity index 84%
rename from products/replay_vision/frontend/replay_scanners/watchFeedGroupLogic.test.ts
rename to products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.test.ts
index 5aa5d4ff3966..53f2ccd65fc7 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedGroupLogic.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.test.ts
@@ -3,9 +3,9 @@ import { expectLogic } from 'kea-test-utils'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
-import { watchFeedGroupLogic } from './watchFeedGroupLogic'
+import { highlightFeedGroupLogic } from './highlightFeedGroupLogic'
-describe('watchFeedGroupLogic', () => {
+describe('highlightFeedGroupLogic', () => {
let listSpy: jest.Mock
beforeEach(() => {
@@ -15,7 +15,7 @@ describe('watchFeedGroupLogic', () => {
})
it('loads the group once on first expand, without the card it hangs under', async () => {
- const logic = watchFeedGroupLogic({ observationId: 'card', scannerId: 'scanner-a', dateFrom: '-30d' })
+ const logic = highlightFeedGroupLogic({ observationId: 'card', scannerId: 'scanner-a', dateFrom: '-30d' })
logic.mount()
expect(listSpy).not.toHaveBeenCalled()
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedGroupLogic.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.ts
similarity index 87%
rename from products/replay_vision/frontend/replay_scanners/watchFeedGroupLogic.ts
rename to products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.ts
index c00748f44e11..802409ebf500 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedGroupLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.ts
@@ -6,7 +6,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { visionScannersObservationsList } from '../generated/api'
import type { ReplayObservationApi } from '../generated/api.schemas'
-export interface WatchFeedGroupLogicProps {
+export interface HighlightFeedGroupLogicProps {
/** The card's observation. The backend resolves its feed group from it. */
observationId: string
scannerId: string
@@ -14,7 +14,7 @@ export interface WatchFeedGroupLogicProps {
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchFeedGroupLogicValues {
+export interface highlightFeedGroupLogicValues {
currentTeamId: number | null // teamLogic
expanded: boolean
members: WatchGroupMembers | null
@@ -22,7 +22,7 @@ export interface watchFeedGroupLogicValues {
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchFeedGroupLogicActions {
+export interface highlightFeedGroupLogicActions {
toggleExpanded: () => { value: true }
loadMembers: (_: void) => void
loadMembersFailure: (
@@ -48,19 +48,19 @@ export interface WatchGroupMembers {
total: number
}
-export type watchFeedGroupLogicType = MakeLogicType<
- watchFeedGroupLogicValues,
- watchFeedGroupLogicActions,
- WatchFeedGroupLogicProps
+export type highlightFeedGroupLogicType = MakeLogicType<
+ highlightFeedGroupLogicValues,
+ highlightFeedGroupLogicActions,
+ HighlightFeedGroupLogicProps
>
/** How many of the group's other sessions the card lists before it links to the full list. */
export const WATCH_GROUP_PREVIEW_SIZE = 5
/** The other sessions in a feed card's feed group, loaded the first time the card expands. */
-export const watchFeedGroupLogic = kea<watchFeedGroupLogicType>([
- path((key) => ['products', 'replay_vision', 'frontend', 'replay_scanners', 'watchFeedGroupLogic', key]),
- props({} as WatchFeedGroupLogicProps),
+export const highlightFeedGroupLogic = kea<highlightFeedGroupLogicType>([
+ path((key) => ['products', 'replay_vision', 'frontend', 'replay_scanners', 'highlightFeedGroupLogic', key]),
+ props({} as HighlightFeedGroupLogicProps),
// The window is part of the key, so a range change lists that range's sessions rather than the cached ones.
key((props) => `${props.observationId}:${props.dateFrom}`),
connect(() => ({
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedImpressionCounts.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedImpressionCounts.ts
similarity index 82%
rename from products/replay_vision/frontend/replay_scanners/watchFeedImpressionCounts.ts
rename to products/replay_vision/frontend/replay_scanners/highlightFeedImpressionCounts.ts
index 32799aa6e7e4..e07588f27076 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedImpressionCounts.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedImpressionCounts.ts
@@ -1,7 +1,7 @@
import { chunk } from 'lib/utils/arrays'
import { getCurrentTeamIdOrNone } from 'lib/utils/getAppContext'
-import { visionScannersWatchFeedImpressionsCreate } from '../generated/api'
+import { visionScannersHighlightFeedImpressionsCreate } from '../generated/api'
// The impressions endpoint takes at most this many ids per request.
const IMPRESSIONS_BATCH_SIZE = 100
@@ -14,7 +14,7 @@ export function recordFeedImpressions(feedLoadId: string, observationIds: string
return
}
for (const ids of chunk(observationIds, IMPRESSIONS_BATCH_SIZE)) {
- void visionScannersWatchFeedImpressionsCreate(String(teamId), {
+ void visionScannersHighlightFeedImpressionsCreate(String(teamId), {
feed_load_id: feedLoadId,
observation_ids: ids,
}).catch(() => {})
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.test.ts
similarity index 97%
rename from products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts
rename to products/replay_vision/frontend/replay_scanners/highlightFeedLogic.test.ts
index dc88ccc178cd..cd3fa6f7d310 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.test.ts
@@ -9,12 +9,12 @@ import { initKeaTests } from '~/test/init'
import type { ReplayScannerApi } from '../generated/api.schemas'
import { visionScannersListLogic } from '../logics/visionScannersListLogic'
-import { watchFeedLogic } from './watchFeedLogic'
+import { highlightFeedLogic } from './highlightFeedLogic'
jest.mock('lib/lemon-ui/LemonToast', () => ({ lemonToast: { success: jest.fn(), error: jest.fn() } }))
-describe('watchFeedLogic', () => {
- let logic: ReturnType<typeof watchFeedLogic.build>
+describe('highlightFeedLogic', () => {
+ let logic: ReturnType<typeof highlightFeedLogic.build>
let feedSpy: jest.Mock
const item = (id: string, reasonKind: string): Record<string, any> => ({
@@ -34,12 +34,12 @@ describe('watchFeedLogic', () => {
feedSpy = jest.fn(() => [200, { results: [item('o1', 'embedding_pick'), item('o2', 'recent')] }])
useMocks({
get: {
- '/api/projects/:team/vision/scanners/watch_feed/': feedSpy,
+ '/api/projects/:team/vision/scanners/highlight_feed/': feedSpy,
'/api/projects/:team/vision/scanners/': { results: [], next: null },
},
})
initKeaTests()
- logic = watchFeedLogic.build()
+ logic = highlightFeedLogic.build()
})
afterEach(() => {
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.ts
similarity index 83%
rename from products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
rename to products/replay_vision/frontend/replay_scanners/highlightFeedLogic.ts
index d0eb9d5438ce..65b7f56d90ad 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.ts
@@ -8,39 +8,39 @@ import { teamLogic } from 'scenes/teamLogic'
import { userLogic } from 'scenes/userLogic'
import type { UserType } from '../../../../frontend/src/types'
-import { visionScannersWatchFeedRetrieve } from '../generated/api'
+import { visionScannersHighlightFeedRetrieve } from '../generated/api'
import type { ReplayScannerApi, VisionQuotaApi } from '../generated/api.schemas'
-import type { VisionScannersWatchFeedRetrieveParams, WatchFeedItemApi } from '../generated/api.schemas'
+import type { VisionScannersHighlightFeedRetrieveParams, HighlightFeedItemApi } from '../generated/api.schemas'
import type { FeedDismissalReasonEnumApi } from '../generated/api.schemas'
import { visionQuotaLogic } from '../logics/visionQuotaLogic'
import { visionScannersListLogic } from '../logics/visionScannersListLogic'
-import { dismissFeedItem, withFeedItemRestored, withoutFeedItem } from './watchFeedDismissal'
-import { type WatchFeedEmptyReason, resolveWatchFeedEmptyReason } from './watchFeedEmptyState'
-import { recordFeedImpressions } from './watchFeedImpressionCounts'
+import { dismissFeedItem, withFeedItemRestored, withoutFeedItem } from './highlightFeedDismissal'
+import { type HighlightFeedEmptyReason, resolveHighlightFeedEmptyReason } from './highlightFeedEmptyState'
+import { recordFeedImpressions } from './highlightFeedImpressionCounts'
import {
- type WatchFeedLoad,
- WatchFeedImpressions,
+ type HighlightFeedLoad,
+ HighlightFeedImpressions,
cardProperties,
- newWatchFeedLoad,
+ newHighlightFeedLoad,
servedListProperties,
withNextPage,
-} from './watchFeedTelemetry'
+} from './highlightFeedTelemetry'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchFeedLogicValues {
+export interface highlightFeedLogicValues {
user: UserType | null // userLogic
quota: VisionQuotaApi | null // visionQuotaLogic
quotaLoading: boolean // visionQuotaLogic
scanners: ReplayScannerApi[] // visionScannersListLogic
scannersLoading: boolean // visionScannersListLogic
dateFrom: string
- emptyReason: WatchFeedEmptyReason | null
+ emptyReason: HighlightFeedEmptyReason | null
feedAsOf: string | null
feedFailed: boolean
feedHasMore: boolean
- feedItems: WatchFeedItemApi[] | null
+ feedItems: HighlightFeedItemApi[] | null
feedItemsLoading: boolean
- feedLoad: WatchFeedLoad | null
+ feedLoad: HighlightFeedLoad | null
feedMoreFailed: boolean
feedReloading: boolean
feedServed: number
@@ -50,25 +50,25 @@ export interface watchFeedLogicValues {
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchFeedLogicActions {
+export interface highlightFeedLogicActions {
cardSeen: (
- item: WatchFeedItemApi,
+ item: HighlightFeedItemApi,
position: number
) => {
- item: WatchFeedItemApi
+ item: HighlightFeedItemApi
position: number
}
dismissItem: (
- item: WatchFeedItemApi,
+ item: HighlightFeedItemApi,
position: number,
reason: FeedDismissalReasonEnumApi | null
) => {
- item: WatchFeedItemApi
+ item: HighlightFeedItemApi
position: number
reason: FeedDismissalReasonEnumApi | null
}
- extendFeedLoad: (load: WatchFeedLoad) => {
- load: WatchFeedLoad
+ extendFeedLoad: (load: HighlightFeedLoad) => {
+ load: HighlightFeedLoad
}
loadFeed: () => {
value: true
@@ -81,12 +81,12 @@ export interface watchFeedLogicActions {
errorObject?: any
}
loadFeedSuccess: (
- feedItems: WatchFeedItemApi[],
+ feedItems: HighlightFeedItemApi[],
payload?: {
value: true
}
) => {
- feedItems: WatchFeedItemApi[]
+ feedItems: HighlightFeedItemApi[]
payload?: {
value: true
}
@@ -100,24 +100,24 @@ export interface watchFeedLogicActions {
errorObject?: any
}
loadMoreFeedSuccess: (
- feedItems: WatchFeedItemApi[] | null,
+ feedItems: HighlightFeedItemApi[] | null,
payload?: any
) => {
- feedItems: WatchFeedItemApi[] | null
+ feedItems: HighlightFeedItemApi[] | null
payload?: any
}
restoreItem: (
- item: WatchFeedItemApi,
+ item: HighlightFeedItemApi,
position: number
) => {
- item: WatchFeedItemApi
+ item: HighlightFeedItemApi
position: number
}
setDateFrom: (dateFrom: string) => {
dateFrom: string
}
- setFeedLoad: (load: WatchFeedLoad) => {
- load: WatchFeedLoad
+ setFeedLoad: (load: HighlightFeedLoad) => {
+ load: HighlightFeedLoad
}
setFeedPaging: (
hasMore: boolean,
@@ -134,7 +134,7 @@ export interface watchFeedLogicActions {
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchFeedLogicMeta {
+export interface highlightFeedLogicMeta {
__keaTypeGenInternalSelectorTypes: {
hasOwnScanners: (
scanners: ReplayScannerApi[],
@@ -148,15 +148,15 @@ export interface watchFeedLogicMeta {
quota: VisionQuotaApi | null,
quotaLoading: boolean,
scopedToMine: boolean
- ) => WatchFeedEmptyReason | null
+ ) => HighlightFeedEmptyReason | null
}
}
-export type watchFeedLogicType = MakeLogicType<
- watchFeedLogicValues,
- watchFeedLogicActions,
+export type highlightFeedLogicType = MakeLogicType<
+ highlightFeedLogicValues,
+ highlightFeedLogicActions,
Record<string, any>,
- watchFeedLogicMeta
+ highlightFeedLogicMeta
>
export const DEFAULT_FEED_DATE_FROM: string = '-7d'
@@ -185,24 +185,24 @@ export function feedWindowPhrase(dateFrom: string): string {
export const FEED_PAGE_SIZE = 20
-function feedParams(values: watchFeedLogicValues): VisionScannersWatchFeedRetrieveParams {
- const params: VisionScannersWatchFeedRetrieveParams = { date_from: values.dateFrom, limit: FEED_PAGE_SIZE }
+function feedParams(values: highlightFeedLogicValues): VisionScannersHighlightFeedRetrieveParams {
+ const params: VisionScannersHighlightFeedRetrieveParams = { date_from: values.dateFrom, limit: FEED_PAGE_SIZE }
if (values.scopedToMine && values.user) {
params.created_by = String(values.user.id)
}
return params
}
-function reportFiltered(values: watchFeedLogicValues): void {
- posthog.capture('replay_vision_watch_feed_filtered', {
+function reportFiltered(values: highlightFeedLogicValues): void {
+ posthog.capture('replay_vision_highlight_feed_filtered', {
date_from: values.dateFrom,
only_my_scanners: values.scopedToMine,
})
}
-/** Data for the What to watch tab: the window's most watchable observations, ranked server-side. */
-export const watchFeedLogic = kea<watchFeedLogicType>([
- path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'watchFeedLogic']),
+/** Data for the Highlights tab: the window's most watchable observations, ranked server-side. */
+export const highlightFeedLogic = kea<highlightFeedLogicType>([
+ path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'highlightFeedLogic']),
connect(() => ({
values: [
@@ -221,21 +221,21 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
setDateFrom: (dateFrom: string) => ({ dateFrom }),
setOnlyMyScanners: (onlyMyScanners: boolean) => ({ onlyMyScanners }),
loadFeed: true,
- setFeedLoad: (load: WatchFeedLoad) => ({ load }),
- extendFeedLoad: (load: WatchFeedLoad) => ({ load }),
+ setFeedLoad: (load: HighlightFeedLoad) => ({ load }),
+ extendFeedLoad: (load: HighlightFeedLoad) => ({ load }),
setFeedPaging: (hasMore: boolean, asOf: string | null, served: number) => ({ hasMore, asOf, served }),
- cardSeen: (item: WatchFeedItemApi, position: number) => ({ item, position }),
- dismissItem: (item: WatchFeedItemApi, position: number, reason: FeedDismissalReasonEnumApi | null) => ({
+ cardSeen: (item: HighlightFeedItemApi, position: number) => ({ item, position }),
+ dismissItem: (item: HighlightFeedItemApi, position: number, reason: FeedDismissalReasonEnumApi | null) => ({
item,
position,
reason,
}),
- restoreItem: (item: WatchFeedItemApi, position: number) => ({ item, position }),
+ restoreItem: (item: HighlightFeedItemApi, position: number) => ({ item, position }),
}),
loaders(({ values, actions, cache }) => ({
feedItems: [
- null as WatchFeedItemApi[] | null,
+ null as HighlightFeedItemApi[] | null,
{
loadFeed: async (_, breakpoint) => {
// Counts loads from the moment one starts, so a page requested for an older load is dropped.
@@ -246,10 +246,10 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
// fail instead so the tab shows the error state and a retry.
throw new Error('No current team')
}
- const response = await visionScannersWatchFeedRetrieve(String(teamId), feedParams(values))
+ const response = await visionScannersHighlightFeedRetrieve(String(teamId), feedParams(values))
// Drop out-of-order responses — the most recent filter change owns the feed.
breakpoint()
- actions.setFeedLoad(newWatchFeedLoad(response.results))
+ actions.setFeedLoad(newHighlightFeedLoad(response.results))
actions.setFeedPaging(response.has_more ?? false, response.as_of ?? null, response.results.length)
return response.results
},
@@ -264,7 +264,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
const generation = cache.feedGeneration
let response
try {
- response = await visionScannersWatchFeedRetrieve(String(teamId), {
+ response = await visionScannersHighlightFeedRetrieve(String(teamId), {
...feedParams(values),
offset,
as_of: values.feedAsOf,
@@ -290,7 +290,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
response.as_of ?? null,
offset + response.results.length
)
- posthog.capture('replay_vision_watch_feed_page_loaded', {
+ posthog.capture('replay_vision_highlight_feed_page_loaded', {
...servedListProperties(values.feedLoad, page),
offset,
clip_count: page.length,
@@ -308,7 +308,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
restoreItem: (state, { item, position }) => withFeedItemRestored(state, item, position),
},
feedLoad: [
- null as WatchFeedLoad | null,
+ null as HighlightFeedLoad | null,
{
setFeedLoad: (_, { load }) => load,
extendFeedLoad: (_, { load }) => load,
@@ -415,7 +415,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
for (const item of items) {
countByReasonKind[item.reason.kind] = (countByReasonKind[item.reason.kind] ?? 0) + 1
}
- posthog.capture('replay_vision_watch_feed_viewed', {
+ posthog.capture('replay_vision_highlight_feed_viewed', {
...servedListProperties(values.feedLoad, items),
clip_count: items.length,
scanner_count: new Set(items.map((item) => item.observation.scanner_id)).size,
@@ -452,11 +452,11 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
quota: VisionQuotaApi | null,
quotaLoading: boolean,
scopedToMine: boolean
- ): WatchFeedEmptyReason | null =>
+ ): HighlightFeedEmptyReason | null =>
scannersLoading || quotaLoading
? null
: // The feed does not say anything about recording being off; that card lives in the picks column.
- resolveWatchFeedEmptyReason({
+ resolveHighlightFeedEmptyReason({
scanners,
quota,
sessionRecordingOptIn: null,
@@ -476,7 +476,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
// The tab content mounts only while the tab is active, so mount is the fetch signal.
afterMount(({ actions, cache }) => {
- cache.impressions = new WatchFeedImpressions('feed_tab', (load, ids) =>
+ cache.impressions = new HighlightFeedImpressions('feed_tab', (load, ids) =>
recordFeedImpressions(load.feedLoadId, ids)
)
// Not paused on hide: hiding is when the batch must go out.
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedTelemetry.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedTelemetry.ts
similarity index 79%
rename from products/replay_vision/frontend/replay_scanners/watchFeedTelemetry.ts
rename to products/replay_vision/frontend/replay_scanners/highlightFeedTelemetry.ts
index 138aa0651c11..8d369d7d7dbd 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedTelemetry.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedTelemetry.ts
@@ -1,19 +1,19 @@
import posthog from 'lib/posthog-typed'
import { uuid } from 'lib/utils/dom'
-import type { WatchFeedItemApi } from '../generated/api.schemas'
+import type { HighlightFeedItemApi } from '../generated/api.schemas'
// A second on screen, enough to read the title, so a card scrolled past at speed does not count as shown.
export const CARD_SEEN_DWELL_MS = 1000
/** One feed fetch. Every card event carries its id, so a click, dismissal, or impression joins back to the ranked list it came from. */
-export interface WatchFeedLoad {
+export interface HighlightFeedLoad {
feedLoadId: string
// Each card's place as served, so a dismissal that shortens the list does not shift later cards' positions.
positions: Record<string, number>
}
-export function newWatchFeedLoad(items: WatchFeedItemApi[]): WatchFeedLoad {
+export function newHighlightFeedLoad(items: HighlightFeedItemApi[]): HighlightFeedLoad {
return {
feedLoadId: uuid(),
positions: Object.fromEntries(items.map((item, index) => [item.observation.id, index])),
@@ -21,7 +21,7 @@ export function newWatchFeedLoad(items: WatchFeedItemApi[]): WatchFeedLoad {
}
/** The same load with a later page of unseen cards appended, each placed after every card served so far. */
-export function withNextPage(load: WatchFeedLoad, items: WatchFeedItemApi[]): WatchFeedLoad {
+export function withNextPage(load: HighlightFeedLoad, items: HighlightFeedItemApi[]): HighlightFeedLoad {
const served = Object.keys(load.positions).length
const positions = { ...load.positions }
items.forEach((item, index) => {
@@ -30,11 +30,14 @@ export function withNextPage(load: WatchFeedLoad, items: WatchFeedItemApi[]): Wa
return { ...load, positions }
}
-function servedPosition(load: WatchFeedLoad | null, item: WatchFeedItemApi, position: number): number {
+function servedPosition(load: HighlightFeedLoad | null, item: HighlightFeedItemApi, position: number): number {
return load?.positions[item.observation.id] ?? position
}
-export function servedListProperties(load: WatchFeedLoad | null, items: WatchFeedItemApi[]): Record<string, unknown> {
+export function servedListProperties(
+ load: HighlightFeedLoad | null,
+ items: HighlightFeedItemApi[]
+): Record<string, unknown> {
return {
feed_load_id: load?.feedLoadId ?? null,
observation_ids: items.map((item) => item.observation.id),
@@ -43,8 +46,8 @@ export function servedListProperties(load: WatchFeedLoad | null, items: WatchFee
}
export function cardProperties(
- load: WatchFeedLoad | null,
- item: WatchFeedItemApi,
+ load: HighlightFeedLoad | null,
+ item: HighlightFeedItemApi,
position: number,
surface: string
): Record<string, unknown> {
@@ -64,30 +67,30 @@ export function cardProperties(
}
/** Batches one load's seen cards into a single event. Flushes on tab hide too, since a closed tab sends nothing later. */
-export class WatchFeedImpressions {
+export class HighlightFeedImpressions {
private seen = new Map<string, { position: number; reason_kind: string }>()
// A tab hidden and shown again flushes twice in one load; a card is reported once per load.
private reported = new Set<string>()
- private load: WatchFeedLoad | null = null
+ private load: HighlightFeedLoad | null = null
/** `onFlush` receives each batch of newly seen cards, for anything besides analytics that counts them. */
constructor(
private readonly surface: string,
- private readonly onFlush?: (load: WatchFeedLoad, observationIds: string[]) => void
+ private readonly onFlush?: (load: HighlightFeedLoad, observationIds: string[]) => void
) {}
- start(load: WatchFeedLoad | null): void {
+ start(load: HighlightFeedLoad | null): void {
this.flush()
this.reported.clear()
this.load = load
}
/** Takes a later page of the same load without reporting its cards again. */
- extend(load: WatchFeedLoad): void {
+ extend(load: HighlightFeedLoad): void {
this.load = load
}
- add(item: WatchFeedItemApi, position: number): void {
+ add(item: HighlightFeedItemApi, position: number): void {
if (!this.seen.has(item.observation.id) && !this.reported.has(item.observation.id)) {
this.seen.set(item.observation.id, {
position: servedPosition(this.load, item, position),
@@ -100,7 +103,7 @@ export class WatchFeedImpressions {
if (this.seen.size === 0) {
return
}
- posthog.capture('replay_vision_watch_feed_impressions', {
+ posthog.capture('replay_vision_highlight_feed_impressions', {
feed_load_id: this.load?.feedLoadId ?? null,
surface: this.surface,
count: this.seen.size,
diff --git a/products/replay_vision/frontend/replay_scanners/watchPickSummary.ts b/products/replay_vision/frontend/replay_scanners/highlightPickSummary.ts
similarity index 66%
rename from products/replay_vision/frontend/replay_scanners/watchPickSummary.ts
rename to products/replay_vision/frontend/replay_scanners/highlightPickSummary.ts
index 3806469a78e1..d5f46095dc9e 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPickSummary.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightPickSummary.ts
@@ -1,19 +1,19 @@
import type { ReplayObservationApi } from '../generated/api.schemas'
import { scannerLabel } from '../utils/observation'
-import { watchCardHeadline } from './components/WatchFeedCard'
+import { highlightCardHeadline } from './components/HighlightFeedCard'
import { ScannerType } from './types'
-export interface WatchPickSummary {
+export interface HighlightPickSummary {
title: string
scannerName: string
scannerType: ScannerType | undefined
person: string
}
-export function watchPickSummary(observation: ReplayObservationApi): WatchPickSummary {
+export function highlightPickSummary(observation: ReplayObservationApi): HighlightPickSummary {
const scannerName = scannerLabel(observation)
return {
- title: watchCardHeadline(observation)?.title ?? scannerName,
+ title: highlightCardHeadline(observation)?.title ?? scannerName,
scannerName,
scannerType: observation.scanner_snapshot?.scanner_type as ScannerType | undefined,
person: observation.recording_subject_email || observation.distinct_id || 'Anonymous',
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksLogic.test.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.test.ts
similarity index 91%
rename from products/replay_vision/frontend/replay_scanners/watchPicksLogic.test.ts
rename to products/replay_vision/frontend/replay_scanners/highlightPicksLogic.test.ts
index 40171f4d7a75..067c855c8da4 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksLogic.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.test.ts
@@ -8,9 +8,9 @@ import { sessionRecordingsPlaylistLogic } from 'scenes/session-recordings/playli
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
-import { emptyImpressionsStorageKey, picksShownCountStorageKey, watchPicksLogic } from './watchPicksLogic'
+import { emptyImpressionsStorageKey, picksShownCountStorageKey, highlightPicksLogic } from './highlightPicksLogic'
-describe('watchPicksLogic', () => {
+describe('highlightPicksLogic', () => {
let feedSpy: jest.Mock
let viewedSpy: jest.Mock
const playlistLogicProps = { logicKey: 'test-picks' }
@@ -34,7 +34,7 @@ describe('watchPicksLogic', () => {
])
viewedSpy = jest.fn(() => [200, {}])
useMocks({
- get: { '/api/projects/:team/vision/scanners/watch_feed/': feedSpy },
+ get: { '/api/projects/:team/vision/scanners/highlight_feed/': feedSpy },
post: { '/api/projects/:team/vision/observations/:id/viewed/': viewedSpy },
})
localStorage.clear()
@@ -42,7 +42,7 @@ describe('watchPicksLogic', () => {
})
describe('inside a recordings list', () => {
- let logic: ReturnType<typeof watchPicksLogic.build>
+ let logic: ReturnType<typeof highlightPicksLogic.build>
let playlistLogic: ReturnType<typeof sessionRecordingsPlaylistLogic.build>
let captureSpy: jest.SpyInstance
@@ -51,7 +51,7 @@ describe('watchPicksLogic', () => {
captureSpy.mockClear()
playlistLogic = sessionRecordingsPlaylistLogic(playlistLogicProps)
playlistLogic.mount()
- logic = watchPicksLogic({ logicKey: 'test-picks', playlistLogicProps })
+ logic = highlightPicksLogic({ logicKey: 'test-picks', playlistLogicProps })
logic.mount()
await expectLogic(logic).toDispatchActions(['loadPicks']).toFinishAllListeners()
}
@@ -75,7 +75,9 @@ describe('watchPicksLogic', () => {
})
const shownEvents = (): unknown[] =>
- captureSpy.mock.calls.filter(([name]) => name === 'replay_vision_watch_picks_shown').map((call) => call[1])
+ captureSpy.mock.calls
+ .filter(([name]) => name === 'replay_vision_highlight_picks_shown')
+ .map((call) => call[1])
it('opens on the picks and reports the impression with its count', () => {
expect(logic.values.effectiveListMode).toBe('picks')
@@ -97,7 +99,7 @@ describe('watchPicksLogic', () => {
logic.actions.cardSeen(item('fallback', 'session-c') as any, 0)
logic.unmount()
const batches = captureSpy.mock.calls
- .filter(([name]) => name === 'replay_vision_watch_feed_impressions')
+ .filter(([name]) => name === 'replay_vision_highlight_feed_impressions')
.map(([, props]) => props.impressions.map((i: { observation_id: string }) => i.observation_id))
expect(batches).toEqual([['o1']])
logic.mount()
@@ -114,7 +116,7 @@ describe('watchPicksLogic', () => {
await mountList()
expect(
captureSpy.mock.calls
- .filter(([name]) => name === 'replay_vision_watch_picks_shown_third_time')
+ .filter(([name]) => name === 'replay_vision_highlight_picks_shown_third_time')
.map((call) => call[1])
).toEqual(thirdTimeEvents)
expect(localStorage.getItem(picksShownCountStorageKey())).toBe(String(stored + 1))
@@ -177,7 +179,7 @@ describe('watchPicksLogic', () => {
column.mount()
for (const position of [0, 1]) {
column.actions.setSegment('picks')
- logic.actions.watchPick(logic.values.picks![position], position)
+ logic.actions.highlightPick(logic.values.picks![position], position)
expect(column.values.segment).toBe('moments')
}
column.unmount()
@@ -186,7 +188,7 @@ describe('watchPicksLogic', () => {
it('selects the pick, seeks ahead of its key moment, and marks it viewed for this person', async () => {
expect(logic.values.unwatchedCount).toBe(3)
await expectLogic(logic, () => {
- logic.actions.watchPick(logic.values.picks![0], 0)
+ logic.actions.highlightPick(logic.values.picks![0], 0)
})
.toDispatchActions([playlistLogic.actionCreators.setSelectedRecordingId('session-a')])
.toFinishAllListeners()
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksLogic.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.ts
similarity index 74%
rename from products/replay_vision/frontend/replay_scanners/watchPicksLogic.ts
rename to products/replay_vision/frontend/replay_scanners/highlightPicksLogic.ts
index 448809614cae..61b15086398e 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.ts
@@ -29,22 +29,22 @@ import { teamLogic } from 'scenes/teamLogic'
import { SessionRecordingSidebarTab } from '~/types'
-import { visionObservationsViewedCreate, visionScannersWatchFeedRetrieve } from '../generated/api'
-import type { WatchFeedItemApi } from '../generated/api.schemas'
-import { observationKeyMomentMs, watchStartSeconds } from './components/WatchFeedCard'
-import type { WatchFeedEmptyReason } from './watchFeedEmptyState'
-import { recordFeedImpressions } from './watchFeedImpressionCounts'
+import { visionObservationsViewedCreate, visionScannersHighlightFeedRetrieve } from '../generated/api'
+import type { HighlightFeedItemApi } from '../generated/api.schemas'
+import { observationKeyMomentMs, highlightStartSeconds } from './components/HighlightFeedCard'
+import type { HighlightFeedEmptyReason } from './highlightFeedEmptyState'
+import { recordFeedImpressions } from './highlightFeedImpressionCounts'
import {
- type WatchFeedLoad,
- WatchFeedImpressions,
+ type HighlightFeedLoad,
+ HighlightFeedImpressions,
cardProperties,
- newWatchFeedLoad,
+ newHighlightFeedLoad,
servedListProperties,
-} from './watchFeedTelemetry'
+} from './highlightFeedTelemetry'
-export type WatchPicksListMode = 'recordings' | 'picks'
+export type HighlightPicksListMode = 'recordings' | 'picks'
-export interface WatchPicksLogicProps {
+export interface HighlightPicksLogicProps {
logicKey: string
playlistLogicProps: SessionRecordingPlaylistLogicProps
}
@@ -58,42 +58,49 @@ const PICKS_DATE_FROM = '-7d'
export const PICKS_SHOWN_SURVEY_IMPRESSION = 3
const teamStorageKey = (key: string) => (): string =>
`${key}.${teamLogic.findMounted()?.values.currentTeamId ?? 'unknown'}`
-export const picksShownCountStorageKey = teamStorageKey('replay-vision.watch-picks-shown-count')
+export const picksShownCountStorageKey = teamStorageKey('replay-vision.highlight-picks-shown-count')
const picksShownCount = localStorageSlot(picksShownCountStorageKey, z.number().int().nonnegative())
-export const emptyImpressionsStorageKey = teamStorageKey('replay-vision.watch-picks-empty-impressions')
+export const emptyImpressionsStorageKey = teamStorageKey('replay-vision.highlight-picks-empty-impressions')
export const EMPTY_IMPRESSIONS_BEFORE_RECORDINGS = 2
const emptyImpressions = localStorageSlot(emptyImpressionsStorageKey, z.number().int().nonnegative())
const FOCUS_RELOAD_MIN_MS = 60_000
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchPicksLogicValues {
+export interface highlightPicksLogicValues {
currentTeamId: number | null // teamLogic
activeSessionId: string | null
- effectiveListMode: WatchPicksListMode
+ effectiveListMode: HighlightPicksListMode
emptyImpressionsAtMount: number
- listMode: WatchPicksListMode | null
+ listMode: HighlightPicksListMode | null
openedOnDeepLink: boolean
- picks: WatchFeedItemApi[] | null
+ picks: HighlightFeedItemApi[] | null
picksFailed: boolean
- picksLoad: WatchFeedLoad | null
+ picksLoad: HighlightFeedLoad | null
picksLoading: boolean
unwatchedCount: number
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchPicksLogicActions {
+export interface highlightPicksLogicActions {
adoptPicksMode: () => {
value: true
}
cardSeen: (
- item: WatchFeedItemApi,
+ item: HighlightFeedItemApi,
position: number
) => {
- item: WatchFeedItemApi
+ item: HighlightFeedItemApi
position: number
}
- emptyStateShown: (reason: WatchFeedEmptyReason) => {
- reason: WatchFeedEmptyReason
+ emptyStateShown: (reason: HighlightFeedEmptyReason) => {
+ reason: HighlightFeedEmptyReason
+ }
+ highlightPick: (
+ item: HighlightFeedItemApi,
+ position: number
+ ) => {
+ item: HighlightFeedItemApi
+ position: number
}
loadPicks: () => {
value: true
@@ -106,12 +113,12 @@ export interface watchPicksLogicActions {
errorObject?: any
}
loadPicksSuccess: (
- picks: WatchFeedItemApi[],
+ picks: HighlightFeedItemApi[],
payload?: {
value: true
}
) => {
- picks: WatchFeedItemApi[]
+ picks: HighlightFeedItemApi[]
payload?: {
value: true
}
@@ -122,46 +129,39 @@ export interface watchPicksLogicActions {
setActiveSessionId: (sessionId: string | null) => {
sessionId: string | null
}
- setListMode: (mode: WatchPicksListMode) => {
- mode: WatchPicksListMode
+ setListMode: (mode: HighlightPicksListMode) => {
+ mode: HighlightPicksListMode
}
- setPicksLoad: (load: WatchFeedLoad) => {
- load: WatchFeedLoad
- }
- watchPick: (
- item: WatchFeedItemApi,
- position: number
- ) => {
- item: WatchFeedItemApi
- position: number
+ setPicksLoad: (load: HighlightFeedLoad) => {
+ load: HighlightFeedLoad
}
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchPicksLogicMeta {
+export interface highlightPicksLogicMeta {
key: string
__keaTypeGenInternalSelectorTypes: {
effectiveListMode: (
- listMode: WatchPicksListMode | null,
+ listMode: HighlightPicksListMode | null,
openedOnDeepLink: boolean,
picksFailed: boolean,
emptyImpressionsAtMount: number
- ) => WatchPicksListMode
- unwatchedCount: (picks: WatchFeedItemApi[] | null) => number
+ ) => HighlightPicksListMode
+ unwatchedCount: (picks: HighlightFeedItemApi[] | null) => number
}
}
-export type watchPicksLogicType = MakeLogicType<
- watchPicksLogicValues,
- watchPicksLogicActions,
- WatchPicksLogicProps,
- watchPicksLogicMeta
+export type highlightPicksLogicType = MakeLogicType<
+ highlightPicksLogicValues,
+ highlightPicksLogicActions,
+ HighlightPicksLogicProps,
+ highlightPicksLogicMeta
>
-export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicksLogicType>([
- props({} as WatchPicksLogicProps),
+export const highlightPicksLogic: LogicWrapper<highlightPicksLogicType> = kea<highlightPicksLogicType>([
+ props({} as HighlightPicksLogicProps),
key((props) => props.logicKey),
- path((key) => ['products', 'replay_vision', 'frontend', 'replay_scanners', 'watchPicksLogic', key]),
+ path((key) => ['products', 'replay_vision', 'frontend', 'replay_scanners', 'highlightPicksLogic', key]),
connect(() => ({
values: [teamLogic, ['currentTeamId']],
@@ -169,30 +169,30 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
actions({
loadPicks: true,
- setListMode: (mode: WatchPicksListMode) => ({ mode }),
+ setListMode: (mode: HighlightPicksListMode) => ({ mode }),
adoptPicksMode: true,
- watchPick: (item: WatchFeedItemApi, position: number) => ({ item, position }),
+ highlightPick: (item: HighlightFeedItemApi, position: number) => ({ item, position }),
setActiveSessionId: (sessionId: string | null) => ({ sessionId }),
markPickViewed: (observationId: string) => ({ observationId }),
- setPicksLoad: (load: WatchFeedLoad) => ({ load }),
- cardSeen: (item: WatchFeedItemApi, position: number) => ({ item, position }),
- emptyStateShown: (reason: WatchFeedEmptyReason) => ({ reason }),
+ setPicksLoad: (load: HighlightFeedLoad) => ({ load }),
+ cardSeen: (item: HighlightFeedItemApi, position: number) => ({ item, position }),
+ emptyStateShown: (reason: HighlightFeedEmptyReason) => ({ reason }),
}),
loaders(({ values, actions }) => ({
picks: [
- null as WatchFeedItemApi[] | null,
+ null as HighlightFeedItemApi[] | null,
{
loadPicks: async (_, breakpoint) => {
if (!values.currentTeamId) {
throw new Error('No current team')
}
- const response = await visionScannersWatchFeedRetrieve(String(values.currentTeamId), {
+ const response = await visionScannersHighlightFeedRetrieve(String(values.currentTeamId), {
date_from: PICKS_DATE_FROM,
limit: PICKS_LIMIT,
})
breakpoint()
- actions.setPicksLoad(newWatchFeedLoad(response.results))
+ actions.setPicksLoad(newHighlightFeedLoad(response.results))
return response.results
},
},
@@ -209,14 +209,14 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
) ?? null,
},
picksLoad: [
- null as WatchFeedLoad | null,
+ null as HighlightFeedLoad | null,
{
setPicksLoad: (_, { load }) => load,
},
],
listMode: [
- null as WatchPicksListMode | null,
- { persist: true, storageKey: 'replay-vision.watch-picks-list-mode' },
+ null as HighlightPicksListMode | null,
+ { persist: true, storageKey: 'replay-vision.highlight-picks-list-mode' },
{
setListMode: (_, { mode }) => mode,
adoptPicksMode: () => 'picks',
@@ -243,11 +243,11 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
effectiveListMode: [
(s) => [s.listMode, s.openedOnDeepLink, s.picksFailed, s.emptyImpressionsAtMount],
(
- listMode: WatchPicksListMode | null,
+ listMode: HighlightPicksListMode | null,
openedOnDeepLink: boolean,
picksFailed: boolean,
emptyImpressionsAtMount: number
- ): WatchPicksListMode =>
+ ): HighlightPicksListMode =>
listMode ??
(openedOnDeepLink || picksFailed || emptyImpressionsAtMount >= EMPTY_IMPRESSIONS_BEFORE_RECORDINGS
? 'recordings'
@@ -255,7 +255,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
],
unwatchedCount: [
(s) => [s.picks],
- (picks: WatchFeedItemApi[] | null): number =>
+ (picks: HighlightFeedItemApi[] | null): number =>
(picks ?? []).filter((pick) => !pick.observation.viewed).length,
],
}),
@@ -274,7 +274,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
}
const shownCount = (picksShownCount.get() ?? 0) + 1
picksShownCount.set(shownCount)
- posthog.capture('replay_vision_watch_picks_shown', {
+ posthog.capture('replay_vision_highlight_picks_shown', {
...servedListProperties(values.picksLoad, values.picks),
view: 'list',
count: values.picks.length,
@@ -282,7 +282,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
shown_count: shownCount,
})
if (shownCount === PICKS_SHOWN_SURVEY_IMPRESSION) {
- posthog.capture('replay_vision_watch_picks_shown_third_time', { view: 'list' })
+ posthog.capture('replay_vision_highlight_picks_shown_third_time', { view: 'list' })
}
}
return {
@@ -301,7 +301,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
return
}
cache.emptyStateShownReason = reason
- posthog.capture('replay_vision_watch_picks_empty_shown', { reason })
+ posthog.capture('replay_vision_highlight_picks_empty_shown', { reason })
},
cardSeen: ({ item, position }) => {
// Fallback rows below the picks were not served by the ranker, so they are not impressions of this load.
@@ -310,15 +310,15 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
}
},
setListMode: ({ mode }) => {
- posthog.capture('replay_vision_watch_picks_list_mode_changed', { mode })
+ posthog.capture('replay_vision_highlight_picks_list_mode_changed', { mode })
if (mode === 'picks') {
reportPicksShown()
}
},
- watchPick: async ({ item, position }) => {
+ highlightPick: async ({ item, position }) => {
const { observation } = item
const keyMomentMs = observationKeyMomentMs(observation)
- posthog.capture('replay_vision_watch_clip_clicked', {
+ posthog.capture('replay_vision_highlight_clip_clicked', {
...cardProperties(
values.picksLoad?.positions[observation.id] !== undefined ? values.picksLoad : null,
item,
@@ -331,7 +331,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
view: 'list',
})
const playerParams = {
- t: keyMomentMs === null ? undefined : watchStartSeconds(keyMomentMs),
+ t: keyMomentMs === null ? undefined : highlightStartSeconds(keyMomentMs),
sidebarTab: SessionRecordingSidebarTab.OBSERVATIONS,
showInspector: true,
}
@@ -373,7 +373,9 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
}),
afterMount(({ actions, cache }) => {
- cache.impressions = new WatchFeedImpressions('list', (load, ids) => recordFeedImpressions(load.feedLoadId, ids))
+ cache.impressions = new HighlightFeedImpressions('list', (load, ids) =>
+ recordFeedImpressions(load.feedLoadId, ids)
+ )
// Not paused on hide: hiding is when the batch must go out.
cache.disposables.add(cache.impressions.flushOnHideAndUnmount, 'impressionsFlush', { pauseOnPageHidden: false })
actions.loadPicks()
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksStaleLogic.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksStaleLogic.ts
similarity index 89%
rename from products/replay_vision/frontend/replay_scanners/watchPicksStaleLogic.ts
rename to products/replay_vision/frontend/replay_scanners/highlightPicksStaleLogic.ts
index ba424cdac8e3..2c28901c0440 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksStaleLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksStaleLogic.ts
@@ -28,13 +28,18 @@ import {
visionScannersObservationsStatsRetrieve,
visionScannersPartialUpdate,
} from '../generated/api'
-import type { ReplayObservationApi, ReplayScannerApi, VisionQuotaApi, WatchFeedItemApi } from '../generated/api.schemas'
+import type {
+ ReplayObservationApi,
+ ReplayScannerApi,
+ VisionQuotaApi,
+ HighlightFeedItemApi,
+} from '../generated/api.schemas'
import { visionQuotaLogic } from '../logics/visionQuotaLogic'
import { visionScannersListLogic } from '../logics/visionScannersListLogic'
+import { HighlightFeedEmptyReason, resolveHighlightFeedEmptyReason } from './highlightFeedEmptyState'
+import { highlightPicksLogic } from './highlightPicksLogic'
+import { HighlightPicksStaleReason, resolveHighlightPicksStaleReason } from './highlightPicksStaleState'
import { scanDrought } from './scanDrought'
-import { WatchFeedEmptyReason, resolveWatchFeedEmptyReason } from './watchFeedEmptyState'
-import { watchPicksLogic } from './watchPicksLogic'
-import { WatchPicksStaleReason, resolveWatchPicksStaleReason } from './watchPicksStaleState'
const DROUGHT_SCANNER_CAP = 10
const BACKFILL_DAYS = 7
@@ -61,24 +66,24 @@ export interface QuietWeekStats {
succeeded: number
}
-export interface WatchPicksStaleLogicProps {
+export interface HighlightPicksStaleLogicProps {
logicKey: string
playlistLogicProps: SessionRecordingPlaylistLogicProps
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchPicksStaleLogicValues {
+export interface highlightPicksStaleLogicValues {
+ picks: HighlightFeedItemApi[] | null // highlightPicksLogic
currentTeam: TeamPublicType | TeamType | null // teamLogic
currentTeamId: number | null // teamLogic
quota: VisionQuotaApi | null // visionQuotaLogic
scanners: ReplayScannerApi[] // visionScannersListLogic
- picks: WatchFeedItemApi[] | null // watchPicksLogic
backfillCandidates: ReplayScannerApi[]
backfillEstimate: BackfillEstimate | null
backfillEstimateLoading: boolean
backfillScannerId: string | null
backfillTotals: Record<string, number>
- blockReason: WatchFeedEmptyReason
+ blockReason: HighlightFeedEmptyReason
busyScannerId: string | null
droughtScannerIds: string[]
droughtScannerIdsLoading: boolean
@@ -90,13 +95,13 @@ export interface watchPicksStaleLogicValues {
pickedBackfillScannerId: string | null
quietWeek: QuietWeekStats | null
quietWeekLoading: boolean
- staleReason: WatchPicksStaleReason | null
+ staleReason: HighlightPicksStaleReason | null
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchPicksStaleLogicActions {
- loadScannersSuccess: (
- scanners: ReplayScannerApi[],
+export interface highlightPicksStaleLogicActions {
+ loadPicksSuccess: (
+ picks: HighlightFeedItemApi[],
payload?:
| {
value: true
@@ -106,10 +111,10 @@ export interface watchPicksStaleLogicActions {
payload?: {
value: true
}
- scanners: ReplayScannerApi[]
- } // visionScannersListLogic
- loadPicksSuccess: (
- picks: WatchFeedItemApi[],
+ picks: HighlightFeedItemApi[]
+ } // highlightPicksLogic
+ loadScannersSuccess: (
+ scanners: ReplayScannerApi[],
payload?:
| {
value: true
@@ -119,8 +124,8 @@ export interface watchPicksStaleLogicActions {
payload?: {
value: true
}
- picks: WatchFeedItemApi[]
- } // watchPicksLogic
+ scanners: ReplayScannerApi[]
+ } // visionScannersListLogic
backfillStarted: (
scannerId: string,
totalSessions: number
@@ -246,20 +251,20 @@ export interface watchPicksStaleLogicActions {
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchPicksStaleLogicMeta {
+export interface highlightPicksStaleLogicMeta {
key: string
__keaTypeGenInternalSelectorTypes: {
blockReason: (
scanners: ReplayScannerApi[],
quota: VisionQuotaApi | null,
currentTeam: TeamPublicType | TeamType | null
- ) => WatchFeedEmptyReason
+ ) => HighlightFeedEmptyReason
staleReason: (
- picks: WatchFeedItemApi[] | null,
- blockReason: WatchFeedEmptyReason,
+ picks: HighlightFeedItemApi[] | null,
+ blockReason: HighlightFeedEmptyReason,
droughtScannerIds: string[],
now: Date
- ) => WatchPicksStaleReason | null
+ ) => HighlightPicksStaleReason | null
backfillCandidates: (scanners: ReplayScannerApi[]) => ReplayScannerApi[]
backfillScannerId: (
pickedBackfillScannerId: string | null,
@@ -270,19 +275,19 @@ export interface watchPicksStaleLogicMeta {
}
}
-export type watchPicksStaleLogicType = MakeLogicType<
- watchPicksStaleLogicValues,
- watchPicksStaleLogicActions,
- WatchPicksStaleLogicProps,
- watchPicksStaleLogicMeta
+export type highlightPicksStaleLogicType = MakeLogicType<
+ highlightPicksStaleLogicValues,
+ highlightPicksStaleLogicActions,
+ HighlightPicksStaleLogicProps,
+ highlightPicksStaleLogicMeta
>
-export const watchPicksStaleLogic: LogicWrapper<watchPicksStaleLogicType> = kea<watchPicksStaleLogicType>([
- props({} as WatchPicksStaleLogicProps),
+export const highlightPicksStaleLogic: LogicWrapper<highlightPicksStaleLogicType> = kea<highlightPicksStaleLogicType>([
+ props({} as HighlightPicksStaleLogicProps),
key((props) => props.logicKey),
- path((key) => ['products', 'replay_vision', 'frontend', 'replay_scanners', 'watchPicksStaleLogic', key]),
+ path((key) => ['products', 'replay_vision', 'frontend', 'replay_scanners', 'highlightPicksStaleLogic', key]),
- connect((props: WatchPicksStaleLogicProps) => ({
+ connect((props: HighlightPicksStaleLogicProps) => ({
values: [
teamLogic,
['currentTeamId', 'currentTeam'],
@@ -290,10 +295,10 @@ export const watchPicksStaleLogic: LogicWrapper<watchPicksStaleLogicType> = kea<
['scanners'],
visionQuotaLogic,
['quota'],
- watchPicksLogic(props),
+ highlightPicksLogic(props),
['picks'],
],
- actions: [visionScannersListLogic, ['loadScannersSuccess'], watchPicksLogic(props), ['loadPicksSuccess']],
+ actions: [visionScannersListLogic, ['loadScannersSuccess'], highlightPicksLogic(props), ['loadPicksSuccess']],
})),
actions({
@@ -458,8 +463,8 @@ export const watchPicksStaleLogic: LogicWrapper<watchPicksStaleLogicType> = kea<
scanners: ReplayScannerApi[],
quota: VisionQuotaApi | null,
currentTeam: TeamPublicType | TeamType | null
- ): WatchFeedEmptyReason =>
- resolveWatchFeedEmptyReason({
+ ): HighlightFeedEmptyReason =>
+ resolveHighlightFeedEmptyReason({
scanners,
quota,
sessionRecordingOptIn: currentTeam?.session_recording_opt_in ?? null,
@@ -469,12 +474,12 @@ export const watchPicksStaleLogic: LogicWrapper<watchPicksStaleLogicType> = kea<
staleReason: [
(s) => [s.picks, s.blockReason, s.droughtScannerIds, s.now],
(
- picks: WatchFeedItemApi[] | null,
- blockReason: WatchFeedEmptyReason,
+ picks: HighlightFeedItemApi[] | null,
+ blockReason: HighlightFeedEmptyReason,
droughtScannerIds: string[],
now: Date
- ): WatchPicksStaleReason | null =>
- resolveWatchPicksStaleReason({ picks: picks ?? [], blockReason, droughtScannerIds, now }),
+ ): HighlightPicksStaleReason | null =>
+ resolveHighlightPicksStaleReason({ picks: picks ?? [], blockReason, droughtScannerIds, now }),
],
backfillCandidates: [
(s) => [s.scanners],
@@ -505,10 +510,10 @@ export const watchPicksStaleLogic: LogicWrapper<watchPicksStaleLogicType> = kea<
const refresh = (): void => {
visionScannersListLogic.findMounted()?.actions.loadScanners()
visionQuotaLogic.findMounted()?.actions.loadQuota()
- watchPicksLogic.findMounted(props)?.actions.loadPicks()
+ highlightPicksLogic.findMounted(props)?.actions.loadPicks()
}
const act = (action: string, scannerId: string): void => {
- posthog.capture('replay_vision_watch_picks_stale_action', {
+ posthog.capture('replay_vision_highlight_picks_stale_action', {
reason: values.staleReason,
action,
scanner_id: scannerId,
@@ -537,7 +542,7 @@ export const watchPicksStaleLogic: LogicWrapper<watchPicksStaleLogicType> = kea<
actions.loadQuietWeek()
}
if (values.staleReason) {
- posthog.capture('replay_vision_watch_picks_stale_shown', { reason: values.staleReason })
+ posthog.capture('replay_vision_highlight_picks_stale_shown', { reason: values.staleReason })
}
},
toggleScanner: async ({ scannerId, enabled }) => {
@@ -577,12 +582,12 @@ export const watchPicksStaleLogic: LogicWrapper<watchPicksStaleLogicType> = kea<
cache.disposables.add(() => {
const timer = window.setInterval(() => {
polls += 1
- const picks = watchPicksLogic.findMounted(props)?.values.picks ?? []
+ const picks = highlightPicksLogic.findMounted(props)?.values.picks ?? []
if (polls > BACKFILL_POLL_MAX || picks.length > 0) {
cache.disposables.dispose('backfill-poll')
return
}
- watchPicksLogic.findMounted(props)?.actions.loadPicks()
+ highlightPicksLogic.findMounted(props)?.actions.loadPicks()
}, BACKFILL_POLL_MS)
return () => clearInterval(timer)
}, 'backfill-poll')
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksStaleState.test.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksStaleState.test.ts
similarity index 65%
rename from products/replay_vision/frontend/replay_scanners/watchPicksStaleState.test.ts
rename to products/replay_vision/frontend/replay_scanners/highlightPicksStaleState.test.ts
index 1b8b929fef4d..6064d5de6b74 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksStaleState.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksStaleState.test.ts
@@ -1,14 +1,14 @@
-import type { WatchFeedItemApi } from '../generated/api.schemas'
-import { type WatchPicksStaleReason, resolveWatchPicksStaleReason } from './watchPicksStaleState'
+import type { HighlightFeedItemApi } from '../generated/api.schemas'
+import { type HighlightPicksStaleReason, resolveHighlightPicksStaleReason } from './highlightPicksStaleState'
const now = new Date('2026-10-16T12:00:00Z')
-const pick = (daysAgo: number, viewed: boolean): WatchFeedItemApi =>
+const pick = (daysAgo: number, viewed: boolean): HighlightFeedItemApi =>
({
observation: { created_at: new Date(now.getTime() - daysAgo * 86_400_000).toISOString(), viewed },
- }) as unknown as WatchFeedItemApi
+ }) as unknown as HighlightFeedItemApi
-describe('resolveWatchPicksStaleReason', () => {
- it.each<[string, WatchFeedItemApi[], any, string[], WatchPicksStaleReason | null]>([
+describe('resolveHighlightPicksStaleReason', () => {
+ it.each<[string, HighlightFeedItemApi[], any, string[], HighlightPicksStaleReason | null]>([
['no picks, so the empty state owns it', [], 'no-scanners', [], null],
['a fresh unwatched pick', [pick(0.5, false)], 'quiet-window', [], null],
['every pick watched but recent', [pick(1, true)], 'quiet-window', [], 'caught-up'],
@@ -24,6 +24,6 @@ describe('resolveWatchPicksStaleReason', () => {
null,
],
])('reads %s', (_name, picks, blockReason, droughtScannerIds, expected) => {
- expect(resolveWatchPicksStaleReason({ picks, blockReason, droughtScannerIds, now })).toBe(expected)
+ expect(resolveHighlightPicksStaleReason({ picks, blockReason, droughtScannerIds, now })).toBe(expected)
})
})
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksStaleState.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksStaleState.ts
similarity index 67%
rename from products/replay_vision/frontend/replay_scanners/watchPicksStaleState.ts
rename to products/replay_vision/frontend/replay_scanners/highlightPicksStaleState.ts
index 6c9fdd6293e7..8aaa11c9b2a6 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksStaleState.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksStaleState.ts
@@ -1,9 +1,9 @@
-import type { WatchFeedItemApi } from '../generated/api.schemas'
-import type { WatchFeedEmptyReason } from './watchFeedEmptyState'
+import type { HighlightFeedItemApi } from '../generated/api.schemas'
+import type { HighlightFeedEmptyReason } from './highlightFeedEmptyState'
export const STALE_AFTER_MS = 2 * 24 * 60 * 60 * 1000
-export type WatchPicksStaleReason =
+export type HighlightPicksStaleReason =
| 'caught-up'
| 'quiet-week'
| 'drought'
@@ -11,19 +11,19 @@ export type WatchPicksStaleReason =
| 'all-disabled'
| 'all-capped'
-export interface WatchPicksStaleInput {
- picks: WatchFeedItemApi[]
- blockReason: WatchFeedEmptyReason
+export interface HighlightPicksStaleInput {
+ picks: HighlightFeedItemApi[]
+ blockReason: HighlightFeedEmptyReason
droughtScannerIds: string[]
now: Date
}
-export function resolveWatchPicksStaleReason({
+export function resolveHighlightPicksStaleReason({
picks,
blockReason,
droughtScannerIds,
now,
-}: WatchPicksStaleInput): WatchPicksStaleReason | null {
+}: HighlightPicksStaleInput): HighlightPicksStaleReason | null {
if (picks.length === 0) {
return null
}
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksStarter.test.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksStarter.test.ts
similarity index 96%
rename from products/replay_vision/frontend/replay_scanners/watchPicksStarter.test.ts
rename to products/replay_vision/frontend/replay_scanners/highlightPicksStarter.test.ts
index 4dd843204cb6..98431189191a 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksStarter.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksStarter.test.ts
@@ -1,4 +1,4 @@
-import { planBurst, samplingRateForTarget, starterSpendMode } from './watchPicksStarter'
+import { planBurst, samplingRateForTarget, starterSpendMode } from './highlightPicksStarter'
const recording = (id: string, overrides: Record<string, unknown> = {}): any => ({
id,
@@ -8,7 +8,7 @@ const recording = (id: string, overrides: Record<string, unknown> = {}): any =>
...overrides,
})
-describe('watchPicksStarter', () => {
+describe('highlightPicksStarter', () => {
const thirty = Array.from({ length: 30 }, (_, i) => recording(`s${i}`))
it.each<[string, any[], number, 'free' | 'budget', number | null, number | null, number]>([
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksStarter.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksStarter.ts
similarity index 100%
rename from products/replay_vision/frontend/replay_scanners/watchPicksStarter.ts
rename to products/replay_vision/frontend/replay_scanners/highlightPicksStarter.ts
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksStarterLogic.test.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksStarterLogic.test.ts
similarity index 70%
rename from products/replay_vision/frontend/replay_scanners/watchPicksStarterLogic.test.ts
rename to products/replay_vision/frontend/replay_scanners/highlightPicksStarterLogic.test.ts
index 6354e32921a9..979867f594f6 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksStarterLogic.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksStarterLogic.test.ts
@@ -5,14 +5,14 @@ import { sessionRecordingsPlaylistLogic } from 'scenes/session-recordings/playli
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
-import { watchPicksLogic } from './watchPicksLogic'
-import { watchPicksStarterLogic } from './watchPicksStarterLogic'
+import { highlightPicksLogic } from './highlightPicksLogic'
+import { highlightPicksStarterLogic } from './highlightPicksStarterLogic'
-describe('watchPicksStarterLogic', () => {
+describe('highlightPicksStarterLogic', () => {
it('plans the burst from the loaded recordings and starts on free credits', () => {
useMocks({
get: {
- '/api/projects/:team/vision/scanners/watch_feed/': () => [200, { results: [] }],
+ '/api/projects/:team/vision/scanners/highlight_feed/': () => [200, { results: [] }],
'/api/environments/:team/vision/quota/': () => [
200,
{ free_monthly_credits: 2500, credits_used: 0, credit_limit: null },
@@ -24,9 +24,9 @@ describe('watchPicksStarterLogic', () => {
const playlistLogicProps = { logicKey: 'starter-test' }
const playlist = sessionRecordingsPlaylistLogic(playlistLogicProps)
playlist.mount()
- const picks = watchPicksLogic({ logicKey: 'starter-test', playlistLogicProps })
+ const picks = highlightPicksLogic({ logicKey: 'starter-test', playlistLogicProps })
picks.mount()
- const logic = watchPicksStarterLogic(picks.props)
+ const logic = highlightPicksStarterLogic(picks.props)
logic.mount()
expect(logic.values.spendMode).toBe('free')
expect(logic.values.candidateRecordings).toEqual(playlist.values.sessionRecordings)
diff --git a/products/replay_vision/frontend/replay_scanners/highlightPicksStarterLogic.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksStarterLogic.ts
new file mode 100644
index 000000000000..c910cb3037ff
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksStarterLogic.ts
@@ -0,0 +1,533 @@
+import {
+ LogicWrapper,
+ MakeLogicType,
+ actions,
+ afterMount,
+ connect,
+ kea,
+ key,
+ listeners,
+ path,
+ props,
+ reducers,
+ selectors,
+} from 'kea'
+import { router } from 'kea-router'
+
+import { lemonToast } from 'lib/lemon-ui/LemonToast'
+import posthog from 'lib/posthog-typed'
+import { pluralize } from 'lib/utils/strings'
+import {
+ SessionRecordingPlaylistLogicProps,
+ sessionRecordingsPlaylistLogic,
+} from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'
+import { teamLogic } from 'scenes/teamLogic'
+import { urls } from 'scenes/urls'
+
+import { NodeKind } from '~/queries/schema/schema-general'
+import type { SessionRecordingType } from '~/types'
+
+import {
+ visionScannersBulkObserveCreate,
+ visionScannersCreate,
+ visionScannersEstimateCreate,
+ visionScannersObservationsList,
+} from '../generated/api'
+import type { ReplayObservationApi, ReplayScannerApi } from '../generated/api.schemas'
+import { visionQuotaLogic } from '../logics/visionQuotaLogic'
+import { visionScannersListLogic } from '../logics/visionScannersListLogic'
+import { formatCreditsMaybeUsd } from '../utils/credits'
+import { highlightPicksLogic } from './highlightPicksLogic'
+import {
+ BURST_MAX_RECORDINGS,
+ BUDGET_PRESETS,
+ BurstPlan,
+ FREE_SCANNER_CREDIT_LIMIT,
+ QUICKSTART_SCANNER,
+ StarterSpendMode,
+ TARGET_MONTHLY_SCANS,
+ planBurst,
+ samplingRateForTarget,
+ starterSpendMode,
+} from './highlightPicksStarter'
+import { DEFAULT_MODEL, DEFAULT_PROVIDER, OBSERVATION_CREDITS_BY_MODEL, scannerToApiBody } from './types'
+
+const BURST_POLL_MS = 10_000
+const BURST_POLL_MAX = 60
+const BURST_STALL_MS = 3 * 60_000
+const BURST_RESUME_MAX_AGE_MS = 30 * 60_000
+
+export interface BurstCounts {
+ pending: number
+ succeeded: number
+ failed: number
+}
+
+export interface HighlightPicksStarterLogicProps {
+ logicKey: string
+ playlistLogicProps?: SessionRecordingPlaylistLogicProps
+}
+
+type CandidateRecording = Pick<SessionRecordingType, 'id' | 'recording_duration' | 'active_seconds' | 'ongoing'>
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface highlightPicksStarterLogicValues {
+ currentTeamId: number | null // teamLogic
+ freeCreditsLeft: number | null // visionQuotaLogic
+ budget: number
+ budgetChosen: boolean
+ burstCounts: BurstCounts
+ burstDone: boolean
+ burstPlan: BurstPlan
+ burstSessionIds: string[]
+ burstStalled: boolean
+ burstStartedAt: number
+ burstTeamId: number | null
+ candidateRecordings: CandidateRecording[]
+ creditsPerObservation: number
+ freeAvailable: boolean
+ scannedAnyway: ReplayObservationApi[] | null
+ spendMode: StarterSpendMode
+ startError: string | null
+ startedScanner: ReplayScannerApi | null
+ starting: boolean
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface highlightPicksStarterLogicActions {
+ burstPolled: (counts: BurstCounts) => {
+ counts: BurstCounts
+ }
+ burstSettled: (stalled?: boolean) => {
+ stalled: boolean
+ }
+ chooseBudget: (budgetChosen: boolean) => {
+ budgetChosen: boolean
+ }
+ pollBurst: () => {
+ value: true
+ }
+ reset: () => {
+ value: true
+ }
+ resumeBurst: () => {
+ value: true
+ }
+ scannedAnywayLoaded: (observations: ReplayObservationApi[]) => {
+ observations: ReplayObservationApi[]
+ }
+ scannerStarted: (
+ scanner: ReplayScannerApi,
+ sessionIds: string[],
+ teamId: number
+ ) => {
+ scanner: ReplayScannerApi
+ sessionIds: string[]
+ teamId: number
+ }
+ setBudget: (budget: number) => {
+ budget: number
+ }
+ showScannedAnyway: () => {
+ value: true
+ }
+ startFailed: (message: string) => {
+ message: string
+ }
+ startScanner: () => {
+ value: true
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface highlightPicksStarterLogicMeta {
+ key: string
+ __keaTypeGenInternalSelectorTypes: {
+ candidateRecordings: (arg: SessionRecordingType[]) => CandidateRecording[]
+ freeAvailable: (freeCreditsLeft: number | null, creditsPerObservation: number) => boolean
+ spendMode: (freeAvailable: boolean, budgetChosen: boolean) => StarterSpendMode
+ burstPlan: (
+ candidateRecordings: CandidateRecording[],
+ creditsPerObservation: number,
+ spendMode: StarterSpendMode,
+ freeCreditsLeft: number | null,
+ budget: number
+ ) => BurstPlan
+ }
+}
+
+export type highlightPicksStarterLogicType = MakeLogicType<
+ highlightPicksStarterLogicValues,
+ highlightPicksStarterLogicActions,
+ HighlightPicksStarterLogicProps,
+ highlightPicksStarterLogicMeta
+>
+
+export const highlightPicksStarterLogic: LogicWrapper<highlightPicksStarterLogicType> =
+ kea<highlightPicksStarterLogicType>([
+ props({} as HighlightPicksStarterLogicProps),
+ key((props) => props.logicKey),
+ path((key) => ['products', 'replay_vision', 'frontend', 'replay_scanners', 'highlightPicksStarterLogic', key]),
+
+ connect(() => ({
+ values: [teamLogic, ['currentTeamId'], visionQuotaLogic, ['freeCreditsLeft']],
+ })),
+
+ actions({
+ setBudget: (budget: number) => ({ budget }),
+ chooseBudget: (budgetChosen: boolean) => ({ budgetChosen }),
+ startScanner: true,
+ scannerStarted: (scanner: ReplayScannerApi, sessionIds: string[], teamId: number) => ({
+ scanner,
+ sessionIds,
+ teamId,
+ }),
+ startFailed: (message: string) => ({ message }),
+ pollBurst: true,
+ burstPolled: (counts: BurstCounts) => ({ counts }),
+ burstSettled: (stalled: boolean = false) => ({ stalled }),
+ resumeBurst: true,
+ showScannedAnyway: true,
+ scannedAnywayLoaded: (observations: ReplayObservationApi[]) => ({ observations }),
+ reset: true,
+ }),
+
+ reducers({
+ budget: [
+ BUDGET_PRESETS[1] as number,
+ {
+ setBudget: (_, { budget }) => budget,
+ },
+ ],
+ budgetChosen: [
+ false,
+ {
+ chooseBudget: (_, { budgetChosen }) => budgetChosen,
+ reset: () => false,
+ },
+ ],
+ starting: [
+ false,
+ {
+ startScanner: () => true,
+ scannerStarted: () => false,
+ startFailed: () => false,
+ },
+ ],
+ startError: [
+ null as string | null,
+ {
+ startScanner: () => null,
+ startFailed: (_, { message }) => message,
+ reset: () => null,
+ },
+ ],
+ startedScanner: [
+ null as ReplayScannerApi | null,
+ { persist: true, storageKey: 'replay-vision.highlight-picks-starter.startedScanner' },
+ {
+ scannerStarted: (_, { scanner }) => scanner,
+ reset: () => null,
+ },
+ ],
+ burstSessionIds: [
+ [] as string[],
+ { persist: true, storageKey: 'replay-vision.highlight-picks-starter.burstSessionIds' },
+ {
+ scannerStarted: (_, { sessionIds }) => sessionIds,
+ reset: () => [],
+ },
+ ],
+ burstCounts: [
+ { pending: 0, succeeded: 0, failed: 0 } as BurstCounts,
+ {
+ scannerStarted: (_, { sessionIds }) => ({ pending: sessionIds.length, succeeded: 0, failed: 0 }),
+ burstPolled: (_, { counts }) => counts,
+ reset: () => ({ pending: 0, succeeded: 0, failed: 0 }),
+ },
+ ],
+ burstDone: [
+ false,
+ { persist: true, storageKey: 'replay-vision.highlight-picks-starter.burstDone' },
+ {
+ scannerStarted: (_, { sessionIds }) => sessionIds.length === 0,
+ burstSettled: () => true,
+ reset: () => false,
+ },
+ ],
+ burstStartedAt: [
+ 0,
+ { persist: true, storageKey: 'replay-vision.highlight-picks-starter.burstStartedAt' },
+ {
+ scannerStarted: () => Date.now(),
+ reset: () => 0,
+ },
+ ],
+ burstTeamId: [
+ null as number | null,
+ { persist: true, storageKey: 'replay-vision.highlight-picks-starter.burstTeamId' },
+ {
+ scannerStarted: (_, { teamId }) => teamId,
+ reset: () => null,
+ },
+ ],
+ burstStalled: [
+ false,
+ {
+ scannerStarted: () => false,
+ burstSettled: (_, { stalled }) => stalled,
+ reset: () => false,
+ },
+ ],
+ scannedAnyway: [
+ null as ReplayObservationApi[] | null,
+ {
+ scannedAnywayLoaded: (_, { observations }) => observations,
+ reset: () => null,
+ },
+ ],
+ }),
+
+ selectors(({ props }) => ({
+ candidateRecordings: [
+ () => [
+ props.playlistLogicProps
+ ? sessionRecordingsPlaylistLogic(props.playlistLogicProps).selectors.sessionRecordings
+ : () => [],
+ ],
+ (recordings: SessionRecordingType[]): CandidateRecording[] => recordings,
+ ],
+ creditsPerObservation: [() => [], (): number => OBSERVATION_CREDITS_BY_MODEL[DEFAULT_MODEL]],
+ freeAvailable: [
+ (s) => [s.freeCreditsLeft, s.creditsPerObservation],
+ (freeCreditsLeft: number | null, creditsPerObservation: number): boolean =>
+ starterSpendMode(freeCreditsLeft, creditsPerObservation) === 'free',
+ ],
+ spendMode: [
+ (s) => [s.freeAvailable, s.budgetChosen],
+ (freeAvailable: boolean, budgetChosen: boolean): StarterSpendMode =>
+ freeAvailable && !budgetChosen ? 'free' : 'budget',
+ ],
+ burstPlan: [
+ (s) => [s.candidateRecordings, s.creditsPerObservation, s.spendMode, s.freeCreditsLeft, s.budget],
+ (
+ candidateRecordings: CandidateRecording[],
+ creditsPerObservation: number,
+ spendMode: StarterSpendMode,
+ freeCreditsLeft: number | null,
+ budget: number
+ ): BurstPlan =>
+ planBurst(candidateRecordings, creditsPerObservation, spendMode, freeCreditsLeft, budget),
+ ],
+ })),
+
+ listeners(({ actions, values, props, cache }) => ({
+ startScanner: async () => {
+ const teamId = values.currentTeamId
+ if (!teamId) {
+ actions.startFailed('Could not create the scanner. Try again.')
+ return
+ }
+ const template = QUICKSTART_SCANNER
+ const query = { kind: NodeKind.RecordingsQuery }
+ let estimatedAtFullRate: number | null = null
+ try {
+ const estimate = await visionScannersEstimateCreate(String(teamId), {
+ query,
+ sampling_rate: 1,
+ model: DEFAULT_MODEL,
+ })
+ estimatedAtFullRate = estimate.estimated_observations_per_month
+ } catch {
+ estimatedAtFullRate = null
+ }
+ const samplingRate = samplingRateForTarget(estimatedAtFullRate, TARGET_MONTHLY_SCANS)
+ const free = values.spendMode === 'free'
+ const plan = values.burstPlan
+ let scanner: ReplayScannerApi
+ try {
+ scanner = await visionScannersCreate(
+ String(teamId),
+ scannerToApiBody({
+ name: template.name,
+ description: template.description,
+ scanner_type: template.scanner_type,
+ scanner_config: structuredClone(template.scanner_config),
+ model: DEFAULT_MODEL,
+ provider: DEFAULT_PROVIDER,
+ enabled: true,
+ sampling_rate: samplingRate,
+ sampling_mode: 'balanced',
+ query,
+ tags: [],
+ free_only: free,
+ credit_limit: free ? FREE_SCANNER_CREDIT_LIMIT : values.budget,
+ creation_method: 'template',
+ })
+ )
+ } catch {
+ posthog.capture('replay_vision_highlight_picks_starter_failed', {
+ template: template.key,
+ step: 'create',
+ })
+ actions.startFailed('Could not create the scanner. Try again.')
+ return
+ }
+ let started: string[] = []
+ if (plan.sessionIds.length > 0) {
+ try {
+ const response = await visionScannersBulkObserveCreate(String(teamId), scanner.id, {
+ session_ids: plan.sessionIds,
+ })
+ started = response.results
+ .filter(
+ (result) =>
+ result.scan_outcome === 'started' || result.scan_outcome === 'already_running'
+ )
+ .map((result) => result.session_id)
+ } catch {
+ started = []
+ }
+ }
+ posthog.capture('replay_vision_highlight_picks_starter_started', {
+ template: template.key,
+ scanner_id: scanner.id,
+ spend_mode: values.spendMode,
+ sampling_rate: samplingRate,
+ burst_planned: plan.sessionIds.length,
+ burst_started: started.length,
+ })
+ visionScannersListLogic.findMounted()?.actions.loadScanners()
+ visionQuotaLogic.findMounted()?.actions.loadQuota()
+ highlightPicksLogic.findMounted(props)?.actions.adoptPicksMode()
+ if (!free) {
+ const showUsd = visionQuotaLogic.findMounted()?.values.showUsd ?? false
+ lemonToast.success(
+ `${scanner.name} created with a ${formatCreditsMaybeUsd(values.budget, showUsd)} monthly limit.`,
+ {
+ button: {
+ label: 'Change limit',
+ action: () => router.actions.push(urls.replayVision(scanner.id)),
+ dataAttr: 'vision-highlight-picks-starter-change-limit',
+ },
+ }
+ )
+ }
+ actions.scannerStarted(scanner, started, teamId)
+ },
+ scannerStarted: ({ sessionIds }) => {
+ if (sessionIds.length > 0) {
+ actions.resumeBurst()
+ }
+ },
+ resumeBurst: () => {
+ let polls = 0
+ cache.lastProgress = values.burstCounts.succeeded + values.burstCounts.failed
+ cache.lastProgressAt = Date.now()
+ actions.pollBurst()
+ cache.disposables.add(() => {
+ const timer = window.setInterval(() => {
+ polls += 1
+ if (polls > BURST_POLL_MAX) {
+ actions.burstSettled(true)
+ return
+ }
+ actions.pollBurst()
+ }, BURST_POLL_MS)
+ return () => clearInterval(timer)
+ }, 'burst-poll')
+ },
+ pollBurst: async (_, breakpoint) => {
+ const teamId = values.currentTeamId
+ const scanner = values.startedScanner
+ if (!teamId || !scanner) {
+ return
+ }
+ const burst = new Set(values.burstSessionIds)
+ const response = await visionScannersObservationsList(String(teamId), scanner.id, {
+ limit: BURST_MAX_RECORDINGS,
+ order_by: '-created_at',
+ })
+ breakpoint()
+ const rows = response.results.filter((row) => burst.has(row.session_id))
+ const counts: BurstCounts = {
+ pending: rows.filter((row) => row.status === 'pending' || row.status === 'running').length,
+ succeeded: rows.filter((row) => row.status === 'succeeded').length,
+ failed: rows.filter((row) => row.status === 'failed' || row.status === 'ineligible').length,
+ }
+ actions.burstPolled(counts)
+ highlightPicksLogic.findMounted(props)?.actions.loadPicks()
+ const progress = counts.succeeded + counts.failed
+ if (progress !== cache.lastProgress) {
+ cache.lastProgress = progress
+ cache.lastProgressAt = Date.now()
+ }
+ if (counts.pending === 0 && rows.length >= burst.size) {
+ actions.burstSettled(false)
+ } else if (Date.now() - (cache.lastProgressAt ?? Date.now()) > BURST_STALL_MS) {
+ actions.burstSettled(true)
+ }
+ },
+ burstSettled: ({ stalled }) => {
+ cache.disposables.dispose('burst-poll')
+ const picksLogicMounted = highlightPicksLogic.findMounted(props)
+ if (
+ values.startedScanner &&
+ values.burstCounts.succeeded > 0 &&
+ picksLogicMounted &&
+ picksLogicMounted.values.effectiveListMode !== 'picks'
+ ) {
+ lemonToast.info(
+ `${values.startedScanner.name} finished scanning ${pluralize(values.burstCounts.succeeded, 'recording')}.`,
+ {
+ button: {
+ label: 'Show highlights',
+ action: () => picksLogicMounted.actions.setListMode('picks'),
+ dataAttr: 'vision-highlight-picks-starter-finished-toast',
+ },
+ }
+ )
+ }
+ posthog.capture('replay_vision_highlight_picks_starter_settled', {
+ scanner_id: values.startedScanner?.id,
+ stalled,
+ pending: values.burstCounts.pending,
+ succeeded: values.burstCounts.succeeded,
+ failed: values.burstCounts.failed,
+ picks_count: highlightPicksLogic.findMounted(props)?.values.picks?.length ?? 0,
+ })
+ },
+ showScannedAnyway: async (_, breakpoint) => {
+ const teamId = values.currentTeamId
+ const scanner = values.startedScanner
+ if (!teamId || !scanner) {
+ return
+ }
+ const response = await visionScannersObservationsList(String(teamId), scanner.id, {
+ limit: BURST_MAX_RECORDINGS,
+ order_by: '-created_at',
+ status: 'succeeded',
+ })
+ breakpoint()
+ actions.scannedAnywayLoaded(response.results)
+ },
+ reset: () => {
+ cache.disposables.dispose('burst-poll')
+ },
+ })),
+
+ afterMount(({ actions, values }) => {
+ if (!values.startedScanner) {
+ return
+ }
+ const stale =
+ values.burstDone ||
+ values.burstTeamId !== values.currentTeamId ||
+ Date.now() - values.burstStartedAt > BURST_RESUME_MAX_AGE_MS
+ if (stale) {
+ actions.reset()
+ return
+ }
+ actions.resumeBurst()
+ }),
+ ])
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksStarterLogic.ts b/products/replay_vision/frontend/replay_scanners/watchPicksStarterLogic.ts
deleted file mode 100644
index d6a1a039050c..000000000000
--- a/products/replay_vision/frontend/replay_scanners/watchPicksStarterLogic.ts
+++ /dev/null
@@ -1,527 +0,0 @@
-import {
- LogicWrapper,
- MakeLogicType,
- actions,
- afterMount,
- connect,
- kea,
- key,
- listeners,
- path,
- props,
- reducers,
- selectors,
-} from 'kea'
-import { router } from 'kea-router'
-
-import { lemonToast } from 'lib/lemon-ui/LemonToast'
-import posthog from 'lib/posthog-typed'
-import { pluralize } from 'lib/utils/strings'
-import {
- SessionRecordingPlaylistLogicProps,
- sessionRecordingsPlaylistLogic,
-} from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'
-import { teamLogic } from 'scenes/teamLogic'
-import { urls } from 'scenes/urls'
-
-import { NodeKind } from '~/queries/schema/schema-general'
-import type { SessionRecordingType } from '~/types'
-
-import {
- visionScannersBulkObserveCreate,
- visionScannersCreate,
- visionScannersEstimateCreate,
- visionScannersObservationsList,
-} from '../generated/api'
-import type { ReplayObservationApi, ReplayScannerApi } from '../generated/api.schemas'
-import { visionQuotaLogic } from '../logics/visionQuotaLogic'
-import { visionScannersListLogic } from '../logics/visionScannersListLogic'
-import { formatCreditsMaybeUsd } from '../utils/credits'
-import { DEFAULT_MODEL, DEFAULT_PROVIDER, OBSERVATION_CREDITS_BY_MODEL, scannerToApiBody } from './types'
-import { watchPicksLogic } from './watchPicksLogic'
-import {
- BURST_MAX_RECORDINGS,
- BUDGET_PRESETS,
- BurstPlan,
- FREE_SCANNER_CREDIT_LIMIT,
- QUICKSTART_SCANNER,
- StarterSpendMode,
- TARGET_MONTHLY_SCANS,
- planBurst,
- samplingRateForTarget,
- starterSpendMode,
-} from './watchPicksStarter'
-
-const BURST_POLL_MS = 10_000
-const BURST_POLL_MAX = 60
-const BURST_STALL_MS = 3 * 60_000
-const BURST_RESUME_MAX_AGE_MS = 30 * 60_000
-
-export interface BurstCounts {
- pending: number
- succeeded: number
- failed: number
-}
-
-export interface WatchPicksStarterLogicProps {
- logicKey: string
- playlistLogicProps?: SessionRecordingPlaylistLogicProps
-}
-
-type CandidateRecording = Pick<SessionRecordingType, 'id' | 'recording_duration' | 'active_seconds' | 'ongoing'>
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchPicksStarterLogicValues {
- currentTeamId: number | null // teamLogic
- freeCreditsLeft: number | null // visionQuotaLogic
- budget: number
- budgetChosen: boolean
- burstCounts: BurstCounts
- burstDone: boolean
- burstPlan: BurstPlan
- burstSessionIds: string[]
- burstStalled: boolean
- burstStartedAt: number
- burstTeamId: number | null
- candidateRecordings: CandidateRecording[]
- creditsPerObservation: number
- freeAvailable: boolean
- scannedAnyway: ReplayObservationApi[] | null
- spendMode: StarterSpendMode
- startError: string | null
- startedScanner: ReplayScannerApi | null
- starting: boolean
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchPicksStarterLogicActions {
- burstPolled: (counts: BurstCounts) => {
- counts: BurstCounts
- }
- burstSettled: (stalled?: boolean) => {
- stalled: boolean
- }
- chooseBudget: (budgetChosen: boolean) => {
- budgetChosen: boolean
- }
- pollBurst: () => {
- value: true
- }
- reset: () => {
- value: true
- }
- resumeBurst: () => {
- value: true
- }
- scannedAnywayLoaded: (observations: ReplayObservationApi[]) => {
- observations: ReplayObservationApi[]
- }
- scannerStarted: (
- scanner: ReplayScannerApi,
- sessionIds: string[],
- teamId: number
- ) => {
- scanner: ReplayScannerApi
- sessionIds: string[]
- teamId: number
- }
- setBudget: (budget: number) => {
- budget: number
- }
- showScannedAnyway: () => {
- value: true
- }
- startFailed: (message: string) => {
- message: string
- }
- startScanner: () => {
- value: true
- }
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface watchPicksStarterLogicMeta {
- key: string
- __keaTypeGenInternalSelectorTypes: {
- candidateRecordings: (arg: SessionRecordingType[]) => CandidateRecording[]
- freeAvailable: (freeCreditsLeft: number | null, creditsPerObservation: number) => boolean
- spendMode: (freeAvailable: boolean, budgetChosen: boolean) => StarterSpendMode
- burstPlan: (
- candidateRecordings: CandidateRecording[],
- creditsPerObservation: number,
- spendMode: StarterSpendMode,
- freeCreditsLeft: number | null,
- budget: number
- ) => BurstPlan
- }
-}
-
-export type watchPicksStarterLogicType = MakeLogicType<
- watchPicksStarterLogicValues,
- watchPicksStarterLogicActions,
- WatchPicksStarterLogicProps,
- watchPicksStarterLogicMeta
->
-
-export const watchPicksStarterLogic: LogicWrapper<watchPicksStarterLogicType> = kea<watchPicksStarterLogicType>([
- props({} as WatchPicksStarterLogicProps),
- key((props) => props.logicKey),
- path((key) => ['products', 'replay_vision', 'frontend', 'replay_scanners', 'watchPicksStarterLogic', key]),
-
- connect(() => ({
- values: [teamLogic, ['currentTeamId'], visionQuotaLogic, ['freeCreditsLeft']],
- })),
-
- actions({
- setBudget: (budget: number) => ({ budget }),
- chooseBudget: (budgetChosen: boolean) => ({ budgetChosen }),
- startScanner: true,
- scannerStarted: (scanner: ReplayScannerApi, sessionIds: string[], teamId: number) => ({
- scanner,
- sessionIds,
- teamId,
- }),
- startFailed: (message: string) => ({ message }),
- pollBurst: true,
- burstPolled: (counts: BurstCounts) => ({ counts }),
- burstSettled: (stalled: boolean = false) => ({ stalled }),
- resumeBurst: true,
- showScannedAnyway: true,
- scannedAnywayLoaded: (observations: ReplayObservationApi[]) => ({ observations }),
- reset: true,
- }),
-
- reducers({
- budget: [
- BUDGET_PRESETS[1] as number,
- {
- setBudget: (_, { budget }) => budget,
- },
- ],
- budgetChosen: [
- false,
- {
- chooseBudget: (_, { budgetChosen }) => budgetChosen,
- reset: () => false,
- },
- ],
- starting: [
- false,
- {
- startScanner: () => true,
- scannerStarted: () => false,
- startFailed: () => false,
- },
- ],
- startError: [
- null as string | null,
- {
- startScanner: () => null,
- startFailed: (_, { message }) => message,
- reset: () => null,
- },
- ],
- startedScanner: [
- null as ReplayScannerApi | null,
- { persist: true, storageKey: 'replay-vision.watch-picks-starter.startedScanner' },
- {
- scannerStarted: (_, { scanner }) => scanner,
- reset: () => null,
- },
- ],
- burstSessionIds: [
- [] as string[],
- { persist: true, storageKey: 'replay-vision.watch-picks-starter.burstSessionIds' },
- {
- scannerStarted: (_, { sessionIds }) => sessionIds,
- reset: () => [],
- },
- ],
- burstCounts: [
- { pending: 0, succeeded: 0, failed: 0 } as BurstCounts,
- {
- scannerStarted: (_, { sessionIds }) => ({ pending: sessionIds.length, succeeded: 0, failed: 0 }),
- burstPolled: (_, { counts }) => counts,
- reset: () => ({ pending: 0, succeeded: 0, failed: 0 }),
- },
- ],
- burstDone: [
- false,
- { persist: true, storageKey: 'replay-vision.watch-picks-starter.burstDone' },
- {
- scannerStarted: (_, { sessionIds }) => sessionIds.length === 0,
- burstSettled: () => true,
- reset: () => false,
- },
- ],
- burstStartedAt: [
- 0,
- { persist: true, storageKey: 'replay-vision.watch-picks-starter.burstStartedAt' },
- {
- scannerStarted: () => Date.now(),
- reset: () => 0,
- },
- ],
- burstTeamId: [
- null as number | null,
- { persist: true, storageKey: 'replay-vision.watch-picks-starter.burstTeamId' },
- {
- scannerStarted: (_, { teamId }) => teamId,
- reset: () => null,
- },
- ],
- burstStalled: [
- false,
- {
- scannerStarted: () => false,
- burstSettled: (_, { stalled }) => stalled,
- reset: () => false,
- },
- ],
- scannedAnyway: [
- null as ReplayObservationApi[] | null,
- {
- scannedAnywayLoaded: (_, { observations }) => observations,
- reset: () => null,
- },
- ],
- }),
-
- selectors(({ props }) => ({
- candidateRecordings: [
- () => [
- props.playlistLogicProps
- ? sessionRecordingsPlaylistLogic(props.playlistLogicProps).selectors.sessionRecordings
- : () => [],
- ],
- (recordings: SessionRecordingType[]): CandidateRecording[] => recordings,
- ],
- creditsPerObservation: [() => [], (): number => OBSERVATION_CREDITS_BY_MODEL[DEFAULT_MODEL]],
- freeAvailable: [
- (s) => [s.freeCreditsLeft, s.creditsPerObservation],
- (freeCreditsLeft: number | null, creditsPerObservation: number): boolean =>
- starterSpendMode(freeCreditsLeft, creditsPerObservation) === 'free',
- ],
- spendMode: [
- (s) => [s.freeAvailable, s.budgetChosen],
- (freeAvailable: boolean, budgetChosen: boolean): StarterSpendMode =>
- freeAvailable && !budgetChosen ? 'free' : 'budget',
- ],
- burstPlan: [
- (s) => [s.candidateRecordings, s.creditsPerObservation, s.spendMode, s.freeCreditsLeft, s.budget],
- (
- candidateRecordings: CandidateRecording[],
- creditsPerObservation: number,
- spendMode: StarterSpendMode,
- freeCreditsLeft: number | null,
- budget: number
- ): BurstPlan => planBurst(candidateRecordings, creditsPerObservation, spendMode, freeCreditsLeft, budget),
- ],
- })),
-
- listeners(({ actions, values, props, cache }) => ({
- startScanner: async () => {
- const teamId = values.currentTeamId
- if (!teamId) {
- actions.startFailed('Could not create the scanner. Try again.')
- return
- }
- const template = QUICKSTART_SCANNER
- const query = { kind: NodeKind.RecordingsQuery }
- let estimatedAtFullRate: number | null = null
- try {
- const estimate = await visionScannersEstimateCreate(String(teamId), {
- query,
- sampling_rate: 1,
- model: DEFAULT_MODEL,
- })
- estimatedAtFullRate = estimate.estimated_observations_per_month
- } catch {
- estimatedAtFullRate = null
- }
- const samplingRate = samplingRateForTarget(estimatedAtFullRate, TARGET_MONTHLY_SCANS)
- const free = values.spendMode === 'free'
- const plan = values.burstPlan
- let scanner: ReplayScannerApi
- try {
- scanner = await visionScannersCreate(
- String(teamId),
- scannerToApiBody({
- name: template.name,
- description: template.description,
- scanner_type: template.scanner_type,
- scanner_config: structuredClone(template.scanner_config),
- model: DEFAULT_MODEL,
- provider: DEFAULT_PROVIDER,
- enabled: true,
- sampling_rate: samplingRate,
- sampling_mode: 'balanced',
- query,
- tags: [],
- free_only: free,
- credit_limit: free ? FREE_SCANNER_CREDIT_LIMIT : values.budget,
- creation_method: 'template',
- })
- )
- } catch {
- posthog.capture('replay_vision_watch_picks_starter_failed', { template: template.key, step: 'create' })
- actions.startFailed('Could not create the scanner. Try again.')
- return
- }
- let started: string[] = []
- if (plan.sessionIds.length > 0) {
- try {
- const response = await visionScannersBulkObserveCreate(String(teamId), scanner.id, {
- session_ids: plan.sessionIds,
- })
- started = response.results
- .filter(
- (result) => result.scan_outcome === 'started' || result.scan_outcome === 'already_running'
- )
- .map((result) => result.session_id)
- } catch {
- started = []
- }
- }
- posthog.capture('replay_vision_watch_picks_starter_started', {
- template: template.key,
- scanner_id: scanner.id,
- spend_mode: values.spendMode,
- sampling_rate: samplingRate,
- burst_planned: plan.sessionIds.length,
- burst_started: started.length,
- })
- visionScannersListLogic.findMounted()?.actions.loadScanners()
- visionQuotaLogic.findMounted()?.actions.loadQuota()
- watchPicksLogic.findMounted(props)?.actions.adoptPicksMode()
- if (!free) {
- const showUsd = visionQuotaLogic.findMounted()?.values.showUsd ?? false
- lemonToast.success(
- `${scanner.name} created with a ${formatCreditsMaybeUsd(values.budget, showUsd)} monthly limit.`,
- {
- button: {
- label: 'Change limit',
- action: () => router.actions.push(urls.replayVision(scanner.id)),
- dataAttr: 'vision-watch-picks-starter-change-limit',
- },
- }
- )
- }
- actions.scannerStarted(scanner, started, teamId)
- },
- scannerStarted: ({ sessionIds }) => {
- if (sessionIds.length > 0) {
- actions.resumeBurst()
- }
- },
- resumeBurst: () => {
- let polls = 0
- cache.lastProgress = values.burstCounts.succeeded + values.burstCounts.failed
- cache.lastProgressAt = Date.now()
- actions.pollBurst()
- cache.disposables.add(() => {
- const timer = window.setInterval(() => {
- polls += 1
- if (polls > BURST_POLL_MAX) {
- actions.burstSettled(true)
- return
- }
- actions.pollBurst()
- }, BURST_POLL_MS)
- return () => clearInterval(timer)
- }, 'burst-poll')
- },
- pollBurst: async (_, breakpoint) => {
- const teamId = values.currentTeamId
- const scanner = values.startedScanner
- if (!teamId || !scanner) {
- return
- }
- const burst = new Set(values.burstSessionIds)
- const response = await visionScannersObservationsList(String(teamId), scanner.id, {
- limit: BURST_MAX_RECORDINGS,
- order_by: '-created_at',
- })
- breakpoint()
- const rows = response.results.filter((row) => burst.has(row.session_id))
- const counts: BurstCounts = {
- pending: rows.filter((row) => row.status === 'pending' || row.status === 'running').length,
- succeeded: rows.filter((row) => row.status === 'succeeded').length,
- failed: rows.filter((row) => row.status === 'failed' || row.status === 'ineligible').length,
- }
- actions.burstPolled(counts)
- watchPicksLogic.findMounted(props)?.actions.loadPicks()
- const progress = counts.succeeded + counts.failed
- if (progress !== cache.lastProgress) {
- cache.lastProgress = progress
- cache.lastProgressAt = Date.now()
- }
- if (counts.pending === 0 && rows.length >= burst.size) {
- actions.burstSettled(false)
- } else if (Date.now() - (cache.lastProgressAt ?? Date.now()) > BURST_STALL_MS) {
- actions.burstSettled(true)
- }
- },
- burstSettled: ({ stalled }) => {
- cache.disposables.dispose('burst-poll')
- const picksLogicMounted = watchPicksLogic.findMounted(props)
- if (
- values.startedScanner &&
- values.burstCounts.succeeded > 0 &&
- picksLogicMounted &&
- picksLogicMounted.values.effectiveListMode !== 'picks'
- ) {
- lemonToast.info(
- `${values.startedScanner.name} finished scanning ${pluralize(values.burstCounts.succeeded, 'recording')}.`,
- {
- button: {
- label: 'Show what to watch',
- action: () => picksLogicMounted.actions.setListMode('picks'),
- dataAttr: 'vision-watch-picks-starter-finished-toast',
- },
- }
- )
- }
- posthog.capture('replay_vision_watch_picks_starter_settled', {
- scanner_id: values.startedScanner?.id,
- stalled,
- pending: values.burstCounts.pending,
- succeeded: values.burstCounts.succeeded,
- failed: values.burstCounts.failed,
- picks_count: watchPicksLogic.findMounted(props)?.values.picks?.length ?? 0,
- })
- },
- showScannedAnyway: async (_, breakpoint) => {
- const teamId = values.currentTeamId
- const scanner = values.startedScanner
- if (!teamId || !scanner) {
- return
- }
- const response = await visionScannersObservationsList(String(teamId), scanner.id, {
- limit: BURST_MAX_RECORDINGS,
- order_by: '-created_at',
- status: 'succeeded',
- })
- breakpoint()
- actions.scannedAnywayLoaded(response.results)
- },
- reset: () => {
- cache.disposables.dispose('burst-poll')
- },
- })),
-
- afterMount(({ actions, values }) => {
- if (!values.startedScanner) {
- return
- }
- const stale =
- values.burstDone ||
- values.burstTeamId !== values.currentTeamId ||
- Date.now() - values.burstStartedAt > BURST_RESUME_MAX_AGE_MS
- if (stale) {
- actions.reset()
- return
- }
- actions.resumeBurst()
- }),
-])
diff --git a/products/replay_vision/frontend/utils/breadcrumbs.ts b/products/replay_vision/frontend/utils/breadcrumbs.ts
index e141b4fa7d67..5cb13a8af5c9 100644
--- a/products/replay_vision/frontend/utils/breadcrumbs.ts
+++ b/products/replay_vision/frontend/utils/breadcrumbs.ts
@@ -15,12 +15,14 @@ export const VISION_ROOT_BREADCRUMB: Breadcrumb = {
}
/**
- * The home view an observation was opened from, carried in its URL's `from` param. The watch feed
+ * The home view an observation was opened from, carried in its URL's `from` param. The highlight feed
* lives on the home scene, not the scanner that owns a row, so back needs this to return to the feed
* rather than the scanner. Absent for observations opened from a scanner's own list.
*/
export const OBSERVATION_ORIGIN_PARAM = 'from'
-export const WATCH_FEED_ORIGIN = 'watch'
+/** The home tab that shows the highlight feed, also the `from` value of an observation opened from it. */
+export const HIGHLIGHTS_TAB = 'highlights'
+export const HIGHLIGHT_FEED_ORIGIN = HIGHLIGHTS_TAB
export const RECORDING_ORIGIN = 'recording'
export const POSTHOG_AI_ORIGIN = 'ai'
/** The in-app page the reader left, such as a playlist or the scene a PostHog AI side panel was open over. */
@@ -28,7 +30,7 @@ export const OBSERVATION_RETURN_PATH_PARAM = 'return_to'
export type ReturnOrigin = typeof RECORDING_ORIGIN | typeof POSTHOG_AI_ORIGIN
-const OBSERVATION_ORIGINS: readonly string[] = [WATCH_FEED_ORIGIN, RECORDING_ORIGIN, POSTHOG_AI_ORIGIN]
+const OBSERVATION_ORIGINS: readonly string[] = [HIGHLIGHT_FEED_ORIGIN, RECORDING_ORIGIN, POSTHOG_AI_ORIGIN]
export function isObservationOrigin(value: unknown): value is string {
return typeof value === 'string' && OBSERVATION_ORIGINS.includes(value)
@@ -52,12 +54,12 @@ export function observationFromOriginUrl(observationId: string, origin: ReturnOr
}).url
}
-/** The crumb the back button returns to for an observation opened from the "What to watch" feed. */
-export function watchFeedBreadcrumb(): Breadcrumb {
+/** The crumb the back button returns to for an observation opened from the Highlights feed. */
+export function highlightFeedBreadcrumb(): Breadcrumb {
return {
key: 'replay-vision-watch',
- name: 'What to watch',
- path: combineUrl(urls.replayVision(), { tab: WATCH_FEED_ORIGIN }).url,
+ name: 'Highlights',
+ path: combineUrl(urls.replayVision(), { tab: HIGHLIGHTS_TAB }).url,
}
}
diff --git a/products/replay_vision/mcp/tools.yaml b/products/replay_vision/mcp/tools.yaml
index badfd2e27111..32be8a207ca9 100644
--- a/products/replay_vision/mcp/tools.yaml
+++ b/products/replay_vision/mcp/tools.yaml
@@ -690,6 +690,31 @@ tools:
`enabled`, `sampling_rate`, `provider`, `model`, `emits_signals`, `scanner_version`, and `last_swept_at`.
`dashboard_id` links the scanner's dashboard when one exists, and `dashboard_suggested` says whether to
offer the user one with `vision-scanners-dashboard-create`.
+ vision-scanners-highlight-feed:
+ operation: vision_scanners_highlight_feed_retrieve
+ enabled: true
+ scopes:
+ - replay_scanner:read
+ - session_recording:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: Get ranked recordings to watch
+ description: >
+ Rank succeeded replay vision observations in a window by how worth watching their recordings are, across
+ every scanner you can read. Each item pairs the `observation` (with its `session_id`) and the `reason` it
+ made the feed. `date_from` defaults to `-7d` (ISO 8601 or relative); the window spans at most 90 days.
+ Narrow with `scanner_ids`, `scanner_type`, or scanner `tags`. `limit` is at most 50. Use it to answer "which
+ recordings should I watch this week?".
+ agent_note: |
+ Point the person at one or two recordings with a one-line reason each, rather than listing the whole feed.
+ response:
+ exclude:
+ - results.*.observation.scanner_snapshot
+ - results.*.observation.workflow_id
+ - results.*.observation.triggered_by_user
+ strip_nulls: true
vision-scanners-impact-get:
operation: vision_scanners_impact_retrieve
enabled: true
@@ -1020,28 +1045,3 @@ tools:
`analysis_observations`, not of `observations`. Balanced sampling gives small variants a higher
`sampling_rate`, so even observation counts do not mean even traffic. To read one variant's summaries, call
`vision-scanners-observations-list` with `variant` set to its key.
- vision-scanners-watch-feed:
- operation: vision_scanners_watch_feed_retrieve
- enabled: true
- scopes:
- - replay_scanner:read
- - session_recording:read
- annotations:
- readOnly: true
- destructive: false
- idempotent: true
- title: Get ranked recordings to watch
- description: >
- Rank succeeded replay vision observations in a window by how worth watching their recordings are, across
- every scanner you can read. Each item pairs the `observation` (with its `session_id`) and the `reason` it
- made the feed. `date_from` defaults to `-7d` (ISO 8601 or relative); the window spans at most 90 days.
- Narrow with `scanner_ids`, `scanner_type`, or scanner `tags`. `limit` is at most 50. Use it to answer "which
- recordings should I watch this week?".
- agent_note: |
- Point the person at one or two recordings with a one-line reason each, rather than listing the whole feed.
- response:
- exclude:
- - results.*.observation.scanner_snapshot
- - results.*.observation.workflow_id
- - results.*.observation.triggered_by_user
- strip_nulls: true
diff --git a/products/replay_vision/skills/exploring-replay-vision-observations/SKILL.md b/products/replay_vision/skills/exploring-replay-vision-observations/SKILL.md
index 163dc7d23a60..8af3fa023d96 100644
--- a/products/replay_vision/skills/exploring-replay-vision-observations/SKILL.md
+++ b/products/replay_vision/skills/exploring-replay-vision-observations/SKILL.md
@@ -60,7 +60,7 @@ Pick the axis that matches the question:
- **The distribution, not the rows?** → `vision-scanners-observations-stats` gives one scanner's status mix
and success rate, distinct sessions covered, rating totals, and the per-type distributions (monitor verdict
counts, classifier tag rankings, scorer score summary and histogram) without paging through observations.
-- **Which recordings are worth watching?** → `vision-scanners-watch-feed` ranks succeeded observations across
+- **Which recordings are worth watching?** → `vision-scanners-highlight-feed` ranks succeeded observations across
every readable scanner over a window (default the last 7 days) and says why each made the cut.
- **Has something already summarized this?** → if the scanner has scouts attached, read their reports instead
of re-deriving the pattern (`vision-scanners-scout-reports-list`, then `vision-scanners-scout-reports-get`).
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index a141231d3e66..d16f981ac305 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -15730,6 +15730,21 @@
"readOnlyHint": true
}
},
+ "vision-scanners-highlight-feed": {
+ "description": "Rank succeeded replay vision observations in a window by how worth watching their recordings are, across every scanner you can read. Each item pairs the `observation` (with its `session_id`) and the `reason` it made the feed. `date_from` defaults to `-7d` (ISO 8601 or relative); the window spans at most 90 days. Narrow with `scanner_ids`, `scanner_type`, or scanner `tags`. `limit` is at most 50. Use it to answer \"which recordings should I watch this week?\".",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "Get ranked recordings to watch",
+ "title": "Get ranked recordings to watch",
+ "required_scopes": ["replay_scanner:read", "session_recording:read"],
+ "api_operations": ["GET /api/projects/{project_id}/vision/scanners/highlight_feed/"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
"vision-scanners-impact-get": {
"description": "Affected sessions and users for a scanner over a trailing window, counted from its observations. Monitors count verdict-yes observations and take no qualifiers; classifiers require `tag`; scorers require `min_score` and/or `max_score`. `sessions_without_user` reports affected sessions that carried no distinct ID, so the user count reads honestly against the session count.",
"category": "Replay vision",
@@ -15945,21 +15960,6 @@
"readOnlyHint": true
}
},
- "vision-scanners-watch-feed": {
- "description": "Rank succeeded replay vision observations in a window by how worth watching their recordings are, across every scanner you can read. Each item pairs the `observation` (with its `session_id`) and the `reason` it made the feed. `date_from` defaults to `-7d` (ISO 8601 or relative); the window spans at most 90 days. Narrow with `scanner_ids`, `scanner_type`, or scanner `tags`. `limit` is at most 50. Use it to answer \"which recordings should I watch this week?\".",
- "category": "Replay vision",
- "feature": "replay_vision",
- "summary": "Get ranked recordings to watch",
- "title": "Get ranked recordings to watch",
- "required_scopes": ["replay_scanner:read", "session_recording:read"],
- "api_operations": ["GET /api/projects/{project_id}/vision/scanners/watch_feed/"],
- "annotations": {
- "destructiveHint": false,
- "idempotentHint": true,
- "openWorldHint": true,
- "readOnlyHint": true
- }
- },
"visual-review-repos-flakiness-retrieve": {
"description": "Snapshots in a repo whose rendering is untrusted: a gate failure on a recent default-branch run, an absorbed diff close to the threshold, or an active quarantine. A snapshot that is not listed may still render small absorbed differences from its baseline; those stay under the diff thresholds and block nobody. Start here to decide what to quarantine or lift. Each entry has `flakiness_state`, `hard_rate` (share of recent default-branch runs that failed the gate), `soft_rate` (share a toleration absorbed), `window_runs`, `headroom` and `needs_decision`. `totals.tracked` counts every baselined snapshot, the state counts cover the reportable rows, and `listed` stops at the cap. Takes no filters: filter the entries yourself, and pass `fields` to trim the response.",
"category": "Visual review",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 6a7d4f59f7bb..b18862a4420b 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -16506,6 +16506,21 @@
"readOnlyHint": true
}
},
+ "vision-scanners-highlight-feed": {
+ "description": "Rank succeeded replay vision observations in a window by how worth watching their recordings are, across every scanner you can read. Each item pairs the `observation` (with its `session_id`) and the `reason` it made the feed. `date_from` defaults to `-7d` (ISO 8601 or relative); the window spans at most 90 days. Narrow with `scanner_ids`, `scanner_type`, or scanner `tags`. `limit` is at most 50. Use it to answer \"which recordings should I watch this week?\".",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "Get ranked recordings to watch",
+ "title": "Get ranked recordings to watch",
+ "required_scopes": ["replay_scanner:read", "session_recording:read"],
+ "api_operations": ["GET /api/projects/{project_id}/vision/scanners/highlight_feed/"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
"vision-scanners-impact-get": {
"description": "Affected sessions and users for a scanner over a trailing window, counted from its observations. Monitors count verdict-yes observations and take no qualifiers; classifiers require `tag`; scorers require `min_score` and/or `max_score`. `sessions_without_user` reports affected sessions that carried no distinct ID, so the user count reads honestly against the session count.",
"category": "Replay vision",
@@ -16721,21 +16736,6 @@
"readOnlyHint": true
}
},
- "vision-scanners-watch-feed": {
- "description": "Rank succeeded replay vision observations in a window by how worth watching their recordings are, across every scanner you can read. Each item pairs the `observation` (with its `session_id`) and the `reason` it made the feed. `date_from` defaults to `-7d` (ISO 8601 or relative); the window spans at most 90 days. Narrow with `scanner_ids`, `scanner_type`, or scanner `tags`. `limit` is at most 50. Use it to answer \"which recordings should I watch this week?\".",
- "category": "Replay vision",
- "feature": "replay_vision",
- "summary": "Get ranked recordings to watch",
- "title": "Get ranked recordings to watch",
- "required_scopes": ["replay_scanner:read", "session_recording:read"],
- "api_operations": ["GET /api/projects/{project_id}/vision/scanners/watch_feed/"],
- "annotations": {
- "destructiveHint": false,
- "idempotentHint": true,
- "openWorldHint": true,
- "readOnlyHint": true
- }
- },
"visual-review-repos-flakiness-retrieve": {
"description": "Snapshots in a repo whose rendering is untrusted: a gate failure on a recent default-branch run, an absorbed diff close to the threshold, or an active quarantine. A snapshot that is not listed may still render small absorbed differences from its baseline; those stay under the diff thresholds and block nobody. Start here to decide what to quarantine or lift. Each entry has `flakiness_state`, `hard_rate` (share of recent default-branch runs that failed the gate), `soft_rate` (share a toleration absorbed), `window_runs`, `headroom` and `needs_decision`. `totals.tracked` counts every baselined snapshot, the state counts cover the reportable rows, and `listed` stops at the cap. Takes no filters: filter the entries yourself, and pass `fields` to trim the response.",
"category": "Visual review",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 7cec11fead22..5405e014d276 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -58720,6 +58720,98 @@ export namespace Schemas {
AnyUser: 'any-user',
} as const;
+ /**
+ * * `failure` - Failure
+ * * `struggle` - Struggle
+ * * `revenue` - Revenue
+ */
+ export type HighlightFeedCategoryEnum = typeof HighlightFeedCategoryEnum[keyof typeof HighlightFeedCategoryEnum];
+
+
+ export const HighlightFeedCategoryEnum = {
+ Failure: 'failure',
+ Struggle: 'struggle',
+ Revenue: 'revenue',
+ } as const;
+
+ /**
+ * Body of POST /vision/scanners/highlight_feed_impressions/.
+ */
+ export interface HighlightFeedImpressions {
+ /** The client's id for the feed load that showed these cards. One load counts each card once. */
+ feed_load_id: string;
+ /**
+ * Observations the calling user saw in the Highlights feed, at most 100. Ids the user cannot read are ignored.
+ * @minItems 1
+ * @maxItems 100
+ */
+ observation_ids: string[];
+ }
+
+ /**
+ * * `embedding_pick` - Embedding Pick
+ * * `unviewed_recent` - Unviewed Recent
+ * * `recent` - Recent
+ */
+ export type HighlightFeedReasonEnum = typeof HighlightFeedReasonEnum[keyof typeof HighlightFeedReasonEnum];
+
+
+ export const HighlightFeedReasonEnum = {
+ EmbeddingPick: 'embedding_pick',
+ UnviewedRecent: 'unviewed_recent',
+ Recent: 'recent',
+ } as const;
+
+ /**
+ * Machine-readable reason an observation made the feed; the frontend renders the copy.
+ */
+ export interface HighlightFeedReason {
+ /** Why the observation is in the feed: `embedding_pick` (the session reads like a failure, struggle, or revenue moment and ranks in its scanner's top fifth), `unviewed_recent` (new to you), `recent` (nothing special, newest available).
+ *
+ * * `embedding_pick` - Embedding Pick
+ * * `unviewed_recent` - Unviewed Recent
+ * * `recent` - Recent */
+ kind: HighlightFeedReasonEnum;
+ /** What the session reads like, for `embedding_pick`.
+ *
+ * * `failure` - Failure
+ * * `struggle` - Struggle
+ * * `revenue` - Revenue */
+ watch_category?: HighlightFeedCategoryEnum;
+ /**
+ * Other sessions from the same scanner in the window that describe nearly the same thing, for `embedding_pick`. The feed shows one session per group.
+ * @nullable
+ */
+ similar_count?: number | null;
+ /**
+ * Distinct people across the session's feed group in the window, for `embedding_pick`. A finding that reached more people ranks higher.
+ * @nullable
+ */
+ affected_people?: number | null;
+ }
+
+ /**
+ * One feed entry: the observation plus why it ranked.
+ */
+ export interface HighlightFeedItem {
+ /** The observation, in the standard shape. */
+ observation: ReplayObservation;
+ /** Why this observation made the feed. */
+ reason: HighlightFeedReason;
+ }
+
+ /**
+ * Response of GET /vision/scanners/highlight_feed/.
+ */
+ export interface HighlightFeedResponse {
+ /** Succeeded observations in the window worth watching, most interesting first, each carrying the reason it ranked. Every observation that carries a finding is returned; observations that carry none (`unviewed_recent`, `recent`) are returned only to pad a near-empty feed to three items, so a quiet window answers with a handful of rows rather than a full page of newest clips. */
+ results: HighlightFeedItem[];
+ /** Whether a later page holds more ranked items. Request it with `offset` set past this page. */
+ has_more: boolean;
+ /** The time this feed ranks as of. Send it back with later pages. */
+ as_of: string;
+ }
+
/**
* * `risk` - Risk
* * `opportunity` - Opportunity
@@ -123031,98 +123123,6 @@ export namespace Schemas {
run_id: string;
}
- /**
- * * `failure` - Failure
- * * `struggle` - Struggle
- * * `revenue` - Revenue
- */
- export type WatchFeedCategoryEnum = typeof WatchFeedCategoryEnum[keyof typeof WatchFeedCategoryEnum];
-
-
- export const WatchFeedCategoryEnum = {
- Failure: 'failure',
- Struggle: 'struggle',
- Revenue: 'revenue',
- } as const;
-
- /**
- * Body of POST /vision/scanners/watch_feed_impressions/.
- */
- export interface WatchFeedImpressions {
- /** The client's id for the feed load that showed these cards. One load counts each card once. */
- feed_load_id: string;
- /**
- * Observations the calling user saw in the Highlights feed, at most 100. Ids the user cannot read are ignored.
- * @minItems 1
- * @maxItems 100
- */
- observation_ids: string[];
- }
-
- /**
- * * `embedding_pick` - Embedding Pick
- * * `unviewed_recent` - Unviewed Recent
- * * `recent` - Recent
- */
- export type WatchFeedReasonEnum = typeof WatchFeedReasonEnum[keyof typeof WatchFeedReasonEnum];
-
-
- export const WatchFeedReasonEnum = {
- EmbeddingPick: 'embedding_pick',
- UnviewedRecent: 'unviewed_recent',
- Recent: 'recent',
- } as const;
-
- /**
- * Machine-readable reason an observation made the feed; the frontend renders the copy.
- */
- export interface WatchFeedReason {
- /** Why the observation is in the feed: `embedding_pick` (the session reads like a failure, struggle, or revenue moment and ranks in its scanner's top fifth), `unviewed_recent` (new to you), `recent` (nothing special, newest available).
- *
- * * `embedding_pick` - Embedding Pick
- * * `unviewed_recent` - Unviewed Recent
- * * `recent` - Recent */
- kind: WatchFeedReasonEnum;
- /** What the session reads like, for `embedding_pick`.
- *
- * * `failure` - Failure
- * * `struggle` - Struggle
- * * `revenue` - Revenue */
- watch_category?: WatchFeedCategoryEnum;
- /**
- * Other sessions from the same scanner in the window that describe nearly the same thing, for `embedding_pick`. The feed shows one session per group.
- * @nullable
- */
- similar_count?: number | null;
- /**
- * Distinct people across the session's feed group in the window, for `embedding_pick`. A finding that reached more people ranks higher.
- * @nullable
- */
- affected_people?: number | null;
- }
-
- /**
- * One feed entry: the observation plus why it ranked.
- */
- export interface WatchFeedItem {
- /** The observation, in the standard shape. */
- observation: ReplayObservation;
- /** Why this observation made the feed. */
- reason: WatchFeedReason;
- }
-
- /**
- * Response of GET /vision/scanners/watch_feed/.
- */
- export interface WatchFeedResponse {
- /** Succeeded observations in the window worth watching, most interesting first, each carrying the reason it ranked. Every observation that carries a finding is returned; observations that carry none (`unviewed_recent`, `recent`) are returned only to pad a near-empty feed to three items, so a quiet window answers with a handful of rows rather than a full page of newest clips. */
- results: WatchFeedItem[];
- /** Whether a later page holds more ranked items. Request it with `offset` set past this page. */
- has_more: boolean;
- /** The time this feed ranks as of. Send it back with later pages. */
- as_of: string;
- }
-
export interface WebAnalyticsBotCondition {
/**
* Stable id for the condition. Generated when omitted.
@@ -142431,7 +142431,7 @@ export namespace Schemas {
*/
verdict?: string;
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string;
};
@@ -142677,7 +142677,7 @@ export namespace Schemas {
*/
verdict?: string;
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string;
};
@@ -142740,7 +142740,7 @@ export namespace Schemas {
*/
verdict?: string;
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string;
};
@@ -142803,7 +142803,7 @@ export namespace Schemas {
*/
verdict?: string;
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string;
};
@@ -142890,12 +142890,12 @@ export namespace Schemas {
*/
verdict?: string;
/**
- * Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
+ * Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.
*/
watch_group?: string;
};
- export type VisionScannersWatchFeedRetrieveParams = {
+ export type VisionScannersHighlightFeedRetrieveParams = {
/**
* The time the first page loaded. Later pages rank as of that time: observations, views, dismissals and impressions after it are ignored, so pages do not shift under a reader who scrolls.
*/
@@ -142942,7 +142942,7 @@ export namespace Schemas {
* * `experiment` - Experiment
* @minLength 1
*/
- scanner_type?: VisionScannersWatchFeedRetrieveScannerType;
+ scanner_type?: VisionScannersHighlightFeedRetrieveScannerType;
/**
* Comma-separated scanner tags to restrict the feed to. A team with many scanners uses these to follow one area without naming every scanner in it.
* @minLength 1
@@ -142950,10 +142950,10 @@ export namespace Schemas {
tags?: string;
};
- export type VisionScannersWatchFeedRetrieveScannerType = typeof VisionScannersWatchFeedRetrieveScannerType[keyof typeof VisionScannersWatchFeedRetrieveScannerType];
+ export type VisionScannersHighlightFeedRetrieveScannerType = typeof VisionScannersHighlightFeedRetrieveScannerType[keyof typeof VisionScannersHighlightFeedRetrieveScannerType];
- export const VisionScannersWatchFeedRetrieveScannerType = {
+ export const VisionScannersHighlightFeedRetrieveScannerType = {
Monitor: 'monitor',
Classifier: 'classifier',
Scorer: 'scorer',
diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.ts
index 01cc06d8fb7f..9baa60e63d38 100644
--- a/services/mcp/src/generated/replay_vision/api.ts
+++ b/services/mcp/src/generated/replay_vision/api.ts
@@ -517,7 +517,7 @@ export const VisionObservationsRetrieveQueryParams = () => zod.object({
.string()
.optional()
.describe(
- "Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts."
+ "Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts."
),
})
@@ -1593,7 +1593,7 @@ export const VisionScannersObservationsListQueryParams = () => zod.object({
.string()
.optional()
.describe(
- "Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts."
+ "Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts."
),
})
@@ -1683,7 +1683,7 @@ export const VisionScannersObservationsRetrieveQueryParams = () => zod.object({
.string()
.optional()
.describe(
- "Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts."
+ "Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts."
),
})
@@ -1772,7 +1772,7 @@ export const VisionScannersObservationsStatsRetrieveQueryParams = () => zod.obje
.string()
.optional()
.describe(
- "Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts."
+ "Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts."
),
})
@@ -2235,6 +2235,86 @@ export const VisionScannersEstimateCreateBody = () => zod
})
.describe('Body of POST \/vision\/scanners\/estimate\/ — a proposed, unsaved scanner config.')
+/**
+ * Succeeded observations in the window worth watching, ranked for the Highlights tab.
+ */
+export const VisionScannersHighlightFeedRetrieveParams = () => zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const visionScannersHighlightFeedRetrieveQueryDateFromDefault = `-7d`
+
+export const visionScannersHighlightFeedRetrieveQueryLimitDefault = 20
+export const visionScannersHighlightFeedRetrieveQueryLimitMax = 50
+
+export const visionScannersHighlightFeedRetrieveQueryOffsetDefault = 0
+export const visionScannersHighlightFeedRetrieveQueryOffsetMin = 0
+export const visionScannersHighlightFeedRetrieveQueryOffsetMax = 1000
+
+export const VisionScannersHighlightFeedRetrieveQueryParams = () => zod.object({
+ as_of: zod.iso
+ .datetime({ offset: true })
+ .optional()
+ .describe(
+ 'The time the first page loaded. Later pages rank as of that time: observations, views, dismissals and impressions after it are ignored, so pages do not shift under a reader who scrolls.'
+ ),
+ created_by: zod
+ .string()
+ .min(1)
+ .optional()
+ .describe('Comma-separated user IDs. Restrict the feed to observations from scanners those users created.'),
+ date_from: zod
+ .string()
+ .min(1)
+ .default(visionScannersHighlightFeedRetrieveQueryDateFromDefault)
+ .describe(
+ "Only observations created at or after this time. Accepts ISO 8601, a relative date like `-7d`, or `now`; values without an explicit offset are interpreted in the project's timezone. The window between `date_from` and `date_to` may span at most 90 days."
+ ),
+ date_to: zod
+ .string()
+ .min(1)
+ .optional()
+ .describe(
+ 'Only observations created at or before this time. Same formats as `date_from`; omit it to query through the current time.'
+ ),
+ limit: zod
+ .number()
+ .min(1)
+ .max(visionScannersHighlightFeedRetrieveQueryLimitMax)
+ .default(visionScannersHighlightFeedRetrieveQueryLimitDefault)
+ .describe(
+ 'Ceiling on feed items to return per page, at most 50. A page routinely returns fewer: a window is not padded to this number with clips that carry no finding.'
+ ),
+ offset: zod
+ .number()
+ .min(visionScannersHighlightFeedRetrieveQueryOffsetMin)
+ .max(visionScannersHighlightFeedRetrieveQueryOffsetMax)
+ .default(visionScannersHighlightFeedRetrieveQueryOffsetDefault)
+ .describe('How many ranked items to skip. Send `as_of` with every page after the first.'),
+ scanner_ids: zod
+ .string()
+ .min(1)
+ .optional()
+ .describe('Comma-separated scanner UUIDs to restrict the feed to. Defaults to every scanner you can read.'),
+ scanner_type: zod
+ .enum(['monitor', 'classifier', 'scorer', 'summarizer', 'experiment'])
+ .optional()
+ .describe(
+ 'Restrict the feed to observations from scanners of this type.\n\n\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment'
+ ),
+ tags: zod
+ .string()
+ .min(1)
+ .optional()
+ .describe(
+ 'Comma-separated scanner tags to restrict the feed to. A team with many scanners uses these to follow one area without naming every scanner in it.'
+ ),
+})
+
/**
* Scan named sessions against a prompt without saving a scanner first, for one-off questions.
*
@@ -2321,83 +2401,3 @@ export const VisionScannersStatsRetrieveParams = () => zod.object({
"Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
),
})
-
-/**
- * Succeeded observations in the window worth watching, ranked for the Highlights tab.
- */
-export const VisionScannersWatchFeedRetrieveParams = () => zod.object({
- project_id: zod
- .string()
- .describe(
- "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
- ),
-})
-
-export const visionScannersWatchFeedRetrieveQueryDateFromDefault = `-7d`
-
-export const visionScannersWatchFeedRetrieveQueryLimitDefault = 20
-export const visionScannersWatchFeedRetrieveQueryLimitMax = 50
-
-export const visionScannersWatchFeedRetrieveQueryOffsetDefault = 0
-export const visionScannersWatchFeedRetrieveQueryOffsetMin = 0
-export const visionScannersWatchFeedRetrieveQueryOffsetMax = 1000
-
-export const VisionScannersWatchFeedRetrieveQueryParams = () => zod.object({
- as_of: zod.iso
- .datetime({ offset: true })
- .optional()
- .describe(
- 'The time the first page loaded. Later pages rank as of that time: observations, views, dismissals and impressions after it are ignored, so pages do not shift under a reader who scrolls.'
- ),
- created_by: zod
- .string()
- .min(1)
- .optional()
- .describe('Comma-separated user IDs. Restrict the feed to observations from scanners those users created.'),
- date_from: zod
- .string()
- .min(1)
- .default(visionScannersWatchFeedRetrieveQueryDateFromDefault)
- .describe(
- "Only observations created at or after this time. Accepts ISO 8601, a relative date like `-7d`, or `now`; values without an explicit offset are interpreted in the project's timezone. The window between `date_from` and `date_to` may span at most 90 days."
- ),
- date_to: zod
- .string()
- .min(1)
- .optional()
- .describe(
- 'Only observations created at or before this time. Same formats as `date_from`; omit it to query through the current time.'
- ),
- limit: zod
- .number()
- .min(1)
- .max(visionScannersWatchFeedRetrieveQueryLimitMax)
- .default(visionScannersWatchFeedRetrieveQueryLimitDefault)
- .describe(
- 'Ceiling on feed items to return per page, at most 50. A page routinely returns fewer: a window is not padded to this number with clips that carry no finding.'
- ),
- offset: zod
- .number()
- .min(visionScannersWatchFeedRetrieveQueryOffsetMin)
- .max(visionScannersWatchFeedRetrieveQueryOffsetMax)
- .default(visionScannersWatchFeedRetrieveQueryOffsetDefault)
- .describe('How many ranked items to skip. Send `as_of` with every page after the first.'),
- scanner_ids: zod
- .string()
- .min(1)
- .optional()
- .describe('Comma-separated scanner UUIDs to restrict the feed to. Defaults to every scanner you can read.'),
- scanner_type: zod
- .enum(['monitor', 'classifier', 'scorer', 'summarizer', 'experiment'])
- .optional()
- .describe(
- 'Restrict the feed to observations from scanners of this type.\n\n\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment'
- ),
- tags: zod
- .string()
- .min(1)
- .optional()
- .describe(
- 'Comma-separated scanner tags to restrict the feed to. A team with many scanners uses these to follow one area without naming every scanner in it.'
- ),
-})
diff --git a/services/mcp/src/tools/generated/replay_vision.ts b/services/mcp/src/tools/generated/replay_vision.ts
index 1bb42628dc83..bc05a7772106 100644
--- a/services/mcp/src/tools/generated/replay_vision.ts
+++ b/services/mcp/src/tools/generated/replay_vision.ts
@@ -1122,6 +1122,48 @@ const visionScannersGet = (): ToolBase<ReturnType<typeof VisionScannersGetSchema
},
})
+const VisionScannersHighlightFeedSchema = () => {
+ const VisionScannersHighlightFeedRetrieveQueryParams = orvalSchemas.VisionScannersHighlightFeedRetrieveQueryParams()
+ return VisionScannersHighlightFeedRetrieveQueryParams
+}
+
+const visionScannersHighlightFeed = (): ToolBase<
+ ReturnType<typeof VisionScannersHighlightFeedSchema>,
+ WithAgentNote<Schemas.HighlightFeedResponse>
+> => ({
+ name: 'vision-scanners-highlight-feed',
+ schema: VisionScannersHighlightFeedSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof VisionScannersHighlightFeedSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.HighlightFeedResponse>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/scanners/highlight_feed/`,
+ query: {
+ as_of: params.as_of,
+ created_by: params.created_by,
+ date_from: params.date_from,
+ date_to: params.date_to,
+ limit: params.limit,
+ offset: params.offset,
+ scanner_ids: params.scanner_ids,
+ scanner_type: params.scanner_type,
+ tags: params.tags,
+ },
+ })
+ const filtered = stripNullFields(
+ omitResponseFields(result, [
+ 'results.*.observation.scanner_snapshot',
+ 'results.*.observation.workflow_id',
+ 'results.*.observation.triggered_by_user',
+ ])
+ ) as typeof result
+ return withAgentNote(
+ filtered,
+ 'Point the person at one or two recordings with a one-line reason each, rather than listing the whole feed.\n'
+ )
+ },
+})
+
const VisionScannersImpactGetSchema = () => {
const VisionScannersImpactRetrieveParams = orvalSchemas.VisionScannersImpactRetrieveParams()
const VisionScannersImpactRetrieveQueryParams = orvalSchemas.VisionScannersImpactRetrieveQueryParams()
@@ -1639,48 +1681,6 @@ const visionScannersVariantsList = (): ToolBase<
},
})
-const VisionScannersWatchFeedSchema = () => {
- const VisionScannersWatchFeedRetrieveQueryParams = orvalSchemas.VisionScannersWatchFeedRetrieveQueryParams()
- return VisionScannersWatchFeedRetrieveQueryParams
-}
-
-const visionScannersWatchFeed = (): ToolBase<
- ReturnType<typeof VisionScannersWatchFeedSchema>,
- WithAgentNote<Schemas.WatchFeedResponse>
-> => ({
- name: 'vision-scanners-watch-feed',
- schema: VisionScannersWatchFeedSchema(),
- handler: async (context: Context, params: z.infer<ReturnType<typeof VisionScannersWatchFeedSchema>>) => {
- const projectId = await context.stateManager.getProjectId()
- const result = await context.api.request<Schemas.WatchFeedResponse>({
- method: 'GET',
- path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/scanners/watch_feed/`,
- query: {
- as_of: params.as_of,
- created_by: params.created_by,
- date_from: params.date_from,
- date_to: params.date_to,
- limit: params.limit,
- offset: params.offset,
- scanner_ids: params.scanner_ids,
- scanner_type: params.scanner_type,
- tags: params.tags,
- },
- })
- const filtered = stripNullFields(
- omitResponseFields(result, [
- 'results.*.observation.scanner_snapshot',
- 'results.*.observation.workflow_id',
- 'results.*.observation.triggered_by_user',
- ])
- ) as typeof result
- return withAgentNote(
- filtered,
- 'Point the person at one or two recordings with a one-line reason each, rather than listing the whole feed.\n'
- )
- },
-})
-
export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'vision-alerts-create': visionAlertsCreate,
'vision-alerts-delete': visionAlertsDelete,
@@ -1718,6 +1718,7 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'vision-scanners-duplicate': visionScannersDuplicate,
'vision-scanners-estimate': visionScannersEstimate,
'vision-scanners-get': visionScannersGet,
+ 'vision-scanners-highlight-feed': visionScannersHighlightFeed,
'vision-scanners-impact-get': visionScannersImpactGet,
'vision-scanners-inline-scan': visionScannersInlineScan,
'vision-scanners-list': visionScannersList,
@@ -1732,5 +1733,4 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'vision-scanners-self-driving-stats': visionScannersSelfDrivingStats,
'vision-scanners-update': visionScannersUpdate,
'vision-scanners-variants-list': visionScannersVariantsList,
- 'vision-scanners-watch-feed': visionScannersWatchFeed,
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-observations-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-observations-get.json
index 9e293735195f..b78a4d026850 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-observations-get.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-observations-get.json
@@ -62,7 +62,7 @@
"type": "string"
},
"watch_group": {
- "description": "Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.",
+ "description": "Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.",
"type": "string"
}
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-watch-feed.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-highlight-feed.json
similarity index 100%
rename from services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-watch-feed.json
rename to services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-highlight-feed.json
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-get.json
index 3049b2ac13c7..ae5a921731ab 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-get.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-get.json
@@ -65,7 +65,7 @@
"type": "string"
},
"watch_group": {
- "description": "Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.",
+ "description": "Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.",
"type": "string"
}
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-list.json
index fff4db7510f1..0218e391b0ac 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-list.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-list.json
@@ -69,7 +69,7 @@
"type": "string"
},
"watch_group": {
- "description": "Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.",
+ "description": "Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.",
"type": "string"
}
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-stats.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-stats.json
index 81fcc3167a2b..b0aa3502f378 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-stats.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-observations-stats.json
@@ -61,7 +61,7 @@
"type": "string"
},
"watch_group": {
- "description": "Only observations the watch feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.",
+ "description": "Only observations the highlight feed groups with this observation as near duplicates, including itself. Pair it with the feed's `date_from` to list the sessions a feed card counts.",
"type": "string"
}
},
diff --git a/tach.toml b/tach.toml
index 7034cdd6443c..d42becf3010c 100644
--- a/tach.toml
+++ b/tach.toml
@@ -876,7 +876,7 @@ depends_on = [
"products.experiments",
"products.exports",
"products.feature_flags",
- # Facade-only: the watch feed's hourly Jev sweep calls the shared decision-model client.
+ # Facade-only: the highlight feed's hourly Jev sweep calls the shared decision-model client.
"products.ml_inference",
"products.notifications",
"products.signals",