Skip to content

test(studio): the edit bench reads an undo once Studio says its reload is done - #8542

Merged
miguel-heygen merged 1 commit into
mainfrom
test/bench-undo-waits-for-studio
Nov 23, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
test/bench-undo-waits-for-studio

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

The edit-accuracy bench now reads a sequence's final undo and redo only once Studio says the preview has finished changing. It records how long that took as undo.shownMs and undo.redoShownMs. Before, under load, a sealed undo could read 240-329 px from where it landed: the box held still while the undo's reload was still on its way, and the bench took that still box as the result.

Why

A sequence ends by walking its undos, then its redos, and measuring the box after each walk with settled(). settled() waits for the box to hold still, and for Studio's "preview changing" marker only in keyframed cases (swapPending, case.mjs). #4866 kept that keyframed-only on purpose: waiting in other cases made a later undo land in the preview's burst of requests. settle.test.mjs pins that rule, and this change leaves it.

On a sealed preview, an undo that can't be applied in place reloads the whole film. While that reload runs, the box doesn't move, so in a case without keyframes settled() returned early.

On the 12 sequences below, at 3 parallel jobs, 3 sealed and 3 unsealed runs alternating, the undo read off right after settled() in:

  • sealed: 3 of 27 (seqplainkeys-none-pct 329 px twice, seqplainkeys-none-center 240 px once). Each landed 0.6-2.1 s later.
  • unsealed: 1 of 27, 60 px, landing 0.4 s later.

The sequence's commit step already waits for Studio this way before it measures (restedFor(studioBusy)). The undo and redo walks now do the same.

Related work

Refs #7846 (Studio's preview sealed by default): its edit-accuracy gate scores these sequences.

How

  • shownOnceRested(busy, frame, settle) in sequences.mjs waits until studioBusy reads clear two frames in a row, through the existing restedFor. It then returns the settled box and the ms until Studio was clear.
  • The end-of-case undo and redo walks use it in place of a bare settled(). The two times go into the case's undo result as shownMs and redoShownMs. Nothing scores them yet, so the gate doesn't change.
  • settled(), swapPending and every other step keep their timing.

No visible change

Bench only; Studio doesn't change.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

fails without the fix:

  • packages/studio/tests/e2e/edit-accuracy/settle.test.mjs: "reads an undo's box once Studio says its reload is done, and how long that took". It also fails when shownOnceRested skips the wait.

  • Every test under packages/studio/tests/e2e/edit-accuracy (13 files, 126 tests) passes three runs in a row on Linux.

@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 57 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final undo and redo now wait for Studio's busy markers to clear across two frame reads before sampling the box. The new fields measure the remaining wait after each history walk. Per-step sampling and scoring stay as before.

The PR body names the regression. All 23 focused tests passed, and bypassing the wait made the new test sample the old box. The broader edit-accuracy run passed 125 of 126 locally. The same iframe initialization failure reproduced with the parent version of the changed harness file under the local Happy DOM setup. GitHub reports green checks at this head.

— tai (automated review)

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 07949fb Nov 23, 2026
83 checks passed
@miguel-heygen
miguel-heygen deleted the test/bench-undo-waits-for-studio branch November 23, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants