feat(diff): compare computed values canonically — a re-serialization isn't a change#161
Merged
Merged
Conversation
…isn't a change Dogfooding a real re-baseline showed StyleProof reporting a flood of "changes" that weren't: a newer Chromium serialized identical values differently — rgba(8, 18, 32, 0.62) became #0812209e, a font list's comma spacing shifted — and every one read as a diff, drowning the review and blowing the report up to hundreds of MB. A green flickered red purely across browser versions. Compare by a canonical form instead: colours parse to one rgba() (hex / rgb / rgba / hsl / hsla, short+long hex, comma + modern space syntax), and comma/whitespace runs normalize outside quotes. Captures become serialization-independent. Safety bar — only PROVABLY-equal values collapse: an unparseable value (or anything inside a quoted string) is left byte-for-byte, so a real change (#ff0000 → #ff0001, 0.5 → 0.6 alpha, a different font) always still surfaces. The report shows the real captured strings; only the equality test is canonical. Custom props stay ignored; content/text diffs stay exact. Tests: test/canonicalize.test.mjs — equal spellings collapse, real changes never do, quoted/unparseable left untouched, and diffStyleMaps yields zero findings for a serialization-only difference. Full suite 255/255 (no existing diff test regressed). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🗺️ StyleProof report📊 View the side-by-side visual report →To accept: rebuild the map with |
Fallow audit reportNo GitHub PR/MR findings. Generated by fallow. |
Fallow audit report0 inline findings selected for GitHub review. |
# Conflicts: # CHANGELOG.md # package.json
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 and why
StyleProof stops reporting a change when the browser merely re-serialized an identical
value. Dogfooding a real re-baseline exposed it: a newer Chromium rewrote
rgba(8, 18, 32, 0.62)as#0812209e, a Tailwind migration reformatted a font list'scomma spacing — and the diff flagged every one as a difference, drowning the review in
changes that aren't changes and blowing the report up to hundreds of MB. A green flickered
red purely across browser/build versions.
The diff now compares by a canonical form: colours parse to one
rgba()(hex /rgb/rgba/hsl/hsla, short + long hex, comma + modern space syntax), and comma/whitespaceruns normalize outside quotes. Captures become serialization-independent — the root fix
for re-baseline noise, at the diff, not the report.
Safety bar — only provably-equal values collapse. An unparseable value (or anything
inside a quoted string) is left byte-for-byte, so a real change always still surfaces. The
report shows the real captured strings; only the equality test is canonical. Custom props
stay ignored; content/text diffs stay exact.
Proof (required)
Screenshots Not applicable — diff-logic change, no browser surface. Receipts in
test/canonicalize.test.mjs:Full suite 255/255 — no existing diff test regressed (nothing relied on treating a
re-serialization as a change). build / typecheck / lint / format:check clean.
Checklist
build && typecheck && lint && format:checkpass ·npm test255/255test/canonicalize.test.mjs· Updated CHANGELOG ([3.15.0])