3.4 KiB
3.4 KiB
@suaveplan/react-audio-stream — transport-share + auto-reconnect (chunk D)
- Target path:
packages/ui/react/react-audio-stream/ - Tier: browser/react
- Date: 2026-05-23
- Status: PROPOSED — chunk D of the 4-chunk
enterprise-react-audio-streamsplit. Final chunk; archives the parent change folder.
Why
Transport-share (the "watch the DJ play" scenario) and auto-reconnect both compose the session-core, transports, and hooks-components chunks. They land last because they need every earlier piece in place. This chunk also performs the spec fold and archive of the parent enterprise-react-audio-stream folder.
What changes
- Transport-share control channel —
src/transport-share/control-channel.tsdefines the wire protocol ('play','pause','seek','setTempo'envelopes) and the per-sessionTransportShareCoordinatorthat listens to the granting peer's localTransportand forwards events to receivers. - Share state machine —
src/transport-share/share-state.tstracks'local' | 'driving' | 'receiving'; transitions viarequestTransportShare(peerId)/grantTransportShare()/ driver-disconnect signal. useTransportShare()—src/hooks/use-transport-share/use-transport-share.tsexposes the state + grant/request methods to React.- Shared-transport indicator —
<SharedTransportIndicator>component renders "Shared transport active" when in receiving mode; controls dispatched while receiving no-op without throwing. - Auto-reconnect —
src/session/reconnect.tswires@suaveplan/retry-driven exponential back-off (base 1 s, multiplier 2, jitter ±20%, max 30 s, capped atmaxReconnectAttemptsdefault 8) into theStreamSessionlifecycle. Onlynetworkandsignallinginterruption classes trigger reconnect;media-permission,peer, and explicitdisconnect()skip. - Reconnect events —
'reconnect-attempt'(with attempt number),'reconnect-failed'(after exhaustion). Countersreact_audio_stream_reconnect_attempt_total/react_audio_stream_reconnect_failed_totalincrement per event (instruments registered in chunk A). - Playwright E2E —
tests/e2e/transport-share.spec.tsruns two real browser instances against a local signalling-channel fixture and asserts share-mode propagation. Marked browser-tier; runs only under the e2e turbo pipeline. - Spec fold + archive — final task in this chunk:
- Fold
openspec/changes/enterprise-react-audio-stream/specs/react-audio-stream/spec.mdintoopenspec/specs/react-audio-stream/spec.md(the canonical version). - Move
openspec/changes/enterprise-react-audio-stream/→openspec/archive/2026-05-23-enterprise-react-audio-stream/. - Also move the four split change folders (
enterprise-react-audio-stream-{session-core,transports,hooks-components,transport-share}/) to the archive alongside it. - Regenerate
MANIFEST.md.
- Fold
Requirements landed by this chunk
From the original spec:
- Auto-reconnect with exponential back-off (full)
- Transport-share mode (full)
Impact
- ~15 files (control channel + share state + 1 hook + 1 component + reconnect + E2E).
- Imports
StreamSession,InterruptionClassifier,ReactAudioStreamErrorfrom chunk A;useStreamSessionfrom chunk C. - Final chunk — runs full package gate (
lint typecheck test:coverageat 100/100/100/100), folds canonical spec, archives all 5 change folders (parent + 4 splits) intoopenspec/archive/.