Repository navigation
fix: account for native media precision in motion playback test - #4419
Merged
Merged
Conversation
Keep exact agreement between recordings and verify shared transport time within two microseconds, including a deterministic fractional seek that failed the old relative assertion. No product behavior changes. Closes #4418
This was referenced Nov 3, 2026
max-sixty
pushed a commit
that referenced
this pull request
Nov 3, 2026
Pausing two motion recordings could leave them a microsecond apart. On pause, `lf-motion` reads the furthest recording's time and seeks only the recordings behind it. Chromium truncates a seek target to whole microseconds, so for about one playback position in fifty the seeked recording lands a microsecond behind the leader, which was never seeked: a leader at 0.5004 s pulls the trailing recording to 0.500399 s. That is the `0.5004 == 0.500399` failure in #5169. Now, once any recording is off the clock's time, `#seekVideos` seeks all of them, so each gets the same native rounding. A transport whose recordings already agree still seeks none, and the test's check that playback never seeks per frame still passes. This is the same truncation #4419 found for a seek requested by the author. That PR widened the transport-versus-video tolerance. This change fixes the transport itself, and the exact agreement between recordings holds again without a wider tolerance. **Verification.** A new step in `test_motion_recordings_share_native_playback_and_a_sticky_transport` pauses and resumes the leading recording natively until it stops on a position the truncation moves, then pauses the transport and asserts the two recordings agree exactly. That search is a `wait_for_function` under the suite's deadline, so the test fails rather than passes when it never reaches such a position. With main's `lf-motion.js` the step failed three runs out of three (`4.0623 == 4.062299`, `2.0136 == 2.013599`, `1.0006 == 1.000599`); with the fix it passed three out of three. The browser type check (`tsc -p browser/types`) is clean. Closes #5169 — automated triage --------- Co-authored-by: leaf-agent <[email protected]>
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.
The motion playback test compared native video time with the transport clock using a relative tolerance that allowed less than one microsecond early in playback. Chromium can truncate a fractional seek by one microsecond: requesting 252.00699999999998 ms returns 252.006 ms from both videos, reproducing the exact failure in #4418.
Use a fixed 0.002 ms tolerance for the native-media comparison, covering that truncation and floating-point rounding. The test now exercises the reported fractional seek deterministically as well as the ordinary pause. Exact agreement between the two recordings and the assertion against per-frame seeking remain intact; product behavior is unchanged. This preserves #3658's shared native playback intent.
Validation: the fractional seek fails with the old assertion and passes with the correction in the full touch playback/sticky transport journey.
Closes #4418 — automated triage