Skip to content

Flaky: P7OfflineSubtitleTests.embeddedSelectionInvalidatesPendingSidecarParse (possible subtitle selection race) #436

Open

Description

@jlipworth

On main (b9162746), with nothing else running on the machine, the full macOS hosted suite failed 1 of 990 tests:

P7OfflineSubtitleTests.embeddedSelectionInvalidatesPendingSidecarParse(fromDetail: true) failed at LabstreamTests/P7OfflineSubtitleTests.swift:96: Expectation failed: after.selectedID == .avFoundation(0).

The suite on its own then failed 1 of 5 runs, so this is intermittent, not caused by load.

What the test does: it selects an offline sidecar subtitle whose cue parse is held, selects an embedded (AVFoundation) subtitle while that parse is pending, releases the parse, and then expects the embedded track to remain selected.

What we know:

  • The overlay assertion passed: the late sidecar parse did not take over the overlay.
  • The selected ID was not the embedded track.

Possible causes:

  • A test timing gap: currentMediaSelection hasn't caught up yet when loadSubtitleTracks() reads it.
  • A real product race: a completing sidecar selection clears the AVFoundation selection after the user picked the embedded track. The user would see subtitles turn off after choosing an embedded track during a slow sidecar load.

Next step: find which of the two it is. Check whether the sidecar path's completion or cancellation calls select(nil, in: group) after the embedded selection was made, then either fix that ordering or make the test await the selection settling.

Release impact: not treated as a TestFlight blocker. Offline playback with a slow sidecar parse plus a quick switch to an embedded track is an edge case. Recorded during the 1.8.0 (1655) pre-upload check.

Activity

  1. added
    bugSomething isn't working
    playerIn-player UI / playback
    on Nov 5, 2026
  2. added a commit that references this issue on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdownloadsOffline downloadsplayerIn-player UI / playback

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions