Repository navigation
[KS] Flakes: media-native playback timing, session-relaunch scroll restore (#444) - #447
Merged
Merged
Conversation
Under load the restart seek lands after play() returns, so the status still read 3s; the timed drains also raced late playback starts. Wait on the player's time and reported events instead, and check the playback rate on the item's timebase.
A scroll offset set after the details view mounted but before it was sized was ignored, and the first report (0) overwrote it, so the saved session sometimes held 0. Treat it as pending like a restored offset, and assert the note reports it before the app quits.
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.
Refs #444
Root causes
play()issues an async seek to 0 and the test readstatus.currentTimesynchronously. Under load the seek hasn't landed yet, so it still read 3.0 (media.native.mm:116). The other playback checks waited on fixed wall-clock drains (Drain(0.4),Drain(0.6)), which race a late playback start. The player itself behaves correctly: its time observer reports the jump.useRestoredScroll), not in Spark's restore. Whenscroll-1-160arrived after the details ScrollView mounted but before it was sized, the target-change effect ignored it because nothing had been reported yet. The first sizing then reported 0 and overwrote 160, so the saved session held 0. Trace from a failing launch:render:0, target:0, render:160, target:160 (pending null, reported null), sized, report:0.Fixes
tests/media.native.mm: wait on the player's own clock and events. The playback rate is checked on the item's timebase (== 2, a new check). Time is waited past 1.6. Restart is shown by a reported status below 0.5 afterplay(), with noendedstatus. Looping is shown by a reported jump back below 1, with noended, and still playing.NoteView.tsx: an offset set before the first report becomes the pending restore offset, the same as a saved one.session-relaunch.yaml: also asserts that the note reports 160 before quitting, so this race fails at the step that causes it.Verification (this session)
*-nativetests ran in parallel (all at line 116). It also failed once in each of the two load runs below.vitest run tests/media-native.test.ts: 20/20 while the full suite ran in parallel. Another 20/20 whileks-lock native bun run rebuild:macosran, though only the first 14 runs overlapped the build. The fixed binary also passed 20/20 under the native-test load.--backend driver, before the fix: failed 1/10 and 6/15, always with scroll 0. With the launch-1 assertion added it failed 1/8, at that new step. After the fix: 12/12 with instrumentation, then 10/10 clean.bun run typecheck: pass.bun run e2e:lint: 0 problems.bun run test: 1965 passed, 2 failed, both known: the node-runtime asdf shim, and the motion-native frames check (display asleep). media-native passed within the suite.