Skip to content

fix(webapp): stop playback on sign-out whatever the replaygain mode - #329

Merged
InstaZDLL merged 1 commit into
mainfrom
claude/bold-pasteur-1d6958
Oct 25, 2026
Merged

InstaZDLL merged 1 commit into
mainfrom
claude/bold-pasteur-1d6958

Conversation

@InstaZDLL

@InstaZDLL InstaZDLL commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

What

Signing out unmounts PlayerProvider. The unmount cleanup added in #326 paused and dropped the <audio> element only on its way out of a ReplayGain graph, after an early return when no graph existed. With ReplayGain off, which is the default, nothing paused the element, which is never in the document, so the music carried on over the sign-in page. The bug was older than #326.

The cleanup now closes the candidate and the graph as before, then always pauses the element, removes its src, calls load() and drops the ref. The mount effect creates a fresh element, as it already did after the graph path, so StrictMode and Fast Refresh replays keep working. The graphMounted guard is unchanged.

Test

stops the music when the listener signs out with ReplayGain off in webapp/e2e/studio-nocturne.spec.ts:

  • serves a real 60-second silent WAV through mocked stream-ticket and stream routes, so paused and currentTime mean something;
  • records every media element that was asked to play, by wrapping HTMLMediaElement.prototype.play, and counts AudioContexts;
  • plays an album, waits for an element to be playing with currentTime > 0 and checks that no context was made (so this is the plain path);
  • signs out and polls until no recorded element is still playing.

Inversion: run against a fresh webapp/dist built without the fix, it fails at the last poll (Expected: 0, Received: 1). With the fix it passes.

Checks

The bundle was rebuilt before every Playwright run. The runs used port 4199 through an uncommitted local config, not 4173 or 4533.

  • bun --cwd=webapp run build: ok
  • biome check .: no errors (the 10 warnings were already there, in CSS and biome.json)
  • vitest: 29 files, 235 tests passed
  • full Playwright suite: 277 passed, 17 skipped (desktop-only tests on the mobile project), 0 failed

Summary by CodeRabbit

  • Corrections de bugs
    • La lecture audio s’arrête désormais correctement lorsque le lecteur est démonté, y compris lorsque ReplayGain est désactivé.
    • Ajout d’un test vérifiant le démarrage de la lecture sans contexte audio et son arrêt à la déconnexion.

Signing out unmounts PlayerProvider. Its cleanup paused and dropped the
audio element only when a ReplayGain graph existed, so with ReplayGain
off, the default, the music carried on over the sign-in page. The
element is now paused, emptied and dropped on every unmount; the
AudioContext cleanup and the graphMounted guard are unchanged.

The Playwright test plays a real WAV with ReplayGain off, signs out and
asserts that no element that was asked to play is still playing. It
fails without the fix.

Signed-off-by: InstaZDLL <github.105mh@8shield.net>
@github-actions github-actions Bot added type: fix Bug fix scope: web Embedded web player (React) size: m 50-200 lines labels Oct 25, 2026
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between ee1786a and 49c12c9.

Files selected for processing: 2
  • webapp/e2e/studio-nocturne.spec.ts
  • webapp/src/player/player.tsx

Limit details: You’ve used the included review currently available. Your 87 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Walkthrough

Quand ReplayGain est désactivé, le démontage de PlayerProvider poursuit le nettoyage de l’élément audio même sans graphe actif. Un test vérifie que la lecture démarre, puis s’arrête à la déconnexion.

Changes: Nettoyage du lecteur sans ReplayGain

Layer / File(s) Summary
Nettoyage et test à la déconnexion
webapp/src/player/player.tsx, webapp/e2e/studio-nocturne.spec.ts
Le nettoyage ferme le contexte et réinitialise le gain si le graphe existe. Dans tous les cas, il met l’élément audio en pause, retire sa source et le recharge. Le test utilise un WAV silencieux et vérifie que la lecture s’arrête après la déconnexion.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 49c12

Playback is stopped on sign-out with ReplayGain off, and no actionable merge risk remains after normal checks.

Security architecture risk: Minimal · up to 49c12

The change stops browser playback during sign-out regardless of ReplayGain mode, without expanding access or privileges. No introduced or materially worsened security architecture concern was identified in the inspected change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The effective change is confined to playback resources owned by the browser's PlayerProvider. It reduces continued playback after leaving the authenticated shell; it does not establish server-side stream-ticket revocation or a broader credential-lifecycle guarantee.

Trust Boundaries and Controls

  • observed — The authenticated route retains its session check. The sign-out control awaits logout and then navigates to the separate login route, removing the shell that contains PlayerProvider. The changed cleanup strengthens resource termination at that existing boundary rather than altering the authentication decision.

Resilience and Maintainability Implications

  • observed — The new desktop regression test requires actual playback progress with no AudioContext construction, signs out, and then checks that every recorded playback element is paused. Its stream responses are mocked; the reported passing and inversion runs were not independently executed during this review.
Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed Le titre décrit clairement le correctif principal : arrêter la lecture lors de la déconnexion, quel que soit le mode ReplayGain.
Description check Passed La description est complète. Elle explique le problème, le changement, le test de régression et les résultats de validation. Les sections utilisent des intitulés différents du modèle, mais couvrent so…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

La description est complète. Elle explique le problème, le changement, le test de régression et les résultats de validation. Les sections utilisent des intitulés différents du modèle, mais couvrent son contenu essentiel. La section Notes est optionnelle.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 Biome (2.5.15)
webapp/e2e/studio-nocturne.spec.ts

Biome could not lint this file: nested root configuration. Check the repository's Biome configuration and plugins.

webapp/src/player/player.tsx

Biome could not lint this file: nested root configuration. Check the repository's Biome configuration and plugins.

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added type: fix Bug fix and removed type: fix Bug fix labels Oct 25, 2026
@InstaZDLL InstaZDLL self-assigned this Oct 25, 2026
@InstaZDLL
InstaZDLL merged commit 0099de9 into main Oct 25, 2026
16 checks passed
@InstaZDLL
InstaZDLL deleted the claude/bold-pasteur-1d6958 branch October 25, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: web Embedded web player (React) size: m 50-200 lines type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant