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
+7 -1
View File
@@ -49,9 +49,15 @@ the API — creator ruling 2026-09-01): no lying in the copy.
editor tolerance, cite the research). Test: `Args_RecordBlock_IsFragmentedMp4_SoACrashKeepsTheFile` — the flags are on the record block and
absent from the streaming block. Verified by construction only: the file still needs one real
interrupted-take check on Windows (kill ffmpeg mid-recording, play the result).
5. ☐ **Pre-flight** — before broadcast insert, one TCP probe to the ingest host:1935 (~2s timeout).
5. ✅ **Pre-flight** (shipped 2026-11-05) — before broadcast insert, one TCP probe to the ingest host:1935 (~2s timeout).
Unreachable → Error toast, no insert, no ghost broadcast ("check VPN/network"). The "forgot the
VPN" story, solved as prevention instead of recovery. Test: fake probe failure aborts go-live before any API call.
**Shipped:** `Services/IngestProbe.cs` (`IIngestProbe` + `TcpIngestProbe`, 2 s timeout, rtmp→1935 /
rtmps→443) and `MainViewModel.IngestPreflightAsync`, called BEFORE the first API call whenever a
cached ingest URL exists (first run probes after resolving the stream, still before any broadcast is
created). Tests: `IngestPreflightTests` — unreachable aborts, reachable continues, and the probe is
exercised against real sockets (a listening port answers true, the same port closed answers false
quickly).
### Design decisions