Repository navigation
Conversation
…band A uniform rescale of one framebuffer only drifts in aspect by integer rounding, which stays under 2 / the shortest side. Capping the 1% tolerance at that bound rejects iPhone 16 vs 16 Pro / Pro Max captures (0.29% / 0.22% apart) as a dimension mismatch, while real 1.0x vs 0.3x/0.25x pairs still normalize. Fixes #807
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…spect-rounding-tolerance
Two rounded rescales of one screen can sit past 1 / shortest side, so a 1 / shortest bound would reject them; nothing caught that. Also bring the tolerance comment and an older test name in line with the capped bound.
With the tighter aspect bound, a foreign baseline near a panel's aspect (e.g. an iPad Pro 11 vs the Duo cover panel) now hard-fails, and the hint named the cover panel for both sizes while still saying to fold.
latekvo
marked this pull request as ready for review
October 24, 2026 14:52
latekvo
marked this pull request as draft
October 24, 2026 14:52
…spect-rounding-tolerance
Member
Author
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.
Closes #807
The 1% aspect tolerance let full-res captures from two different iPhones (16 vs 16 Pro / Pro Max, 0.29% / 0.22% apart) be resampled and diffed as one screen. The tolerance is now capped at
2 / shortest side, the most that integer rounding of rescales can move the aspect, so pairs further apart than that become a dimension mismatch while real 1.0x vs 0.5/0.3/0.25x pairs still normalize.Pairs inside the rounding bound still normalize: they cannot be told apart from a rescale by dimensions alone (i16 Pro vs Pro Max, i16 vs 16 Plus, and more once one side is a scaled capture, since the bound grows as the image shrinks).
On a foldable, a foreign baseline near a panel aspect now hard-fails; the posture hint is dropped when both sizes map to one posture, instead of naming the cover panel twice and saying to fold.
No docs update needed.
Verification
Probe:
diffPngFileson real PNGs, with same-device downscales made by realsips -Z(the pathdownscalePngInPlaceuses) and full-res cross-device pairs that sit within 1% aspect.The last row cannot be decided from dimensions: 1206x2622 is exactly a floor-rounded 0.914x rescale of 1320x2868. Images with a shortest side under 200 px keep the 1% bound, as before (100x200 vs 101x200 normalizes, vs 102x200 mismatches).
A sweep over 29,796 rescale pairs (13 device sizes, scales 0.05-1.0, round/floor/ceil) found 0 pairs that normalize on main and are rejected here. Reverting only the return line brings back both failures in the unit-level repro.
A second sweep modelled each producer's rounding: sim-server f32
round(iOS sim and Android),Math.round(Chromium, Vega, Harmony) and measuredsips -Z(physical iOS, tvOS). It covered 80 device sizes, scaled-vs-scaled pairs (such as the 0.5 baseline vs 0.25 live-capture fallback) and double rescales, and found 0 same-screen pairs rejected here. iPhone 16 Pro Max simulator captures at 7 scales came out at exactlyround(W*s). Mutants2 -> 1(now killed by the two-rescale test) and2 -> 3/4,min -> maxare all caught.Checks:
npx tsc --build, the test typecheck, vitest on the screenshot-diff, foldable and flow snapshot/visual test files, and prettier + eslint on the changed files all pass.