Repository navigation
test(studio): the edit bench reads a nudge burst's box once a sealed preview has drawn it - #8822
miguel-heygen wants to merge 3 commits into
Conversation
…rst into two saves The bench pressed each nudge key, then waited for a frame. On CI the frame after the first nudge following a rotate can take 400+ ms (GPU-side), longer than Studio's 400 ms burst window, so the burst saved twice and the undo walk came up one short. The keys of a burst now go back to back through one helper.
…preview has drawn it A sealed preview draws a nudge a frame round trip after its keys. The bench read the box once, right after the keys, and in some runs that read came before the draw: the un-nudged box became the step's intended box, and drop and reload scored 3 px against a correct file.
|
The sealed draw delay the body lists as not measured. Time from the last nudge keydown to the first sampled frame showing the burst, both read on Studio's page clock. A sealed frame is read through the bench's own port into it. Studio built at main
A sealed preview shows a nudge about one frame later than an unsealed one. The sampler takes one sample per frame, so each figure can be off by up to a frame. This is reported here, not changed: the bench now waits for the draw, and the delay itself is a separate Studio timing question. |
jrusso1020
left a comment
There was a problem hiding this comment.
Verdict: APPROVE at 811f8e86ed9edb7858842771823c319eb3be8f46.
The cause and the fix match. The nudge step recorded intended from one read right after the keys and a single frame. A sealed preview draws a nudge one frame round trip after its keys, so that read could still show the box from before the keys. Drop-and-reload then compared a correct saved file against the un-nudged box.
shownAfterKeys(read, from, frame)reads until the box is ≥ 0.5 px offfromand has held (< 0.01 px) for two more reads.- After 2 s it returns whatever is showing, so keys that never draw still fail the step.
- Both the sequence's nudge step and the single-nudge gesture now take the box before the keys and read through it.
- Not reusing
settled()is the right call: an undrawn box also holds still.
The new tests use fake timers. The "fails without the fix:" line names the drawn-box test, and the deadline test pins the 2 s give-up. The diff is against its base #8809 (bench code and tests only). The checks that ran on this stacked base are green.
Non-blocking: waiting up to 2 s for the draw means the bench no longer notices a sealed preview that is slow to draw a nudge, as long as it draws within that window. Logging the time from keys to drawn box per case would keep that visible.
Need · Size · Reuse · Simpler · Structure: removes a measured bench false-fail (9 of 24 sealed runs) · +70/−3, bench only · reuses measure, nextFrame and quadDistance · ok · ok
Risk: low. Test bench only.
— Rames
The base branch was changed.
Edit accuracy: accurate 273 (base branch 271), smooth 53 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) |
# Conflicts: # packages/studio/tests/e2e/edit-accuracy/case.mjs # packages/studio/tests/e2e/edit-accuracy/saves.test.mjs
What
The edit accuracy bench reads a nudge burst's box once the preview has drawn the keys, instead of right after them. In a sealed preview that read sometimes came before the draw, and
seqrotatenudge-*-nestedcases then failed drop and reload by 3 px against a correct saved file.Stacked on #8809, which touches the same nudge step.
Why
With a sealed preview,
seqrotatenudge-none-{center,pct,px}-r0-nested-z100failed drop and reload at 3.02 to 3.07 px in some runs, with 2 saves and undo true. The saved file and the reloaded box were right. The box the step recorded was not: it was the box from before the nudges.The sequence's nudge step recorded the box once, right after the keys and one frame. A sealed preview draws a nudge a frame round trip after its keys. A probe that read the box every frame after the keys, with Studio built at main
614ece8b, sealed, 24 case-runs:So the step's "intended" box was the un-nudged one, and drop and reload compared a correct file with it.
Related work
Refs #8809 (base of this PR).
How
case.mjs:shownAfterKeys(read, from, frame)reads the box until it is 0.5 px or more offfrom(the box before the keys) and has held for 2 more reads. After 2 s it returns whatever shows, so keys that never draw still fail the step.frombefore the keys and recordsintendedthrough it. The single-nudge gesture reads its box through it, from the box it measured before the keys.settled(): a box that hasn't been drawn yet holds still too, and a settle that restarts on the save's move would hide a save that shifts the box.Test plan
fails without the fix:
packages/studio/tests/e2e/edit-accuracy/saves.test.mjs"is the drawn box, not the one shown before the preview drew the keys" fails on a single read withexpected [ [ +0, +0 ], …] to deeply equal [ [ 3, +0 ], …]. Dropping the "moved offfrom" condition fails it again. "gives up at its deadline with the undrawn box when the keys never draw, so the step still fails" fails when the deadline is cut to 200 ms.npx vitest run tests/e2e/edit-accuracy/inpackages/studio: 13 files, 133 of 133, three runs in a row.The bench, Studio built at main
614ece8b, this branch's bench, the 48seqrotatenudge-*,seqnudge-*,seqab-*andnudge-*cases, pr grid,--jobs 1, the preview frame'sself.originlogged in every case (nullsealed):These runs are at
ff3dee8c. The head (811f8e86) differs only in reading the pre-key box before the step starts its smoothness recording instead of just after.Before this change, on the same build with #8809's bench: sealed 48/48, 48/48, 46/48, and both run-3 failures were
seqrotatenudge-*-nesteddrop and reload 3.02 px.Not measured: how long a sealed preview takes to draw a nudge after its keys. The probe's times include the bench's own work before each read: unsealed, which draws inside the keydown, came out the same as sealed, about 60 ms. A page-side measurement follows in a comment.
No visible change