Review a run
Status: Stable
A run that finds differences leaves a branch baseline-update/<build> with the changed images. design-tests review helps you decide, for each image on that branch, whether it becomes part of the baseline. This page explains what the command is for, the steps in order, what a run has to record for a good review, and what the evidence does and does not show. The options of every step are in the CLI reference.
What the review is forโ
Every image on a baseline-update/<build> branch gets one of three outcomes:
- Take: the change is intended, and the image goes into the baseline.
- Leave: the change is not intended, or the capture is not reliable, and the baseline keeps its image.
- Open: nothing in the evidence decides it, and a person has to.
design-tests review does the mechanical part of that decision. It reads the run, groups and measures the changed images, ranks the app changes that may explain them, and drafts a take, a leave or a question for each image with the rule that produced it. It decides nothing that needs judgement. It does not merge, and it does not call the CI system or the git host.
Who runs itโ
A person can run every step by hand. An agent can run them through the skill reviewing-design-test-runs, which the package ships in skills/. The skill adds the judgement the command leaves out: it reads the app repository, writes the changes file, looks at the images, checks a flaky candidate in the live Storybook and writes the report. The command proposes and the person or agent decides. A person always merges the baseline.
Run the review with the latest release of the package, not with the version the suite pins. The run itself stays at the pinned version, because the browser build decides the pixels.
pnpm --package=@qs/design-tests@latest dlx design-tests review summary 131
The steps in orderโ
All steps take the build number of the run. Run them from a checkout of the suite repository, or name it with --suite <dir>. The outputs below are shortened, with example values.
1. Summaryโ
review summary prints what the run reported: the counts, the images the branch changes, the previous run, the app repository with the commit range, and the warnings. Read the warnings first. A platform change between two runs, an image that the run reported but the branch does not hold, and a branch cut from another commit than the run compared against each change how far you can trust the rest.
design-tests review summary 131
๐ Run 131 (RUN.json v1)
Job: suite-nightly https://ci.example.test/job/suite-nightly/131/
Compared against suite commit c0ffee000000
Counts: 50 passed ยท 5 diffs ยท 0 flaky ยท 1 new ยท 0 errors ยท 0 deleted ยท 50 total
Branch: 6 images (1 added, 5 modified, 0 deleted)
Previous run: 129
2. Groupsโ
review groups sorts the changed images by project, story title and viewport. The group shows how widespread a change is. The shape label says it: local (one story, one viewport), component (one story title in several projects or stories), chrome (the same viewport fails across several story titles, which points to shared page parts) or environment (half the run or more fails). Each image also says how it compares with the same image in the previous run, for example same pixels as run 129.
design-tests review groups 131
๐งฉ 5 groups in run 131; previous run 129
[local] alpha ร Components/Teaser ร Mobile (1)
M failed alpha/components/teaser/default-mobile.png
[component] alpha ร Pages/Landing ร Mobile (2)
M failed alpha/pages/landing/default-mobile.png
M failed alpha/pages/landing/long-mobile.png
3. Measureโ
review measure compares the baseline and the run image of each changed image pixel by pixel: the number of changed pixels, the size of both images, the largest channel difference and the bands of rows that changed. The bands tell whether a change sits in the header, the middle or the footer. The measurement is the input of the draft, the size-drop rule and the ranking.
The step resumes. When a --budget <seconds> ends the call, incomplete: true is printed, and the same command continues where it stopped.
design-tests review measure 131 --budget 150
4. Fetchโ
review fetch writes the baseline image and the run image of the paths you name into the state directory, so that you or an agent can look at them. Look at one pair per group, at every image with a large pixel difference, and at every image that the size-drop rule asks about.
design-tests review fetch 131 alpha/components/teaser/default-mobile.png
5. Draftโ
review draft runs the steps above and applies the rules. It writes evidence.json, evidence.md, draft.json and report.md into the state directory, and prints how many images are taken, left out or open, with the rules that fired. The exit code is 0 when nothing is open, 2 when open items or an incomplete measurement remain, and 1 on an error. Exit 2 is the normal result of a draft with questions.
design-tests review draft 131 --budget 150
๐ Draft for run 131: 2 questions (6 images)
needs-attribution: 5
size-drop: 1
review draft writes report.md again on every call. Edit the report only after the last draft.
6. Rankโ
review rank ranks the app changes against each group. You write the changes into a changes file from the app repository's log, its pull requests or its tickets; the command reads no git host. The ranking uses the changed components, the changed files and the bands of the measurement. review draft --changes <file> runs the same ranking and moves an image from "needs attribution" to "attribution ranked".
design-tests review rank 131 --changes changes.json
๐
Ranking of run 131: 5 groups, 4 with ranked changes, unmatched: 1
alpha ร Components/Teaser ร Mobile (1 image; bands: mid)
1. pr-205 "Teaser image radius" โ score 3
path: app/components/teaser/Teaser.scss names "teaser"
7. Baseline branchโ
When the review leaves out an image or keeps an item open, merging the whole branch would put those images into the baseline. review baseline-branch builds a partial baseline from a take list instead: a branch baseline/run-<build>-<topic> that holds the taken images and nothing else. Without --create it only plans the branch and checks it.
design-tests review baseline-branch 131 --take take.txt --topic teaser-radius
design-tests review baseline-branch 131 --take take.txt --topic teaser-radius --create --push
Partial baseline of run 131, topic teaser-radius
Branch: baseline/run-131-teaser-radius
Take: 3 images (0 added, 3 changed, 0 deleted)
Left out: 3 images
Check: passed
Plan only: nothing was created. Add --create to build the branch, --push to push it.
The check holds when the branch differs from its start by exactly the taken images and from the run's branch by exactly the left-out ones. Open a draft pull request for the branch while an item is open. A person merges it.
What the run must recordโ
The review reads the records of the run and cannot invent what they lack. A review is as good as these five things:
| The run records | Where it comes from | What the review does with it |
|---|---|---|
A run record, RUN.json | baseline-update writes it into the branch (Run record). For an older branch, pass the run's manifest.json with --manifest. | Without either, the review has nothing to read and stops. |
| The previous run | The branch baseline-update/<n> of the previous run of the same job. Keep at least one. | Names how each image compares with the previous run. Without it, the review has no run identity. |
| The pixel hash | run computes it for every failed and new image (pixelHash, manifest 1.6.0). | Compares two runs by pixels, also when the images of the previous run are gone. |
| The source repository | The configuration key sourceRepository. | Prints where to read the app's log. Without it, the summary says that none is declared. |
| The commit of the Storybook | The Storybook git metadata, served by the Storybook addon. | Ends the commit range. Without it, the range knows only a time window. |
The commit range reads from the commit of the baseline's run to the commit of this run. With both ends, the app changes between them are exactly the candidates. With a time window only, more changes qualify and the ranking says less.
What the evidence shows, and what it does notโ
The review gives evidence. These limits are part of the output, and they are the reason a person or an agent still decides:
- A ranked change is never a cause. A ranking says that a change touches the component, a changed file bears its name, or the change reaches the band where the image differs. Read the diff of the change and check it against one image pair before you name it.
- Changes can tie. Changes with the same score share a rank. The order inside a tie is the order of display, not a ranking. When three or more changes reach a group only because they change shared tokens or a theme, the review lists them as one shared entry and leaves the group without a candidate.
- "Same pixels as run N" is never "stable". A capture that collapsed in the same way twice has the same pixels twice. Equal pixels also say nothing about the code when the two runs tested different code.
- The size-drop rule asks, it never takes. A capture whose bytes per pixel fell below a third of its baseline's, or whose height dropped by a quarter or more, may be blank. The rule turns such an image into a question. It does not leave the image out and does not take it.
- A flake needs proof to leave an image out. Two attempts of one run that differ, two runs of the same code that differ, or the live Storybook showing the baseline's state are proof. A suspicion is a question.
- The review never guesses. A repository, a change or a cause that no record names stays a question.
Limitsโ
- It reads one run and its previous run. It does not follow an image over many runs, unless you pass a history file to
review draft. - It reads the changes only from the file you write. It runs no
git logand calls no git host, so the ranking is as complete as that file. - The measurement compares images and does not know what they show. A blank capture and an intended change can look alike by numbers; the size-drop rule and your own look at the image catch the difference.
- A suite without
RUN.jsonneeds--manifestfor every step, and a run without a previous branch has no run identity. - Only a person merges a baseline branch. The review builds the partial baseline branch and stops there.
Relatedโ
- CLI reference: review: every option and file format
- Baseline management: updating baselines after intended changes
- Use with Jenkins: the run record and the commit range
- Stabilization playbook: how to fix a capture that is proven flaky
- Glossary: changes file, ranked change, tie, partial baseline and the other terms