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.

fix(visual-review): confirm before accepting a quarantined snapshot's change (#113151)

Julian Bez8525532835bf
diff --git a/.agents/skills/writing-ui-components/SKILL.md b/.agents/skills/writing-ui-components/SKILL.md
index 1d90d8e7039c..f9a8ce6c89bb 100644
--- a/.agents/skills/writing-ui-components/SKILL.md
+++ b/.agents/skills/writing-ui-components/SKILL.md
@@ -215,7 +215,8 @@ acts on it.
- **New presentational components ship with a story** (handbook rule). Each committed story
shows a state that no other story shows. A story adds a light and a dark visual review
baseline, and every later change to that surface must re-approve both. A quarantined story's
- diff does not gate the PR, so check for it and approve it by identifier
+ diff does not gate the PR. When your change alters that story, approve it by identifier.
+ When it does not, leave the diff alone: it is the flake the quarantine hides
([triaging-visual-review-runs](../../../products/visual_review/skills/triaging-visual-review-runs/SKILL.md#quarantined-stories-in-your-run)).
A story written only
to look at a change or to take a PR screenshot is scratch: keep it out of the commit.
diff --git a/products/visual_review/frontend/components/SnapshotDiffViewer.tsx b/products/visual_review/frontend/components/SnapshotDiffViewer.tsx
index f64efec24719..9839dd9d228d 100644
--- a/products/visual_review/frontend/components/SnapshotDiffViewer.tsx
+++ b/products/visual_review/frontend/components/SnapshotDiffViewer.tsx
@@ -223,6 +223,37 @@ export function SnapshotDiffViewer({
})
}
+ // Accepting writes this picture into the baseline for every branch. On a pull request that does
+ // not touch the story, the picture is usually the flake the quarantine is hiding.
+ const openAcceptQuarantinedDialog = (): void => {
+ // The dialog stays clickable during its close transition, so a double click would approve twice.
+ let submitted = false
+ LemonDialog.open({
+ title: 'Accept a change to a quarantined snapshot?',
+ description: (
+ <div className="flex flex-col gap-2">
+ <code className="break-all">{snapshot.identifier}</code>
+ <p className="m-0">
+ This snapshot is quarantined because it renders inconsistently, so its change does not block
+ your pull request. Accept it only if your pull request changes this story. Otherwise leave it as
+ it is: accepting it makes this picture the baseline for everyone.
+ </p>
+ </div>
+ ),
+ primaryButton: {
+ children: 'Accept change',
+ onClick: () => {
+ if (!submitted) {
+ submitted = true
+ onApprove?.()
+ }
+ },
+ 'data-attr': 'visual-review-snapshot-accept-quarantined-confirm',
+ },
+ secondaryButton: { children: 'Cancel' },
+ })
+ }
+
// Parse identifier for display (e.g., "Feature-Flags-settings--e2e-test--dark--1440x900")
const parts = snapshot.identifier.split('--')
const pageName = parts[0]?.replace(/-/g, ' ') || snapshot.identifier
@@ -289,9 +320,9 @@ export function SnapshotDiffViewer({
<LemonButton
type="secondary"
size="small"
- onClick={onApprove}
+ onClick={openAcceptQuarantinedDialog}
loading={isApproving}
- tooltip="This change does not block the PR because the story is quarantined. Accept it to make this picture the baseline when you finalize the run."
+ tooltip="This change does not block the pull request because the story is quarantined. Accept it only if your pull request changes this story."
data-attr="visual-review-snapshot-accept-quarantined"
>
Accept change