Repository navigation
Pages can see window.__RENDERDIFF__ and mark elements data-renderdiff-mask - #70
Merged
Merged
Conversation
…-mask Every page gets window.__RENDERDIFF__ = true before its first script, and every mask path (capture, text read, recheck, locate, --computed) also masks [data-renderdiff-mask]. The attribute's value, or the attribute name when empty, is listed under "What was neutralized" and in the result's `masked`, kept out of meta.masks so --rerun-failed and the config hash are unaffected. Fixes #49 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / why
Sites that know what drifts (a rotating quote, a chat widget) had no way to say so from the page; every mask had to live in the renderdiff config. Now:
window.__RENDERDIFF__ = trueis set before the page's first script on every load (first line of the existing seeded-Math.randominit script inprepare(), so it covers first pages, the recheck's fresh context and replacement pages). No request header, so no CORS preflights.[data-renderdiff-mask]is appended inmasksFor(), the one function every mask path goes through: the PNG paint (one-shot and tiled), the text read, the recheck's and the finallocate, and--computed. It is not added tocfg.masks, so the config hash,meta.masksand--rerun-failed's setup comparison are untouched.How the reason appears in the report
capture()reads each marked element's attribute value:data-renderdiff-mask="rotating quote"becomesrotating quote (data-renderdiff-mask)(mirrors<sel> (--mask)); an empty value is listed asdata-renderdiff-mask. The distinct reasons of both sides go on the result asmasked(absent when none), and "What was neutralized" in report.html and evidence.html lists them after the configured masks. "None configured." still shows only when there are neither.How tested
New guard-rail fixture
cooperate: three boxes whose text differs between the sides — one markeddata-renderdiff-mask, one hidden by the page underwindow.__RENDERDIFF__, one control. The new test intests/visual/guardrails.test.ts(describe("masks")) asserts every diff region names only the control, the text diff is only the control's line, and the reason shows up in bothmaskedand the report.src/change: fails (actual: 'div.box.marked > p'). With only the flag line removed: fails (actual: 'div.box.flagged > p'). With the change: passes.maskReasonsdeepEquals stay green, pinning that the always-present locator adds nothing when no element carries the attribute.npm run typecheck,lint,format:check,npm test(305 pass),npm run test:visual(333 pass).Docs: "Cooperating pages" in
docs/scoping.md,maskedindocs/output.md, the skill reference's mask row, bullet and results.json fields.Fixes #49
🤖 Generated with Claude Code