test(radio): Lock single-mode load abort against false PLAY_ERROR

Merged
FC
15d ago
+47-0

Change

RADIO-23 is already fixed on main by #457 (7f7ed3b). This PR adds regression proof for the single-mode lifecycle and does not change production playback code.

Verified root cause (radio@0.7.1)

Production reported AbortError: Load aborted as handled PLAY_ERROR (mode: single, external streams, retry_phase: none, no stack). Two events (2026-10-19 Chrome/macOS; 2026-10-21 Samsung Internet/Android).

In MediaElementAttachment.waitUntilReady, listening to the media element abort event treated a queued abort from the previous load() as failure of the current attachment. That rejection bubbled as DOMException("Load aborted", "AbortError") and was reported as unexpected PLAY_ERROR.

#457 stopped listening to media abort and cancels only via the attachment AbortController. Media error and the readiness timeout still fail closed.

Intentional cancellation was a hypothesis; the established defect is the unscoped media abort during load/replacement lifecycle transitions.

This PR

  • Adds an AudioManager regression: playing Single stream replacement ignores a queued media abort and stays healthy (no error state).
  • Comments the existing media-element queued-abort regression for the RADIO-23 shape.
  • Companion assertions remain: a bare media abort does not hide a subsequent load error or timeout (genuine failures stay reported).

Out of scope (other agents): RADIO-24 obsolete play() rejection; RADIO-27 recovery cancelLoad / pending-load cancellation.

Fixes RADIO-23
https://avoidquest.sentry.io/issues/RADIO-23

Validation

  • TDD proof: with the attachment fix temporarily reverted, the new AudioManager test fails with AbortError: Load aborted; with current main, it passes.
  • bun run check — pass
  • bun run typecheck — pass
  • bun test apps/radio/src/lib/audio/manager/audio-manager.test.ts apps/radio/src/lib/audio/playback/media-element-playback-source.test.ts — 72 pass / 0 fail
  • Not run: full @avoid.quest/radio suite / build (test-only change; no production code)
  • Not verified: physical-device Samsung Internet replay; production deploy; Sentry status (left unchanged)

Base SHA: 7f7ed3bf52672df71a5514591af0b3a866708d0b

Changelog: skip

Open in Web Open in Cursor 

Summary by cubic

Adds regression tests for RADIO-23, proving a playing single-mode stream replacement ignores a queued media abort from the previous load() instead of reporting AbortError: Load aborted as PLAY_ERROR. No production code changes; the fix already landed on main in #457.

  • Covers both the AudioManager lifecycle and the MediaElementPlaybackSource queued-abort shape.
  • Existing assertions remain in place so a bare abort does not mask genuine load errors or timeouts.