[PR #7896] [MERGED] fix(tts): end a test clip only after it has loaded (WebKit stall at tts-mobile-playback:124) #7992

Closed
opened 2026-10-24 04:09:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7896
Author: @SpicyMarinara
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/webkit-tts-second-ended


📝 Commits (1)

  • 2dfa250 fix(tts): end a test clip only after it has loaded

📊 Changes

1 file changed (+13 additions, -2 deletions)

View changed files

📝 e2e/tts-mobile-playback.e2e.ts (+13 -2)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

No issue. This fixes a release-matrix stall from run 39457323028 (mobile-webkit shard 18/18, 17796b6c0).

Why this change

e2e/tts-mobile-playback.e2e.ts:124 hung on the second synthetic ended, with nothing logged until the 60 s test timeout. Both synthesis responses had already returned 200, and every earlier assertion had passed. The 60 s teardown then hid the original wait behind a closed-context DELETE error.

Cause: the test's finish() fired a synthetic ended at a clip whose blob was still loading (readyState 0, networkState LOADING). The spy stubs play(), so nothing waits for the clip to load, and the second clip was ended about 4–10 ms after its src was set. Real playback can't do this, because ended only fires after the media has loaded and played. On that ended, TTSService cleans up the reused <audio> element by pausing it, removing src, calling load() and revoking the URL. Linux WebKit's GStreamer backend can freeze the page while it tears down a load that is still in progress. The second page.evaluate therefore never returns. Chromium and macOS WebKit don't stall here.

This is a test race against a Linux-WebKit native stall, not an Engine logic bug. The Engine's completion handlers settle and clear their listeners correctly. Dropping only load() doesn't help: the stall moves to the next src = (see the numbers below).

What changed

  • In e2e/tts-mobile-playback.e2e.ts, finish() now waits for the current clip's loadedmetadata (or error) before dispatching ended. It waits for the right condition, not a longer timeout. All assertions, gates and counts are unchanged.

Validation

Repro numbers:

Run Before After
Minimal reproduction of TTSService's clip sequence on one reused element, Linux WebKit (official playwright:v1.63.0-noble image), synthetic ended right after the src change, 60 rounds 4/60 hung, every one inside pause → removeAttribute(src) → load() with readyState=0, networkState=2 0/60 (wait for loadedmetadata first)
Same, with load() removed from cleanup (rejected alternative) 1/60 hung, now at audio.src = … n/a
Same, Chromium 0/60 n/a
Full spec, macOS mobile-webkit + mobile-chromium, --repeat-each=20 --workers=2 40/40 passed (no local repro on macOS WebKit) 40/40 passed
  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Rerun mobile-webkit shard 18 (or the full Playwright matrix) on this branch and confirm tts-mobile-playback.e2e.ts passes.
  • No runtime code changed, so no in-app check is needed.
  • Not run locally, because the release was waiting: pnpm check, and a long full-spec Linux WebKit repeat run.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Not applicable. This is a test-only change.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7896 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/20/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/webkit-tts-second-ended` --- ### 📝 Commits (1) - [`2dfa250`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2dfa25075cc6a47a297be8e59519245d4f91e82a) fix(tts): end a test clip only after it has loaded ### 📊 Changes **1 file changed** (+13 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `e2e/tts-mobile-playback.e2e.ts` (+13 -2) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue No issue. This fixes a release-matrix stall from run [39457323028](https://github.com/Pasta-Devs/Marinara-Engine/actions/runs/39457323028) (mobile-webkit shard 18/18, `17796b6c0`). ## Why this change `e2e/tts-mobile-playback.e2e.ts:124` hung on the second synthetic `ended`, with nothing logged until the 60 s test timeout. Both synthesis responses had already returned 200, and every earlier assertion had passed. The 60 s teardown then hid the original wait behind a closed-context `DELETE` error. **Cause:** the test's `finish()` fired a synthetic `ended` at a clip whose blob was still loading (`readyState` 0, `networkState` LOADING). The spy stubs `play()`, so nothing waits for the clip to load, and the second clip was ended about 4–10 ms after its `src` was set. Real playback can't do this, because `ended` only fires after the media has loaded and played. On that `ended`, `TTSService` cleans up the reused `<audio>` element by pausing it, removing `src`, calling `load()` and revoking the URL. Linux WebKit's GStreamer backend can freeze the page while it tears down a load that is still in progress. The second `page.evaluate` therefore never returns. Chromium and macOS WebKit don't stall here. This is a test race against a Linux-WebKit native stall, not an Engine logic bug. The Engine's completion handlers settle and clear their listeners correctly. Dropping only `load()` doesn't help: the stall moves to the next `src =` (see the numbers below). ## What changed - In `e2e/tts-mobile-playback.e2e.ts`, `finish()` now waits for the current clip's `loadedmetadata` (or `error`) before dispatching `ended`. It waits for the right condition, not a longer timeout. All assertions, gates and counts are unchanged. ## Validation Repro numbers: | Run | Before | After | | --- | --- | --- | | Minimal reproduction of `TTSService`'s clip sequence on one reused element, Linux WebKit (official `playwright:v1.63.0-noble` image), synthetic `ended` right after the `src` change, 60 rounds | **4/60 hung**, every one inside `pause → removeAttribute(src) → load()` with `readyState=0`, `networkState=2` | **0/60** (wait for `loadedmetadata` first) | | Same, with `load()` removed from cleanup (rejected alternative) | 1/60 hung, now at `audio.src = …` | n/a | | Same, Chromium | 0/60 | n/a | | Full spec, macOS mobile-webkit + mobile-chromium, `--repeat-each=20 --workers=2` | 40/40 passed (no local repro on macOS WebKit) | 40/40 passed | - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Rerun mobile-webkit shard 18 (or the full Playwright matrix) on this branch and confirm `tts-mobile-playback.e2e.ts` passes. - No runtime code changed, so no in-app check is needed. - Not run locally, because the release was waiting: `pnpm check`, and a long full-spec Linux WebKit repeat run. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Not applicable. This is a test-only change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:09:29 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7992
No description provided.