mostlyright.weather.earnings.live_capture_runner
mostlyright.weather.earnings.live_capture_runner
Section titled “mostlyright.weather.earnings.live_capture_runner”Live capture session runner + live de-risk spike harness (Phase 27, 27-09 W5).
Two surfaces:
run_live_session(ticker, call_id, manifest_url, *, on_frame, ...)
: Orchestrates a live capture session: open a
LiveHlsCapturer (via a
capturer_factory seam), pump every yielded (pcm_frame, spoken_at) to the
injected on_frame callback (27-10’s streaming STT / bus is the real consumer;
tests inject a recorder), and on end-of-stream emit a SINGLE EndOfCall
handoff so the W1 batch path produces the AUTHORITATIVE ledger (D-27.12 — live is
provisional, the post-call ledger settles). A provider with no live edge
(LiveCaptureUnsupported)
routes to the batch path only — logged, never a crash.
27-10 seam (lazy / injected). The real consumer is 27-10’s STT/bus, which lands
NEXT. This module does NOT import it — the consumer is the injected on_frame
callback, so this commit has NO hard dependency on 27-10.
observe_live_posture / render_spike_report (Task 1)
: The live de-risk SPIKE harness. Task 1 is an OPERATOR-GATED de-risk spike against
=2 SCHEDULED REAL earnings calls — which CANNOT run headless (you cannot fabricate a live edge). The harness reads the load-bearing posture observations (ENDLIST vs live edge, target-duration, window size, token posture, audio_only rendition) off a manifest and renders the per-provider GO/NO-GO report the operator reviews. The REAL-CALL spike is DEFERRED to the operator; the harness is proven against synthetic fixtures + the banked Q4/IVS GO (NKE live-call validation).
Legal (D-27.9): audio is a transient PCM frame stream into on_frame — this
runner NEVER persists or serves it; only frames + the end-of-call handoff cross the
boundary.
Functions
Section titled “Functions”observe_live_posture(*, provider, …[, …]) | Fetch the master + media manifest and extract the live-edge posture. |
|---|---|
render_spike_report(observations) | Render the operator-reviewed LIVE-SPIKE-REPORT markdown from observations. |
run_live_session(ticker, call_id, …[, …]) | Open the live capturer, pump frames to on_frame, hand off at end-of-call. |
Classes
Section titled “Classes”EndOfCall(ticker, call_id, frame_count, …) | End-of-stream handoff to the authoritative post-call batch path (D-27.12). |
|---|---|
LiveSessionResult(ticker, call_id[, …]) | The outcome of a run_live_session() — frame count + termination posture. |
ProviderSpikeObservation(provider[, …]) | A per-provider live-edge posture observation for the operator spike report. |
class mostlyright.weather.earnings.live_capture_runner.EndOfCall(ticker, call_id, frame_count, ended_cleanly, live_supported)
Section titled “class mostlyright.weather.earnings.live_capture_runner.EndOfCall(ticker, call_id, frame_count, ended_cleanly, live_supported)”Bases: object
End-of-stream handoff to the authoritative post-call batch path (D-27.12).
Carries the (ticker, call_id) identity so the W1 batch path produces the
AUTHORITATIVE ledger after the live (provisional) feed closes. ended_cleanly
distinguishes a clean #EXT-X-ENDLIST / stall termination from a live path
that was never opened (no live edge → batch-only).
call_id : str
Section titled “call_id : str”ended_cleanly : bool
Section titled “ended_cleanly : bool”frame_count : int
Section titled “frame_count : int”live_supported : bool
Section titled “live_supported : bool”ticker : str
Section titled “ticker : str”class mostlyright.weather.earnings.live_capture_runner.LiveSessionResult(ticker, call_id, frame_count=0, ended_cleanly=False, live_supported=True)
Section titled “class mostlyright.weather.earnings.live_capture_runner.LiveSessionResult(ticker, call_id, frame_count=0, ended_cleanly=False, live_supported=True)”Bases: object
The outcome of a run_live_session() — frame count + termination posture.
call_id : str
Section titled “call_id : str”ended_cleanly : bool
Section titled “ended_cleanly : bool”frame_count : int
Section titled “frame_count : int”live_supported : bool
Section titled “live_supported : bool”ticker : str
Section titled “ticker : str”class mostlyright.weather.earnings.live_capture_runner.ProviderSpikeObservation(provider, has_endlist=False, target_duration_s=0.0, window_segment_count=0, audio_only_rendition_found=False, token_in_url=False, session_headers_required=False, verdict=‘DEFERRED’, notes=”)
Section titled “class mostlyright.weather.earnings.live_capture_runner.ProviderSpikeObservation(provider, has_endlist=False, target_duration_s=0.0, window_segment_count=0, audio_only_rendition_found=False, token_in_url=False, session_headers_required=False, verdict=‘DEFERRED’, notes=”)”Bases: object
A per-provider live-edge posture observation for the operator spike report.
Records the load-bearing observations (27-RESEARCH §6.1): is this a live edge
(no #EXT-X-ENDLIST)? what is the target-duration / poll cadence? how many
segments does the rolling window retain (keep-up margin)? is the token in-URL
(Q4/IVS) vs a header/query token (webcasts.com)? are session headers required
(ChorusCall)? is there an audio_only rendition (no video pull)? The verdict
is the operator’s per-provider GO / NO-GO / DEFERRED.
- Parameters:
audio_only_rendition_found : bool
Section titled “audio_only_rendition_found : bool”has_endlist : bool
Section titled “has_endlist : bool”notes : str
Section titled “notes : str”provider : str
Section titled “provider : str”session_headers_required : bool
Section titled “session_headers_required : bool”target_duration_s : float
Section titled “target_duration_s : float”token_in_url : bool
Section titled “token_in_url : bool”verdict : str
Section titled “verdict : str”window_segment_count : int
Section titled “window_segment_count : int”mostlyright.weather.earnings.live_capture_runner.observe_live_posture(, provider, master_url, client, session_headers=())
Section titled “mostlyright.weather.earnings.live_capture_runner.observe_live_posture(, provider, master_url, client, session_headers=())”Fetch the master + media manifest and extract the live-edge posture.
Reuses LiveHlsCapturer’s
parsers so the spike observes EXACTLY what the capturer would follow. NO audio is
fetched or retained (D-27.9) — only the manifest posture is recorded. Against a
live (no-ENDLIST) manifest this reports the rolling-window size + target-duration;
against a VOD/replay it flags has_endlist so the operator sees whether the
live edge differs from the later VOD (the load-bearing unknown).
- Return type:
ProviderSpikeObservation - Parameters:
mostlyright.weather.earnings.live_capture_runner.render_spike_report(observations)
Section titled “mostlyright.weather.earnings.live_capture_runner.render_spike_report(observations)”Render the operator-reviewed LIVE-SPIKE-REPORT markdown from observations.
Emits the per-provider GO/NO-GO table with the observed window/target-duration/ token posture and an explicit note on whether the live-edge posture differs from the VOD posture (the load-bearing unknown, 27-RESEARCH §6.1). NO audio is retained — only posture observations (D-27.9).
- Return type:
str - Parameters: observations (list [ProviderSpikeObservation ])
mostlyright.weather.earnings.live_capture_runner.run_live_session(ticker, call_id, manifest_url, *, on_frame, on_end_of_call=None, session=None, capturer_factory=<function _default_capturer_factory>)
Section titled “mostlyright.weather.earnings.live_capture_runner.run_live_session(ticker, call_id, manifest_url, *, on_frame, on_end_of_call=None, session=None, capturer_factory=<function _default_capturer_factory>)”Open the live capturer, pump frames to on_frame, hand off at end-of-call.
Every (pcm_frame, spoken_at) the capturer yields is forwarded to on_frame
in order (27-10’s STT/bus is the real consumer). On end-of-stream a SINGLE
EndOfCall is passed to on_end_of_call (if given) so the W1 batch path
produces the authoritative ledger (D-27.12). A provider whose capturer_factory
raises LiveCaptureUnsupported (dial-in / SABR / Lumi) opens NO live
session — it is logged and STILL emits an end-of-call handoff (live_supported= False) so the batch ledger runs. No audio is persisted; only frames + the handoff
cross the boundary.