fix: add DASH-003 live trades and session rows

This commit is contained in:
2026-08-17 12:20:42 -04:00
parent e7b6ae5878
commit f617574b16
5 changed files with 180 additions and 9 deletions

59
TASK_DASH-003_PROMPT.md Normal file
View File

@@ -0,0 +1,59 @@
# TASK: DASH-003 — Fix live trades feed + add live session rows
# Staged: 2026-08-17
# Sprint: Parallel Product Work — dashboard-only
# ─────────────────────────────────────────────────────────────────
## Part 1 — BUGFIX: /api/state trades field is stale (priority)
app.js's renderServerState() correctly feeds payload.trades from /api/state
into Trade Detail, Grade Distribution, and Provenance Health on every 5s
poll — this is NOT gated behind manual JSON load, it's already live by
design. But the server is currently returning only 2 old trade records
(matching pre-8/16 sentinel data) instead of today's actual fills from
today's trades_Simple_ORB_NT8_YYYYMMDD.jsonl.
READ-FIRST: locate where server.py/parsers.py builds the `trades` field for
/api/state. Compare its file-selection logic against the current_session
fix already applied — confirm whether this is the same root cause (not
selecting the newest/today's trades_*.jsonl by date) or a separate issue
(e.g. reading a cached/fixed path, or filtering by a stale session_id).
FIX: ensure /api/state's trades field always reflects the CURRENT day's
trades_*.jsonl, refreshed on the same poll cycle as everything else.
VALIDATE: with a real trade present in today's trades file, confirm it
appears in Trade Detail/Grade Distribution/Provenance Health within one
poll cycle, without any manual action.
## Part 2 — Live session rows (unblocks Daily Timeline, Config Integrity,
## Silent Day Explorer, and the Decision/Defect headline counts)
renderServerState() in app.js currently calls:
render({ rows: [], diagnostics: [], trade_records: asArray(payload.trades) })
`rows: []` is hardcoded — these four sections structurally cannot populate
from the live server no matter what, since they all key off data.rows.
Add a `rows` (or `sessions`) field to /api/state's response, built from the
CURRENT session's log + provenance file, matching the same row shape
logtriage.py's triage.json already produces for TOOL-001 rows (account,
instrument, bar_type, signals, submits, fills, net_pnl, config_hash,
code_version, reject_summaries). Reuse logtriage's parsing logic rather
than reimplementing it — import/call the existing module if feasible.
Update app.js's renderServerState() to pass this real rows data instead of
the hardcoded empty array.
Scope for this pass: CURRENT session only (today), not a full historical
rescan — that remains logtriage.py's job for multi-day analysis. This just
makes today's session visible live without a manual step.
## VALIDATION
- Confirm Daily Timeline shows today's session with real signal/submit/
fill/net_pnl counts, live, without loading any file.
- Confirm Config Integrity shows today's ConfigHash/CodeVersion.
- Confirm no regression to the manual "Load TOOL-001 JSON" path — it must
still work independently for historical/offline analysis.
## GOVERNANCE
Track as [DASH-003] in SPRINT_BOARD.md.