Commit 174aa03
authored
Stage managed broadcast before starting ingest (#11)
## Summary
- Reconcile, create if needed, and bind exactly one marked unlisted
broadcast before FFmpeg starts ingest.
- Fail closed before ingest when an unmarked recoverable broadcast is
already bound to the reusable stream.
- Reuse the prepared lifecycle state after ingest becomes active,
avoiding a redundant reconciliation pass.
- Include API operation, HTTP status, and structured reason values in
redacted supervisor failures.
- Update the executive flow, Pi runbook, architecture diagram, lifecycle
design, and changelog.
## Root Cause
The deployed controller started FFmpeg before it could create the first
marked replacement event. A legacy unmarked event with auto-start and
auto-stop enabled therefore became live as soon as ingest appeared.
`liveBroadcasts.insert` then returned `User requests exceed the rate
limit.`, the pre-public fail-closed path stopped FFmpeg, and YouTube
ended the legacy event seven seconds after it started.
The durable write-ahead generation remained safe and no new marked
broadcast ID was recorded, but the quota backoff repeated the same
visible start/stop sequence.
## Recovery Design
- Source probe remains the first gate; a camera that is already
unavailable creates nothing.
- Non-public recovery stages one marked unlisted event and durably
verifies binding before FFmpeg starts.
- Active and upcoming inventory blocks any unmarked event bound to the
reusable stream.
- Lost insert responses reconcile by the existing generation marker
before another insert.
- Insert throttling preserves the same pending generation.
- Bind failure preserves the returned broadcast ID and retries binding
without reinserting.
- Active/good ingest and fresh FFmpeg media remain mandatory for
`testing`, `live`, and public promotion.
- A previously verified public event still starts media without making
control-plane availability a hard pre-ingest dependency.
## Rollout And Rollback
Rollout will stop the Pi service, create a private timestamped snapshot,
deploy the merged scripts, clear only the expired retry deadline, and
restart the service. If insert remains rate-limited, FFmpeg must not
start and the same pending generation must remain under bounded
cooldown. If insert succeeds, exactly one marked unlisted event must be
bound before ingest, then transition to live and public after health
gates.
Local rollback is valid only before a new remote event is staged. Once
staging succeeds, the prior version must remain stopped because it
cannot understand the new marked generation; no automatic YouTube
deletion, completion, or unbinding is part of rollback.
## Verification
- `pytest -q`: 102 passed
- `ruff check .`: passed
- `python -m py_compile` for all runtime scripts: passed
- Markdownlint CLI 0.18.1 across repository Markdown: passed
- `git diff --check`: passed
- Commit is GPG-signed
- Two distinct-family architecture reviews completed; the first changed
sequencing to pre-ingest staging, and the revised review surfaced no
load-bearing blocker
- Distinct-family code review was attempted twice but returned no
content; hosted CI and PR review remain required before merge1 parent 9a7f535 commit 174aa03
10 files changed
Lines changed: 908 additions & 76 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
5 | 13 | | |
6 | 14 | | |
7 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | | - | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
408 | 410 | | |
409 | 411 | | |
410 | 412 | | |
| 413 | + | |
411 | 414 | | |
412 | 415 | | |
413 | 416 | | |
| |||
425 | 428 | | |
426 | 429 | | |
427 | 430 | | |
428 | | - | |
| 431 | + | |
429 | 432 | | |
430 | | - | |
| 433 | + | |
431 | 434 | | |
432 | 435 | | |
433 | 436 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
91 | 102 | | |
92 | 103 | | |
93 | 104 | | |
| |||
401 | 412 | | |
402 | 413 | | |
403 | 414 | | |
404 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
405 | 422 | | |
406 | 423 | | |
407 | 424 | | |
408 | | - | |
| 425 | + | |
409 | 426 | | |
410 | 427 | | |
411 | 428 | | |
| |||
414 | 431 | | |
415 | 432 | | |
416 | 433 | | |
| 434 | + | |
417 | 435 | | |
418 | 436 | | |
419 | 437 | | |
420 | 438 | | |
421 | 439 | | |
| 440 | + | |
422 | 441 | | |
423 | 442 | | |
424 | 443 | | |
425 | 444 | | |
426 | 445 | | |
427 | 446 | | |
428 | 447 | | |
| 448 | + | |
429 | 449 | | |
430 | 450 | | |
431 | 451 | | |
432 | 452 | | |
433 | 453 | | |
| 454 | + | |
434 | 455 | | |
435 | 456 | | |
436 | 457 | | |
| |||
439 | 460 | | |
440 | 461 | | |
441 | 462 | | |
| 463 | + | |
442 | 464 | | |
443 | 465 | | |
444 | | - | |
| 466 | + | |
445 | 467 | | |
446 | 468 | | |
447 | 469 | | |
| |||
582 | 604 | | |
583 | 605 | | |
584 | 606 | | |
| 607 | + | |
585 | 608 | | |
586 | 609 | | |
587 | 610 | | |
| |||
596 | 619 | | |
597 | 620 | | |
598 | 621 | | |
| 622 | + | |
599 | 623 | | |
600 | 624 | | |
601 | 625 | | |
| |||
607 | 631 | | |
608 | 632 | | |
609 | 633 | | |
| 634 | + | |
610 | 635 | | |
611 | 636 | | |
612 | 637 | | |
| |||
622 | 647 | | |
623 | 648 | | |
624 | 649 | | |
625 | | - | |
| 650 | + | |
626 | 651 | | |
627 | 652 | | |
628 | 653 | | |
| |||
662 | 687 | | |
663 | 688 | | |
664 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
665 | 701 | | |
666 | 702 | | |
667 | 703 | | |
| |||
686 | 722 | | |
687 | 723 | | |
688 | 724 | | |
689 | | - | |
| 725 | + | |
690 | 726 | | |
691 | 727 | | |
692 | 728 | | |
| |||
698 | 734 | | |
699 | 735 | | |
700 | 736 | | |
| 737 | + | |
| 738 | + | |
701 | 739 | | |
702 | 740 | | |
703 | 741 | | |
| |||
789 | 827 | | |
790 | 828 | | |
791 | 829 | | |
792 | | - | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
793 | 834 | | |
794 | | - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
795 | 841 | | |
796 | 842 | | |
797 | 843 | | |
| |||
820 | 866 | | |
821 | 867 | | |
822 | 868 | | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
823 | 908 | | |
824 | 909 | | |
825 | | - | |
| 910 | + | |
826 | 911 | | |
827 | | - | |
| 912 | + | |
828 | 913 | | |
829 | 914 | | |
830 | 915 | | |
| |||
912 | 997 | | |
913 | 998 | | |
914 | 999 | | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
915 | 1006 | | |
916 | 1007 | | |
917 | 1008 | | |
| |||
939 | 1030 | | |
940 | 1031 | | |
941 | 1032 | | |
| 1033 | + | |
| 1034 | + | |
942 | 1035 | | |
943 | 1036 | | |
944 | 1037 | | |
| |||
963 | 1056 | | |
964 | 1057 | | |
965 | 1058 | | |
966 | | - | |
| 1059 | + | |
967 | 1060 | | |
968 | 1061 | | |
969 | 1062 | | |
| |||
0 commit comments