: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
chore(visual-review): steer authors to approve quarantined changes (#110168)
Julian Beza800ef07eda2
diff --git a/.agents/skills/writing-ui-components/SKILL.md b/.agents/skills/writing-ui-components/SKILL.mdindex 43fa0fca280c..af20ece32cdb 100644--- a/.agents/skills/writing-ui-components/SKILL.md+++ b/.agents/skills/writing-ui-components/SKILL.md@@ -214,7 +214,10 @@ acts on it.dashboards and Playwright find them. Once shipped it's frozen (see the table above).- **New presentational components ship with a story** (handbook rule). Each committed storyshows 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 story written only+ 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+ ([triaging-visual-review-runs](../../../products/visual_review/skills/triaging-visual-review-runs/SKILL.md#quarantined-stories-in-your-run)).+ A story written onlyto look at a change or to take a PR screenshot is scratch: keep it out of the commit.Flag-gated components use the `featureFlags` story parameter([setting-feature-flags-in-storybook](../setting-feature-flags-in-storybook/SKILL.md)).diff --git a/products/visual_review/README.md b/products/visual_review/README.mdindex 5ee4e7fdd8be..4b865554b2a1 100644--- a/products/visual_review/README.md+++ b/products/visual_review/README.md@@ -267,7 +267,15 @@ The procedure is: open a PR that renders the story, approve the `changed` or `neA PR renders only the stories its diff affects, so a story the PR does not touch needs the full matrix: add the `run-ci-frontend` label before the push that should render it.The label only widens a Storybook run that happens anyway, so the PR must also change a path the Storybook workflow watches.+Neither the gate nor the PR comment shows a quarantined story's diff.+So the author of a change to a quarantined story has to look for it: list the run's snapshots with `include_quarantined=true`.+A fix for the flake itself leaves nothing in the run to approve, and nothing records it, so the PR description names the identifiers the fix should release.+Lift the quarantine after the merge.+Check first that the default branch renders the story as its entry.+When the latest default-branch run still lists the story as changed, the lift fails nearly every run, and so does the expiry date.+A `broken` entry is the usual sign, but its state covers 7 days, so it can lag a fix.+Re-baseline such a story with the procedure above before the quarantine ends.A lift records the default branch's head commit, and a run whose commit does not contain that commit still treats the story as quarantined.That matters because an entry on the default branch does not reach a branch that forked before it, and healing cannot supply it either: healing reads the merge-base, which for such a branch also predates the entry.So an older branch keeps the quarantine until it merges the default branch, and the lift cannot red its gate.diff --git a/products/visual_review/skills/triaging-visual-review-runs/SKILL.md b/products/visual_review/skills/triaging-visual-review-runs/SKILL.mdindex 7a9596f0213d..4f660fcc332d 100644--- a/products/visual_review/skills/triaging-visual-review-runs/SKILL.md+++ b/products/visual_review/skills/triaging-visual-review-runs/SKILL.md@@ -29,15 +29,17 @@ It may not ship a visual change on its own: `finalize-create` commits the baseliGather the evidence with [Is the diff real or unrelated?](#is-the-diff-real-or-unrelated) and the [flake check](#flake-check-has-this-story-been-changing),then take the first row that matches each changed snapshot.-| Evidence | Action | Human yes needed |-| ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ---------------------------------- |-| PR comes from a fork (`isCrossRepository: true`) | Report only. See [Fork PRs](#fork-prs-have-no-visual-review-run) | No VR writes possible |-| The diff comes from your change and is intended | `approve-create`, then ask for finalize | Yes, for each run, before finalize |-| The diff comes from your change and is not intended | Fix the code and push. No VR write | No |-| Story outside your change, flakiness entry `unstable`, `hard_count` ≥ 5, `last_flaked_at` in the last 7 days | `quarantine-create`, then `recompute-create`. Report it | No |-| Story outside your change, flakiness entry `broken` | Do not quarantine. Its baseline on the default branch is wrong. Report it and recommend a re-baseline | Yes |-| Story outside your change, quiet history, same width and height, `change_kind: pixel`, a noise source you can name | `tolerate-create`, then `recompute-create` | No |-| Anything else: `unstable` with fewer failures, a real-looking change you did not make, unsure | Stop and report what you saw | Yes |+| Evidence | Action | Human yes needed |+| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ---------------------------------- |+| PR comes from a fork (`isCrossRepository: true`) | Report only. See [Fork PRs](#fork-prs-have-no-visual-review-run) | No VR writes possible |+| The diff comes from your change and is intended | `approve-create`, then ask for finalize | Yes, for each run, before finalize |+| The diff comes from your change and is not intended | Fix the code and push. No VR write | No |+| Your change renders a quarantined story `changed` or `new`, and the change is intended | `approve-create` for that identifier, then ask for finalize. See [Quarantined stories](#quarantined-stories-in-your-run) | Yes, for each run, before finalize |+| Your change fixes a quarantined story's flake, and the story renders `unchanged` | Say so in the PR description. Lift the quarantine after the merge, per [Triaging the queue](#triaging-the-queue) | No |+| Story outside your change, flakiness entry `unstable`, `hard_count` ≥ 5, `last_flaked_at` in the last 7 days | `quarantine-create`, then `recompute-create`. Report it | No |+| Story outside your change, flakiness entry `broken` | Do not quarantine. Its baseline on the default branch is wrong. Report it and recommend a re-baseline | Yes |+| Story outside your change, quiet history, same width and height, `change_kind: pixel`, a noise source you can name | `tolerate-create`, then `recompute-create` | No |+| Anything else: `unstable` with fewer failures, a real-looking change you did not make, unsure | Stop and report what you saw | Yes |Each theme is its own identifier.Judge the `--light` and `--dark` snapshots of a story separately, and quarantine only the ones that match.@@ -47,6 +49,30 @@ The diff already absorbs most real render noise below the threshold, and a smallA toleration accepts one exact hash forever and cannot be undone through the API, so it is never a way past a gate.A story that renders differently from run to run and meets the quarantine row above gets a quarantine, which also protects every other developer. With less evidence, report it instead.+### Quarantined stories in your run++A quarantine hides a story's diff from the gate and from the PR comment, so a green check does not show that your change left a quarantined story alone.+The story still renders and is diffed on every run that selects it. A PR run renders only the stories its diff affects.+Check every run of a change that touches UI.+List the changed quarantined snapshots with+`posthog:visual-review-runs-snapshots-list { id: <run_id>, include_quarantined: true, exclude_unchanged: true }`.+With `exclude_unchanged`, `quarantined_count` counts only the changed ones.+The list is paginated and does not put quarantined rows first, so follow `next` until every row is read.++- A quarantined story that your change renders differently needs its new picture approved by identifier, then finalized.+ "Approve all" and `approve_all` skip quarantined snapshots.+ Without the approval, the default branch keeps the old entry, and every run fails on the day the quarantine is lifted or expires.+- A quarantined story that your change does not touch can still show `changed`, because it is flaky. Leave it.+- A fix for the flake changes nothing VR can see in one run, so the story renders `unchanged` and the list above leaves it out.+ Look it up with `posthog:visual-review-repos-quarantine-list { id: <repo_id>, identifier }` instead.+ Nothing records the fix, and the quarantine stays until someone lifts it or its expiry date passes, whichever comes first.+ Name the exact identifiers in the PR description, and lift only after the default branch renders them clean.+- A change that deletes a quarantined story leaves its baseline entry behind.+ Only a full run classifies the story `removed`, and only finalize prunes the entry.+ The `run-ci-frontend` label takes effect on the next push or ready-for-review, not when it is added, so push after labeling and check that the new run is full.+ Finalize that run before the merge, or every full run reports the story `removed` once the quarantine ends.+- One clean render does not prove a rare flake is gone, and neither does `variant_count: 0`, which counts only absorbed variants.+## When this skill appliesTrigger this skill on any of:@@ -312,6 +338,16 @@ When the user is doing housekeeping rather than asking about a specific PR:5. Lift stale quarantines: entries in `visual-review-repos-flakiness-retrieve` with `needs_decision: true` stopped failingor expire soon. Lift one with `posthog:visual-review-repos-quarantine-expire-create { id, run_type, identifier }`only when it had no hard failure in the window, or a merged fix removed the cause.+ Before a lift, check that the default branch renders the story as its entry now.+ Use the latest completed default-branch run of the quarantine's run type whose commit contains the fix, and list its+ changed snapshots with `include_quarantined: true, exclude_unchanged: true`, following `next`.+ Lift only when the story is not in that list on several such runs. A rare flake renders clean most of the time,+ so one clean run is not enough, and a pending run or one of another run type proves nothing.+ The `broken` state alone does not decide it. The state covers 7 days, so it stays `broken` for days after a fix lands.+ When the story is still in that list, check that recent default-branch runs render the same changed picture before you re-baseline it.+ One changed render of a flaky story is a flake, and re-baselining it only swaps which variant fails. Keep the quarantine then.+ For the same picture on run after run, re-baseline it first (the README's quarantine section has the procedure), then lift.+ Report a quarantine in that condition before its expiry date, because the expiry fails runs the same way.## Output expectations@@ -324,6 +360,7 @@ For triage / aggregate questions, a short table beats prose. Group by what the u## What NOT to do- Do not tolerate to get past a gate, and do not quarantine a diff your own change caused or a `broken` entry.+- Do not read a green gate as proof that your change left quarantined stories alone. See [Quarantined stories](#quarantined-stories-in-your-run).- Do not assume the failing GitHub check on a PR is unrelated to VR — if a `visual-review` check is red ona PR you're working on, that's the trigger to run this skill.- Do not read an empty run list on a fork PR as a broken or pending run.