mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
Review finding 5. A `data-hidden` toggle mid-playback fired
`webAudio.stopAll()` + a full reschedule for EVERY user, while the two skips
that reschedule exists to re-run are themselves gated on
`silenceHiddenAudioEnabled()`. Un-enrolled — which is everyone, the canary is at
0% — the rebuilt set was therefore identical, and the only observable effect was
an audible stop-and-restart across the whole mix on every visibility toggle.
Also folds the same bus-blindness fixed in media.ts into the two scheduling
skips: they used `closest("[data-hidden]")`, which cannot see a muted BUS
because membership lives on the member's `data-audio-group` and a group never
nests its members. Both now share one `isSilencedByHidden` predicate.
**Three existing tests were passing only because the path was ungated** — worth
knowing, because it is the second time this canary's tests have measured the
wrong thing:
- "batches a mid-playback toggle into exactly one reschedule" and "stops the
running sources before rescheduling" never enrolled the canary. They now do;
the reschedule IS the feature.
- "still schedules a data-hidden clip when the host has not opted in" asserted
through `scheduleMediaElementPlayback`, and in jsdom `webAudioReady` is false
so `play()` schedules nothing — the ungated reschedule was the only scheduler
in the test, i.e. the assertion was carried by the defect. It now measures the
finding directly: the same `data-hidden` toggle costs ONE `stopAll` un-enrolled
(the seek's own) and two enrolled. Verified 1 vs 2, and 3 vs 1 on a revert.
Two things that cost a round each, for the next person: a plain `seek()` calls
`stopAll()` unconditionally, so a raw "was stopAll called" assertion proves
nothing — count the delta. And `hiddenAudioDirty` is set by a data-hidden
MUTATION, so the gesture under test has to toggle the attribute; a seek alone
never reaches the reschedule.
core: 122 files, 2490 tests.