diff --git a/README.md b/README.md index 9bd8758..78982fd 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,8 @@ renderdiff http://localhost:3000 https://example.com / /about --rerun-failed to the config, or in cwd); commit it. Later, a shot whose every difference matches an entry is listed on an `accepted:` line and doesn't count toward the exit code; anything new on the same page still shows. `--rerun-failed` reruns only what the last run in `--out` didn't find clean -or accepted (with the same `--only`, if it had one). Against a slow reference, `--cache-right` +or accepted (with the same `--only`, if it had one), keeping a shot with no differing pixels +and at most 100 unstable ones. Against a slow reference, `--cache-right` replays the right side's recorded traffic for up to an hour; drop it for the final run. Matching rules, why to accept on the platform that checks, and the cache: [docs/accepted.md](https://github.com/tmashara/renderdiff/blob/main/docs/accepted.md). diff --git a/docs/accepted.md b/docs/accepted.md index fbfc952..b6ebcb1 100644 --- a/docs/accepted.md +++ b/docs/accepted.md @@ -59,7 +59,9 @@ fingerprint covers it. `--rerun-failed` reads `results.json` in `--out`, keeps every shot that was clean or is accepted (against the accepted file as it is now), reruns the rest — differences, unstable shots, errors — and merges them back into `results.json` and `report.html` in route and width -order. The out dir is kept rather than wiped; only a rerun shot's own old files are replaced. +order. A shot with no differing pixels and at most 100 unstable ones (anti-aliased corners, +which recur on every load) is kept too, and is still not clean. +The out dir is kept rather than wiped; only a rerun shot's own old files are replaced. A `rerun:` line says how many shots it reran on how many routes, and how many it reused. `meta` describes the rerun (its clock, browser and time); a reused shot was taken under the earlier run's. It must repeat the previous run: different origins, routes, widths, config diff --git a/docs/how-it-works.md b/docs/how-it-works.md index 381aad4..25ffa32 100644 --- a/docs/how-it-works.md +++ b/docs/how-it-works.md @@ -29,7 +29,9 @@ honestly. This is what renderdiff does to make sure of that. (server-sent events and beacons don't count), then re-injects the stylesheet to catch late-injected chrome. Stylesheets that failed or answered ≥ 400 (blocked URLs aside) and font faces that failed (blocked font files included) are recorded per side as - `failed`, and keep the route off the `clean:` line. + `failed`, and keep the route off the `clean:` line. When only one side failed, that side is + loaded again once, and reported only if it fails again; a failure that recurred isn't retried + on later shots. - **Shoots until stable** — repeats the screenshot until two in a row match (at most 3; 2 for tiled pages). Pixels still changing between the last two shots of the same load are noise from that origin: they're painted magenta on both sides, reported per comparison diff --git a/skills/renderdiff/SKILL.md b/skills/renderdiff/SKILL.md index 67b53e0..6ad5376 100644 --- a/skills/renderdiff/SKILL.md +++ b/skills/renderdiff/SKILL.md @@ -19,7 +19,7 @@ the § named at each step. Setting up a project (`/renderdiff init`): [init.md]( | Change | Run | | --- | --- | -| CSS only, markup untouched (refactor, dead-CSS removal, token swap) | pixels + `--computed`. First diff the two builds (§ Reference and routes): if only asset hashes differ, no shots are needed; otherwise shoot the routes the changed rules reach. Expect `dom identical` on every route: then each `computed:` finding is a real style change, even on a clean route. `dom differs`: often a wrapper's class changed, re-keying its subtree (§ `--computed`). Hover menus and open menus aren't shot without a `before` hook that ends waiting for the open state, and dead-CSS removal breaks exactly those. | +| CSS only, markup untouched (refactor, dead-CSS removal, token swap) | pixels + `--computed`. First diff the two builds (§ Reference and routes): if only asset hashes differ, or every changed rule means the same, no shots are needed; otherwise shoot the routes the changed rules reach. Expect `dom identical` on every route: then each `computed:` finding is a real style change, even on a clean route. `dom differs`: often a wrapper's class changed, re-keying its subtree (§ `--computed`). Hover menus and open menus aren't shot without a `before` hook that ends waiting for the open state, and dead-CSS removal breaks exactly those. | | Markup changes (framework, template or component migration) | pixels, plus `--aria`: `aria: identical` means a screen reader gets the same page. `--computed` findings would only be hints. | | Dependency or build upgrade | pixels, plus `--computed` if the markup should be identical. | | One component | pixels with `--selector ` or `'/route @sel'`. | @@ -37,16 +37,19 @@ Pixels decide the score and the exit code in every mode. replace this step and step 2's masks. None, and the project will be run more than once: offer `/renderdiff init` ([init.md](init.md)) after this check. 2. **Baseline**: base vs base. Before changing code, the untouched change side against the - reference; if the change is already made, the base build served on two ports. Whatever - differs varies per load: mask it (a `varies` line prints the mask; `--mask-media` for - iframes, `--mask ` or a config mask with a `reason`; video is already frozen; a - looping carousel: stop it with a `before` hook on both sides, or mask it), and rerun - until clean; `--only ` reruns some of a config's routes with their hooks, which - routes typed on the command line don't get. A difference with no `varies` line and - nothing unstable: `renderdiff probe --width ` names what varies - between loads; mask that. Against production instead: open each difference, then - `--accept "differs before the change"`. § Masks, accepts and thresholds. -3. **Change, run all routes at default widths, read each row in this order**: `ERROR` → + reference. If the change is already made, run step 3 first (its recheck already reloads each + differing shot's right side), then base vs base on only the routes that still differ, the + right origin on both sides (§ Reference and routes). Whatever differs varies per load: mask + it (a `varies` line prints the mask; `--mask-media` for iframes, `--mask ` or a config + mask with a `reason`; video is already frozen; a looping carousel: stop it with a `before` + hook on both sides, or mask it), and rerun until clean; `--only ` reruns some of a + config's routes with their hooks, which routes typed on the command line don't get. A + difference with no `varies` line and nothing unstable: + `renderdiff probe --width ` names what varies between loads; mask that. Against production instead: open + each difference, then `--accept "differs before the change"`. § Masks, accepts and + thresholds. +3. **Change, run every route in scope (CSS only: the routes the changed rules reach) at + default widths, read each row in this order**: `ERROR` → `failed` (a missing stylesheet or font explains the whole row: fix, rerun) → `fonts` → `text` → `h`/`w`, `band`, `aligned`, `line` → `dom` (`sel prop l→r` is a computed value: find the *rule*) → `findings:` (one cause on many routes: fix it once) → `computed:` → `Read` the @@ -65,7 +68,7 @@ Pixels decide the score and the exit code in every mode. Before you mask, accept, set `--threshold`, drop a route or skip a width: § Rationalizations. 5. **Iterate** with `--rerun-failed` (same arguments) and optionally `--cache-right` - (§ Iterating). **Finish** with a fresh full run: all routes, default widths, neither flag. + (§ Iterating). **Finish** with a fresh full run: the same routes, default widths, neither flag. All clean? Confirm both sides actually rendered. Exit 0 is not verified: unstable pixels or a failed asset alone exit 0, so report them. 1: an diff --git a/skills/renderdiff/reference.md b/skills/renderdiff/reference.md index 7640bee..14f4a08 100644 --- a/skills/renderdiff/reference.md +++ b/skills/renderdiff/reference.md @@ -29,14 +29,27 @@ results.json · Gotchas. - **CSS-only change:** diff the two build outputs first: every CSS file, plus the HTML and JS (minified CSS: `tr '}' '\n'` gives one rule per line; pair hashed file names by their stem; ignore `.map` files and `sourceMappingURL`). If they match apart from asset hashes, no route - needs shots; say so in the report. If HTML or JS differ too, the change isn't CSS-only. For + needs shots; say so in the report. The same if every changed rule means the same: + declarations only reordered (unless a shorthand and its longhand swap, `margin` and + `margin-top`), or values only re-notated (`rgb(0 0 0 / 50%)` for `rgba(0,0,0,.5)`, hex case + and short form, `0` for `0px`, `::before` for `:before`, `(width >= 60em)` for + `(min-width: 60em)`); name the rules you checked. If HTML or JS differ too, the change isn't + CSS-only, unless only inlined CSS differs: Astro, Svelte, Vue and similar builds copy + `