: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): reject unknown review_state filters on run lists (#113730)
Julian Bezd6c8cbcb8d86
diff --git a/products/visual_review/backend/facade/api.py b/products/visual_review/backend/facade/api.pyindex fd43609915ab..e26e0c7fafdb 100644--- a/products/visual_review/backend/facade/api.py+++ b/products/visual_review/backend/facade/api.py@@ -50,7 +50,7 @@ from ..logic import (toleration,)from . import contracts-from .enums import ActorType, QuarantineLiftState, RunPurpose, ShiftBandKind+from .enums import ActorType, QuarantineLiftState, RunPurpose, RunReviewFilter, ShiftBandKindUser = get_user_model()@@ -521,7 +521,7 @@ def _baseline_moved_day_index(moved_at: datetime | None, now: datetime) -> int |def list_runs(team_id: int,- review_state: str | None = None,+ review_state: RunReviewFilter | None = None,repo_id: UUID | None = None,pr_number: int | None = None,commit_sha: str | None = None,diff --git a/products/visual_review/backend/facade/enums.py b/products/visual_review/backend/facade/enums.pyindex e771db9188db..5b32b12f3038 100644--- a/products/visual_review/backend/facade/enums.py+++ b/products/visual_review/backend/facade/enums.py@@ -39,6 +39,15 @@ class RunPurpose(StrEnum):OBSERVE = "observe" # Tracking only — not approvable+class RunReviewFilter(StrEnum):+ """Where a run stands in review, as the run lists filter it."""++ NEEDS_REVIEW = "needs_review" # Completed PR run with changes nobody approved yet+ CLEAN = "clean" # No changes, or approved+ PROCESSING = "processing" # Diffs still computing+ STALE = "stale" # Superseded by a newer run while its changes were unapproved++class ReviewDecision(StrEnum):"""Run-level review outcome."""diff --git a/products/visual_review/backend/logic/run_queries.py b/products/visual_review/backend/logic/run_queries.pyindex 7561efac2090..dce1767bf58a 100644--- a/products/visual_review/backend/logic/run_queries.py+++ b/products/visual_review/backend/logic/run_queries.py@@ -16,7 +16,7 @@ from posthog.helpers.trigram_search import ()from ..db import WRITER_DB-from ..facade.enums import RunPurpose, RunStatus, SnapshotResult+from ..facade.enums import RunPurpose, RunReviewFilter, RunStatus, SnapshotResultfrom ..models import Run, RunSnapshotfrom . import errors@@ -39,17 +39,17 @@ _CURRENT = Q(superseded_by__isnull=True)_ON_PR = Q(pr_number__isnull=False)-REVIEW_STATE_FILTERS: dict[str, Q] = {+REVIEW_STATE_FILTERS: dict[RunReviewFilter, Q] = {# Only PR runs need human review — master/branch pushes without a PR are just drift- "needs_review": Q(status=RunStatus.COMPLETED)+ RunReviewFilter.NEEDS_REVIEW: Q(status=RunStatus.COMPLETED)& _HAS_CHANGES& Q(approved=False)& _CURRENT& _ON_PR& Q(purpose=RunPurpose.REVIEW),- "clean": (Q(status=RunStatus.COMPLETED) & ~_HAS_CHANGES) | Q(approved=True),- "processing": Q(status=RunStatus.PROCESSING) & _CURRENT,- "stale": Q(superseded_by__isnull=False) & Q(approved=False) & _HAS_CHANGES,+ RunReviewFilter.CLEAN: (Q(status=RunStatus.COMPLETED) & ~_HAS_CHANGES) | Q(approved=True),+ RunReviewFilter.PROCESSING: Q(status=RunStatus.PROCESSING) & _CURRENT,+ RunReviewFilter.STALE: Q(superseded_by__isnull=False) & Q(approved=False) & _HAS_CHANGES,}# Free-text search over the runs list uses the shared trigram helper for the@@ -61,7 +61,7 @@ RUN_SEARCH_FIELDS = (TrigramSearchField("branch"), TrigramSearchField("run_type"def list_runs_for_team(team_id: int,- review_state: str | None = None,+ review_state: RunReviewFilter | None = None,repo_id: UUID | None = None,pr_number: int | None = None,commit_sha: str | None = None,@@ -71,7 +71,7 @@ def list_runs_for_team(qs = Run.objects.filter(team_id=team_id).select_related("repo")if repo_id is not None:qs = qs.filter(repo_id=repo_id)- if review_state and review_state in REVIEW_STATE_FILTERS:+ if review_state is not None:qs = qs.filter(REVIEW_STATE_FILTERS[review_state])if pr_number is not None:qs = qs.filter(pr_number=pr_number)@@ -102,10 +102,10 @@ def get_review_state_counts(team_id: int, repo_id: UUID | None = None) -> dict[sif repo_id is not None:qs = qs.filter(repo_id=repo_id)return qs.aggregate(- needs_review=Count("id", filter=REVIEW_STATE_FILTERS["needs_review"]),- clean=Count("id", filter=REVIEW_STATE_FILTERS["clean"]),- processing=Count("id", filter=REVIEW_STATE_FILTERS["processing"]),- stale=Count("id", filter=REVIEW_STATE_FILTERS["stale"]),+ needs_review=Count("id", filter=REVIEW_STATE_FILTERS[RunReviewFilter.NEEDS_REVIEW]),+ clean=Count("id", filter=REVIEW_STATE_FILTERS[RunReviewFilter.CLEAN]),+ processing=Count("id", filter=REVIEW_STATE_FILTERS[RunReviewFilter.PROCESSING]),+ stale=Count("id", filter=REVIEW_STATE_FILTERS[RunReviewFilter.STALE]),)diff --git a/products/visual_review/backend/presentation/serializers.py b/products/visual_review/backend/presentation/serializers.pyindex 31c8d97a7b00..74eed130ee73 100644--- a/products/visual_review/backend/presentation/serializers.py+++ b/products/visual_review/backend/presentation/serializers.py@@ -143,6 +143,13 @@ class SnapshotSerializer(DataclassSerializer):reviewed_by = UserBasicInfoSerializer(allow_null=True, required=False)cluster_summary = ClusterSummarySerializer(allow_null=True, required=False)row_shift = RowShiftSerializer(allow_null=True, required=False)+ is_quarantined = serializers.BooleanField(+ required=False,+ help_text=(+ "Whether a quarantine covered this snapshot when the run was last gated, so its diff did not "+ "block the pull request. It keeps that value after the quarantine ends or a new one starts."+ ),+ )class Meta:dataclass = Snapshot@@ -725,7 +732,9 @@ class RunSnapshotsQuerySerializer(serializers.Serializer):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."+ "in quarantined_count instead, since they are noise when reviewing real changes. "+ "This filter uses the quarantines active now. Each snapshot's `is_quarantined` flag "+ "holds the state when the run was gated, so for an older run pass true and read the flag."),)exclude_unchanged = serializers.BooleanField(@@ -749,7 +758,9 @@ class RunSnapshotsQuerySerializer(serializers.Serializer):"Whether to list only the snapshots whose identifier is currently quarantined. ""Defaults to false. When true, `include_quarantined` is ignored and quarantined ""snapshots are returned. Combine with `exclude_unchanged=false` to find a quarantined "- "story that rendered `unchanged`, which is the snapshot to request a lift on merge for."+ "story that rendered `unchanged`, which is the snapshot to request a lift on merge for. "+ "This uses the quarantines active now, not each snapshot's `is_quarantined` flag, so on an "+ "older run it misses stories whose quarantine has ended since."),)diff --git a/products/visual_review/backend/presentation/views.py b/products/visual_review/backend/presentation/views.pyindex b3f36e6cf890..0661c9678904 100644--- a/products/visual_review/backend/presentation/views.py+++ b/products/visual_review/backend/presentation/views.py@@ -43,7 +43,7 @@ from ..facade.contracts import (UpdateRepoInput,UpdateRepoRequestInput,)-from ..facade.enums import ActorType+from ..facade.enums import ActorType, RunReviewFilterfrom .serializers import (AddSnapshotsInputSerializer,AddSnapshotsResultSerializer,@@ -99,6 +99,31 @@ def _parse_uuid(value: str, field: str = "id") -> UUID:raise ValidationError({field: "Must be a valid UUID."})+REVIEW_STATE_PARAMETER = OpenApiParameter(+ "review_state",+ str,+ required=False,+ enum=[state.value for state in RunReviewFilter],+ description=(+ "Filter by where the run stands in review. `needs_review`: a completed pull request run with "+ "changes nobody approved yet. `clean`: no changes, or approved. `processing`: diffs still computing. "+ "`stale`: superseded by a newer run while its changes were unapproved."+ ),+)+++def _parse_review_state(request: Request) -> RunReviewFilter | None:+ """Reject an unknown review state, so a typo returns a 400 instead of every run."""+ value = request.query_params.get("review_state")+ if value is None:+ return None+ try:+ return RunReviewFilter(value)+ except ValueError:+ allowed = ", ".join(state.value for state in RunReviewFilter)+ raise ValidationError({"review_state": f"Must be one of: {allowed}."})++# Both run-scoped snapshot lookups need a run id AND a snapshot identifier. Clients that# read only the prose kept sending one of the two, so the pair is described in one place# and each side names the other as required.@@ -150,7 +175,8 @@ class SnapshotsPagination(PrecountedLimitOffsetPagination):"type": "integer","description": ("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."+ "is quarantined now. Excluded from results unless include_quarantined=true is passed. "+ "This can differ from the run's own counts, which use the quarantines at gating time."),}return schema@@ -522,7 +548,7 @@ class RepoRunsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):@extend_schema(parameters=[- OpenApiParameter("review_state", str, required=False, description="Filter by review state"),+ REVIEW_STATE_PARAMETER,OpenApiParameter("search",str,@@ -534,7 +560,7 @@ class RepoRunsViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):)def list(self, request: Request, **kwargs) -> Response:"""List runs in this repo, optionally filtered by review state and free-text search."""- review_state = request.query_params.get("review_state")+ review_state = _parse_review_state(request)search = request.query_params.get("search")if search and len(search) > MAX_SEARCH_LENGTH:return Response(@@ -590,7 +616,7 @@ class RunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):@extend_schema(parameters=[- OpenApiParameter("review_state", str, required=False, description="Filter by review state"),+ REVIEW_STATE_PARAMETER,OpenApiParameter("pr_number", int, required=False, description="Filter by GitHub PR number"),OpenApiParameter("commit_sha", str, required=False, description="Filter by full commit SHA"),OpenApiParameter("branch", str, required=False, description="Filter by branch name"),@@ -618,7 +644,7 @@ class RunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):)runs = api.list_runs(self.team_id,- review_state=request.query_params.get("review_state"),+ review_state=_parse_review_state(request),pr_number=pr_number,commit_sha=request.query_params.get("commit_sha"),branch=request.query_params.get("branch"),diff --git a/products/visual_review/backend/tests/logic/test_runs.py b/products/visual_review/backend/tests/logic/test_runs.pyindex c7741ea07ae7..7a3f9f97e683 100644--- a/products/visual_review/backend/tests/logic/test_runs.py+++ b/products/visual_review/backend/tests/logic/test_runs.py@@ -6,7 +6,7 @@ from django.db.models.signals import post_savefrom products.visual_review.backend.db import WRITER_DBfrom products.visual_review.backend.facade.contracts import CreateRunInput, SnapshotManifestItem-from products.visual_review.backend.facade.enums import RunStatus, RunType, SnapshotResult+from products.visual_review.backend.facade.enums import RunReviewFilter, RunStatus, RunType, SnapshotResultfrom products.visual_review.backend.logic import approvals, artifact_store, errors, repos, run_queries, runsfrom products.visual_review.backend.models import Repo, Run, RunSnapshotfrom products.visual_review.backend.tests.conftest import PRODUCT_DATABASES@@ -663,8 +663,8 @@ class TestRunSupersession:self._create_run(repo, commit_sha="old")self._create_run(repo, commit_sha="new")- current_runs = list(run_queries.list_runs_for_team(team.id, review_state="needs_review"))- stale_runs = list(run_queries.list_runs_for_team(team.id, review_state="stale"))+ current_runs = list(run_queries.list_runs_for_team(team.id, review_state=RunReviewFilter.NEEDS_REVIEW))+ stale_runs = list(run_queries.list_runs_for_team(team.id, review_state=RunReviewFilter.STALE))assert len(current_runs) == 1assert current_runs[0].commit_sha == "new"@@ -708,7 +708,7 @@ class TestRunSupersession:first.refresh_from_db()assert first.superseded_by is not None# Approved runs still show in clean filter, not stale- clean = list(run_queries.list_runs_for_team(team.id, review_state="clean"))+ clean = list(run_queries.list_runs_for_team(team.id, review_state=RunReviewFilter.CLEAN))assert any(r.id == first.id for r in clean)def test_clean_run_superseded_but_stays_clean(self, repo, team, mocker):@@ -737,7 +737,7 @@ class TestRunSupersession:clean_run.refresh_from_db()assert clean_run.superseded_by is not None# Clean runs still show in clean filter, not stale- clean = list(run_queries.list_runs_for_team(team.id, review_state="clean"))+ clean = list(run_queries.list_runs_for_team(team.id, review_state=RunReviewFilter.CLEAN))assert any(r.id == clean_run.id for r in clean)def test_approved_run_shows_in_clean_not_stale(self, repo, team, user):@@ -747,8 +747,8 @@ class TestRunSupersession:self._create_run(repo, commit_sha="2nd")- stale = list(run_queries.list_runs_for_team(team.id, review_state="stale"))- clean = list(run_queries.list_runs_for_team(team.id, review_state="clean"))+ stale = list(run_queries.list_runs_for_team(team.id, review_state=RunReviewFilter.STALE))+ clean = list(run_queries.list_runs_for_team(team.id, review_state=RunReviewFilter.CLEAN))assert len(stale) == 0clean_shas = {r.commit_sha for r in clean}diff --git a/products/visual_review/backend/tests/test_presentation.py b/products/visual_review/backend/tests/test_presentation.pyindex 42600f864444..9d98dbf02593 100644--- a/products/visual_review/backend/tests/test_presentation.py+++ b/products/visual_review/backend/tests/test_presentation.py@@ -1020,6 +1020,19 @@ class TestRepoRunsSearch(VisualReviewTeamScopedTestMixin, APIBaseTest):other_state = self.client.get(self._runs_url(review_state="processing", search="feature"))self.assertEqual(self._branches(other_state.json()), set())+ @parameterized.expand(+ [+ ("repo_runs_unknown", "_runs_url", "approved"),+ ("repo_runs_empty", "_runs_url", ""),+ ("team_runs_unknown", "_team_runs_url", "approved"),+ ]+ )+ def test_unknown_review_state_is_rejected(self, _name: str, url_builder: str, review_state: str):+ response = self.client.get(getattr(self, url_builder)(review_state=review_state))++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertIn("needs_review", str(response.json()))+def test_team_wide_endpoint_supports_search(self):# The project-wide endpoint (exposed as the MCP tool) shares the same search path.response = self.client.get(self._team_runs_url(search="feature"))diff --git a/products/visual_review/frontend/generated/api.schemas.ts b/products/visual_review/frontend/generated/api.schemas.tsindex 866cc497c96d..a37708aa2fe5 100644--- a/products/visual_review/frontend/generated/api.schemas.ts+++ b/products/visual_review/frontend/generated/api.schemas.ts@@ -705,6 +705,8 @@ export interface SnapshotApi {reviewed_by?: UserBasicInfoApi | nullcluster_summary?: ClusterSummaryApi | nullrow_shift?: RowShiftApi | null+ /** Whether a quarantine covered this snapshot when the run was last gated, so its diff did not block the pull request. It keeps that value after the quarantine ends or a new one starts. */+ is_quarantined?: booleanid: stringrun_id: stringidentifier: string@@ -720,7 +722,6 @@ export interface SnapshotApi {approved_hash: string/** @nullable */tolerated_hash_id?: string | null- is_quarantined?: booleanmetadata?: SnapshotApiMetadata/** @nullable */ssim_score?: number | null@@ -735,7 +736,7 @@ export interface PaginatedSnapshotListApi {/** @nullable */previous?: string | nullresults: SnapshotApi[]- /** 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. */+ /** Count of this run's snapshots that match the other filters and whose identifier is quarantined now. Excluded from results unless include_quarantined=true is passed. This can differ from the run's own counts, which use the quarantines at gating time. */quarantined_count?: number}@@ -849,15 +850,25 @@ export type VisualReviewReposRunsListParams = {*/offset?: number/**- * Filter by review state+ * Filter by where the run stands in review. `needs_review`: a completed pull request run with changes nobody approved yet. `clean`: no changes, or approved. `processing`: diffs still computing. `stale`: superseded by a newer run while its changes were unapproved.*/- review_state?: string+ review_state?: VisualReviewReposRunsListReviewState/*** Free-text search over branch, commit SHA, run type, and PR number*/search?: string}+export type VisualReviewReposRunsListReviewState =+ (typeof VisualReviewReposRunsListReviewState)[keyof typeof VisualReviewReposRunsListReviewState]++export const VisualReviewReposRunsListReviewState = {+ Clean: 'clean',+ NeedsReview: 'needs_review',+ Processing: 'processing',+ Stale: 'stale',+} as const+export type VisualReviewReposSnapshotsListParams = {/*** Number of results to return per page.@@ -891,15 +902,25 @@ export type VisualReviewRunsListParams = {*/pr_number?: number/**- * Filter by review state+ * Filter by where the run stands in review. `needs_review`: a completed pull request run with changes nobody approved yet. `clean`: no changes, or approved. `processing`: diffs still computing. `stale`: superseded by a newer run while its changes were unapproved.*/- review_state?: string+ review_state?: VisualReviewRunsListReviewState/*** Free-text search over branch, commit SHA, run type, and PR number*/search?: string}+export type VisualReviewRunsListReviewState =+ (typeof VisualReviewRunsListReviewState)[keyof typeof VisualReviewRunsListReviewState]++export const VisualReviewRunsListReviewState = {+ Clean: 'clean',+ NeedsReview: 'needs_review',+ Processing: 'processing',+ Stale: 'stale',+} as const+export type VisualReviewRunsSnapshotHistoryListParams = {/*** Identifier of the snapshot to look up, for example a Storybook story id plus theme. Read it from the `identifier` field of a snapshot in the run. It is a name rather than a UUID, and it is required in addition to the run id in the path.@@ -921,7 +942,7 @@ export type VisualReviewRunsSnapshotsListParams = {*/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.+ * 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. This filter uses the quarantines active now. Each snapshot's `is_quarantined` flag holds the state when the run was gated, so for an older run pass true and read the flag.*/include_quarantined?: boolean/**@@ -933,7 +954,7 @@ export type VisualReviewRunsSnapshotsListParams = {*/offset?: number/**- * Whether to list only the snapshots whose identifier is currently quarantined. Defaults to false. When true, `include_quarantined` is ignored and quarantined snapshots are returned. Combine with `exclude_unchanged=false` to find a quarantined story that rendered `unchanged`, which is the snapshot to request a lift on merge for.+ * Whether to list only the snapshots whose identifier is currently quarantined. Defaults to false. When true, `include_quarantined` is ignored and quarantined snapshots are returned. Combine with `exclude_unchanged=false` to find a quarantined story that rendered `unchanged`, which is the snapshot to request a lift on merge for. This uses the quarantines active now, not each snapshot's `is_quarantined` flag, so on an older run it misses stories whose quarantine has ended since.*/quarantined_only?: boolean/**diff --git a/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.tsindex cf52bb9c61b0..4e9857d1031d 100644--- a/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts+++ b/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts@@ -6,10 +6,15 @@ import { teamLogic } from 'scenes/teamLogic'import { Breadcrumb } from '~/types'import { visualReviewReposRunsCountsRetrieve, visualReviewReposRunsList } from '../generated/api'-import type { PaginatedRunListApi, RepoApi, ReviewStateCountsApi } from '../generated/api.schemas'+import type {+ PaginatedRunListApi,+ RepoApi,+ ReviewStateCountsApi,+ VisualReviewReposRunsListReviewState,+} from '../generated/api.schemas'import { visualReviewRepoLogic } from './visualReviewRepoLogic'-export type ReviewState = 'needs_review' | 'clean' | 'processing' | 'stale'+export type ReviewState = VisualReviewReposRunsListReviewStateconst RUNS_PAGE_SIZE = 20@@ -69,7 +74,7 @@ export interface visualReviewRunsSceneLogicActions {payload?: any}setActiveTab: (tab: ReviewState) => {- tab: ReviewState+ tab: VisualReviewReposRunsListReviewState}setPage: (page: number) => {page: numberdiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 1c6c66c78e5e..cd9440ecf692 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -72144,6 +72144,8 @@ export namespace Schemas {reviewed_by?: UserBasicInfo | null;cluster_summary?: ClusterSummary | null;row_shift?: RowShift | null;+ /** Whether a quarantine covered this snapshot when the run was last gated, so its diff did not block the pull request. It keeps that value after the quarantine ends or a new one starts. */+ is_quarantined?: boolean;id: string;run_id: string;identifier: string;@@ -72159,7 +72161,6 @@ export namespace Schemas {approved_hash: string;/** @nullable */tolerated_hash_id?: string | null;- is_quarantined?: boolean;metadata?: SnapshotMetadata;/** @nullable */ssim_score?: number | null;@@ -72174,7 +72175,7 @@ export namespace Schemas {/** @nullable */previous?: string | null;results: Snapshot[];- /** 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. */+ /** Count of this run's snapshots that match the other filters and whose identifier is quarantined now. Excluded from results unless include_quarantined=true is passed. This can differ from the run's own counts, which use the quarantines at gating time. */quarantined_count?: number;}@@ -127036,15 +127037,25 @@ export namespace Schemas {*/offset?: number;/**- * Filter by review state+ * Filter by where the run stands in review. `needs_review`: a completed pull request run with changes nobody approved yet. `clean`: no changes, or approved. `processing`: diffs still computing. `stale`: superseded by a newer run while its changes were unapproved.*/- review_state?: string;+ review_state?: VisualReviewReposRunsListReviewState;/*** Free-text search over branch, commit SHA, run type, and PR number*/search?: string;};+ export type VisualReviewReposRunsListReviewState = typeof VisualReviewReposRunsListReviewState[keyof typeof VisualReviewReposRunsListReviewState];+++ export const VisualReviewReposRunsListReviewState = {+ Clean: 'clean',+ NeedsReview: 'needs_review',+ Processing: 'processing',+ Stale: 'stale',+ } as const;+export type VisualReviewReposSnapshotsListParams = {/*** Number of results to return per page.@@ -127078,15 +127089,25 @@ export namespace Schemas {*/pr_number?: number;/**- * Filter by review state+ * Filter by where the run stands in review. `needs_review`: a completed pull request run with changes nobody approved yet. `clean`: no changes, or approved. `processing`: diffs still computing. `stale`: superseded by a newer run while its changes were unapproved.*/- review_state?: string;+ review_state?: VisualReviewRunsListReviewState;/*** Free-text search over branch, commit SHA, run type, and PR number*/search?: string;};+ export type VisualReviewRunsListReviewState = typeof VisualReviewRunsListReviewState[keyof typeof VisualReviewRunsListReviewState];+++ export const VisualReviewRunsListReviewState = {+ Clean: 'clean',+ NeedsReview: 'needs_review',+ Processing: 'processing',+ Stale: 'stale',+ } as const;+export type VisualReviewRunsSnapshotHistoryListParams = {/*** Identifier of the snapshot to look up, for example a Storybook story id plus theme. Read it from the `identifier` field of a snapshot in the run. It is a name rather than a UUID, and it is required in addition to the run id in the path.@@ -127108,7 +127129,7 @@ export namespace Schemas {*/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.+ * 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. This filter uses the quarantines active now. Each snapshot's `is_quarantined` flag holds the state when the run was gated, so for an older run pass true and read the flag.*/include_quarantined?: boolean;/**@@ -127120,7 +127141,7 @@ export namespace Schemas {*/offset?: number;/**- * Whether to list only the snapshots whose identifier is currently quarantined. Defaults to false. When true, `include_quarantined` is ignored and quarantined snapshots are returned. Combine with `exclude_unchanged=false` to find a quarantined story that rendered `unchanged`, which is the snapshot to request a lift on merge for.+ * Whether to list only the snapshots whose identifier is currently quarantined. Defaults to false. When true, `include_quarantined` is ignored and quarantined snapshots are returned. Combine with `exclude_unchanged=false` to find a quarantined story that rendered `unchanged`, which is the snapshot to request a lift on merge for. This uses the quarantines active now, not each snapshot's `is_quarantined` flag, so on an older run it misses stories whose quarantine has ended since.*/quarantined_only?: boolean;/**diff --git a/services/mcp/src/generated/visual_review/api.ts b/services/mcp/src/generated/visual_review/api.tsindex 98fb81ec6f46..1c9495ef9d1f 100644--- a/services/mcp/src/generated/visual_review/api.ts+++ b/services/mcp/src/generated/visual_review/api.ts@@ -251,7 +251,12 @@ export const VisualReviewReposRunsListParams = () => zod.object({export const VisualReviewReposRunsListQueryParams = () => zod.object({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.'),- review_state: zod.string().optional().describe('Filter by review state'),+ review_state: zod+ .enum(['clean', 'needs_review', 'processing', 'stale'])+ .optional()+ .describe(+ 'Filter by where the run stands in review. `needs_review`: a completed pull request run with changes nobody approved yet. `clean`: no changes, or approved. `processing`: diffs still computing. `stale`: superseded by a newer run while its changes were unapproved.'+ ),search: zod.string().optional().describe('Free-text search over branch, commit SHA, run type, and PR number'),})@@ -284,7 +289,12 @@ export const VisualReviewRunsListQueryParams = () => zod.object({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.'),pr_number: zod.number().optional().describe('Filter by GitHub PR number'),- review_state: zod.string().optional().describe('Filter by review state'),+ review_state: zod+ .enum(['clean', 'needs_review', 'processing', 'stale'])+ .optional()+ .describe(+ 'Filter by where the run stands in review. `needs_review`: a completed pull request run with changes nobody approved yet. `clean`: no changes, or approved. `processing`: diffs still computing. `stale`: superseded by a newer run while its changes were unapproved.'+ ),search: zod.string().optional().describe('Free-text search over branch, commit SHA, run type, and PR number'),})@@ -491,7 +501,7 @@ export const VisualReviewRunsSnapshotsListQueryParams = () => zod.object({.boolean().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.'+ "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. This filter uses the quarantines active now. Each snapshot's `is_quarantined` flag holds the state when the run was gated, so for an older run pass true and read the flag."),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.'),@@ -499,7 +509,7 @@ export const VisualReviewRunsSnapshotsListQueryParams = () => zod.object({.boolean().default(visualReviewRunsSnapshotsListQueryQuarantinedOnlyDefault).describe(- 'Whether to list only the snapshots whose identifier is currently quarantined. Defaults to false. When true, `include_quarantined` is ignored and quarantined snapshots are returned. Combine with `exclude_unchanged=false` to find a quarantined story that rendered `unchanged`, which is the snapshot to request a lift on merge for.'+ "Whether to list only the snapshots whose identifier is currently quarantined. Defaults to false. When true, `include_quarantined` is ignored and quarantined snapshots are returned. Combine with `exclude_unchanged=false` to find a quarantined story that rendered `unchanged`, which is the snapshot to request a lift on merge for. This uses the quarantines active now, not each snapshot's `is_quarantined` flag, so on an older run it misses stories whose quarantine has ended since."),snapshot_id: zod.string()