Skip to content

Recheck differing shots for content that varies per load - #66

Merged
tmashara merged 2 commits into
mainfrom
claude/issue-47-recheck
Oct 29, 2026
Merged

tmashara merged 2 commits into
mainfrom
claude/issue-47-recheck

Conversation

@tmashara

Copy link
Copy Markdown
Owner

What / why

A counter, a rotating banner or an "N minutes ago" that differs between two loads of the same site reads as a regression today, so you only find it with a base-vs-base baseline. Now a shot with a difference reloads its right side once, in a fresh context. Any elements that differ between the two right loads are reported as varies.

  • They are painted out on both sides, like a mask, and left out of the score (total - unstable - varies). The painted area is the located element's box, or the region rect when no element was found. Painting only the pixels that changed between the two right loads would miss the left side's own value, and so would painting the cell rects when a digit happens to repeat between loads. The element box is exactly what the suggested mask would cover.
  • They are listed after the routes in both the compact summary and the --progress summary:
    varies /drifting @1440  148,480px  div.drift
      --mask 'div.drift'
      masks: [{ selector: "div.drift", urlPath: "/drifting", reason: "varies per load" }]
    
  • results.json gets varies (regions with elements) and variesPixels. Both are optional and only written when a recheck found something, so older files and the --cache-right deepEqual test are unaffected.
  • report.html shows N px vary per load. evidence.html adds the note N shot(s) vary per load (painted out).
  • The recheck is a hint, like locate: if it fails for any reason, the shot keeps its first measurement. The context is created inside the try and closed in finally.

Behaviour changes

  • Recheck is on by default. --no-recheck turns it off. It is CLI-only (no config key, not in the config hash), like --cache-right.
  • Never under --cache-right. A replay serves the same bytes on every load, so a recheck would find almost nothing, and it would also touch the HAR recording.
  • A shot that only varies is clean (on the clean: line, reusable, exit 0) but is still listed under varies.
  • A shot with varying content can't be accepted. unacceptable returns "varies per load", for the same reason as unstable: the painted pixels change from run to run, so the region hashes don't reproduce. The fix is the printed mask.

Cost

Shots with no difference cost nothing extra. Each differing shot pays for one more context create/close, one full right capture (one extra GET on the right origin), one more compare and one more locate. When something varies, it also pays one more cancelUnstable and compare. That is roughly +50% wall time on a differing shot. During a redesign, where every shot differs, use --no-recheck.

Cut

  • A config-file recheck key, rechecking the left side, more than one recheck, and a cap on recheck count or area.
  • Crops for varies regions, and a varies token in compact rows or progress lines.
  • Removing varying text from the text diff: a shot that only varies hides its row anyway.
  • A page did not settle-style cap for varies: a mostly-varying page is listed with its pixel count.

Known limits

  • The fresh context starts without the cookies or localStorage left by earlier routes, and with a cold HTTP cache. Content that depends on those will show up as varying.
  • If a real change sits inside a varying element's box, it is painted out with it. It is always listed with its selector and pixel count.
  • Variation that changes the page height is only partly handled: its regions are painted, but the height delta still counts against the score.

How tested

  • Visual tier (tests/visual/guardrails.test.ts, masks):
    • The existing "unmasked drifting value costs the score" test now runs with --no-recheck and also asserts that there is no varies.
    • New test: /drifting plus /color. /drifting is clean, has diffPixels 0 and variesPixels > 0, and its element is div.drift. The varies, --mask and masks: lines are printed. /color still differs and has no varies.
    • New test: /drifting plus a left-only h1 { color: red } hook. It still differs and has variesPixels > 0, and --accept prints can't be (1 varies per load).
  • All three new or changed tests fail on main and pass with this change. I ran them 6 times in a row and they passed every time.
  • Unit tier: --help lists --no-recheck.
  • npm run typecheck, npm run lint, npm run format:check, npm test (294 pass) and npm run test:visual (332 pass) all pass on macOS. No accepted-diff hashes were recorded.
  • Docs updated: docs/output.md, docs/how-it-works.md, README.md, skills/renderdiff/reference.md, skills/renderdiff/SKILL.md.

Fixes #47

🤖 Generated with Claude Code

tmashara and others added 2 commits October 29, 2026 17:33
A differing shot reloads its right side once in a fresh context. Elements
that differ between the two loads are painted out on both sides like a
mask, left out of the score, never accepted, and listed with the --mask
and config masks entry that would cover them. --no-recheck turns it off;
--cache-right never rechecks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t's host as the mask

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmashara
tmashara merged commit 5d8fa91 into main Oct 29, 2026
3 checks passed
@tmashara
tmashara deleted the claude/issue-47-recheck branch October 29, 2026 16: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.

Recheck differing shots for load-to-load variation

1 participant