Skip to content

Add renderdiff merge - #87

Merged
tmashara merged 2 commits into
mainfrom
claude/issue-76-merge
Oct 29, 2026
Merged

tmashara merged 2 commits into
mainfrom
claude/issue-76-merge

Conversation

@tmashara

@tmashara tmashara commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

What / why

renderdiff merge <full-out> <partial-out> --out <dir> combines a full run with a partial one, e.g. a handful of routes rerun under a new mask, which --rerun-failed can't do (it refuses a changed config). No browser. The result is a new out dir: the full run's results, each name@width the partial run also has replaced in place by the partial's shot (files included), and the partial's other shots appended. The key is the same name@width key --rerun-failed uses. Summary, findings, report.html and evidence.html are recomputed; exit 0, or 2 with ✗ … (never 1 or 3: merging measures nothing).

meta is the full run's, with widths, masks, hideSelectors and blockUrlPatterns unioned (so "What was neutralized" never under-reports what the partial run hid or blocked) and rightReplayedFrom recomputed over the merged results. Stale accepts: the full run's minus the replaced shots, plus the partial's. Each shot keeps the accepted flag its own run gave it; renderdiff.accepted.json isn't reread (no config context), documented.

Refusals (exit 2) and what they protect

  • Different meta.left/meta.right: the shots would compare different sites.
  • --out at or inside an input: never write into an input. Compared by realpath, so a trailing slash, a relative path, a symlink or a case alias can't slip past (an --out that's a parent of an input is already refused by wipeable).
  • --out holding foreign files: same wipeable() check and message as a run.
  • A referenced file missing from an input: checked before --out is wiped, so the previous output isn't lost for nothing.
  • Two kept shots writing one file (slug clash: slugs() suffixes -2 by route order, so a partial run with fewer routes can give a route the bare stem a full-run shot uses). Checked while building the copy map, before --out is touched.
  • --rerun-failed on a merged out dir (previous() guard): otherwise it would match the full run's config hash, reuse shots taken under the partial run's config and rewrite meta.masks to the old one, so evidence would under-report what was neutralized.

The from field

BaseResult.from?: string: the generatedAt of the run the shot came from; absent for the run in meta. A shot that already had from (the partial was itself a merge) keeps it.

evidence.html: Not verified

A merged run says Not verified, with a "N shot(s) merged from a later run" note. Same rule as a --rerun-failed run that reused shots: shots taken at different times may not reflect the same build. For a verdict, chain renderdiff report <dir> --verdict ….

Cut

  • meta.merged[]: per-entry from is the record; add a list if someone needs the partial run's config/version.
  • Version/browser/threshold warnings and a platform refusal: none loses data or hides a diff.
  • --verdict/--title on merge (chain report), in-place merge, re-applying renderdiff.accepted.json, a "merged" line in report.html.

How tested

Unit tier, describe("renderdiff merge") in tests/unit/report.test.ts: two out dirs built with writeResults and distinct file bytes per run, driven through the CLI.

  • Happy path: replaced /@1440 carries from and the partial's file bytes, untouched shots have no from, /b (an error with unsettled frames) appended with its frames copied, the replaced shot's extra crop not copied, summary.differing 0, meta.masks unioned, generatedAt stays the full run's, report.html written, evidence banner Not verified; re-merging into the same --out succeeds.
  • Refusals: different origin, --out = input, a symlink to an input with a trailing slash, a dir inside an input, --out with a foreign file (left intact), a missing source file (the existing --out keeps its results.json).
  • Slug clash: exit 2 naming both shots, --out not created.

All three fail on main (the CLI treats merge as an origin) and pass with the change. npm run typecheck, lint, format:check, npm test (314 pass), npm run test:visual (337 pass). Partial failure: past the checks, --out only ever held renderdiff output and stays wipeable, so rerunning the merge recovers. The previous() guard isn't unit-testable (the CLI preflights both URLs before run()).

Docs: README § Output, docs/output.md (## merge, from in the results.json sample, the Not verified list), skills/renderdiff/reference.md (## merge, an Iterating bullet, the exit-2 row).

Fixes #76

🤖 Generated with Claude Code

tmashara and others added 2 commits October 29, 2026 19:39
Combine a full run's out dir with a partial run's (e.g. a few routes
rerun under a new mask) into a new out dir: the partial's shots replace
or add to the full run's, each tagged with `from`.

Fixes #76

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ore wiping

Compare realpaths so a symlink or case alias of an input can't be wiped, and
refuse an --out inside an input. Check every referenced file exists before
wiping --out, so a missing source can't cost the previous output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmashara
tmashara force-pushed the claude/issue-76-merge branch from d463cdf to 03d80b8 Compare October 29, 2026 18:42
@tmashara
tmashara merged commit 59e3e60 into main Oct 29, 2026
3 checks passed
@tmashara
tmashara deleted the claude/issue-76-merge branch October 29, 2026 18:51
@tmashara tmashara mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

renderdiff merge: fold a partial rerun into a full results.json

1 participant