Repository navigation
spike(ISP-049): test COEP vs TURN relay, fix blocked-autoplay audio, record findings (partial #719) - #848
Merged
Mikey-222 merged 2 commits intoOct 20, 2026
Conversation
play() awaited AudioContext.resume(), which stays pending forever when the autoplay policy blocks audio, so a siren with no recent user gesture hung silently and recorded nothing; unlock() was never called anywhere. - play() gives up after RESUME_TIMEOUT_MS, vibrates as a fallback and returns 'blocked' (or 'played'); unlock() reports whether audio is running - armOnFirstGesture() unlocks audio on the first user gesture; Help arms it - trackAudioAlert() emits an audio.alert span (played/blocked) and getStats() exposes the counts - the Test siren button says when sound is blocked test/audio-alert.test.js was failing on main (vitest 4 cannot 'new' an arrow-function mock); fix the fake AudioContext and add 8 tests covering the blocked, rejected, no-vibration, gesture and disposer cases. Refs Hel-Phone#719
…ne#719 findings Add a reproducible experiment (real TURN server + relay-only peer connections in Chrome under no headers, COEP credentialless and COEP require-corp). Over UDP it connected 10/10 through the relay in every configuration, so the issue's COEP-blocks-TURN diagnosis is not supported; TCP failed in the control too and is inconclusive. The report also checks each claim in the issue against the repository (no TURN server, no COOP/COEP in csp.ts, 27-line webrtc.ts, reconnect backoff already present) and lists what remains. Refs Hel-Phone#719
|
@praizehimm Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
What I found when checking the issue against the code
Details and commands are in
docs/spikes/719-webrtc-coep-turn-audio-report.md. The important points:turn:URL, noturn-credentialsroute (the path doesn't exist), no coturn config.src/lib/webrtc.tsis a 27-line STUN-only ICE benchmark, withiceCandidatePoolSize: 2(not 10).server/middleware/csp.tsemits no COOP/COEP. They are set invite.config.ts(dev and preview) and referenced bytest/coep-headers-spike.test.js.iceConnectionStateisn't used anywhere, there is no Web Push code, andwsClient.tsalready has exponential backoff with jitter.test/audio-alert.test.jswas failing onmain, not green: vitest 4 can'tnewan arrow-function mock.1. Experiment: does COOP/COEP block TURN relay? (it doesn't, over UDP)
scripts/spikes/webrtc_coep_turn_experiment.mjsruns a real TURN server and, in Chrome 155, opens relay-only peer connections (iceTransportPolicy: 'relay'), so a data channel opens only if the TURN allocation works. 10 runs per row:crossOriginIsolated=truecrossOriginIsolated=trueSo the issue's central diagnosis ("COEP blocks TURN allocation") is not supported: ICE/TURN traffic is not an HTTP fetch, so COEP/CORP don't apply to it. If calls fail in production, the cause is more likely that no TURN is configured, or that the credential
fetch()is cross-origin.Honest limits:
node-turn/Chrome TCP setup, not the headers.turns:(TLS).npm i --no-save node-turn(not added topackage.json) and a Chrome (--executable/CHROMIUM_PATH, like the other spike scripts).2. Fix:
EmergencyAudioAlerthung silently when autoplay was blockedplay()awaitedAudioContext.resume(), which stays pending forever when the autoplay policy blocks audio. A siren with no recent user gesture hung with no sound and no record;unlock()existed but was never called.play()waits at most 1 s, then vibrates ([500,250,500], best effort) and returns'blocked'(else'played').unlock()reports whether audio is running; newarmOnFirstGesture()unlocks on the first user gesture (Help.tsxarms it on mount).trackAudioAlert('played'|'blocked')intelemetry.tsemits anaudio.alertspan, so the blocked rate is measurable;getStats()exposes counts.Tests:
test/audio-alert.test.jsis 10 tests (it was 2, both failing). 9 of the 10 fail against the oldaudioAlert.ts, including the hang case.tsc --noEmiterror count is unchanged (29 before and after, none in the changed files). ESLint can't parse any.tsin this repo (pre-existing), so it gave no signal here.Not done (needs a TURN deployment, real devices, or product decisions)
Per-call TURN credentials/proxy (nothing to proxy yet) · Web Push wake path · NAT×battery×network policy table and the Moto G measurements · Playwright
webrtc-nat/background-killprojects ·ice*/turn401/wsReaped/pushDeliveredmetrics, dashboards and alerts · NAT-mix peers inserver/tests/load.js· rejoin allowlist inrateLimiter.ts,keepAlivetiming,crashRecovery.ts(not examined) · the ops runbook. I'd suggest splitting these into separate issues now that the COEP premise is checked.Commits
fix(audio): stop EmergencyAudioAlert hanging when autoplay is blockeddocs(spike): test whether COOP/COEP blocks TURN relay; record #719 findingsI did not run the full test suite or the Playwright projects.
Closes #719
Closes #711
Closes #717
Closes #718