EMRY-022: Derived state (EMA / throughput / ETA) in the dashboard #64

Merged
vxfemboy merged 2 commits from emry-022-derived-state into main 2026-06-25 11:41:06 +00:00
vxfemboy commented 2026-06-25 11:33:37 +00:00 (Migrated from github.com)

Closes EMRY-022 (#17). Branched off main.

What

The engine session now runs derived-metric processors and surfaces them live:

  • An Ema per metric ({name}_ema) when RunConfig.smoothing is set.
  • A Throughput processor (steps_per_sec, plus eta_secs when total_steps is known) when track_throughput is on.

Outputs are published to the bus as synthetic MetricsBatch events, so the TUI shows them as live series. Both options default on; the demo pre-registers the derived names so the dashboard labels them.

Design decision

Derived metrics go to the bus only — not events.jsonl/metrics.jsonl — because they're recomputable from the raw logs. This keeps the audit trail and the export rows clean. The fast emit() path is unchanged (still lock-free); the processors + registry lock run only on the worker thread.

Verification

  • ./scripts/pre-commit-rust.sh green: clippy -D warnings, 45 engine tests, session.rs 96.8% lines, total 96.70%
  • Tests: derived ids appear on the bus but not in metrics.jsonl; derived can be disabled (asserts derived ids absent); existing file-count tests unaffected (derived don't touch files)
  • Demo builds and pre-registers derived labels

Review

Architecture verified (no feedback loop, hot path untouched, derived not persisted, raw-then-derived ordering). Fixed the one actionable finding: the disabled-derived test had a non-catching assertion (now checks derived ids absent). Documented that derived bus events are indistinguishable from raw (safe — only live display consumes the bus).

Closes EMRY-022 (#17). Branched off `main`. ## What The engine session now runs derived-metric processors and surfaces them live: - An `Ema` per metric (`{name}_ema`) when `RunConfig.smoothing` is set. - A `Throughput` processor (`steps_per_sec`, plus `eta_secs` when `total_steps` is known) when `track_throughput` is on. Outputs are published to the bus as synthetic `MetricsBatch` events, so the TUI shows them as live series. Both options **default on**; the demo pre-registers the derived names so the dashboard labels them. ## Design decision Derived metrics go to the **bus only** — not `events.jsonl`/`metrics.jsonl` — because they're recomputable from the raw logs. This keeps the audit trail and the export rows clean. The fast `emit()` path is unchanged (still lock-free); the processors + registry lock run only on the worker thread. ## Verification - `./scripts/pre-commit-rust.sh` green: clippy `-D warnings`, 45 engine tests, session.rs 96.8% lines, total 96.70% - Tests: derived ids appear on the bus but not in metrics.jsonl; derived can be disabled (asserts derived ids absent); existing file-count tests unaffected (derived don't touch files) - Demo builds and pre-registers derived labels ## Review Architecture verified (no feedback loop, hot path untouched, derived not persisted, raw-then-derived ordering). Fixed the one actionable finding: the disabled-derived test had a non-catching assertion (now checks derived ids absent). Documented that derived bus events are indistinguishable from raw (safe — only live display consumes the bus).
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
femboy/emry!64
No description provided.