EMRY-015: RunSession + Engine API — Emry runs end-to-end #60
No reviewers
Labels
No labels
blocked
bug
compat
docs
documentation
duplicate
emry-cli
emry-core
emry-engine
emry-ingest
emry-py
emry-store
emry-tui
emry-web
enhancement
good first issue
gpu-compute
help wanted
hpc
infra
integrations
invalid
needs-design
P0-blocker
P1-core
P2-enhanced
P3-future
performance
pull-request
python
pytorch
question
rust
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
femboy/emry!60
Loading…
Reference in a new issue
No description provided.
Delete branch "emry-015-run-session"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes EMRY-015 (#13). Branched off
main. Emry is now runnable end-to-end.What
crates/emry-engine/src/session.rs—Engine::start(RunConfig) -> RunHandleassembles every M0/M1 piece into a live run:EventBusfor observersAnomalyDetectorper metric →Event::AlertJsonlSinkwritingevents.jsonl(audit) +metrics.jsonl(wide rows)RunHandle:emit(&[(MetricId,f64)])(fast, lock-free ring push),emit_dynamic(slow, name-resolving),set_phase,set_epoch,finish. The worker drains the ring, persists, publishes, and runs anomaly detection.finish()drains+flushes everything;Dropmarks the run interrupted.examples/synthetic_run.rsis the runnable demo — confirmed locally: a 200-step loop produced RunStarted → 200 batches → a spikeAlertat step 120 (z=147) → RunFinished, plus a 200-rowmetrics.jsonlwith resolved names.Architecture note
emry-enginenow depends onemry-store(engine orchestrates persistence). No cycle (store depends only on core). This corrects thecore→engine→storeflow I'd noted earlier — the real direction is engine→store.Verification
./scripts/pre-commit-rust.shgreen: clippy-D warnings, 41 engine tests, session.rs 95% lines, total 97.68%Self-review fix (review agent hit a session limit)
Found and fixed a hang: if the ring is full at
finish(), theRunFinishedpush is dropped and the worker would never terminate →join()hangs forever.finish_withnow also raises the stop flag, so the worker always exits (then drains the ring; a pushed RunFinished is still written).Deferred
EMA/Welford/throughput processor wiring into the session → EMRY-022 (their
DerivedMetrics need aDerivedState/TUI consumer). Anomaly is wired now becauseEvent::Alerthas a home.