:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(replay-vision): highlights grid and feed kind filter (#125282)
Tue Haulund3ff6275ac8a1
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 75e8232fa187..dbaab2700391 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -14815,17 +14815,17 @@ snapshots:scenes-app-replay-vision--experiment-variants-waiting-for-observations--light:hash: v1.k794b7964.a1555dab4c0006028e8c240451c56c6aed5e31c8a8e68c893e3d6a07b562bba6.VYeYPsjZ_p0Rt4cbZzF7lbxjxurMjLXff9kJRsy49gUscenes-app-replay-vision--home-highlight-feed--dark:- hash: v1.k794b7964.f523bdb7bcfef034532b6c11e11478ec199cfcb3246d22e4d2ccad6b1b38fc4f.hMr887mIHYKTjQH27GMT76K56YyNe19BiWC4KQpw4nU+ hash: v1.k794b7964.ec0e951c9f685c26a91a3de09630807894d078b885b465b508fcdb78d5686754.J0OllnltGLUmsAB7kwoxpIHPzUA74zDs-B_hNDfcxPIscenes-app-replay-vision--home-highlight-feed--light:- hash: v1.k794b7964.7594537d1642bffd9a9077cbff5b281290c9916d748b8f00877b6c9dadc100dd.IAOkUTKrN_QAilF3rLjKaGw9wW2tTctepVWE4UfgxcU+ hash: v1.k794b7964.6b2f825b29d4078f079b7aeaeb0417f19f3ec0f10e84b9bdce737891d6c0eb43.qGm3jeKMbDPI4AjNjYGEGutCQjGXkGwjq6c5vAQEmTcscenes-app-replay-vision--home-highlight-feed-empty--dark:- hash: v1.k794b7964.9cc31cd0b1956a94195b57c22dc1b8685e87d5102197f079ef7f48115dedb29c.GGIwoix1bj2E3mVcLak54LA6DobNO8SZavr6hURmWpg+ hash: v1.k794b7964.aa2a535d2294cab79f8090ef68ef9b8a74c930928c50c011df3eabb0ee7f455b.LrXy7q5Igei_2wtEYnbLH-pTAC_cBJSgkLKp5xAiNcQscenes-app-replay-vision--home-highlight-feed-empty--light:- hash: v1.k794b7964.f5fdca66d1aac945dccd33803444618745291e781b0bc404beb36947f3c2c212.O4bNRE_ZWsm4FvTmW5NL3IsgtMCOCVnv0kxlWTbyZSQ+ hash: v1.k794b7964.956f928ca170ccd303a63fcaff74d11712aa98ce535e21960ae5f647c860a672.c3yP7uZ4Uy7msDHBonc7A27Enl15dBa8XOKb10rdmjkscenes-app-replay-vision--home-highlight-feed-only-newest--dark:- hash: v1.k794b7964.d6e53f27da260d677f44ff7fc08f195853096f76f391e22d54851c250b22b85f.PdrpRblQvx7y-RP5nRHwtSks6_bOLpzwGpllK-ao1u4+ hash: v1.k794b7964.4492f7e3699a0b1425a0fff12ee817e0543b206c1879b6d59f4ec72446665954.gUMupxG7Xyn6skmo4bGZXRpySTJzc0-_Uz60R1M3kkYscenes-app-replay-vision--home-highlight-feed-only-newest--light:- hash: v1.k794b7964.dad343e2baa8a7ffbac56e70dac0182295a4c3e21b0141b00770d8a7fa96b774.AeywrD4S6EMXRptBuUrAHcbfR2rGKbJ-20XlzHocxK8+ hash: v1.k794b7964.dec4ed34fcef4ce6caa8f7107f50f3a8fd8dd5de971bf45eeb8dfa8ee1a8974b.Pn4KJvco4NA-hhFmRbkNladCF8Q5gV1EqkjI6v89n_kscenes-app-replay-vision--monitor-observations--dark:hash: v1.k794b7964.9ec7ef6c17074e9547647fe71aa2613100208fa0c7ba87a3d97897b4f183a5c8.-UKB-w06mWDRH2yNgzIBhn3Qhn2MYlFTNXjhMce1hh4scenes-app-replay-vision--monitor-observations--light:diff --git a/products/replay_vision/backend/api/observations.py b/products/replay_vision/backend/api/observations.pyindex d939be8b7ffc..4007dc3fa3ed 100644--- a/products/replay_vision/backend/api/observations.py+++ b/products/replay_vision/backend/api/observations.py@@ -780,6 +780,15 @@ class ReplayObservationFilter(django_filters.FilterSet):"Pair it with the feed's `date_from` to list the sessions a feed card counts."),)+ watch_category = MultiChoiceFilter(+ field_name="watch_rank__category",+ valid_choices=frozenset(ISSUE_CATEGORIES),+ error_key="watch_category",+ help_text=(+ "Only observations the watch feed ranks under any of these kinds (comma-separated: "+ "failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`."+ ),+ )date_from = django_filters.CharFilter(method="_filter_date_from",help_text=(diff --git a/products/replay_vision/backend/api/scanners.py b/products/replay_vision/backend/api/scanners.pyindex 3fc90691912b..7d8ca166df33 100644--- a/products/replay_vision/backend/api/scanners.py+++ b/products/replay_vision/backend/api/scanners.py@@ -182,6 +182,7 @@ from products.replay_vision.backend.temporal.constants import VISION_SIGNALS_SOUfrom products.replay_vision.backend.temporal.metrics import record_estimate_outcome, record_scanner_limit_reachedfrom products.replay_vision.backend.temporal.read_meter_types import current_sweep_throttle_factorfrom products.replay_vision.backend.watch_rank import (+ ISSUE_CATEGORIES,rank_highlight_feed_by_embedding,select_embedding_filler,select_embedding_picks,@@ -1722,6 +1723,15 @@ class HighlightFeedQuerySerializer(serializers.Serializer):required=False,help_text="Comma-separated user IDs. Restrict the feed to observations from scanners those users created.",)+ categories = serializers.CharField(+ required=False,+ help_text=(+ "Comma-separated kinds of moment to include: `failure` (errors, failed requests, dead ends), `struggle` "+ "(repeated attempts, rage clicks, abandoned forms), `revenue` (failed payments, cancellations, usage "+ "limits). Defaults to all three. A pick keeps its rank within its scanner, so leaving a kind out drops "+ "its sessions without promoting weaker ones."+ ),+ )limit = serializers.IntegerField(required=False,default=HIGHLIGHT_FEED_DEFAULT_LIMIT,@@ -1750,6 +1760,13 @@ class HighlightFeedQuerySerializer(serializers.Serializer):def validate_tags(self, value: str) -> list[str]:return [tagify(tag) for tag in split_csv(value)]+ def validate_categories(self, value: str) -> list[str] | None:+ categories = set(validate_csv_choices(value, frozenset(ISSUE_CATEGORIES), "categories"))+ if not categories:+ raise serializers.ValidationError("Include at least one category.")+ # Every category is the unfiltered feed, so it shares that feed's cached picks.+ return None if categories == set(ISSUE_CATEGORIES) else sorted(categories)+def validate_scanner_ids(self, value: str) -> list[UUID]:raw_ids = split_csv(value)if not raw_ids:@@ -2526,6 +2543,7 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, visorted(readable_experiment_ids(self.user_access_control, self.team_id)),sorted(map(str, allowed_ids)),params.get("scanner_type"),+ params.get("categories"),]).encode()).hexdigest()@@ -2540,13 +2558,24 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vielse:# 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, HIGHLIGHT_FEED_CANDIDATE_CAP+ walkable,+ allowed_ids,+ viewed,+ self.user_access_control,+ self.team_id,+ HIGHLIGHT_FEED_CANDIDATE_CAP,+ params.get("categories") or ISSUE_CATEGORIES,)# 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) < HIGHLIGHT_FEED_MIN_ITEMS:+ filler_base = walkable+ if params.get("categories"):+ # Padding must not bring back a session the viewer hid by its category.+ hidden = [category for category in ISSUE_CATEGORIES if category not in params["categories"]]+ filler_base = walkable.exclude(watch_rank__category__in=hidden)candidate_rows += select_embedding_filler(- walkable, allowed_ids, viewed, self.user_access_control, self.team_id, pick_roots+ filler_base, 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), HIGHLIGHT_FEED_PICKS_CACHE_TTL_S)diff --git a/products/replay_vision/backend/tests/test_api.py b/products/replay_vision/backend/tests/test_api.pyindex 3ef2e0d6e11f..4b2927a22720 100644--- a/products/replay_vision/backend/tests/test_api.py+++ b/products/replay_vision/backend/tests/test_api.py@@ -2249,14 +2249,15 @@ class TestReplayObservationViewSet(_VisionAPITestCase):("asked_by_a_copy", "copy"),("unknown_id", None),("another_teams_row", "other_team"),+ ("kept_to_the_chosen_kinds", "copy", "failure,revenue"),])- def test_filter_by_watch_group(self, _name: str, asked: str | None) -> None:+ def test_filter_by_watch_group(self, _name: str, asked: str | None, categories: str | None = None) -> None:rows = {name: self._create_observation(session_id=name, status=ObservationStatus.SUCCEEDED, completed_at=timezone.now())- for name in ("root", "copy", "routine", "stale", "other")+ for name in ("root", "copy", "struggle", "routine", "stale", "other")}root_id = str(rows["root"].id)@@ -2271,6 +2272,7 @@ class TestReplayObservationViewSet(_VisionAPITestCase):for name, watch_rank in {"root": rank(None),"copy": rank(root_id),+ "struggle": rank(root_id, category="struggle"),"routine": rank(root_id, category="routine"),"stale": rank(root_id, anchor_version=ANCHOR_VERSION - 1),"other": rank(None),@@ -2287,10 +2289,12 @@ class TestReplayObservationViewSet(_VisionAPITestCase):watch_rank=rank(root_id),)member = {"other_team": str(other_row.id), None: str(uuid.uuid4())}.get(asked) or str(rows[str(asked)].id)- resp = self.client.get(f"{self.observations_url(str(self.scanner.id))}?watch_group={member}")+ query = f"watch_group={member}" + (f"&watch_category={categories}" if categories else "")+ resp = self.client.get(f"{self.observations_url(str(self.scanner.id))}?{query}")self.assertEqual(resp.status_code, 200)- expected = {"root", "copy"} if asked in ("root", "copy") else set()+ group = {"root", "copy"} if categories else {"root", "copy", "struggle"}+ expected = group if asked in ("root", "copy") else set()self.assertEqual({r["session_id"] for r in resp.json()["results"]}, expected)def test_order_by_created_at_descending(self) -> None:@@ -2479,6 +2483,7 @@ class TestReplayObservationViewSet(_VisionAPITestCase):("status=bogus", "status"),("triggered_by=hack", "triggered_by"),("verdict=maybe", "verdict"),+ ("watch_category=routine", "watch_category"),("min_score=low", "min_score"),("max_score=high", "max_score"),("order_by=garbage", "order_by"),@@ -4774,6 +4779,8 @@ class TestHighlightFeedQueryValidation(SimpleTestCase):("non_numeric_created_by", {"created_by": "1,alice"}),("limit_too_high", {"limit": "51"}),("limit_zero", {"limit": "0"}),+ ("unknown_category", {"categories": "failure,billing"}),+ ("only_separators", {"categories": ","}),])def test_rejects_invalid_query(self, _name: str, params: dict[str, str]) -> None:@@ -4786,6 +4793,16 @@ class TestHighlightFeedQueryValidation(SimpleTestCase):assert serializer.validated_data["date_from"] == "-7d"assert serializer.validated_data["limit"] == 20+ @parameterized.expand(+ [("every_category", "struggle,revenue,failure", None), ("subset", "revenue,failure", ["failure", "revenue"])]+ )+ def test_categories_normalize_so_equal_choices_share_cached_picks(+ self, _name: str, raw: str, expected: list[str] | None+ ) -> None:+ serializer = HighlightFeedQuerySerializer(data={"categories": raw})+ assert serializer.is_valid()+ assert serializer.validated_data["categories"] == expected+class TestHighlightFeedAPI(_VisionAPITestCase):@property@@ -4860,6 +4877,32 @@ class TestHighlightFeedAPI(_VisionAPITestCase):[item["observation"]["session_id"] for item in items], [f"row-{i}" for i in range(len(expected_kinds))])+ def test_categories_drop_the_left_out_picks_even_when_picks_are_cached(self) -> None:+ scanner = self._create_scanner(name="m")+ # Of 20 ranked rows the top four clear the percentile cut: two failures and two revenue rows.+ rows = []+ for i in range(20):+ category = ("failure", "revenue")[i % 2] if i < 4 else "routine"+ rows.append(self._ranked_observation(scanner, f"row-{i}", 10 + i, category, 0.9 - i / 100))+ self._ranked_observation(scanner, "row-1-failure-copy", 40, "failure", -0.5, group=str(rows[1].id))++ everything = self.client.get(self.feed_url, {"limit": 50}).json()["results"]+ revenue_only = self.client.get(self.feed_url, {"limit": "50", "categories": "revenue"}).json()["results"]++ def picks(items: list[dict]) -> dict[str, int]:+ return {+ item["observation"]["session_id"]: item["reason"]["similar_count"]+ for item in items+ if item["reason"]["kind"] == "embedding_pick"+ }++ assert picks(everything) == {"row-0": 0, "row-1": 1, "row-2": 0, "row-3": 0}+ assert picks(revenue_only) == {"row-1": 0, "row-3": 0}+ # Two picks fall short of the floor, so filler pads the feed without the failures just hidden.+ shown = [item["observation"]["session_id"] for item in revenue_only]+ assert len(shown) >= 3+ assert not {"row-0", "row-2"} & set(shown)+def test_pages_do_not_shift_when_the_reader_opens_a_card_mid_scroll(self) -> None:scanner = self._create_scanner(name="m")for i in range(30):diff --git a/products/replay_vision/backend/watch_rank.py b/products/replay_vision/backend/watch_rank.pyindex 8760f00d0224..9e8abdce741c 100644--- a/products/replay_vision/backend/watch_rank.py+++ b/products/replay_vision/backend/watch_rank.py@@ -10,7 +10,7 @@ errors all the time does not fill the feed.import mathimport asynciofrom collections import Counter-from collections.abc import Mapping+from collections.abc import Mapping, Sequencefrom dataclasses import asdictfrom datetime import timedeltafrom typing import Any, Literal, cast@@ -282,7 +282,10 @@ def _cap_feed_groups(rows: list[dict[str, Any]], cap: int) -> dict[Any, dict[strdef _pick_window_rows(- ranked: QuerySet[ReplayObservation], current_ranks: QuerySet[ReplayObservation], limit: int+ ranked: QuerySet[ReplayObservation],+ current_ranks: QuerySet[ReplayObservation],+ limit: int,+ categories: Sequence[str],) -> list[dict[str, Any]]:"""Each scanner's top-fifth issue rows in pick order: every scanner's best first, then every second-best.@@ -331,7 +334,7 @@ def _pick_window_rows(*counts_params,*top_params,1 - HIGHLIGHT_PICK_MIN_PERCENTILE,- list(ISSUE_CATEGORIES),+ list(categories),HIGHLIGHT_PICK_MIN_PERCENTILE,limit,)@@ -347,11 +350,14 @@ def select_embedding_picks(access: UserAccessControl,team_id: int,cap: int,+ categories: Sequence[str],) -> list[dict[str, Any]]:"""The window's pick rows for the embedding ranker, with each row's percentile and the reach of its feed group.The percentile is taken over every ranked row a scanner has in the window, not over a recency slice, so a- longer window reaches further back instead of re-ranking the same newest rows.+ longer window reaches further back instead of re-ranking the same newest rows. `categories` narrows the picks+ after that ranking, so turning a category off drops its rows without promoting weaker rows of the others. A+ group's reach counts only members of those categories, so it matches the similar sessions the card's popover lists."""group_root = watch_group_root()ranked = walkable.filter(@@ -367,11 +373,11 @@ def select_embedding_picks(# 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 * (HIGHLIGHT_PICK_GROUP_CANDIDATES + 1)- rows = _pick_window_rows(ranked, current_ranks, fetch_limit)+ rows = _pick_window_rows(ranked, current_ranks, fetch_limit, categories)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 * HIGHLIGHT_PICK_REFILL_FACTOR), cap+ _pick_window_rows(ranked, current_ranks, fetch_limit * HIGHLIGHT_PICK_REFILL_FACTOR, categories), cap)if not window_values:return []@@ -395,7 +401,7 @@ def select_embedding_picks(for row in accessible_observations(access,team_id,- current_ranks.filter(id__in=member_ids, watch_category__in=ISSUE_CATEGORIES),+ current_ranks.filter(id__in=member_ids, watch_category__in=list(categories)),).annotate(watch_group_root=group_root).values("watch_group_root")diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.tsindex 7797482e5dfa..467ce554cb06 100644--- a/products/replay_vision/frontend/generated/api.schemas.ts+++ b/products/replay_vision/frontend/generated/api.schemas.ts@@ -3120,6 +3120,10 @@ export type VisionObservationsRetrieveParams = {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string/*** 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.*/@@ -3367,6 +3371,10 @@ export type VisionScannersObservationsListParams = {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string/*** 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.*/@@ -3430,6 +3438,10 @@ export type VisionScannersObservationsRetrieveParams = {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string/*** 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.*/@@ -3493,6 +3505,10 @@ export type VisionScannersObservationsSignalReportsListParams = {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string/*** 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.*/@@ -3580,6 +3596,10 @@ export type VisionScannersObservationsStatsRetrieveParams = {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string/*** 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.*/@@ -3591,6 +3611,11 @@ 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.*/as_of?: string+ /**+ * Comma-separated kinds of moment to include: `failure` (errors, failed requests, dead ends), `struggle` (repeated attempts, rage clicks, abandoned forms), `revenue` (failed payments, cancellations, usage limits). Defaults to all three. A pick keeps its rank within its scanner, so leaving a kind out drops its sessions without promoting weaker ones.+ * @minLength 1+ */+ categories?: string/*** Comma-separated user IDs. Restrict the feed to observations from scanners those users created.* @minLength 1diff --git a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.test.ts b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.test.tsindex 52c8a630d182..d720d3a24679 100644--- a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.test.ts+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.test.ts@@ -27,17 +27,17 @@ describe('HighlightFeedCard helpers', () => {watch_category: 'struggle',similar_count: 1,} as HighlightFeedReasonApi,- expected: 'The user struggled in this session. 1 other session from this scanner looks similar.',+ expected: 'The user struggled here and in 1\u00a0similar session.',},{- name: 'counts the people behind an embedding pick when it reached more than one',+ name: 'counts sessions rather than people, so the sentence matches the similar sessions button',reason: {kind: 'embedding_pick',watch_category: 'failure',similar_count: 5,affected_people: 4,} as HighlightFeedReasonApi,- expected: 'Something failed in this session. 4 people had a similar session.',+ expected: 'Something failed here and in 5\u00a0similar sessions.',},{name: 'renders a sentence for a reason kind this frontend does not know',diff --git a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.tsxindex 78a6c85cd43e..e79d283fdfd9 100644--- a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCard.tsx@@ -8,6 +8,7 @@ import { useAutoMarkRead } from 'lib/components/NotificationsMenu/useAutoMarkReaimport { TZLabel } from 'lib/components/TZLabel'import posthog from 'lib/posthog-typed'import { colonDelimitedDuration } from 'lib/utils/durations'+import { pluralize } from 'lib/utils/strings'import { urls } from 'scenes/urls'import { readResult } from '../../components/ObservationCard'@@ -23,38 +24,47 @@ import type {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 { feedCategoriesParam, highlightFeedLogic } from '../highlightFeedLogic'import { CARD_SEEN_DWELL_MS, cardProperties } from '../highlightFeedTelemetry'import { SCANNER_TYPE_TAG_TYPE, ScannerType } from '../types'import { HighlightFeedDismissButton } from './HighlightFeedDismissButton'-import { HighlightFeedGroupList, HighlightFeedGroupToggle } from './HighlightFeedGroup'+import { HighlightFeedGroupToggle, similarSessionsLabel } 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<HighlightFeedCategoryEnumApi, string> = {- failure: 'Something failed in this session.',- struggle: 'The user struggled in this session.',- revenue: 'This session touches billing or a plan limit.',+const WATCH_CATEGORY_COPY: Record<+ HighlightFeedCategoryEnumApi,+ { alone: string; withSimilar: (similar: string) => string }+> = {+ failure: {+ alone: 'Something failed in this session.',+ withSimilar: (similar) => `Something failed here and in ${similar}.`,+ },+ struggle: {+ alone: 'The user struggled in this session.',+ withSimilar: (similar) => `The user struggled here and in ${similar}.`,+ },+ revenue: {+ alone: 'A payment problem came up in this session.',+ withSimilar: (similar) => `A payment problem came up here and in ${similar}.`,+ },}/** What the reason kind says about the session. */export function highlightReasonCopy(reason: HighlightFeedReasonApi): string {switch (reason.kind) {case 'embedding_pick': {- const category = reason.watch_category- ? WATCH_CATEGORY_COPY[reason.watch_category]- : 'This session stands out for this scanner.'- const people = reason.affected_people ?? 1- if (people > 1) {- return `${category} ${people} people had a similar session.`- }+ // Sessions, not people, so the count matches the card's similar sessions button.const similar = reason.similar_count ?? 0+ const copy = reason.watch_category ? WATCH_CATEGORY_COPY[reason.watch_category] : nullif (similar === 0) {- return category+ return copy?.alone ?? 'This session stands out for this scanner.'}- return `${category} ${similar} other session${similar === 1 ? ' from this scanner looks' : 's from this scanner look'} similar.`+ return copy+ ? copy.withSimilar(similarSessionsLabel(similar))+ : `This session and ${pluralize(similar, 'similar one')} stand out for this scanner.`}case 'unviewed_recent':return 'New since you last looked.'@@ -146,7 +156,7 @@ function HighlightCardPerson({person: string | null | undefined}): JSX.Element {return (- <div className="flex flex-wrap items-center gap-1 text-xs text-muted">+ <div className="flex min-w-0 items-center gap-1 text-xs text-muted">{person &&(observation.distinct_id ? (<Link@@ -255,7 +265,7 @@ export function highlightFeedRowTitle(observation: ReplayObservationApi): string*/export function HighlightFeedRow({ item, position }: HighlightFeedRowProps): JSX.Element {const { observation, reason } = item- const { feedLoad, dateFrom } = useValues(highlightFeedLogic)+ const { feedLoad, dateFrom, categories } = useValues(highlightFeedLogic)const { cardSeen, dismissItem } = useActions(highlightFeedLogic)const rowRef = useAutoMarkRead(true, () => cardSeen(item, position), CARD_SEEN_DWELL_MS)const result = readResult(observation)@@ -268,13 +278,16 @@ export function HighlightFeedRow({ item, position }: HighlightFeedRowProps): JSXconst keyMomentMs = observationKeyMomentMs(observation)const observationUrl = highlightFeedObservationUrl(observation)const title = highlightFeedRowTitle(observation)+ const why = highlightReasonCopy(reason)const filler = FILLER_REASON_KINDS.has(reason.kind)const similarCount = reason.kind === 'embedding_pick' ? (reason.similar_count ?? 0) : 0const groupProps = {observationId: observation.id,scannerId: observation.scanner_id,dateFrom,+ categories: feedCategoriesParam(categories),similarCount,+ affectedPeople: reason.kind === 'embedding_pick' ? (reason.affected_people ?? null) : null,cardContext: cardProperties(feedLoad, item, position, 'feed_tab'),}const captureOpened = (): void => {@@ -292,19 +305,22 @@ export function HighlightFeedRow({ item, position }: HighlightFeedRowProps): JSXdata-attr="vision-highlight-feed-row"><header className="flex min-w-0 items-center gap-2">- <HighlightFeedScannerLink- observation={observation}- scannerName={scannerName}- scannerType={scannerType}- />+ <div className="flex min-w-0">+ <HighlightFeedScannerLink+ observation={observation}+ scannerName={scannerName}+ scannerType={scannerType}+ />+ </div><span className="text-xs text-muted" aria-hidden>·</span>- <div className="min-w-0 flex-1">+ {/* The person and age keep up to 45% of the line, so a long email is cut before the scanner name. */}+ <div className="min-w-0 max-w-[45%] shrink-0"><HighlightCardPerson observation={observation} person={person} /></div><HighlightFeedDismissButton- className="relative z-10 shrink-0"+ className="relative z-10 ml-auto shrink-0"onDismiss={(dismissalReason) => dismissItem(item, position, dismissalReason)}/></header>@@ -316,7 +332,8 @@ export function HighlightFeedRow({ item, position }: HighlightFeedRowProps): JSXdata-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'}`}+ // Two lines are always reserved, so cards in one grid row keep their posters level.+ className={`m-0 min-h-[2lh] text-base line-clamp-2 wrap-anywhere group-hover:text-accent ${filler ? 'font-medium text-secondary' : 'font-semibold'}`}title={title}>{!observation.viewed && <span className="sr-only">New: </span>}@@ -332,9 +349,9 @@ export function HighlightFeedRow({ item, position }: HighlightFeedRowProps): JSX<IconFlag className="text-accent" aria-hidden /></span></Tooltip>- <span className="line-clamp-3">+ <span className="min-w-0 truncate" title={why}><span className="sr-only">Why this recording: </span>- {highlightReasonCopy(reason)}+ {why}</span></p></div>@@ -360,7 +377,6 @@ export function HighlightFeedRow({ item, position }: HighlightFeedRowProps): JSX</LemonButton>{similarCount > 0 && <HighlightFeedGroupToggle {...groupProps} />}</footer>- {similarCount > 0 && <HighlightFeedGroupList {...groupProps} />}</article>)}diff --git a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCustomizeButton.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCustomizeButton.tsxnew file mode 100644index 000000000000..91032d06d26f--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedCustomizeButton.tsx@@ -0,0 +1,72 @@+import { useActions, useValues } from 'kea'++import { IconGear } from '@posthog/icons'+import { LemonButton, LemonCheckbox, LemonDropdown } from '@posthog/lemon-ui'++import type { HighlightFeedCategoryEnumApi } from '../../generated/api.schemas'+import { FEED_CATEGORIES, highlightFeedLogic } from '../highlightFeedLogic'++const CATEGORY_COPY: Record<HighlightFeedCategoryEnumApi, { label: string; description: string }> = {+ failure: { label: 'Failures', description: 'Errors, failed requests, clicks that did nothing, dead ends.' },+ struggle: { label: 'Struggles', description: 'Repeated attempts, rage clicks, abandoned forms, workarounds.' },+ revenue: {+ label: 'Payment or checkout problems',+ description: 'Failed payments, cancellations and downgrades, usage limits.',+ },+}++export function HighlightFeedCustomizeButton(): JSX.Element {+ const { categories } = useValues(highlightFeedLogic)+ const { setCategories } = useActions(highlightFeedLogic)+ const customized = categories.length < FEED_CATEGORIES.length+ return (+ <LemonDropdown+ closeOnClickInside={false}+ placement="bottom-end"+ overlay={+ <div className="flex w-80 flex-col gap-3 p-2" data-attr="vision-highlight-feed-customize-menu">+ <div className="text-xs font-semibold uppercase text-secondary">Include sessions with</div>+ {FEED_CATEGORIES.map((category) => {+ const checked = categories.includes(category)+ return (+ <div key={category} className="flex flex-col gap-0.5">+ <LemonCheckbox+ label={<span className="font-medium">{CATEGORY_COPY[category].label}</span>}+ checked={checked}+ disabledReason={+ checked && categories.length === 1 ? 'Keep at least one kind on' : undefined+ }+ onChange={(value) =>+ setCategories(+ value ? [...categories, category] : categories.filter((c) => c !== category)+ )+ }+ data-attr={`vision-highlight-feed-category-${category}`}+ />+ <span className="pl-6 text-xs text-secondary">+ {CATEGORY_COPY[category].description}+ </span>+ </div>+ )+ })}+ </div>+ }+ >+ <LemonButton+ size="small"+ type="tertiary"+ icon={+ <span className="relative flex">+ <IconGear />+ {customized && (+ <span className="absolute -top-0.5 -right-0.5 size-2 rounded-full bg-accent" aria-hidden />+ )}+ </span>+ }+ tooltip={customized ? 'Customize feed (some kinds are hidden)' : 'Customize feed'}+ aria-label="Customize feed"+ data-attr="vision-highlight-feed-customize"+ />+ </LemonDropdown>+ )+}diff --git a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedDismissButton.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedDismissButton.tsxindex 77dc95d748e5..fbd7c85512dd 100644--- a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedDismissButton.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedDismissButton.tsx@@ -1,7 +1,6 @@+import { IconX } from '@posthog/icons'import { LemonButton, LemonMenu } from '@posthog/lemon-ui'-import { IconBlock } from 'lib/lemon-ui/icons'-import type { FeedDismissalReasonEnumApi } from '../../generated/api.schemas'import { feedDismissalMenuItems } from '../highlightFeedDismissal'@@ -15,7 +14,7 @@ export function HighlightFeedDismissButton({ onDismiss, className }: HighlightFe<LemonMenu placement="bottom-end" items={feedDismissalMenuItems(onDismiss)}><LemonButtonsize="xsmall"- icon={<IconBlock />}+ icon={<IconX />}tooltip="Not useful"aria-label="Not useful"className={className}diff --git a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedGroup.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedGroup.tsxindex fc043d930ccd..e0d798ed50c8 100644--- a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedGroup.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedGroup.tsx@@ -1,12 +1,14 @@import { useActions, useValues } from 'kea'import { combineUrl } from 'kea-router'+import { useState } from 'react'import { IconChevronDown, IconPlayFilled } from '@posthog/icons'-import { LemonButton, LemonSkeleton, Link } from '@posthog/lemon-ui'+import { LemonButton, LemonDropdown, LemonSkeleton, Link } from '@posthog/lemon-ui'import { TZLabel } from 'lib/components/TZLabel'import posthog from 'lib/posthog-typed'import { colonDelimitedDuration } from 'lib/utils/durations'+import { pluralize } from 'lib/utils/strings'import { urls } from 'scenes/urls'import { ObservationThumbnail } from '../../components/ObservationThumbnail'@@ -19,7 +21,22 @@ import { observationKeyMomentMs, highlightCardHeadline, highlightFeedObservation/** The card's telemetry properties, so group events join the card they came from. */type CardContext = Record<string, unknown>-type HighlightFeedGroupProps = HighlightFeedGroupLogicProps & { similarCount: number; cardContext: CardContext }+type HighlightFeedGroupProps = HighlightFeedGroupLogicProps & {+ similarCount: number+ /** Distinct people across the whole group, the card's own session included. */+ affectedPeople: number | null+ cardContext: CardContext+}++/** Shared by the card's reason line and its button, so the two always show the same count. */+export function similarSessionsLabel(similarCount: number): string {+ return pluralize(similarCount, 'similar session')+}++function groupSummary(similarCount: number, affectedPeople: number | null): string {+ const others = `This session and ${pluralize(similarCount, 'similar one')}`+ return affectedPeople ? `${others}, from ${pluralize(affectedPeople, 'person', 'people')}` : others+}function HighlightFeedGroupMember({observation,@@ -55,7 +72,7 @@ function HighlightFeedGroupMember({<div className="flex min-w-0 flex-1 flex-col gap-0.5"><Linkto={url}- className="truncate text-sm font-medium text-default"+ className="line-clamp-2 text-sm font-medium wrap-anywhere text-default"title={title}onClick={captureOpened('title')}>@@ -74,6 +91,7 @@ function HighlightFeedGroupMember({to={url}tooltip="Watch session"onClick={captureOpened('watch')}+ className="shrink-0">{keyMomentMs !== null ? colonDelimitedDuration(Math.floor(keyMomentMs / 1000), null) : null}</LemonButton>@@ -81,52 +99,17 @@ function HighlightFeedGroupMember({)}-/** Opens the other sessions in a card's feed group under the card, so a reader can see who else hit it. */-export function HighlightFeedGroupToggle({+function HighlightFeedGroupList({similarCount,+ affectedPeople,cardContext,...logicProps}: HighlightFeedGroupProps): JSX.Element {- const { expanded } = useValues(highlightFeedGroupLogic(logicProps))- const { toggleExpanded } = useActions(highlightFeedGroupLogic(logicProps))- return (- <LemonButton- size="small"- type="tertiary"- sideIcon={- <IconChevronDown className={expanded ? 'rotate-180 transition-transform' : 'transition-transform'} />- }- onClick={() => {- if (!expanded) {- posthog.capture('replay_vision_watch_group_expanded', {- ...cardContext,- similar_count: similarCount,- })- }- toggleExpanded()- }}- aria-expanded={expanded}- className="relative z-10 ml-auto"- data-attr="vision-highlight-feed-group-toggle"- >- {similarCount === 1 ? '1 similar session' : `${similarCount} similar sessions`}- </LemonButton>- )-}--export function HighlightFeedGroupList({- similarCount,- cardContext,- ...logicProps-}: HighlightFeedGroupProps): JSX.Element | null {- const { expanded, members, membersLoading } = useValues(highlightFeedGroupLogic(logicProps))+ const { 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-highlight-feed-group">+ <div className="flex w-[30rem] max-w-[90vw] flex-col gap-3 p-2" data-attr="vision-highlight-feed-group">+ <p className="m-0 text-xs text-secondary">{groupSummary(similarCount, affectedPeople)}</p>{membersLoading ? (<div className="flex flex-col gap-3" aria-busy>{Array.from({ length: Math.min(similarCount, 3) }, (_, i) => (@@ -157,6 +140,7 @@ export function HighlightFeedGroupList({tab: ReplayScannerTab.Observations,watch_group: logicProps.observationId,date_from: logicProps.dateFrom,+ watch_category: logicProps.categories,}).url}className="self-start text-sm"@@ -168,9 +152,55 @@ export function HighlightFeedGroupList({})}>- See all similar sessions+ See all {members.total} similar sessions</Link>)}</div>)}++/**+ * Opens the other sessions in a card's duplicate group in a popover, so a reader can see who else hit it+ * without the card growing and pushing its row out of line with the rest of the grid.+ */+export function HighlightFeedGroupToggle(props: HighlightFeedGroupProps): JSX.Element {+ const { similarCount, affectedPeople, cardContext, ...logicProps } = props+ // Mounted with the card, so members loaded once survive closing and reopening the popover.+ const { members, membersLoading } = useValues(highlightFeedGroupLogic(logicProps))+ const { loadMembers } = useActions(highlightFeedGroupLogic(logicProps))+ const [open, setOpen] = useState(false)+ return (+ <LemonDropdown+ visible={open}+ onVisibilityChange={(visible) => {+ if (visible) {+ posthog.capture('replay_vision_watch_group_expanded', {+ ...cardContext,+ similar_count: similarCount,+ })+ if (members === null && !membersLoading) {+ loadMembers()+ }+ }+ setOpen(visible)+ }}+ // A click on "Try again" must leave the list open to show the retried result.+ closeOnClickInside={false}+ placement="bottom-end"+ overlay={<HighlightFeedGroupList {...props} />}+ >+ <LemonButton+ size="small"+ type="tertiary"+ sideIcon={+ <IconChevronDown className={open ? 'rotate-180 transition-transform' : 'transition-transform'} />+ }+ aria-expanded={open}+ className="relative z-10 ml-auto"+ data-attr="vision-highlight-feed-group-toggle"+ >+ {similarSessionsLabel(similarCount)}+ </LemonButton>+ </LemonDropdown>+ )+}diff --git a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedHeader.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedHeader.tsxnew file mode 100644index 000000000000..90ae816418e8--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedHeader.tsx@@ -0,0 +1,70 @@+import clsx from 'clsx'+import { useActions, useValues } from 'kea'++import { IconChevronDown } from '@posthog/icons'+import { LemonButton, LemonMenu } from '@posthog/lemon-ui'++import { FEED_DATE_OPTIONS, feedWindowOption, highlightFeedLogic } from '../highlightFeedLogic'+import { HighlightFeedCustomizeButton } from './HighlightFeedCustomizeButton'++export function HighlightFeedHeader({ className }: { className?: string }): JSX.Element {+ const { dateFrom, scopedToMine, hasOwnScanners } = useValues(highlightFeedLogic)+ const { setDateFrom, setOnlyMyScanners } = useActions(highlightFeedLogic)+ return (+ <div className={clsx('flex flex-wrap items-end gap-x-4 gap-y-2', className)}>+ <div className="flex min-w-0 flex-col">+ <h3 className="m-0 text-base font-semibold">Sessions worth watching</h3>+ <p className="m-0 text-xs text-secondary">+ Picked from your scanners for signs of failures, struggles, or payment problems.+ </p>+ </div>+ <div className="ml-auto flex items-center gap-1">+ {/* Only someone who created a scanner has a "mine" to narrow to. */}+ {hasOwnScanners && (+ <LemonMenu+ items={[+ {+ label: 'All scanners',+ active: !scopedToMine,+ onClick: () => setOnlyMyScanners(false),+ 'data-attr': 'vision-highlight-feed-scope-all',+ },+ {+ label: 'My scanners',+ active: scopedToMine,+ onClick: () => setOnlyMyScanners(true),+ 'data-attr': 'vision-highlight-feed-scope-mine',+ },+ ]}+ >+ <LemonButton+ size="small"+ type="tertiary"+ sideIcon={<IconChevronDown />}+ data-attr="vision-highlight-feed-scope"+ >+ {scopedToMine ? 'My scanners' : 'All scanners'}+ </LemonButton>+ </LemonMenu>+ )}+ <LemonMenu+ items={FEED_DATE_OPTIONS.map((option) => ({+ label: option.label,+ active: option.value === dateFrom,+ onClick: () => setDateFrom(option.value),+ }))}+ >+ <LemonButton+ size="small"+ type="tertiary"+ sideIcon={<IconChevronDown />}+ data-attr="vision-highlight-feed-range"+ >+ {feedWindowOption(dateFrom)?.label ?? dateFrom}+ </LemonButton>+ </LemonMenu>+ <HighlightFeedCustomizeButton />+ </div>+ </div>+ )+}diff --git a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedTab.tsx b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedTab.tsxindex 8936534571c2..c7cfa83b8588 100644--- a/products/replay_vision/frontend/replay_scanners/components/HighlightFeedTab.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/HighlightFeedTab.tsx@@ -3,19 +3,24 @@ import { useActions, useValues } from 'kea'import { useEffect } from 'react'import { useInView } from 'react-intersection-observer'-import { IconChevronDown } from '@posthog/icons'-import { LemonButton, LemonMenu, LemonSkeleton, LemonTabs, Spinner } from '@posthog/lemon-ui'+import { LemonButton, LemonSkeleton, Spinner } from '@posthog/lemon-ui'import { isHighlightFeedBlock } from '../highlightFeedEmptyState'-import { FEED_DATE_OPTIONS, feedWindowOption, feedWindowPhrase, highlightFeedLogic } from '../highlightFeedLogic'+import { feedWindowPhrase, highlightFeedLogic } from '../highlightFeedLogic'import { HighlightFeedBlockedBanner } from './HighlightFeedBlockedBanner'import { FILLER_REASON_KINDS, HighlightFeedRow } from './HighlightFeedCard'import { HighlightFeedEmptyState } from './HighlightFeedEmptyState'+import { HighlightFeedHeader } from './HighlightFeedHeader'++/** Columns follow the scene's width, so cards stay a similar size and a wide window fills with them rather than empty margin. */+const FEED_GRID = 'grid grid-cols-1 items-start gap-4 @[72rem]:grid-cols-2 @[120rem]:grid-cols-3 @[176rem]:grid-cols-4'+/** A single column stays card-sized rather than stretching one poster across the whole scene. */+const FEED_WIDTH = 'mx-auto w-full max-w-3xl @[72rem]:max-w-none'function FeedSkeleton(): JSX.Element {return (- <div className="mx-auto flex w-full max-w-xl flex-col gap-4" aria-busy>- {[0, 1, 2].map((i) => (+ <div className={clsx(FEED_WIDTH, FEED_GRID)} aria-busy>+ {[0, 1, 2, 3].map((i) => (<LemonSkeleton key={i} className="h-80 rounded-lg" />))}</div>@@ -37,7 +42,7 @@ function FeedEnd({ itemCount }: { itemCount: number }): JSX.Element | null {if (feedMoreFailed) {return (- <div className="flex items-center gap-2 text-sm text-secondary border rounded p-4">+ <div className="col-span-full flex items-center gap-2 text-sm text-secondary border rounded p-4"><span>Couldn't load more sessions.</span><LemonButton size="small" type="secondary" onClick={() => loadMoreFeed({})}>Try again@@ -53,81 +58,32 @@ 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-highlight-feed-end">+ <p className="col-span-full 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 HighlightFeedTab(): JSX.Element {- const {- feedItems,- feedItemsLoading,- feedReloading,- feedLoad,- feedFailed,- dateFrom,- scopedToMine,- hasOwnScanners,- emptyReason,- } = useValues(highlightFeedLogic)- const { setDateFrom, setOnlyMyScanners, loadFeed } = useActions(highlightFeedLogic)+ const { feedItems, feedItemsLoading, feedReloading, feedLoad, feedFailed, dateFrom, emptyReason } =+ useValues(highlightFeedLogic)+ const { loadFeed } = useActions(highlightFeedLogic)const items = feedItems ?? []// Every card carrying a no-evidence reason means the window produced no findings. A feed that mixes a// finding with padding needs no explaining, so this stays off unless the whole feed is padding.const onlyFiller = items.length > 0 && items.every((item) => FILLER_REASON_KINDS.has(item.reason.kind))- const rangeMenu = (- <LemonMenu- items={FEED_DATE_OPTIONS.map((option) => ({- label: option.label,- active: option.value === dateFrom,- onClick: () => setDateFrom(option.value),- }))}- >- <LemonButton- size="small"- type="tertiary"- sideIcon={<IconChevronDown />}- data-attr="vision-highlight-feed-range"- >- {feedWindowOption(dateFrom)?.label ?? dateFrom}- </LemonButton>- </LemonMenu>- )-return (<div className="@container flex flex-col gap-4">- {/* The intro explains the feed on its own, and a project without scanners has no window to pick. */}- {!(emptyReason === 'no-scanners' && items.length === 0) && (- <div className="mx-auto flex w-full max-w-xl items-center justify-between gap-2 -mb-2">- <p className="text-sm text-secondary m-0">Sessions that stand out in your scanner results.</p>- {!hasOwnScanners && rangeMenu}- </div>- )}- {hasOwnScanners && (- <LemonTabs- size="small"- // The small size packs tabs two units apart below md, too tight for two labels this long.- 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-highlight-feed-scope"- tabs={[- { 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}- />- )}+ {/* The empty state explains the feed on its own, and a project without scanners has nothing to filter. */}+ {!(emptyReason === 'no-scanners' && items.length === 0) && <HighlightFeedHeader className={FEED_WIDTH} />}{/* The first render comes before the mount starts the load, and a filter change keeps the lastresult until the new one lands, so an empty screen is only drawn from a finished load. */}{(feedItems === null && !feedFailed) || (feedItemsLoading && items.length === 0) ? (<FeedSkeleton />) : (- <div className="relative mx-auto flex w-full max-w-xl flex-col gap-4">+ <div className={clsx(FEED_WIDTH, 'relative flex flex-col gap-4')}>{/* The last result stays while a filter change loads, dimmed so it doesn't read as the new one. */}{feedReloading && (<div@@ -158,7 +114,7 @@ export function HighlightFeedTab(): JSX.Element {)}{items.length > 0 ? (<div- className={clsx('flex flex-col gap-4 transition-opacity', feedReloading && 'opacity-40')}+ className={clsx(FEED_GRID, 'transition-opacity', feedReloading && 'opacity-40')}aria-busy={feedReloading}// `inert` keeps the stale cards out of keyboard reach; React 18 types lack the attribute.{...(feedReloading ? { inert: '' } : {})}@@ -166,7 +122,7 @@ export function HighlightFeedTab(): JSX.Element {{/* Three newest clips and nothing else is the answer, not a half-loaded feed, so say sorather than leaving the reader to infer it from three identical reason lines. */}{onlyFiller && (- <p className="text-sm text-secondary m-0">+ <p className="col-span-full text-sm text-secondary m-0">No sessions stood out {feedWindowPhrase(dateFrom)}. These are the newest ones.</p>)}@@ -180,12 +136,14 @@ export function HighlightFeedTab(): JSX.Element {<FeedEnd itemCount={items.length} /></div>) : feedFailed ? null : emptyReason ? (- <HighlightFeedEmptyState reason={emptyReason} />+ <div className="mx-auto w-full max-w-xl">+ <HighlightFeedEmptyState reason={emptyReason} />+ </div>) : (// 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// who has scanners.- <LemonSkeleton className="h-32 rounded" />+ <LemonSkeleton className="mx-auto h-32 w-full max-w-xl rounded" />)}</div>)}diff --git a/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.test.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.test.tsindex 53f2ccd65fc7..f99dd998cc36 100644--- a/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.test.ts@@ -14,20 +14,24 @@ describe('highlightFeedGroupLogic', () => {initKeaTests()})- it('loads the group once on first expand, without the card it hangs under', async () => {- const logic = highlightFeedGroupLogic({ observationId: 'card', scannerId: 'scanner-a', dateFrom: '-30d' })+ it('lists the group without the card it hangs under', async () => {+ const logic = highlightFeedGroupLogic({+ observationId: 'card',+ scannerId: 'scanner-a',+ dateFrom: '-30d',+ categories: 'failure',+ })logic.mount()expect(listSpy).not.toHaveBeenCalled()-- await expectLogic(logic, () => logic.actions.toggleExpanded()).toFinishAllListeners()+ await expectLogic(logic, () => logic.actions.loadMembers()).toFinishAllListeners()const params = new URL(listSpy.mock.calls[0][0].request.url).searchParams- expect([params.get('watch_group'), params.get('date_from')]).toEqual(['card', '-30d'])+ expect([params.get('watch_group'), params.get('date_from'), params.get('watch_category')]).toEqual([+ 'card',+ '-30d',+ 'failure',+ ])expect(logic.values.members?.shown.map((member) => member.id)).toEqual(['copy-1', 'copy-2'])expect(logic.values.members?.total).toBe(8)-- logic.actions.toggleExpanded()- await expectLogic(logic, () => logic.actions.toggleExpanded()).toFinishAllListeners()- expect(listSpy).toHaveBeenCalledTimes(1)logic.unmount()})})diff --git a/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.tsindex 802409ebf500..f20466017293 100644--- a/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedGroupLogic.ts@@ -1,4 +1,4 @@-import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers } from 'kea'+import { MakeLogicType, connect, kea, key, path, props } from 'kea'import { loaders } from 'kea-loaders'import { teamLogic } from 'scenes/teamLogic'@@ -11,19 +11,19 @@ export interface HighlightFeedGroupLogicProps {observationId: stringscannerId: stringdateFrom: string+ /** The feed's kinds as its `categories` value, unset when all are on. */+ categories?: string}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface highlightFeedGroupLogicValues {currentTeamId: number | null // teamLogic- expanded: booleanmembers: WatchGroupMembers | nullmembersLoading: boolean}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface highlightFeedGroupLogicActions {- toggleExpanded: () => { value: true }loadMembers: (_: void) => voidloadMembersFailure: (error: string,@@ -57,21 +57,15 @@ export type highlightFeedGroupLogicType = MakeLogicType</** 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. */+/** The other sessions in a feed card's feed group, loaded the first time the card's popover opens. */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}`),+ // The window and kinds are part of the key, so a change lists the matching sessions rather than the cached ones.+ key((props) => `${props.observationId}:${props.dateFrom}:${props.categories ?? ''}`),connect(() => ({values: [teamLogic, ['currentTeamId']],})),- actions({- toggleExpanded: true,- }),- reducers({- expanded: [false, { toggleExpanded: (expanded) => !expanded }],- }),loaders(({ props, values }) => ({members: [null as WatchGroupMembers | null,@@ -83,6 +77,7 @@ export const highlightFeedGroupLogic = kea<highlightFeedGroupLogicType>([const page = await visionScannersObservationsList(String(values.currentTeamId), props.scannerId, {watch_group: props.observationId,date_from: props.dateFrom,+ watch_category: props.categories,limit: WATCH_GROUP_PREVIEW_SIZE + 1,})// The card's own session already sits above the list.@@ -95,11 +90,4 @@ export const highlightFeedGroupLogic = kea<highlightFeedGroupLogicType>([},],})),- listeners(({ actions, values }) => ({- toggleExpanded: () => {- if (values.expanded && values.members === null && !values.membersLoading) {- actions.loadMembers()- }- },- })),])diff --git a/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.test.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.test.tsindex cd3fa6f7d310..b428c8c1efc7 100644--- a/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.test.ts@@ -92,6 +92,23 @@ describe('highlightFeedLogic', () => {.toDispatchActions(['loadFeed', 'loadFeedSuccess']).toFinishAllListeners()expect(new URL(feedSpy.mock.calls.at(-1)[0].request.url).searchParams.get('date_from')).toBe('-30d')++ const lastCategories = (): string | null =>+ new URL(feedSpy.mock.calls.at(-1)[0].request.url).searchParams.get('categories')+ expect(lastCategories()).toBeNull()+ await expectLogic(logic, () => {+ logic.actions.setCategories(['revenue', 'failure'])+ })+ .toDispatchActions(['loadFeed', 'loadFeedSuccess'])+ .toFinishAllListeners()+ expect(lastCategories()).toBe('failure,revenue')+ // Hiding every kind would send an empty filter the server rejects, so the feed shows them all.+ await expectLogic(logic, () => {+ logic.actions.setCategories([])+ })+ .toDispatchActions(['loadFeed', 'loadFeedSuccess'])+ .toFinishAllListeners()+ expect(lastCategories()).toBeNull()})it('names the empty reason only once the fleet and budget have answered', async () => {diff --git a/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.tsindex 65b7f56d90ad..9996d710dd1b 100644--- a/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/highlightFeedLogic.ts@@ -10,7 +10,11 @@ import { userLogic } from 'scenes/userLogic'import type { UserType } from '../../../../frontend/src/types'import { visionScannersHighlightFeedRetrieve } from '../generated/api'import type { ReplayScannerApi, VisionQuotaApi } from '../generated/api.schemas'-import type { VisionScannersHighlightFeedRetrieveParams, HighlightFeedItemApi } from '../generated/api.schemas'+import {+ type VisionScannersHighlightFeedRetrieveParams,+ HighlightFeedCategoryEnumApi,+ type HighlightFeedItemApi,+} from '../generated/api.schemas'import type { FeedDismissalReasonEnumApi } from '../generated/api.schemas'import { visionQuotaLogic } from '../logics/visionQuotaLogic'import { visionScannersListLogic } from '../logics/visionScannersListLogic'@@ -33,6 +37,7 @@ export interface highlightFeedLogicValues {quotaLoading: boolean // visionQuotaLogicscanners: ReplayScannerApi[] // visionScannersListLogicscannersLoading: boolean // visionScannersListLogic+ categories: HighlightFeedCategoryEnumApi[]dateFrom: stringemptyReason: HighlightFeedEmptyReason | nullfeedAsOf: string | null@@ -45,6 +50,7 @@ export interface highlightFeedLogicValues {feedReloading: booleanfeedServed: numberhasOwnScanners: boolean | null+ hiddenCategories: string[]onlyMyScanners: booleanscopedToMine: boolean}@@ -113,6 +119,9 @@ export interface highlightFeedLogicActions {item: HighlightFeedItemApiposition: number}+ setCategories: (categories: HighlightFeedCategoryEnumApi[]) => {+ categories: HighlightFeedCategoryEnumApi[]+ }setDateFrom: (dateFrom: string) => {dateFrom: string}@@ -136,6 +145,7 @@ export interface highlightFeedLogicActions {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface highlightFeedLogicMeta {__keaTypeGenInternalSelectorTypes: {+ categories: (hiddenCategories: string[]) => HighlightFeedCategoryEnumApi[]hasOwnScanners: (scanners: ReplayScannerApi[],scannersLoading: boolean,@@ -167,6 +177,8 @@ export const FEED_DATE_OPTIONS: { value: string; label: string }[] = [{ value: '-30d', label: 'Last 30 days' },{ value: '-90d', label: 'Last 90 days' },]+export const FEED_CATEGORIES: HighlightFeedCategoryEnumApi[] = Object.values(HighlightFeedCategoryEnumApi)+export function feedWindowOption(dateFrom: string): { value: string; label: string } | undefined {return FEED_DATE_OPTIONS.find((option) => option.value === dateFrom)}@@ -185,11 +197,20 @@ export function feedWindowPhrase(dateFrom: string): string {export const FEED_PAGE_SIZE = 20+/** The `categories` query value, left out when every kind is on so all-on shares the default cache. */+export function feedCategoriesParam(categories: HighlightFeedCategoryEnumApi[]): string | undefined {+ return categories.length < FEED_CATEGORIES.length ? categories.join(',') : undefined+}+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)}+ const categories = feedCategoriesParam(values.categories)+ if (categories) {+ params.categories = categories+ }return params}@@ -197,6 +218,7 @@ function reportFiltered(values: highlightFeedLogicValues): void {posthog.capture('replay_vision_highlight_feed_filtered', {date_from: values.dateFrom,only_my_scanners: values.scopedToMine,+ categories: values.categories,})}@@ -219,6 +241,7 @@ export const highlightFeedLogic = kea<highlightFeedLogicType>([actions({setDateFrom: (dateFrom: string) => ({ dateFrom }),+ setCategories: (categories: HighlightFeedCategoryEnumApi[]) => ({ categories }),setOnlyMyScanners: (onlyMyScanners: boolean) => ({ onlyMyScanners }),loadFeed: true,setFeedLoad: (load: HighlightFeedLoad) => ({ load }),@@ -357,6 +380,16 @@ export const highlightFeedLogic = kea<highlightFeedLogicType>([setOnlyMyScanners: (_, { onlyMyScanners }) => onlyMyScanners,},],+ // Keyed by team like the scope, since each project sells something different. Stores what is hidden, so a+ // kind added later shows up for everyone.+ hiddenCategories: [+ [] as string[],+ { persist: true, prefix: `${getCurrentTeamIdOrNone() ?? 'unknown'}__` },+ {+ setCategories: (_, { categories }) =>+ FEED_CATEGORIES.filter((category) => !categories.includes(category)),+ },+ ],feedFailed: [false,{@@ -403,6 +436,12 @@ export const highlightFeedLogic = kea<highlightFeedLogicType>([reportFiltered(values)actions.loadFeed()},+ // The menu stays open while boxes are ticked, so a burst of clicks waits for one request.+ setCategories: async (_, breakpoint) => {+ await breakpoint(300)+ reportFiltered(values)+ actions.loadFeed()+ },// The `scopedToMine` subscription reloads, so a tab switch sends one request.setOnlyMyScanners: () => {reportFiltered(values)@@ -420,6 +459,7 @@ export const highlightFeedLogic = kea<highlightFeedLogicType>([clip_count: items.length,scanner_count: new Set(items.map((item) => item.observation.scanner_id)).size,reason_kind_counts: countByReasonKind,+ categories: values.categories,// Which dead end the reader hit, so the empty screens can be counted and ranked// against each other instead of only showing up as a clip count of zero....(items.length === 0 ? { empty_reason: values.emptyReason ?? 'unresolved' } : {}),@@ -428,6 +468,14 @@ export const highlightFeedLogic = kea<highlightFeedLogicType>([})),selectors({+ // A stored value can name a kind this build no longer knows, and hiding every kind leaves nothing to show.+ categories: [+ (s) => [s.hiddenCategories],+ (hiddenCategories: string[]): HighlightFeedCategoryEnumApi[] => {+ const shown = FEED_CATEGORIES.filter((category) => !hiddenCategories.includes(category))+ return shown.length > 0 ? shown : FEED_CATEGORIES+ },+ ],/** Null until the scanner list answers, so the scope tabs never flash in and out. */hasOwnScanners: [(s) => [s.scanners, s.scannersLoading, s.user],diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.tsindex 48cdcc4f27e0..9f073af08ea3 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts@@ -1333,6 +1333,7 @@ describe('replayScannerLogic', () => {observationBackfillFilter: null as string | null,observationVariantFilter: null as string | null,observationWatchGroupFilter: null as string | null,+ observationWatchCategoryFilter: null as string | null,observationsSort: null,scanner: null,}diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.tsindex 791fa160f4af..dd41c34cf76a 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts@@ -273,6 +273,7 @@ interface ObservationListParams {backfill_id?: stringvariant?: stringwatch_group?: string+ watch_category?: stringverdict?: stringtags?: stringmin_score?: number@@ -317,6 +318,7 @@ interface ObservationFilterValues {observationBackfillFilter: string | nullobservationVariantFilter: string | nullobservationWatchGroupFilter: string | null+ observationWatchCategoryFilter: string | null}type ObservationFilterParamKeys =@@ -332,6 +334,7 @@ type ObservationFilterParamKeys =| 'backfill_id'| 'variant'| 'watch_group'+ | 'watch_category'/** The filter (non-pagination, non-sort) params shared by the list/stats endpoints and the URL query string. */function observationFilterParams(@@ -374,6 +377,9 @@ function observationFilterParams(if (values.observationWatchGroupFilter) {params.watch_group = values.observationWatchGroupFilter}+ if (values.observationWatchCategoryFilter) {+ params.watch_category = values.observationWatchCategoryFilter+ }return params}@@ -552,6 +558,7 @@ export interface replayScannerLogicValues {observationTriggeredByFilter: ObservationTriggeredByValue[]observationVariantFilter: string | nullobservationVerdictFilter: ObservationVerdictValue[]+ observationWatchCategoryFilter: string | nullobservationWatchGroupFilter: string | nullobservations: ReplayObservationApi[]observationsActive: boolean@@ -697,6 +704,7 @@ export interface replayScannerLogicActions {triggeredBy: ObservationTriggeredByValue[]variant: string | nullverdict: ObservationVerdictValue[]+ watchCategory: string | nullwatchGroup: string | null}) => {backfillId: string | null@@ -712,6 +720,7 @@ export interface replayScannerLogicActions {triggeredBy: ObservationTriggerEnumApi[]variant: string | nullverdict: ObservationVerdictValue[]+ watchCategory: string | nullwatchGroup: string | null}retryObservation: (observationId: string) => {@@ -974,6 +983,7 @@ export interface replayScannerLogicMeta {observationBackfillFilter: string | null,observationVariantFilter: string | null,observationWatchGroupFilter: string | null,+ observationWatchCategoryFilter: string | null,observationsSort: ObservationsSorting | null,scanner: ScannerFormValues) => Record<string, number | string>@@ -1077,6 +1087,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([backfillId: string | nullvariant: string | nullwatchGroup: string | null+ watchCategory: string | null}) => state,setChartDateRange: (dateFrom: string | null, dateTo: string | null) => ({ dateFrom, dateTo }),requestScannerEstimate: true,@@ -1648,6 +1659,15 @@ export const replayScannerLogic = kea<replayScannerLogicType>([restoreObservationsTableState: (_, { watchGroup }) => watchGroup,},],+ // Narrows a similar-sessions list to the kinds the Highlights feed showed, so it matches the card's count.+ observationWatchCategoryFilter: [+ null as string | null,+ {+ setObservationWatchGroupFilter: () => null,+ clearObservationFilters: () => null,+ restoreObservationsTableState: (_, { watchCategory }) => watchCategory,+ },+ ],chartDateFrom: ['-14d' as string | null, { setChartDateRange: (_, { dateFrom }) => dateFrom }],chartDateTo: [null as string | null, { setChartDateRange: (_, { dateTo }) => dateTo }],}),@@ -1764,6 +1784,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([s.observationBackfillFilter,s.observationVariantFilter,s.observationWatchGroupFilter,+ s.observationWatchCategoryFilter,s.observationsSort,s.scanner,],@@ -1781,6 +1802,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([observationBackfillFilter: string | null,observationVariantFilter: string | null,observationWatchGroupFilter: string | null,+ observationWatchCategoryFilter: string | null,observationsSort: ObservationsSorting | null,scanner: ReplayScanner | null): Record<string, string | number> => {@@ -1797,6 +1819,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([observationBackfillFilter,observationVariantFilter,observationWatchGroupFilter,+ observationWatchCategoryFilter,observationsSort,observationsPage,scanner,@@ -2794,6 +2817,8 @@ export const replayScannerLogic = kea<replayScannerLogicType>([const variant =typeof variantRaw === 'string' || typeof variantRaw === 'number' ? String(variantRaw) || null : nullconst watchGroup = typeof searchParams.watch_group === 'string' ? searchParams.watch_group : null+ const watchCategory =+ watchGroup && typeof searchParams.watch_category === 'string' ? searchParams.watch_category : nullconst sameAsCurrent =page === values.observationsPage &&sort.columnKey === values.observationsSort?.columnKey &&@@ -2809,7 +2834,8 @@ export const replayScannerLogic = kea<replayScannerLogicType>([dateTo === values.observationDateTo &&backfillId === values.observationBackfillFilter &&variant === values.observationVariantFilter &&- watchGroup === values.observationWatchGroupFilter+ watchGroup === values.observationWatchGroupFilter &&+ watchCategory === values.observationWatchCategoryFilterif (!sameAsCurrent) {actions.restoreObservationsTableState({page,@@ -2826,6 +2852,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([backfillId,variant,watchGroup,+ watchCategory,})}},diff --git a/products/replay_vision/frontend/replay_scanners/types.ts b/products/replay_vision/frontend/replay_scanners/types.tsindex 7ee0b80b918e..e066d92d8ed7 100644--- a/products/replay_vision/frontend/replay_scanners/types.ts+++ b/products/replay_vision/frontend/replay_scanners/types.ts@@ -46,6 +46,7 @@ export const OBSERVATION_LIST_FILTER_KEYS: readonly (keyof VisionObservationsRet'recording_subject','labeled','watch_group',+ 'watch_category','order_by',]@@ -69,6 +70,7 @@ export const OBSERVATION_LIST_URL_PARAM_KEYS = ['backfill_id','variant','watch_group',+ 'watch_category',] as constexport type ObservationsUrlParams = Partial<Record<(typeof OBSERVATION_LIST_URL_PARAM_KEYS)[number], string>>diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 022a9a062b05..c82120276775 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -142485,6 +142485,10 @@ export namespace Schemas {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string;+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string;/*** 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.*/@@ -142731,6 +142735,10 @@ export namespace Schemas {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string;+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string;/*** 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.*/@@ -142794,6 +142802,10 @@ export namespace Schemas {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string;+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string;/*** 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.*/@@ -142857,6 +142869,10 @@ export namespace Schemas {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string;+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string;/*** 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.*/@@ -142944,6 +142960,10 @@ export namespace Schemas {* Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).*/verdict?: string;+ /**+ * Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.+ */+ watch_category?: string;/*** 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.*/@@ -142955,6 +142975,11 @@ export namespace Schemas {* 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.*/as_of?: string;+ /**+ * Comma-separated kinds of moment to include: `failure` (errors, failed requests, dead ends), `struggle` (repeated attempts, rage clicks, abandoned forms), `revenue` (failed payments, cancellations, usage limits). Defaults to all three. A pick keeps its rank within its scanner, so leaving a kind out drops its sessions without promoting weaker ones.+ * @minLength 1+ */+ categories?: string;/*** Comma-separated user IDs. Restrict the feed to observations from scanners those users created.* @minLength 1diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.tsindex 9baa60e63d38..dd589074e67a 100644--- a/services/mcp/src/generated/replay_vision/api.ts+++ b/services/mcp/src/generated/replay_vision/api.ts@@ -513,6 +513,12 @@ export const VisionObservationsRetrieveQueryParams = () => zod.object({.string().optional().describe('Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).'),+ watch_category: zod+ .string()+ .optional()+ .describe(+ "Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`."+ ),watch_group: zod.string().optional()@@ -1589,6 +1595,12 @@ export const VisionScannersObservationsListQueryParams = () => zod.object({.string().optional().describe('Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).'),+ watch_category: zod+ .string()+ .optional()+ .describe(+ "Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`."+ ),watch_group: zod.string().optional()@@ -1679,6 +1691,12 @@ export const VisionScannersObservationsRetrieveQueryParams = () => zod.object({.string().optional().describe('Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).'),+ watch_category: zod+ .string()+ .optional()+ .describe(+ "Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`."+ ),watch_group: zod.string().optional()@@ -1768,6 +1786,12 @@ export const VisionScannersObservationsStatsRetrieveQueryParams = () => zod.obje.string().optional().describe('Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).'),+ watch_category: zod+ .string()+ .optional()+ .describe(+ "Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`."+ ),watch_group: zod.string().optional()@@ -2262,6 +2286,13 @@ export const VisionScannersHighlightFeedRetrieveQueryParams = () => zod.object({.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.'),+ categories: zod+ .string()+ .min(1)+ .optional()+ .describe(+ 'Comma-separated kinds of moment to include: `failure` (errors, failed requests, dead ends), `struggle` (repeated attempts, rage clicks, abandoned forms), `revenue` (failed payments, cancellations, usage limits). Defaults to all three. A pick keeps its rank within its scanner, so leaving a kind out drops its sessions without promoting weaker ones.'+ ),created_by: zod.string().min(1)diff --git a/services/mcp/src/tools/generated/replay_vision.ts b/services/mcp/src/tools/generated/replay_vision.tsindex bc05a7772106..062a28542da7 100644--- a/services/mcp/src/tools/generated/replay_vision.ts+++ b/services/mcp/src/tools/generated/replay_vision.ts@@ -391,6 +391,7 @@ const visionObservationsGet = (): ToolBase<triggered_by: params.triggered_by,variant: params.variant,verdict: params.verdict,+ watch_category: params.watch_category,watch_group: params.watch_group,},})@@ -1140,6 +1141,7 @@ const visionScannersHighlightFeed = (): ToolBase<path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/scanners/highlight_feed/`,query: {as_of: params.as_of,+ categories: params.categories,created_by: params.created_by,date_from: params.date_from,date_to: params.date_to,@@ -1310,6 +1312,7 @@ const visionScannersObservationsGet = (): ToolBase<triggered_by: params.triggered_by,variant: params.variant,verdict: params.verdict,+ watch_category: params.watch_category,watch_group: params.watch_group,},})@@ -1357,6 +1360,7 @@ const visionScannersObservationsList = (): ToolBase<triggered_by: params.triggered_by,variant: params.variant,verdict: params.verdict,+ watch_category: params.watch_category,watch_group: params.watch_group,},})@@ -1416,6 +1420,7 @@ const visionScannersObservationsStats = (): ToolBase<triggered_by: params.triggered_by,variant: params.variant,verdict: params.verdict,+ watch_category: params.watch_category,watch_group: params.watch_group,},})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.jsonindex b78a4d026850..416fc963ce57 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@@ -61,6 +61,10 @@"description": "Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).","type": "string"},+ "watch_category": {+ "description": "Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.",+ "type": "string"+ },"watch_group": {"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-highlight-feed.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-highlight-feed.jsonindex b276d2848e77..ec26dc317abf 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-highlight-feed.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-highlight-feed.json@@ -7,6 +7,11 @@"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","type": "string"},+ "categories": {+ "description": "Comma-separated kinds of moment to include: `failure` (errors, failed requests, dead ends), `struggle` (repeated attempts, rage clicks, abandoned forms), `revenue` (failed payments, cancellations, usage limits). Defaults to all three. A pick keeps its rank within its scanner, so leaving a kind out drops its sessions without promoting weaker ones.",+ "minLength": 1,+ "type": "string"+ },"created_by": {"description": "Comma-separated user IDs. Restrict the feed to observations from scanners those users created.","minLength": 1,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.jsonindex ae5a921731ab..9980e9a7310c 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@@ -64,6 +64,10 @@"description": "Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).","type": "string"},+ "watch_category": {+ "description": "Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.",+ "type": "string"+ },"watch_group": {"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.jsonindex 0218e391b0ac..ccfffbb2a6b0 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@@ -68,6 +68,10 @@"description": "Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).","type": "string"},+ "watch_category": {+ "description": "Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.",+ "type": "string"+ },"watch_group": {"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.jsonindex b0aa3502f378..cb2993a4d2fb 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@@ -60,6 +60,10 @@"description": "Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).","type": "string"},+ "watch_category": {+ "description": "Only observations the watch feed ranks under any of these kinds (comma-separated: failure, struggle, revenue). Pair it with `watch_group` and the feed's `categories`.",+ "type": "string"+ },"watch_group": {"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"