dashboard: stale-session alarm banner + rvol_tod in armed triggers
The 07-21 morning outage (loop booted post-EOD on the 20th, survived
midnight, silently blocked every entry while signals went READY) had zero
UI surface. New query_loop_session projection parses the live session id's
embedded date; a red banner fires when it isn't today's — the exact day-2
poison signature — telling the operator to restart the loop. Armed
Triggers rows now also show rvol_tod (the arming signal since 5597250)
next to legacy rvol.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9bfd458956
commit
2e39b756ba
4 files changed
+63
-1
No files matched your search
@@ -282,3 +282,28 @@ def test_daily_performance_curve_trading_days_only():
|
||||
assert days[1]["day_pnl"] == -200.0 and days[1]["cum_pnl"] == -100.0
|
||||
assert days[1]["trades"] == 2 and days[1]["win_rate"] == 0.5
|
||||
store.close()
|
||||
|
||||
|
||||
def test_loop_session_stale_detection(store):
|
||||
"""A paper session whose embedded date != today must flag stale — the day-2
|
||||
silent entry-block signature (loop booted post-EOD, survived midnight)."""
|
||||
from storage.event_schema import ModuleTickEvent
|
||||
from storage.projections import query_loop_session
|
||||
|
||||
def _tick(cid):
|
||||
store.emit(ModuleTickEvent(
|
||||
timestamp=datetime.now(), mode=EventMode.PAPER,
|
||||
correlation_id=cid, message="tick",
|
||||
module="triggers", stage="snapshot", duration_ms=0.0,
|
||||
input_count=0, output_count=0, metrics={}, errors=[]))
|
||||
|
||||
_tick("paper-2020-01-02-abc123")
|
||||
s = query_loop_session(store)
|
||||
assert s["session_id"] == "paper-2020-01-02-abc123"
|
||||
assert s["session_date"] == "2020-01-02"
|
||||
assert s["stale"] is True
|
||||
|
||||
today = datetime.now().strftime("%Y-%m-%d")
|
||||
_tick(f"paper-{today}-def456")
|
||||
s = query_loop_session(store)
|
||||
assert s["session_date"] == today and s["stale"] is False
|
||||
Reference in new issue
Block a user