Repository navigation
--computed: read the left origin as the right's - #62
Merged
Merged
Conversation
Absolute URLs in snapshot keys, markup and computed url() values carry each side's origin, so two ports or a local build against production reported dom differences and style findings that were only the origin. diffSnapshots now rewrites the left page's origin to the right page's before comparing. Part of #59 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tmashara
force-pushed
the
claude/issue-59-computed-origin
branch
from
October 29, 2026 16:00
3f61f9c to
f190549
Compare
This was referenced Oct 29, 2026
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.
Part of #59 (first item:
--computeddoesn't normalize the origin).What / why
--computedsnapshots carry each side's origin in three places: selector keys (a[href="http://127.0.0.1:4611/x"]), the walked markup (href,src,srcset, inlinestyleurl()…), and computed styles (getComputedStyleresolves everyurl()to an absolute URL, even a relative one in CSS). With two ports, or a local build against production, that alone produceddom differs,unmatchedelements andbackground-image/contentfindings that were only the port.diffSnapshotsis the single compare point, so it now rewrites the left page's origin (full and protocol-relative) to the right page's in the whole left snapshot before comparing. It rewrites left to right instead of stripping both, so a local build that hard-codes production URLs matches production.run.tspassesleftPage.url()/rightPage.url()so redirects use the document's real origin. Same origin and opaque (about:blank,data:) origins are a no-op.Known limits
url("…:4612/a.png")→url("…:4612/b.png")). That's correct, just slightly odd to read.?url=http%3A%2F%2F…, e.g. Next image) aren't rewritten.a[href]only goes into a key when the raw href is under 60 chars. With origins of different lengths, an absolute href near that limit can be keyed on one side only.locatestill keysa[href]by the raw value (pairing falls back to text matching). Out of scope here.How tested
tests/unit/computed.test.ts): same host on two ports, covering the key,srcsetwith a protocol-relative URL, and computedbackground-image. The diff is empty.:46110against:46120(which a rewrite without the port boundary would match) and a different path still differ.origin(absolutea[href]set at parse time fromlocation.origin, plus a relativeurl()background) is added to the--computedcontrols test. It assertsdom 0, no findings at/originanddom identical on 3 of 4./origindom[2, 2]) and pass with it.npm run typecheck,lint,format:check,npm test(294 pass),npm run test:visual(329 pass), after rebasing on Capture: a deadline per shot so a hung renderer can't hang the run #61.🤖 Generated with Claude Code