fix(companion): anchor screenshot-gallery fixtures to noon, not the wall clock - #665
Merged
Merged
Conversation
…all clock
The gallery built its fixture timestamps from DateTime.now(), and the
sidebar buckets chats by calendar day against the real clock. Goldens
generated at 21:45Z and re-checked after midnight came back 7 red with
TODAY->YESTERDAY, PREVIOUS 7 DAYS->PREVIOUS 30 DAYS and 3d->a hard date:
pure clock drift, indistinguishable at a glance from a layout regression.
Anchor the fixtures to noon of the current day so every offset sits far
from both day boundaries. Measured across a simulated date boundary
(TZ=Etc/GMT+12 -> TZ=Pacific/Kiritimati): 1.11% / 14383px of drift down
to 0.04% / 1041px.
The residual is the relative age labels ("3m", "2h"), computed against
the real clock in the sidebar; killing that would mean injecting a clock
into production UI, which is not worth it for a gallery that is
explicitly not a regression gate. Documented in the file instead.
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.
Follow-up #1 from #664.
The defect
test/screenshots/gallery_test.dartbuilt its fixture timestamps straight fromDateTime.now(). The sidebar buckets chats by calendar day against the real clock, so goldens generated at 21:45Z and re-checked after midnight came back 7 red —TODAY→YESTERDAY,PREVIOUS 7 DAYS→PREVIOUS 30 DAYS,3d→a hard date. Pure clock drift, and at a glance indistinguishable from a layout regression. I spent a chunk of last night's run proving that's all it was.The fix
Anchor fixtures to noon of the current day, which keeps every offset far from both day boundaries.
Measured, not asserted
Simulated a date boundary by generating goldens under
TZ=Etc/GMT+12(local date 25 Jul) and checking them underTZ=Pacific/Kiritimati(local date 26 Jul):What this does not fix — stated plainly
The residual 0.04% is the relative age labels (
3m,2h), whichsidebar.dartcomputes against the real clock, so they move by a digit as the hour advances. Removing that would mean injecting a clock into the production UI. Not worth it: the gallery's own header says it is a visual review tool, not a regression suite, its goldens are gitignored, and it does not run in CI. Regenerate them, don't diff them across hours. That tradeoff is documented in the file.While verifying this I also confirmed the second follow-up offered in #664 — a ~0.02% flake where unmodified
mainfails against goldens generated from unmodifiedmainminutes earlier. Not addressed here; it's real but separate, and the same "not a gate" reasoning applies.flutter analyzeclean,dart formaton the touched file only. Test-only change — no production code touched.