feat(stream): probe the ingest before going live — no more ghost broadcasts (TASK 32·5)

"I forgot the VPN" used to create a broadcast on YouTube that nothing ever pushed to: the app looked
live, YouTube held an empty broadcast, and the creator had to work out what happened. Prevention beats
recovery here, so go-live now asks one question first.

- `Services/IngestProbe.cs` — `IIngestProbe` + `TcpIngestProbe`: parse the RTMP URL, connect to the host
  (rtmp → 1935, rtmps → 443) with a 2 s timeout. Any failure answers "not reachable"; the point is a
  fast unambiguous answer, not a diagnosis.
- `MainViewModel.IngestPreflightAsync` runs **before the first API call** whenever a cached ingest URL
  exists; on a first run it probes once the stream is resolved, still before any broadcast is created.
  A false answer logs, tells the creator ("Nothing was created on YouTube…"), and rolls the session
  back — nothing to clean up on YouTube.
- The probe is a test seam (`IngestProbeOverride`) like the camera and chroma ones.

Tests: `IngestPreflightTests` — unreachable aborts, reachable continues, URL parsing (rtmp/rtmps,
garbage), and the probe against **real sockets**: a listening port answers true, the same port closed
answers false and does so fast. FAST gate: 547 passed, 0 failed, 0 warnings.
This commit is contained in:
2026-11-05 14:56:20 -08:00
parent d8c1bdba24
commit ec1091a170
7 changed files with 243 additions and 3 deletions
+3 -1
View File
@@ -17,7 +17,9 @@
status poll (4 s cadence while recovering) with **measured** elapsed/attempt only — the countdown was
dropped after the creator pointed out YouTube's cutoff depends on variables we cannot see. The
`chatEndedEvent` in the chat feed now prompts an immediate status check.
- Next: 32·5 (ingest pre-flight),
- **32·5 shipped**: ingest pre-flight (TCP, 2 s) aborts go-live before any API call, so a dead
network leaves no ghost broadcast.
- Next:
then 32·2/32·3 (countdown + Back on air) which need YOUR measurement take: pull the network on a
private stream and time how long YouTube holds the broadcast.
- Open loop: `32·4` is proven by construction only — kill ffmpeg mid-recording and play the file.