:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(visual-review): page run snapshots in sql and load only changes (#109779)
Julian Bez2d2d2587e32b
diff --git a/products/visual_review/backend/facade/api.py b/products/visual_review/backend/facade/api.pyindex 7b371dc10980..c9308b3998dd 100644--- a/products/visual_review/backend/facade/api.py+++ b/products/visual_review/backend/facade/api.py@@ -608,32 +608,40 @@ def get_run_scope(run_id: UUID, team_id: int) -> contracts.RunScope:def get_run_snapshots(- run_id: UUID, team_id: int | None = None, include_quarantined: bool = True+ run_id: UUID,+ team_id: int | None = None,+ include_quarantined: bool = True,+ exclude_unchanged: bool = False,+ snapshot_id: UUID | None = None,+ limit: int | None = None,+ offset: int = 0,) -> contracts.RunSnapshots:+ """One page of a run's snapshots. `limit=None` returns every match from `offset` on.++ Filtering and paging stay in SQL, and only the page becomes DTOs, because each DTO+ signs a download URL per artifact and a large run holds thousands of rows.+ """if not include_quarantined and team_id is None:raise ValueError("team_id is required to exclude quarantined snapshots")- snapshots = run_queries.get_run_snapshots(run_id, team_id=team_id)- if not snapshots:- return contracts.RunSnapshots(snapshots=[], quarantined_count=0)- repo_id = snapshots[0].run.repo_id- run_type = snapshots[0].run.run_type- quarantined_identifiers = (- {q.identifier for q in quarantine.list_quarantined_identifiers(repo_id, team_id, run_type=run_type)}- if team_id is not None- else set()- )- user_ids = {s.reviewed_by_id for s in snapshots if s.reviewed_by_id}- user_basic_infos = _fetch_user_basic_infos(user_ids)- dtos: list[contracts.Snapshot] = []+ run = run_queries.get_run(run_id, team_id=team_id)+ snapshots = run_queries.run_snapshots(run, exclude_unchanged=exclude_unchanged, snapshot_id=snapshot_id)+quarantined_count = 0- for s in snapshots:- dto = _to_snapshot(s, repo_id, user_basic_infos)- if dto.identifier in quarantined_identifiers:- quarantined_count += 1- if not include_quarantined:- continue- dtos.append(dto)- return contracts.RunSnapshots(snapshots=dtos, quarantined_count=quarantined_count)+ if team_id is not None:+ quarantined = quarantine.active_quarantined_identifiers(run.repo_id, team_id, run.run_type, using=snapshots.db)+ quarantined_count = snapshots.filter(identifier__in=quarantined).count()+ if not include_quarantined:+ snapshots = snapshots.exclude(identifier__in=quarantined)++ total_count = snapshots.count()+ page = list(snapshots[offset : offset + limit if limit is not None else None])+ user_ids = {s.reviewed_by_id for s in page if s.reviewed_by_id}+ user_basic_infos = _fetch_user_basic_infos(user_ids)+ return contracts.RunSnapshots(+ snapshots=[_to_snapshot(s, run.repo_id, user_basic_infos) for s in page],+ quarantined_count=quarantined_count,+ total_count=total_count,+ )def _to_history_entry(entry, repo_id: UUID) -> contracts.SnapshotHistoryEntry:diff --git a/products/visual_review/backend/facade/contracts.py b/products/visual_review/backend/facade/contracts.pyindex b8a6b0e9d22f..578a3a43e08f 100644--- a/products/visual_review/backend/facade/contracts.py+++ b/products/visual_review/backend/facade/contracts.py@@ -311,15 +311,17 @@ class Snapshot:@dataclass(frozen=True)class RunSnapshots:- """A run's snapshots plus the count of its currently-quarantined identifiers.+ """One page of a run's snapshots plus the counts a caller needs around it.- `quarantined_count` always reflects the full run regardless of whether- quarantined snapshots were filtered out of `snapshots`, so callers can- surface "N hidden" without a second fetch.+ `quarantined_count` counts the quarantined snapshots that match the other+ filters, whether or not they were left out of `snapshots`, so callers can+ surface "N hidden" without a second fetch. `total_count` counts every+ snapshot that matches the filters, across all pages."""snapshots: list[Snapshot]quarantined_count: int+ total_count: int@dataclass(frozen=True)diff --git a/products/visual_review/backend/logic/quarantine.py b/products/visual_review/backend/logic/quarantine.pyindex e4dfccd4f7be..7dba06587497 100644--- a/products/visual_review/backend/logic/quarantine.py+++ b/products/visual_review/backend/logic/quarantine.py@@ -7,7 +7,7 @@ from datetime import datetime, timedeltafrom uuid import UUIDfrom django.db import transaction-from django.db.models import Q+from django.db.models import Q, QuerySetfrom django.utils import timezonefrom ..db import READER_DB, WRITER_DB@@ -45,6 +45,22 @@ def list_quarantined_identifiers(return list(qs.order_by("-created_at"))+def active_quarantined_identifiers(+ repo_id: UUID, team_id: int, run_type: str, using: str+) -> QuerySet[QuarantinedIdentifier, str]:+ """Identifiers under an active quarantine, as a subquery that filters snapshot rows in SQL.++ `using` must name the database of the outer query, because Django refuses a subquery+ across database aliases.+ """+ return (+ QuarantinedIdentifier.objects.using(using)+ .filter(repo_id=repo_id, team_id=team_id, run_type=run_type)+ .filter(Q(expires_at__isnull=True) | Q(expires_at__gt=timezone.now()))+ .values_list("identifier", flat=True)+ )++def expiry_soon_cutoff(now: datetime, within_days: int = FLAKINESS_EXPIRY_SOON_DAYS) -> datetime:"""The moment past which an expiry is close enough that somebody has to decide about it."""return now + timedelta(days=within_days)diff --git a/products/visual_review/backend/logic/run_queries.py b/products/visual_review/backend/logic/run_queries.pyindex f0c7a32899ff..7561efac2090 100644--- a/products/visual_review/backend/logic/run_queries.py+++ b/products/visual_review/backend/logic/run_queries.py@@ -144,16 +144,25 @@ def get_run_with_snapshots(run_id: UUID, team_id: int | None = None) -> Run:raise errors.RunNotFoundError(f"Run {run_id} not found") from e-def get_run_snapshots(run_id: UUID, team_id: int | None = None) -> list[RunSnapshot]:- run = get_run(run_id, team_id=team_id)- return list(- run.snapshots.select_related("current_artifact", "baseline_artifact", "diff_artifact").order_by(- db_models.Case(- db_models.When(result=SnapshotResult.UNCHANGED, then=1),- default=0,- ),- "identifier",- )+def run_snapshots(+ run: Run, exclude_unchanged: bool = False, snapshot_id: UUID | None = None+) -> db_models.QuerySet[RunSnapshot]:+ """A run's snapshots with their artifacts joined, actionable results first.++ Returns a queryset so the caller filters and pages in SQL. A large run holds thousands of+ rows, and each row costs a presigned URL per artifact once it becomes a DTO.+ """+ qs = run.snapshots.select_related("current_artifact", "baseline_artifact", "diff_artifact")+ if exclude_unchanged:+ qs = qs.exclude(result=SnapshotResult.UNCHANGED)+ if snapshot_id is not None:+ qs = qs.filter(id=snapshot_id)+ return qs.order_by(+ db_models.Case(+ db_models.When(result=SnapshotResult.UNCHANGED, then=1),+ default=0,+ ),+ "identifier",)diff --git a/products/visual_review/backend/presentation/serializers.py b/products/visual_review/backend/presentation/serializers.pyindex a9a1cc78bf65..d5d55df2d9da 100644--- a/products/visual_review/backend/presentation/serializers.py+++ b/products/visual_review/backend/presentation/serializers.py@@ -621,6 +621,32 @@ class FlakinessOverviewSerializer(DataclassSerializer):dataclass = FlakinessOverview+class RunSnapshotsQuerySerializer(serializers.Serializer):+ include_quarantined = serializers.BooleanField(+ default=False,+ help_text=(+ "Whether to include snapshots whose identifier is currently quarantined. "+ "Defaults to false: quarantined snapshots are excluded from results and reported "+ "in quarantined_count instead, since they are noise when reviewing real changes."+ ),+ )+ exclude_unchanged = serializers.BooleanField(+ default=False,+ help_text=(+ "Whether to leave out snapshots whose result is `unchanged`. Defaults to false. "+ "Pass true to list only the changed, new and removed snapshots, which is what a "+ "review needs. A large run holds thousands of unchanged snapshots and few changes."+ ),+ )+ snapshot_id = serializers.UUIDField(+ required=False,+ help_text=(+ "Return only the snapshot with this id, read from the `id` field of a snapshot in "+ "the run. Use it to fetch one snapshot without listing the whole run."+ ),+ )++class TolerationPileupsQuerySerializer(serializers.Serializer):min_tolerations = serializers.IntegerField(default=VARIANT_PILEUP_MIN,diff --git a/products/visual_review/backend/presentation/views.py b/products/visual_review/backend/presentation/views.pyindex 6d0c10dbb05d..4d8002c329e7 100644--- a/products/visual_review/backend/presentation/views.py+++ b/products/visual_review/backend/presentation/views.py@@ -21,11 +21,11 @@ from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schefrom rest_framework import status, viewsetsfrom rest_framework.decorators import actionfrom rest_framework.exceptions import ValidationError-from rest_framework.pagination import LimitOffsetPaginationfrom rest_framework.request import Requestfrom rest_framework.response import Responsefrom posthog.api.mixins import TypedRequest, validated_request+from posthog.api.pagination import PrecountedLimitOffsetPaginationfrom posthog.api.routing import TeamAndOrgViewSetMixinfrom posthog.auth import is_mcp_requestfrom posthog.helpers.trigram_search import MAX_SEARCH_LENGTH@@ -62,6 +62,7 @@ from .serializers import (RepoSerializer,ReviewStateCountsSerializer,RunSerializer,+ RunSnapshotsQuerySerializer,SnapshotHistoryEntrySerializer,SnapshotSerializer,ToleratedHashEntrySerializer,@@ -126,10 +127,11 @@ _MISSING_IDENTIFIER_DETAIL = ()-class SnapshotsPagination(LimitOffsetPagination):+class SnapshotsPagination(PrecountedLimitOffsetPagination):"""Adds quarantined_count to the paginated snapshots envelope so a client can- show "N quarantined hidden" without a second request. The action sets- `quarantined_count` on the paginator instance before rendering the response."""+ show "N quarantined hidden" without a second request. The action pages in SQL+ through the facade, then sets the total and `quarantined_count` on the paginator+ instance before rendering the response."""quarantined_count = 0@@ -143,8 +145,8 @@ class SnapshotsPagination(LimitOffsetPagination):schema["properties"]["quarantined_count"] = {"type": "integer","description": (- "Count of this run's snapshots whose identifier is currently quarantined. "- "Excluded from results unless include_quarantined=true is passed."+ "Count of this run's snapshots that match the other filters and whose identifier "+ "is currently quarantined. Excluded from results unless include_quarantined=true is passed."),}return schema@@ -615,33 +617,31 @@ class RunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):return Response({"detail": "Run not found"}, status=status.HTTP_404_NOT_FOUND)return Response(RunSerializer(instance=run).data)- @extend_schema(- parameters=[- OpenApiParameter(- "include_quarantined",- OpenApiTypes.BOOL,- description=(- "Whether to include snapshots whose identifier is currently quarantined. "- "Defaults to false: quarantined snapshots are excluded from results and reported "- "in quarantined_count instead, since they are noise when reviewing real changes."- ),- ),- ],+ @validated_request(+ query_serializer=RunSnapshotsQuerySerializer,responses={200: SnapshotSerializer(many=True)},)@action(detail=True, methods=["get"], pagination_class=SnapshotsPagination)- def snapshots(self, request: Request, pk: str, **kwargs) -> Response:+ def snapshots(self, request: TypedRequest, pk: str, **kwargs) -> Response:"""Get a run's snapshots with diff results, excluding quarantined ones by default."""- include_quarantined = request.query_params.get("include_quarantined", "").lower() in ("1", "true")+ query = request.validated_query_data+ paginator = cast(SnapshotsPagination, self.paginator)try:result = api.get_run_snapshots(- _parse_uuid(pk), team_id=self.team_id, include_quarantined=include_quarantined+ _parse_uuid(pk),+ team_id=self.team_id,+ include_quarantined=query["include_quarantined"],+ exclude_unchanged=query["exclude_unchanged"],+ snapshot_id=query.get("snapshot_id"),+ limit=paginator.get_limit(request),+ offset=paginator.get_offset(request),)except api.RunNotFoundError:return Response({"detail": "Run not found"}, status=status.HTTP_404_NOT_FOUND)+ paginator.set_count(result.total_count)+ paginator.quarantined_count = result.quarantined_countpage = self.paginate_queryset(result.snapshots)if page is not None:- cast(SnapshotsPagination, self.paginator).quarantined_count = result.quarantined_countserializer = SnapshotSerializer(instance=page, many=True)return self.get_paginated_response(serializer.data)return Response(SnapshotSerializer(instance=result.snapshots, many=True).data)diff --git a/products/visual_review/backend/tests/logic/test_run_queries.py b/products/visual_review/backend/tests/logic/test_run_queries.pyindex 26f89b50ed54..faa377ad39f6 100644--- a/products/visual_review/backend/tests/logic/test_run_queries.py+++ b/products/visual_review/backend/tests/logic/test_run_queries.py@@ -32,7 +32,7 @@ class TestGetRunSnapshots:team_id=repo.team_id,)- snapshots = run_queries.get_run_snapshots(run.id)+ snapshots = list(run_queries.run_snapshots(run))assert len(snapshots) == 3# Should be ordered by identifierdiff --git a/products/visual_review/backend/tests/test_presentation.py b/products/visual_review/backend/tests/test_presentation.pyindex 7ee03f006e83..fe83bd320bb7 100644--- a/products/visual_review/backend/tests/test_presentation.py+++ b/products/visual_review/backend/tests/test_presentation.py@@ -249,13 +249,7 @@ class TestRunViewSet(VisualReviewTeamScopedTestMixin, APIBaseTest):self.assertEqual(row_shift["bands"], [{"y": 210, "rows": 1, "kind": "inserted"}])self.assertIsNone(by_identifier["Card"]["row_shift"])- @parameterized.expand(- [- ("excluded_by_default", "", {"Card"}),- ("included_when_requested", "?include_quarantined=true", {"Button", "Card"}),- ]- )- def test_get_run_snapshots_quarantine_visibility(self, _name, query, expected_identifiers):+ def _create_run_with_results(self, results: dict[str, str]) -> tuple[str, dict[str, str]]:create_result = api.create_run(CreateRunInput(repo_id=self.vr_project.id,@@ -263,12 +257,46 @@ class TestRunViewSet(VisualReviewTeamScopedTestMixin, APIBaseTest):commit_sha="abc123",branch="main",snapshots=[- SnapshotManifestItem(identifier="Button", content_hash="h1"),- SnapshotManifestItem(identifier="Card", content_hash="h2"),+ SnapshotManifestItem(identifier=identifier, content_hash=f"hash-{identifier}")+ for identifier in results],),team_id=self.team.id,)+ run_id = str(create_result.run_id)+ for identifier, result in results.items():+ artifact, _ = artifact_store.get_or_create_artifact(+ repo_id=self.vr_project.id,+ content_hash=f"hash-{identifier}",+ storage_path=f"visual_review/hash-{identifier}",+ )+ RunSnapshot.objects.filter(run_id=run_id, identifier=identifier).update(+ result=result, current_artifact=artifact+ )+ snapshot_ids = {+ str(identifier): str(snapshot_id)+ for identifier, snapshot_id in RunSnapshot.objects.filter(run_id=run_id).values_list("identifier", "id")+ }+ return run_id, snapshot_ids++ @parameterized.expand(+ [+ ("quarantined_excluded_by_default", {}, {"Card", "Dialog"}, 1),+ ("quarantined_included_when_requested", {"include_quarantined": "true"}, {"Button", "Card", "Dialog"}, 1),+ (+ "unchanged_excluded",+ {"include_quarantined": "true", "exclude_unchanged": "true"},+ {"Button", "Card"},+ 1,+ ),+ ("unchanged_and_quarantined_excluded", {"exclude_unchanged": "true"}, {"Card"}, 1),+ ("one_snapshot_by_id", {"include_quarantined": "true", "snapshot_id": "Dialog"}, {"Dialog"}, 0),+ ]+ )+ def test_get_run_snapshots_filters(self, _name, params, expected_identifiers, expected_quarantined_count):+ run_id, snapshot_ids = self._create_run_with_results(+ {"Button": SnapshotResult.CHANGED, "Card": SnapshotResult.CHANGED, "Dialog": SnapshotResult.UNCHANGED}+ )quarantine.quarantine_identifier(repo_id=self.vr_project.id,identifier="Button",@@ -277,15 +305,38 @@ class TestRunViewSet(VisualReviewTeamScopedTestMixin, APIBaseTest):user_id=self.user.id,team_id=self.team.id,)+ if "snapshot_id" in params:+ params = {**params, "snapshot_id": snapshot_ids[params["snapshot_id"]]}response = self.client.get(- f"/api/projects/{self.team.id}/visual_review/runs/{create_result.run_id}/snapshots/{query}"+ f"/api/projects/{self.team.id}/visual_review/runs/{run_id}/snapshots/?{urlencode(params)}")assert response.status_code == status.HTTP_200_OKdata = response.json()assert {s["identifier"] for s in data["results"]} == expected_identifiers- assert data["quarantined_count"] == 1+ assert data["count"] == len(expected_identifiers)+ assert data["quarantined_count"] == expected_quarantined_count++ @patch(+ "products.visual_review.backend.storage.ArtifactStorage.get_presigned_download_url",+ return_value="https://s3.example.com/download",+ )+ def test_get_run_snapshots_signs_urls_only_for_the_page(self, mock_presigned_download):+ run_id, _ = self._create_run_with_results(+ {"Button": SnapshotResult.CHANGED, "Card": SnapshotResult.UNCHANGED, "Dialog": SnapshotResult.UNCHANGED}+ )++ response = self.client.get(+ f"/api/projects/{self.team.id}/visual_review/runs/{run_id}/snapshots/?limit=1&offset=1"+ )++ assert response.status_code == status.HTTP_200_OK+ data = response.json()+ assert data["count"] == 3+ assert [s["identifier"] for s in data["results"]] == ["Card"]+ assert data["next"] is not None+ assert mock_presigned_download.call_count == 1@patch("products.visual_review.backend.tasks.tasks.process_run_diffs.delay")def test_complete_run_no_changes(self, mock_delay):diff --git a/products/visual_review/frontend/generated/api.schemas.ts b/products/visual_review/frontend/generated/api.schemas.tsindex d75b0394aa1b..67d335d52844 100644--- a/products/visual_review/frontend/generated/api.schemas.ts+++ b/products/visual_review/frontend/generated/api.schemas.ts@@ -655,7 +655,7 @@ export interface PaginatedSnapshotListApi {/** @nullable */previous?: string | nullresults: SnapshotApi[]- /** Count of this run's snapshots whose identifier is currently quarantined. Excluded from results unless include_quarantined=true is passed. */+ /** Count of this run's snapshots that match the other filters and whose identifier is currently quarantined. Excluded from results unless include_quarantined=true is passed. */quarantined_count?: number}@@ -836,6 +836,10 @@ export type VisualReviewRunsSnapshotHistoryListParams = {}export type VisualReviewRunsSnapshotsListParams = {+ /**+ * Whether to leave out snapshots whose result is `unchanged`. Defaults to false. Pass true to list only the changed, new and removed snapshots, which is what a review needs. A large run holds thousands of unchanged snapshots and few changes.+ */+ exclude_unchanged?: boolean/*** Whether to include snapshots whose identifier is currently quarantined. Defaults to false: quarantined snapshots are excluded from results and reported in quarantined_count instead, since they are noise when reviewing real changes.*/@@ -848,6 +852,10 @@ export type VisualReviewRunsSnapshotsListParams = {* The initial index from which to return the results.*/offset?: number+ /**+ * Return only the snapshot with this id, read from the `id` field of a snapshot in the run. Use it to fetch one snapshot without listing the whole run.+ */+ snapshot_id?: string}export type VisualReviewRunsToleratedHashesListParams = {diff --git a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsxindex f62a1832b2a1..61b5f13821b4 100644--- a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx+++ b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx@@ -217,7 +217,9 @@ export function VisualReviewRunScene(): JSX.Element {run,snapshots,snapshotsLoading,+ deepLinkedSnapshotLoading,selectedSnapshot,+ selectedSnapshotId,sortedChangedSnapshots,toleratedHashes,toleratedHashesLoading,@@ -249,18 +251,15 @@ export function VisualReviewRunScene(): JSX.Element {setAddImagesToComment,} = useActions(visualReviewRunSceneLogic)- // Navigation — use changed snapshots when there are changes, otherwise all snapshots- const navSnapshots = sortedChangedSnapshots.length > 0 ? sortedChangedSnapshots : snapshots-- const quarantinedNavCount = navSnapshots.filter((s: SnapshotApi) =>+ const quarantinedNavCount = sortedChangedSnapshots.filter((s: SnapshotApi) =>quarantinedIdentifierSet.has(s.identifier)).lengthconst isHiddenQuarantined = (s: SnapshotApi): boolean =>quarantinedIdentifierSet.has(s.identifier) && s.id !== selectedSnapshot?.idconst visibleNavSnapshots = showQuarantinedThumbnails- ? navSnapshots- : navSnapshots.filter((s: SnapshotApi) => !isHiddenQuarantined(s))- const hiddenQuarantinedCount = navSnapshots.length - visibleNavSnapshots.length+ ? sortedChangedSnapshots+ : sortedChangedSnapshots.filter((s: SnapshotApi) => !isHiddenQuarantined(s))+ const hiddenQuarantinedCount = sortedChangedSnapshots.length - visibleNavSnapshots.lengthconst showQuarantinedToggle = quarantinedNavCount > 0 && (hiddenQuarantinedCount > 0 || showQuarantinedThumbnails)// Navigate over what's actually visible — when quarantined items are hidden, next/previous@@ -338,7 +337,6 @@ export function VisualReviewRunScene(): JSX.Element {const initialSnapshotsLoading = snapshotsLoading && snapshots.length === 0- // Review summary (from loaded snapshots — paginated but covers actionable ones first)// Quarantined snapshots don't need review — exclude from pending countconst reviewPending = snapshots.filter((s: SnapshotApi) =>@@ -518,7 +516,7 @@ export function VisualReviewRunScene(): JSX.Element {)}</div>- {navSnapshots.length > 0 && (+ {sortedChangedSnapshots.length > 0 && (<div className="flex gap-1.5 overflow-x-auto px-3 pb-3">{visibleNavSnapshots.map((snapshot: SnapshotApi) => {const hasThumbnail = thumbnailBasePath && !failedThumbnails.has(snapshot.identifier)@@ -543,7 +541,7 @@ export function VisualReviewRunScene(): JSX.Element {)}{/* Pagination — below thumbnails, right-aligned */}- {(showQuarantinedToggle || navSnapshots.length > 1) && (+ {(showQuarantinedToggle || sortedChangedSnapshots.length > 1) && (<divclassName={`flex items-center gap-2 px-3 pb-2 ${showQuarantinedToggle ? 'justify-between' : 'justify-end'@@ -630,11 +628,16 @@ export function VisualReviewRunScene(): JSX.Element {(!allChangesResolved ? 'Re-trigger would not change the outcome' : undefined)}/>- ) : snapshotsLoading ? (+ ) : snapshotsLoading || deepLinkedSnapshotLoading ? (<div className="space-y-3 py-4"><LemonSkeleton className="h-6 w-1/4" /><LemonSkeleton className="h-48 w-full" /></div>+ ) : selectedSnapshotId ? (+ <div className="text-center text-muted py-8">+ Couldn't load this snapshot. It may not belong to this run. Pick a snapshot from the list+ above, or reload the page.+ </div>) : sortedChangedSnapshots.length > 0 ? (<div className="text-center text-muted py-8">Select a snapshot to view details</div>) : (diff --git a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.test.ts b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.test.tsindex f37f57ae6c1b..11606b0aa88f 100644--- a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.test.ts+++ b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.test.ts@@ -7,6 +7,9 @@ import { visualReviewRunSceneLogic } from './visualReviewRunSceneLogic'const RUN_ID = '00000000-0000-0000-0000-0000000000aa'const TOLERATED_URL = `/api/projects/:team_id/visual_review/runs/${RUN_ID}/tolerated-hashes/`+const SNAPSHOTS_URL = `/api/projects/:team_id/visual_review/runs/${RUN_ID}/snapshots/`+const CHANGED_SNAPSHOT = { id: 'snapshot-changed', identifier: 'changed', result: 'changed' }+const UNCHANGED_SNAPSHOT = { id: 'snapshot-unchanged', identifier: 'unchanged', result: 'unchanged' }const toleratedToday = (index: number): Record<string, unknown> => ({id: `tolerated-${index}`,@@ -26,7 +29,7 @@ describe('visualReviewRunSceneLogic', () => {useMocks({get: {[`/api/projects/:team_id/visual_review/runs/${RUN_ID}/`]: [404, {}],- [`/api/projects/:team_id/visual_review/runs/${RUN_ID}/snapshots/`]: [404, {}],+ [SNAPSHOTS_URL]: [404, {}],[TOLERATED_URL]: async ({ request }) => {const identifier = new URL(request.url).searchParams.get('identifier')if (identifier === 'other') {@@ -64,6 +67,98 @@ describe('visualReviewRunSceneLogic', () => {.toMatchValues({ recentTolerations: { manual: 0, agent: 0, auto: 0 } })})+ it('loads a deep-linked snapshot that the changes-only list leaves out', async () => {+ useMocks({+ get: {+ [SNAPSHOTS_URL]: ({ request }) => {+ const params = new URL(request.url).searchParams+ const results =+ params.get('snapshot_id') === UNCHANGED_SNAPSHOT.id+ ? [UNCHANGED_SNAPSHOT]+ : params.get('exclude_unchanged') === 'true'+ ? [CHANGED_SNAPSHOT]+ : [CHANGED_SNAPSHOT, UNCHANGED_SNAPSHOT]+ return [200, { count: results.length, next: null, previous: null, results }]+ },+ },+ })+ logic.actions.setSelectedSnapshotId(UNCHANGED_SNAPSHOT.id)++ await expectLogic(logic, () => logic.actions.loadSnapshots())+ .toDispatchActions(['loadSnapshotsSuccess', 'loadDeepLinkedSnapshotSuccess'])+ .toMatchValues({ snapshots: [CHANGED_SNAPSHOT], selectedSnapshot: UNCHANGED_SNAPSHOT })+ })++ it('shows the latest deep link when an earlier one is still loading', async () => {+ const otherUnchangedSnapshot = { id: 'snapshot-other', identifier: 'other-unchanged', result: 'unchanged' }+ let releaseFirst: () => void = () => {}+ useMocks({+ get: {+ [SNAPSHOTS_URL]: async ({ request }) => {+ const snapshotId = new URL(request.url).searchParams.get('snapshot_id')+ if (snapshotId === UNCHANGED_SNAPSHOT.id) {+ await new Promise<void>((resolve) => {+ releaseFirst = resolve+ })+ }+ const results =+ snapshotId === UNCHANGED_SNAPSHOT.id+ ? [UNCHANGED_SNAPSHOT]+ : snapshotId === otherUnchangedSnapshot.id+ ? [otherUnchangedSnapshot]+ : [CHANGED_SNAPSHOT]+ return [200, { count: results.length, next: null, previous: null, results }]+ },+ },+ })+ logic.actions.setSelectedSnapshotId(UNCHANGED_SNAPSHOT.id)+ await expectLogic(logic, () => logic.actions.loadSnapshots()).toDispatchActions(['loadDeepLinkedSnapshot'])++ await expectLogic(logic, () => logic.actions.setSelectedSnapshotId(otherUnchangedSnapshot.id))+ .toDispatchActions(['loadDeepLinkedSnapshotSuccess'])+ .toMatchValues({ selectedSnapshot: otherUnchangedSnapshot })++ releaseFirst()+ await expectLogic(logic).toFinishAllListeners()+ await expectLogic(logic).toMatchValues({ selectedSnapshot: otherUnchangedSnapshot })+ })++ it('keeps a cached deep link when the user returns to it before a newer one loads', async () => {+ const otherUnchangedSnapshot = { id: 'snapshot-other', identifier: 'other-unchanged', result: 'unchanged' }+ let releaseOther: () => void = () => {}+ useMocks({+ get: {+ [SNAPSHOTS_URL]: async ({ request }) => {+ const snapshotId = new URL(request.url).searchParams.get('snapshot_id')+ if (snapshotId === otherUnchangedSnapshot.id) {+ await new Promise<void>((resolve) => {+ releaseOther = resolve+ })+ }+ const results =+ snapshotId === UNCHANGED_SNAPSHOT.id+ ? [UNCHANGED_SNAPSHOT]+ : snapshotId === otherUnchangedSnapshot.id+ ? [otherUnchangedSnapshot]+ : [CHANGED_SNAPSHOT]+ return [200, { count: results.length, next: null, previous: null, results }]+ },+ },+ })+ logic.actions.setSelectedSnapshotId(UNCHANGED_SNAPSHOT.id)+ await expectLogic(logic, () => logic.actions.loadSnapshots()).toDispatchActions([+ 'loadDeepLinkedSnapshotSuccess',+ ])+ await expectLogic(logic, () =>+ logic.actions.setSelectedSnapshotId(otherUnchangedSnapshot.id)+ ).toDispatchActions(['loadDeepLinkedSnapshot'])++ logic.actions.setSelectedSnapshotId(UNCHANGED_SNAPSHOT.id)+ releaseOther()+ await expectLogic(logic).toFinishAllListeners()+ await expectLogic(logic).toMatchValues({ selectedSnapshot: UNCHANGED_SNAPSHOT })+ })+it.each([{ slow: 'slow', fast: 'quiet', manual: 0 },{ slow: 'slow-failing', fast: 'flaky', manual: 3 },diff --git a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.tsindex 64d27b1c2de7..6902660da97a 100644--- a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts+++ b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts@@ -43,6 +43,8 @@ export interface visualReviewRunSceneLogicValues {addImagesToComment: boolean // visualReviewPreferencesLogicbreadcrumbs: Breadcrumb[]changedSnapshots: SnapshotApi[]+ deepLinkedSnapshot: SnapshotApi | null+ deepLinkedSnapshotLoading: booleanfailedThumbnails: Set<string>hasChanges: booleanisApprovingSnapshot: boolean@@ -64,6 +66,7 @@ export interface visualReviewRunSceneLogicValues {selectedSnapshotId: string | nullshowQuarantinedThumbnails: booleansnapshots: SnapshotApi[]+ snapshotsLoaded: booleansnapshotsLoading: booleansortedChangedSnapshots: SnapshotApi[]thumbnailBasePath: string | null@@ -95,6 +98,21 @@ export interface visualReviewRunSceneLogicActions {finalizeRunSuccess: () => {value: true}+ loadDeepLinkedSnapshot: (snapshotId: string) => string+ loadDeepLinkedSnapshotFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadDeepLinkedSnapshotSuccess: (+ deepLinkedSnapshot: SnapshotApi | null,+ payload?: string+ ) => {+ deepLinkedSnapshot: SnapshotApi | null+ payload?: string+ }loadQuarantinedIdentifiers: () => anyloadQuarantinedIdentifiersFailure: (error: string,@@ -216,7 +234,8 @@ export interface visualReviewRunSceneLogicMeta {selectedSnapshot: (snapshots: SnapshotApi[],selectedSnapshotId: string | null,- quarantinedIdentifierSet: Set<string>+ quarantinedIdentifierSet: Set<string>,+ deepLinkedSnapshot: SnapshotApi | null) => SnapshotApi | nullrecentTolerations: (toleratedHashes: ToleratedHashEntryApi[],@@ -246,6 +265,16 @@ export type visualReviewRunSceneLogicType = MakeLogicType<visualReviewRunSceneLogicMeta>+function loadSelectedSnapshotIfMissing(+ values: visualReviewRunSceneLogicType['values'],+ actions: visualReviewRunSceneLogicType['actions']+): void {+ const { selectedSnapshotId } = values+ if (selectedSnapshotId && values.snapshotsLoaded && !values.selectedSnapshot) {+ actions.loadDeepLinkedSnapshot(selectedSnapshotId)+ }+}+export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([path(['products', 'visual_review', 'frontend', 'scenes', 'visualReviewRunSceneLogic']),props({} as VisualReviewRunSceneLogicProps),@@ -299,6 +328,12 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([setSelectedSnapshotId: (_, { snapshotId }) => snapshotId,},],+ snapshotsLoaded: [+ false,+ {+ loadSnapshotsSuccess: () => true,+ },+ ],isFinalizing: [false,{@@ -356,11 +391,31 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([const response = await visualReviewRunsSnapshotsList(String(values.currentProjectId), props.runId, {limit: 10000,include_quarantined: true,+ exclude_unchanged: true,})return response.results},},],+ // A deep link can name an unchanged snapshot (the snapshot history page links to every+ // baseline move), which the changes-only list above does not hold.+ deepLinkedSnapshot: [+ null as SnapshotApi | null,+ {+ loadDeepLinkedSnapshot: async (snapshotId: string, breakpoint) => {+ const response = await visualReviewRunsSnapshotsList(String(values.currentProjectId), props.runId, {+ include_quarantined: true,+ snapshot_id: snapshotId,+ })+ breakpoint()+ // The user may have gone back to a snapshot cached here, which starts no request.+ if (values.selectedSnapshotId !== snapshotId) {+ return values.deepLinkedSnapshot+ }+ return response.results[0] ?? null+ },+ },+ ],repo: [null as RepoApi | null,{@@ -408,14 +463,18 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([})),selectors({selectedSnapshot: [- (s) => [s.snapshots, s.selectedSnapshotId, s.quarantinedIdentifierSet],+ (s) => [s.snapshots, s.selectedSnapshotId, s.quarantinedIdentifierSet, s.deepLinkedSnapshot],(snapshots: SnapshotApi[],selectedSnapshotId: string | null,- quarantinedIdentifierSet: Set<string>+ quarantinedIdentifierSet: Set<string>,+ deepLinkedSnapshot: SnapshotApi | null): SnapshotApi | null => {if (selectedSnapshotId) {- return snapshots.find((s) => s.id === selectedSnapshotId) || null+ return (+ snapshots.find((s) => s.id === selectedSnapshotId) ||+ (deepLinkedSnapshot?.id === selectedSnapshotId ? deepLinkedSnapshot : null)+ )}const changed = snapshots.filter((s) => s.result !== 'unchanged')const changedNotQuarantined = changed.filter((s) => !quarantinedIdentifierSet.has(s.identifier))@@ -538,6 +597,13 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([if (snapshot) {actions.loadToleratedHashes(snapshot.identifier)}+ loadSelectedSnapshotIfMissing(values, actions)+ },+ loadDeepLinkedSnapshotSuccess: () => {+ const snapshot = values.selectedSnapshot+ if (snapshot) {+ actions.loadToleratedHashes(snapshot.identifier)+ }},loadRunSuccess: () => {actions.loadRepo()@@ -548,6 +614,7 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([if (snapshot) {actions.loadToleratedHashes(snapshot.identifier)}+ loadSelectedSnapshotIfMissing(values, actions)},finalizeRun: async () => {const { run } = valuesdiff --git a/products/visual_review/mcp/tools.yaml b/products/visual_review/mcp/tools.yamlindex a26d1cec507e..0134668bdb71 100644--- a/products/visual_review/mcp/tools.yaml+++ b/products/visual_review/mcp/tools.yaml@@ -395,10 +395,12 @@ tools:`classification_reason` (`tolerated_hash`, `below_threshold`, `exact`), diff percentage / pixel count, and`review_state` (`pending`, `approved`). Currently-quarantined snapshots are EXCLUDED by default — they areknown-flaky noise, not changes to review — and reported only as a `quarantined_count` on the response; pass- `include_quarantined=true` to fetch them too. Renders an interactive diff viewer with baseline / current /- diff images and approve / tolerate actions. Paginated — pass a `limit` (e.g. 50) when a run might have many- snapshots (a broken run can produce 3000+ pairs); the diff viewer caps the visible list at 100 and- prioritises actionable results regardless.+ `include_quarantined=true` to fetch them too. Pass `exclude_unchanged=true` to list only the changed, new+ and removed snapshots; a large run holds thousands of unchanged ones. Pass `snapshot_id` to fetch one+ snapshot by its `id`. Renders an interactive diff viewer with baseline / current / diff images and approve /+ tolerate actions. Paginated — pass a `limit` (e.g. 50) when a run might have many snapshots (a broken run+ can produce 3000+ pairs); the diff viewer caps the visible list at 100 and prioritises actionable results+ regardless.ui_app: visual-review-snapshotsfeature_flag: visual-reviewvisual-review-runs-tolerate-create:diff --git a/products/visual_review/skills/triaging-visual-review-runs/SKILL.md b/products/visual_review/skills/triaging-visual-review-runs/SKILL.mdindex 41e594d62c6b..5005ff593c4f 100644--- a/products/visual_review/skills/triaging-visual-review-runs/SKILL.md+++ b/products/visual_review/skills/triaging-visual-review-runs/SKILL.md@@ -93,17 +93,17 @@ See [Pull requests from forks](../../../../docs/published/handbook/engineering/fRead tools (safe to call freely):-| Tool | Purpose |-| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `posthog:visual-review-runs-list` | List runs, filter by `pr_number` / `commit_sha` / `branch` / `review_state`. Start here. |-| `posthog:visual-review-runs-retrieve` | Full detail for a single run (status, summary counts, supersession). Carries the `repo_id` the repo tools need. |-| `posthog:visual-review-runs-snapshots-list` | Per-snapshot results inside a run: identifier, `result`, diff %, classification, baseline + current artifact URLs. Quarantined snapshots are excluded by default (see `quarantined_count`); pass `include_quarantined=true` to see them. |-| `posthog:visual-review-repos-flakiness-retrieve` | Repo snapshots whose rendering is untrusted, with a `flakiness_state` and flake rates for each. The flake check starts here. |-| `posthog:visual-review-runs-snapshot-history-list` | One story's baseline timeline on the default branch: one row per baseline change. Takes `{ id: <run_id>, identifier: <identifier> }`. |-| `posthog:visual-review-runs-counts-retrieve` | Aggregate counts for queue triage (how many runs in `needs_review`, etc.). |-| `posthog:visual-review-runs-tolerated-hashes-list` | Hashes the team has explicitly accepted as "known flake / acceptable variation". Takes the same two parameters as the history tool. |-| `posthog:visual-review-repos-list` | Repos (one per GitHub repo) — usually only one matters; useful for filtering. |-| `posthog:visual-review-repos-retrieve` | Repo metadata: baseline file paths, PR-comment configuration. |+| Tool | Purpose |+| -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `posthog:visual-review-runs-list` | List runs, filter by `pr_number` / `commit_sha` / `branch` / `review_state`. Start here. |+| `posthog:visual-review-runs-retrieve` | Full detail for a single run (status, summary counts, supersession). Carries the `repo_id` the repo tools need. |+| `posthog:visual-review-runs-snapshots-list` | Per-snapshot results inside a run: identifier, `result`, diff %, classification, baseline + current artifact URLs. Quarantined snapshots are excluded by default (see `quarantined_count`); pass `include_quarantined=true` to see them. Pass `exclude_unchanged=true` to skip the thousands of unchanged rows a large run holds. |+| `posthog:visual-review-repos-flakiness-retrieve` | Repo snapshots whose rendering is untrusted, with a `flakiness_state` and flake rates for each. The flake check starts here. |+| `posthog:visual-review-runs-snapshot-history-list` | One story's baseline timeline on the default branch: one row per baseline change. Takes `{ id: <run_id>, identifier: <identifier> }`. |+| `posthog:visual-review-runs-counts-retrieve` | Aggregate counts for queue triage (how many runs in `needs_review`, etc.). |+| `posthog:visual-review-runs-tolerated-hashes-list` | Hashes the team has explicitly accepted as "known flake / acceptable variation". Takes the same two parameters as the history tool. |+| `posthog:visual-review-repos-list` | Repos (one per GitHub repo) — usually only one matters; useful for filtering. |+| `posthog:visual-review-repos-retrieve` | Repo metadata: baseline file paths, PR-comment configuration. |Triage tools (reversible, DB-only — they record a review decision but do NOT change the baseline or the gate):@@ -178,7 +178,7 @@ A fork PR has no run, and `visual-review-runs-list` returns an empty list for it1. `posthog:visual-review-runs-list { pr_number: <n>, limit: 5 }` — sort by `created_at` desc, take the latest non-stale one.2. If the run has `summary.changed > 0` or `summary.unresolved > 0`, drill in:- `posthog:visual-review-runs-snapshots-list { id: <run_id> }` and report the `changed` snapshots.+ `posthog:visual-review-runs-snapshots-list { id: <run_id>, exclude_unchanged: true }` and report the `changed` snapshots.Report back: PR number, run UUID, `review_state`, summary counts, and the `_posthogUrl` deep link so theuser can click straight to the diff viewer.@@ -189,7 +189,7 @@ The most useful judgment a code-aware agent can add. Combine three signals: **scand **the actual rendered images**. The agent should look at the screenshots — not just describe metadata.1. **Scope check** — `git diff master...HEAD --stat` (or against the PR's base branch) → list of touched paths.- Cross-reference with `posthog:visual-review-runs-snapshots-list { id }` filtered to `result: changed` → story identifiers.+ Cross-reference with `posthog:visual-review-runs-snapshots-list { id, exclude_unchanged: true }` filtered to `result: changed` → story identifiers.Stories are namespaced like `<area>-<scene>--<story>--<theme>`; e.g. `scenes-app-settings-user--settings-user-profile--dark`maps to `frontend/src/scenes/settings/user/...`. Use this to translate story id → likely source path.diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex a66b31f6479d..810e1b7954d2 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -14079,7 +14079,7 @@"feature_flag": "visual-review"},"visual-review-runs-snapshots-list": {- "description": "List the snapshots captured in a run with their diff results. Each snapshot carries an `identifier` (e.g. Storybook story id + theme), a `result` (`unchanged`, `changed`, `new`, `removed`), an optional `classification_reason` (`tolerated_hash`, `below_threshold`, `exact`), diff percentage / pixel count, and `review_state` (`pending`, `approved`). Currently-quarantined snapshots are EXCLUDED by default — they are known-flaky noise, not changes to review — and reported only as a `quarantined_count` on the response; pass `include_quarantined=true` to fetch them too. Renders an interactive diff viewer with baseline / current / diff images and approve / tolerate actions. Paginated — pass a `limit` (e.g. 50) when a run might have many snapshots (a broken run can produce 3000+ pairs); the diff viewer caps the visible list at 100 and prioritises actionable results regardless.",+ "description": "List the snapshots captured in a run with their diff results. Each snapshot carries an `identifier` (e.g. Storybook story id + theme), a `result` (`unchanged`, `changed`, `new`, `removed`), an optional `classification_reason` (`tolerated_hash`, `below_threshold`, `exact`), diff percentage / pixel count, and `review_state` (`pending`, `approved`). Currently-quarantined snapshots are EXCLUDED by default — they are known-flaky noise, not changes to review — and reported only as a `quarantined_count` on the response; pass `include_quarantined=true` to fetch them too. Pass `exclude_unchanged=true` to list only the changed, new and removed snapshots; a large run holds thousands of unchanged ones. Pass `snapshot_id` to fetch one snapshot by its `id`. Renders an interactive diff viewer with baseline / current / diff images and approve / tolerate actions. Paginated — pass a `limit` (e.g. 50) when a run might have many snapshots (a broken run can produce 3000+ pairs); the diff viewer caps the visible list at 100 and prioritises actionable results regardless.","category": "Visual review","feature": "visual_review","summary": "List run snapshots",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex dc7559cfcd70..78c1b39e2b22 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -14757,7 +14757,7 @@"feature_flag": "visual-review"},"visual-review-runs-snapshots-list": {- "description": "List the snapshots captured in a run with their diff results. Each snapshot carries an `identifier` (e.g. Storybook story id + theme), a `result` (`unchanged`, `changed`, `new`, `removed`), an optional `classification_reason` (`tolerated_hash`, `below_threshold`, `exact`), diff percentage / pixel count, and `review_state` (`pending`, `approved`). Currently-quarantined snapshots are EXCLUDED by default — they are known-flaky noise, not changes to review — and reported only as a `quarantined_count` on the response; pass `include_quarantined=true` to fetch them too. Renders an interactive diff viewer with baseline / current / diff images and approve / tolerate actions. Paginated — pass a `limit` (e.g. 50) when a run might have many snapshots (a broken run can produce 3000+ pairs); the diff viewer caps the visible list at 100 and prioritises actionable results regardless.",+ "description": "List the snapshots captured in a run with their diff results. Each snapshot carries an `identifier` (e.g. Storybook story id + theme), a `result` (`unchanged`, `changed`, `new`, `removed`), an optional `classification_reason` (`tolerated_hash`, `below_threshold`, `exact`), diff percentage / pixel count, and `review_state` (`pending`, `approved`). Currently-quarantined snapshots are EXCLUDED by default — they are known-flaky noise, not changes to review — and reported only as a `quarantined_count` on the response; pass `include_quarantined=true` to fetch them too. Pass `exclude_unchanged=true` to list only the changed, new and removed snapshots; a large run holds thousands of unchanged ones. Pass `snapshot_id` to fetch one snapshot by its `id`. Renders an interactive diff viewer with baseline / current / diff images and approve / tolerate actions. Paginated — pass a `limit` (e.g. 50) when a run might have many snapshots (a broken run can produce 3000+ pairs); the diff viewer caps the visible list at 100 and prioritises actionable results regardless.","category": "Visual review","feature": "visual_review","summary": "List run snapshots",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 23cd3440b350..9b169546c7f6 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -70110,7 +70110,7 @@ export namespace Schemas {/** @nullable */previous?: string | null;results: Snapshot[];- /** Count of this run's snapshots whose identifier is currently quarantined. Excluded from results unless include_quarantined=true is passed. */+ /** Count of this run's snapshots that match the other filters and whose identifier is currently quarantined. Excluded from results unless include_quarantined=true is passed. */quarantined_count?: number;}@@ -122817,6 +122817,10 @@ export namespace Schemas {};export type VisualReviewRunsSnapshotsListParams = {+ /**+ * Whether to leave out snapshots whose result is `unchanged`. Defaults to false. Pass true to list only the changed, new and removed snapshots, which is what a review needs. A large run holds thousands of unchanged snapshots and few changes.+ */+ exclude_unchanged?: boolean;/*** Whether to include snapshots whose identifier is currently quarantined. Defaults to false: quarantined snapshots are excluded from results and reported in quarantined_count instead, since they are noise when reviewing real changes.*/@@ -122829,6 +122833,10 @@ export namespace Schemas {* The initial index from which to return the results.*/offset?: number;+ /**+ * Return only the snapshot with this id, read from the `id` field of a snapshot in the run. Use it to fetch one snapshot without listing the whole run.+ */+ snapshot_id?: string;};export type VisualReviewRunsToleratedHashesListParams = {diff --git a/services/mcp/src/generated/visual_review/api.ts b/services/mcp/src/generated/visual_review/api.tsindex 4ba1e49f99d4..3a2289964d39 100644--- a/services/mcp/src/generated/visual_review/api.ts+++ b/services/mcp/src/generated/visual_review/api.ts@@ -342,15 +342,30 @@ export const VisualReviewRunsSnapshotsListParams = () => zod.object({),})+export const visualReviewRunsSnapshotsListQueryExcludeUnchangedDefault = false+export const visualReviewRunsSnapshotsListQueryIncludeQuarantinedDefault = false+export const VisualReviewRunsSnapshotsListQueryParams = () => zod.object({+ exclude_unchanged: zod+ .boolean()+ .default(visualReviewRunsSnapshotsListQueryExcludeUnchangedDefault)+ .describe(+ 'Whether to leave out snapshots whose result is `unchanged`. Defaults to false. Pass true to list only the changed, new and removed snapshots, which is what a review needs. A large run holds thousands of unchanged snapshots and few changes.'+ ),include_quarantined: zod.boolean()- .optional()+ .default(visualReviewRunsSnapshotsListQueryIncludeQuarantinedDefault).describe('Whether to include snapshots whose identifier is currently quarantined. Defaults to false: quarantined snapshots are excluded from results and reported in quarantined_count instead, since they are noise when reviewing real changes.'),limit: zod.number().optional().describe('Number of results to return per page.'),offset: zod.number().optional().describe('The initial index from which to return the results.'),+ snapshot_id: zod+ .string()+ .optional()+ .describe(+ 'Return only the snapshot with this id, read from the `id` field of a snapshot in the run. Use it to fetch one snapshot without listing the whole run.'+ ),})/**diff --git a/services/mcp/src/tools/generated/visual_review.ts b/services/mcp/src/tools/generated/visual_review.tsindex ff0c0b697e5b..2b9c07650a62 100644--- a/services/mcp/src/tools/generated/visual_review.ts+++ b/services/mcp/src/tools/generated/visual_review.ts@@ -564,9 +564,11 @@ const visualReviewRunsSnapshotsList = (): ToolBase<method: 'GET',path: `/api/projects/${encodeURIComponent(String(projectId))}/visual_review/runs/${encodeURIComponent(String(params.id))}/snapshots/`,query: {+ exclude_unchanged: params.exclude_unchanged,include_quarantined: params.include_quarantined,limit: params.limit,offset: params.offset,+ snapshot_id: params.snapshot_id,},})return await withPostHogUrl(context, result, '/visual_review')