feat(phase2): Latency Display + Buffer Health (Goal 6)#49
Open
roiguri wants to merge 1 commit into
Open
Conversation
bc62a4c to
ef1c27d
Compare
…l 6) Consumes StreamWorker.latency_ready (previously unconsumed) and surfaces it on the header: rolling p50/p95 latency readout + a buffer-health pill (BUFFER OK green / BACKLOG amber). Data-agnostic: latency/backlog are system timing, independent of prediction correctness — works regardless of the fidelity bug and doubles as live instrumentation for the deferred Goal 18/1 work. - Phase2Header: set_latency / set_buffer_health / clear_diagnostics - Phase2Screen: queued latency_ready -> deque(maxlen=100) + pending_samples; 5 Hz QTimer summarises onto the header; started on Start, cleared on Halt/error - LiveStreamSession.batch_size_samples property for the backlog threshold (pending < batch*2); fallback 40 - 8 headless tests; plan doc Goal 6 marked done
ef1c27d to
3eb9b68
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@
What
Wires the header to
StreamWorker.latency_ready(previously emitted but consumed by nobody) and surfaces it as live diagnostics (M2 Goal 6):Latency: p50 / p95 ms, rolling over the last 100 batches.BUFFER OKwhen the backlog is comfortably below the batch size, amberBACKLOGwhen the worker is falling behind (pending_samples >= batch_size * 2).Why this one (data-agnostic)
Latency and backlog are pure system timing — independent of whether the predictions are correct. So this works regardless of the open prediction-fidelity bug, and it doubles as instrumentation for the deferred Goal 18 / Goal 1 work: per-batch timing and queue depth become visible the moment you next replay.
Changes
Phase2Headergainsset_latency/set_buffer_health/clear_diagnosticsplus the right-aligned label + pill.Phase2Screensubscribes tolatency_ready(queued): a data-only slot bufferstotal_msindeque(maxlen=100)and records the latestpending_samples; a 5 HzQTimer(decoupled from the ~25 Hz stream) computes p50/p95 (numpy) and the pill state. Started on Start; stopped + cleared on Halt and on error.LiveStreamSession.batch_size_samples— new read-only property so the backlog threshold scales to the session's batch size without reaching into_worker(fallback 40).Testing
tests/frontend/test_latency_health.py): header text/pill/clear, latency buffering + summary, backlog→amber threshold, timer start/stop lifecycle, clear-on-error, empty-window no-op.session.pytouched).Notes
Branched from
main, independent of #47 (chart perf) and #48 (Trigger Log). All three merge in any order; #48 and this one both touchPhase2Screen(disjoint regions — header/diagnostics here vs. the log card there), so expect a trivial merge.@