Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(visual-review): hide quarantined snapshots by default (#61985)

Paul D'Ambra40d10772d11d
diff --git a/products/visual_review/backend/facade/api.py b/products/visual_review/backend/facade/api.py
index 8cd91511a756..d7c5c8efa235 100644
--- a/products/visual_review/backend/facade/api.py
+++ b/products/visual_review/backend/facade/api.py
@@ -402,14 +402,33 @@ def get_run(run_id: UUID, team_id: int | None = None) -> contracts.Run:
return _to_run(run, user_basic_infos)
-def get_run_snapshots(run_id: UUID, team_id: int | None = None) -> list[contracts.Snapshot]:
+def get_run_snapshots(
+ run_id: UUID, team_id: int | None = None, include_quarantined: bool = True
+) -> contracts.RunSnapshots:
+ if not include_quarantined and team_id is None:
+ raise ValueError("team_id is required to exclude quarantined snapshots")
snapshots = logic.get_run_snapshots(run_id, team_id=team_id)
if not snapshots:
- return []
+ 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 logic.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)
- return [_to_snapshot(s, repo_id, user_basic_infos) for s in snapshots]
+ dtos: list[contracts.Snapshot] = []
+ 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)
def get_snapshot_history(repo_id: UUID, identifier: str, run_type: str) -> list[contracts.SnapshotHistoryEntry]:
diff --git a/products/visual_review/backend/facade/contracts.py b/products/visual_review/backend/facade/contracts.py
index 44fef74f5040..0e2c144bf2b1 100644
--- a/products/visual_review/backend/facade/contracts.py
+++ b/products/visual_review/backend/facade/contracts.py
@@ -219,6 +219,19 @@ class Snapshot:
size_mismatch: bool = False
+@dataclass(frozen=True)
+class RunSnapshots:
+ """A run's snapshots plus the count of its currently-quarantined identifiers.
+
+ `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.
+ """
+
+ snapshots: list[Snapshot]
+ quarantined_count: int
+
+
@dataclass(frozen=True)
class RunSummary:
"""Summary stats for a run."""
diff --git a/products/visual_review/backend/presentation/views.py b/products/visual_review/backend/presentation/views.py
index beaa0565c6d9..965c467f7f62 100644
--- a/products/visual_review/backend/presentation/views.py
+++ b/products/visual_review/backend/presentation/views.py
@@ -20,6 +20,7 @@ from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, OpenApiResponse, extend_schema
from rest_framework import status, viewsets
from rest_framework.decorators import action
+from rest_framework.pagination import LimitOffsetPagination
from rest_framework.request import Request
from rest_framework.response import Response
@@ -62,6 +63,30 @@ from .serializers import (
)
+class SnapshotsPagination(LimitOffsetPagination):
+ """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."""
+
+ quarantined_count = 0
+
+ def get_paginated_response(self, data: object) -> Response:
+ response = super().get_paginated_response(data)
+ response.data["quarantined_count"] = self.quarantined_count
+ return response
+
+ def get_paginated_response_schema(self, schema: dict) -> dict:
+ schema = super().get_paginated_response_schema(schema)
+ 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."
+ ),
+ }
+ return schema
+
+
class RepoViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
"""
Projects for visual review.
@@ -419,19 +444,34 @@ 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(responses={200: SnapshotSerializer(many=True)})
- @action(detail=True, methods=["get"])
+ @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."
+ ),
+ ),
+ ],
+ responses={200: SnapshotSerializer(many=True)},
+ )
+ @action(detail=True, methods=["get"], pagination_class=SnapshotsPagination)
def snapshots(self, request: Request, pk: str, **kwargs) -> Response:
- """Get all snapshots for a run with diff results."""
+ """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")
try:
- snapshots = api.get_run_snapshots(UUID(pk), team_id=self.team_id)
+ result = api.get_run_snapshots(UUID(pk), team_id=self.team_id, include_quarantined=include_quarantined)
except api.RunNotFoundError:
return Response({"detail": "Run not found"}, status=status.HTTP_404_NOT_FOUND)
- page = self.paginate_queryset(snapshots)
+ page = self.paginate_queryset(result.snapshots)
if page is not None:
+ cast(SnapshotsPagination, self.paginator).quarantined_count = result.quarantined_count
serializer = SnapshotSerializer(instance=page, many=True)
return self.get_paginated_response(serializer.data)
- return Response(SnapshotSerializer(instance=snapshots, many=True).data)
+ return Response(SnapshotSerializer(instance=result.snapshots, many=True).data)
@validated_request(
request_serializer=MarkToleratedInputSerializer,
diff --git a/products/visual_review/backend/tests/test_api.py b/products/visual_review/backend/tests/test_api.py
index 39aade832d17..9492a25eb5b1 100644
--- a/products/visual_review/backend/tests/test_api.py
+++ b/products/visual_review/backend/tests/test_api.py
@@ -1,6 +1,6 @@
"""Unit tests for visual_review facade API."""
-from uuid import UUID
+from uuid import UUID, uuid4
import pytest
from unittest.mock import patch
@@ -189,13 +189,56 @@ class TestRunAPI:
team_id=repo.team_id,
)
- snapshots = api.get_run_snapshots(create_result.run_id)
+ snapshots = api.get_run_snapshots(create_result.run_id).snapshots
assert len(snapshots) == 2
assert all(isinstance(s.id, UUID) for s in snapshots)
identifiers = {s.identifier for s in snapshots}
assert identifiers == {"Button", "Card"}
+ @pytest.mark.parametrize(
+ ("include_quarantined", "expected_identifiers"),
+ [
+ (True, {"Button", "Card"}),
+ (False, {"Card"}),
+ ],
+ )
+ def test_get_run_snapshots_filters_quarantined_but_always_counts(
+ self, repo, user, include_quarantined, expected_identifiers
+ ):
+ create_result = api.create_run(
+ CreateRunInput(
+ repo_id=repo.id,
+ run_type=RunType.STORYBOOK,
+ commit_sha="abc123",
+ branch="main",
+ snapshots=[
+ SnapshotManifestItem(identifier="Button", content_hash="hash1"),
+ SnapshotManifestItem(identifier="Card", content_hash="hash2"),
+ ],
+ ),
+ team_id=repo.team_id,
+ )
+ logic.quarantine_identifier(
+ repo_id=repo.id,
+ identifier="Button",
+ run_type=RunType.STORYBOOK,
+ reason="flaky",
+ user_id=user.id,
+ team_id=repo.team_id,
+ )
+
+ result = api.get_run_snapshots(
+ create_result.run_id, team_id=repo.team_id, include_quarantined=include_quarantined
+ )
+
+ assert {s.identifier for s in result.snapshots} == expected_identifiers
+ assert result.quarantined_count == 1
+
+ def test_get_run_snapshots_excluding_quarantined_requires_team_id(self):
+ with pytest.raises(ValueError):
+ api.get_run_snapshots(uuid4(), include_quarantined=False)
+
@pytest.mark.parametrize(
("filters", "expected_commits"),
[
@@ -330,7 +373,7 @@ class TestApproveRunAPI:
assert result.approved_at is None
# Snapshot-level approval fields were set, result preserved
- snapshots = api.get_run_snapshots(create_result.run_id)
+ snapshots = api.get_run_snapshots(create_result.run_id).snapshots
button_snap = next(s for s in snapshots if s.identifier == "Button")
assert button_snap.result == SnapshotResult.CHANGED
assert button_snap.approved_hash == "new_hash"
diff --git a/products/visual_review/backend/tests/test_presentation.py b/products/visual_review/backend/tests/test_presentation.py
index 4dba29ee2512..b6043ff15f23 100644
--- a/products/visual_review/backend/tests/test_presentation.py
+++ b/products/visual_review/backend/tests/test_presentation.py
@@ -142,6 +142,44 @@ class TestRunViewSet(VisualReviewTeamScopedTestMixin, APIBaseTest):
identifiers = {s["identifier"] for s in results}
self.assertEqual(identifiers, {"Button", "Card"})
+ @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):
+ create_result = api.create_run(
+ CreateRunInput(
+ repo_id=self.vr_project.id,
+ run_type=RunType.STORYBOOK,
+ commit_sha="abc123",
+ branch="main",
+ snapshots=[
+ SnapshotManifestItem(identifier="Button", content_hash="h1"),
+ SnapshotManifestItem(identifier="Card", content_hash="h2"),
+ ],
+ ),
+ team_id=self.team.id,
+ )
+ logic.quarantine_identifier(
+ repo_id=self.vr_project.id,
+ identifier="Button",
+ run_type=RunType.STORYBOOK,
+ reason="flaky",
+ user_id=self.user.id,
+ team_id=self.team.id,
+ )
+
+ response = self.client.get(
+ f"/api/projects/{self.team.id}/visual_review/runs/{create_result.run_id}/snapshots/{query}"
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+ data = response.json()
+ assert {s["identifier"] for s in data["results"]} == expected_identifiers
+ assert data["quarantined_count"] == 1
+
@patch("products.visual_review.backend.tasks.tasks.process_run_diffs.delay")
def test_complete_run_no_changes(self, mock_delay):
"""Runs with no changes complete immediately without triggering diff task."""
diff --git a/products/visual_review/backend/tests/test_tasks.py b/products/visual_review/backend/tests/test_tasks.py
index 2888f3247be3..fc42d01b2b72 100644
--- a/products/visual_review/backend/tests/test_tasks.py
+++ b/products/visual_review/backend/tests/test_tasks.py
@@ -93,7 +93,7 @@ class TestProcessRunDiffs:
process_diffs(create_result.run_id)
# Snapshot should remain unchanged
- snapshots = api.get_run_snapshots(create_result.run_id)
+ snapshots = api.get_run_snapshots(create_result.run_id).snapshots
assert len(snapshots) == 1
assert snapshots[0].result == SnapshotResult.UNCHANGED
@@ -113,7 +113,7 @@ class TestProcessRunDiffs:
# Process - should skip new snapshot (no baseline to diff against)
process_diffs(create_result.run_id)
- snapshots = api.get_run_snapshots(create_result.run_id)
+ snapshots = api.get_run_snapshots(create_result.run_id).snapshots
assert len(snapshots) == 1
assert snapshots[0].result == SnapshotResult.NEW
diff --git a/products/visual_review/frontend/generated/api.schemas.ts b/products/visual_review/frontend/generated/api.schemas.ts
index 2e6712e43195..84bf0c2cf4f0 100644
--- a/products/visual_review/frontend/generated/api.schemas.ts
+++ b/products/visual_review/frontend/generated/api.schemas.ts
@@ -388,6 +388,8 @@ export interface PaginatedSnapshotListApi {
/** @nullable */
previous?: string | null
results: SnapshotApi[]
+ /** Count of this run's snapshots whose identifier is currently quarantined. Excluded from results unless include_quarantined=true is passed. */
+ quarantined_count?: number
}
export interface MarkToleratedInputApi {
@@ -515,6 +517,10 @@ export type VisualReviewRunsSnapshotHistoryListParams = {
}
export type VisualReviewRunsSnapshotsListParams = {
+ /**
+ * 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.
+ */
+ include_quarantined?: boolean
/**
* Number of results to return per page.
*/
diff --git a/products/visual_review/frontend/generated/api.ts b/products/visual_review/frontend/generated/api.ts
index a4c103070a5f..2635e7414f2a 100644
--- a/products/visual_review/frontend/generated/api.ts
+++ b/products/visual_review/frontend/generated/api.ts
@@ -580,7 +580,7 @@ export const getVisualReviewRunsSnapshotsListUrl = (
}
/**
- * Get all snapshots for a run with diff results.
+ * Get a run's snapshots with diff results, excluding quarantined ones by default.
*/
export const visualReviewRunsSnapshotsList = async (
projectId: string,
diff --git a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
index 91caada43935..b08698f0c534 100644
--- a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
@@ -133,6 +133,32 @@ function SnapshotThumbnail({
)
}
+function QuarantinedThumbnailsToggle({
+ hiddenCount,
+ isExpanded,
+ onClick,
+}: {
+ hiddenCount: number
+ isExpanded: boolean
+ onClick: () => void
+}): JSX.Element {
+ const label = isExpanded
+ ? 'Hide quarantined'
+ : `${hiddenCount} quarantined item${hiddenCount === 1 ? '' : 's'} hidden`
+
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ aria-expanded={isExpanded}
+ data-attr="visual-review-toggle-quarantined-thumbnails"
+ className="flex flex-col items-center justify-center shrink-0 rounded p-1.5 w-[100px] h-full text-warning-dark border border-dashed border-warning hover:bg-warning/10 transition-colors"
+ >
+ <span className="text-[11px] font-semibold text-center leading-tight">{label}</span>
+ </button>
+ )
+}
+
const PENDING_STALE_THRESHOLD_MS = 15 * 60 * 1000
function RunInProgressEmptyState({
@@ -194,6 +220,7 @@ export function VisualReviewRunScene(): JSX.Element {
toleratedHashesLoading,
quarantinedIdentifiers,
quarantinedIdentifierSet,
+ showQuarantinedThumbnails,
repoFullName,
isFinalizing,
isApprovingSnapshot,
@@ -212,10 +239,22 @@ export function VisualReviewRunScene(): JSX.Element {
unquarantineSnapshot,
recomputeRun,
markThumbnailFailed,
+ toggleQuarantinedThumbnails,
} = 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) =>
+ quarantinedIdentifierSet.has(s.identifier)
+ ).length
+ const isHiddenQuarantined = (s: SnapshotApi): boolean =>
+ quarantinedIdentifierSet.has(s.identifier) && s.id !== selectedSnapshot?.id
+ const visibleNavSnapshots = showQuarantinedThumbnails
+ ? navSnapshots
+ : navSnapshots.filter((s: SnapshotApi) => !isHiddenQuarantined(s))
+ const hiddenQuarantinedCount = navSnapshots.length - visibleNavSnapshots.length
+
const currentIndex = selectedSnapshot
? navSnapshots.findIndex((s: SnapshotApi) => s.id === selectedSnapshot.id)
: -1
@@ -454,7 +493,7 @@ export function VisualReviewRunScene(): JSX.Element {
{navSnapshots.length > 0 && (
<div className="flex gap-1.5 overflow-x-auto px-3 pb-3">
- {navSnapshots.map((snapshot: SnapshotApi) => {
+ {visibleNavSnapshots.map((snapshot: SnapshotApi) => {
const hasThumbnail = thumbnailBasePath && !failedThumbnails.has(snapshot.identifier)
return (
<SnapshotThumbnail
@@ -473,6 +512,13 @@ export function VisualReviewRunScene(): JSX.Element {
/>
)
})}
+ {quarantinedNavCount > 0 && (hiddenQuarantinedCount > 0 || showQuarantinedThumbnails) && (
+ <QuarantinedThumbnailsToggle
+ hiddenCount={hiddenQuarantinedCount}
+ isExpanded={showQuarantinedThumbnails}
+ onClick={toggleQuarantinedThumbnails}
+ />
+ )}
</div>
)}
diff --git a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
index 91a9e40fec6e..7051f57116ba 100644
--- a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
@@ -65,6 +65,7 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
recomputeRunSuccess: true,
recomputeRunFailure: true,
markThumbnailFailed: (identifier: string) => ({ identifier }),
+ toggleQuarantinedThumbnails: true,
}),
reducers({
selectedSnapshotId: [
@@ -107,6 +108,12 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
},
},
],
+ showQuarantinedThumbnails: [
+ false,
+ {
+ toggleQuarantinedThumbnails: (state) => !state,
+ },
+ ],
}),
loaders(({ props, values }) => ({
run: [
@@ -123,6 +130,7 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
loadSnapshots: async () => {
const response = await visualReviewRunsSnapshotsList(String(values.currentProjectId), props.runId, {
limit: 10000,
+ include_quarantined: true,
})
return response.results
},
@@ -173,12 +181,14 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
})),
selectors({
selectedSnapshot: [
- (s) => [s.snapshots, s.selectedSnapshotId],
- (snapshots, selectedSnapshotId): SnapshotApi | null => {
- if (!selectedSnapshotId) {
- return snapshots.find((s) => s.result !== 'unchanged') || snapshots[0] || null
+ (s) => [s.snapshots, s.selectedSnapshotId, s.quarantinedIdentifierSet],
+ (snapshots, selectedSnapshotId, quarantinedIdentifierSet): SnapshotApi | null => {
+ if (selectedSnapshotId) {
+ return snapshots.find((s) => s.id === selectedSnapshotId) || null
}
- return snapshots.find((s) => s.id === selectedSnapshotId) || null
+ const changed = snapshots.filter((s) => s.result !== 'unchanged')
+ const changedNotQuarantined = changed.filter((s) => !quarantinedIdentifierSet.has(s.identifier))
+ return changedNotQuarantined[0] || changed[0] || snapshots[0] || null
},
],
changedSnapshots: [
diff --git a/products/visual_review/mcp/tools.yaml b/products/visual_review/mcp/tools.yaml
index 121a45d81bf3..63e87c081eaf 100644
--- a/products/visual_review/mcp/tools.yaml
+++ b/products/visual_review/mcp/tools.yaml
@@ -200,11 +200,13 @@ tools:
list: true
title: List run snapshots
description: >
- List all snapshots captured in a run with their diff results. Each snapshot carries an `identifier` (e.g.
+ 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`). 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
+ `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.
ui_app: visual-review-snapshots
diff --git a/products/visual_review/skills/triaging-visual-review-runs/SKILL.md b/products/visual_review/skills/triaging-visual-review-runs/SKILL.md
index e5aa1ac1c3e8..c54260e30bcd 100644
--- a/products/visual_review/skills/triaging-visual-review-runs/SKILL.md
+++ b/products/visual_review/skills/triaging-visual-review-runs/SKILL.md
@@ -39,16 +39,16 @@ is faster — direct them there. This skill is for everything around the diff: s
Read 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). |
-| `posthog:visual-review-runs-snapshots-list` | Per-snapshot results inside a run: identifier, `result`, diff %, classification, baseline + current artifact URLs. |
-| `posthog:visual-review-runs-snapshot-history-list` | A single story's last N runs across master/PRs — the flake check. |
-| `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". |
-| `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). |
+| `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-runs-snapshot-history-list` | A single story's last N runs across master/PRs — the flake check. |
+| `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". |
+| `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):
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index c62508fd1db9..b2acc6a909b0 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -6342,7 +6342,7 @@
"feature_flag": "visual-review"
},
"visual-review-runs-snapshots-list": {
- "description": "List all 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`). 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. 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.json
index 9fd69b5dceb1..d1951b1085b2 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -6697,7 +6697,7 @@
"feature_flag": "visual-review"
},
"visual-review-runs-snapshots-list": {
- "description": "List all 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`). 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. 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.ts
index 3e66bff5d644..ec89c05290aa 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -26027,6 +26027,8 @@ 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. */
+ quarantined_count?: number;
}
/**
@@ -52351,6 +52353,10 @@ export namespace Schemas {
};
export type VisualReviewRunsSnapshotsListParams = {
+ /**
+ * 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.
+ */
+ include_quarantined?: boolean;
/**
* Number of results to return per page.
*/
diff --git a/services/mcp/src/generated/visual_review/api.ts b/services/mcp/src/generated/visual_review/api.ts
index 4fd711b1383a..3d0f57a5ed10 100644
--- a/services/mcp/src/generated/visual_review/api.ts
+++ b/services/mcp/src/generated/visual_review/api.ts
@@ -154,7 +154,7 @@ export const VisualReviewRunsSnapshotHistoryListQueryParams = /* @__PURE__ */ zo
})
/**
- * Get all snapshots for a run with diff results.
+ * Get a run's snapshots with diff results, excluding quarantined ones by default.
*/
export const VisualReviewRunsSnapshotsListParams = /* @__PURE__ */ zod.object({
id: zod.string(),
@@ -166,6 +166,12 @@ export const VisualReviewRunsSnapshotsListParams = /* @__PURE__ */ zod.object({
})
export const VisualReviewRunsSnapshotsListQueryParams = /* @__PURE__ */ zod.object({
+ include_quarantined: zod
+ .boolean()
+ .optional()
+ .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.'),
})
diff --git a/services/mcp/src/tools/generated/visual_review.ts b/services/mcp/src/tools/generated/visual_review.ts
index 869783859049..504c9eef5c8a 100644
--- a/services/mcp/src/tools/generated/visual_review.ts
+++ b/services/mcp/src/tools/generated/visual_review.ts
@@ -224,6 +224,7 @@ const visualReviewRunsSnapshotsList = (): ToolBase<
method: 'GET',
path: `/api/projects/${encodeURIComponent(String(projectId))}/visual_review/runs/${encodeURIComponent(String(params.id))}/snapshots/`,
query: {
+ include_quarantined: params.include_quarantined,
limit: params.limit,
offset: params.offset,
},