swactor/crates/runtime-dashboard
zacheryasc 70bb188a6d fix: mild refactor and test coverage (#37)
Extract the timer wheel and watch registry from the worker into a reusable std-extension crate, generalize the worker around a RuntimeExtension factory, and decompose the monolithic runtime test file into focused suites.

- crates/std: extract TimerWheel (deterministic tick-counted one-shot/interval timers) and WatchRegistry (target-to-watcher death-notification index) out of src/worker.rs into reusable modules
- crates/std: add Ctx extension traits (CtxMonitoring, CtxNaming, CtxWatching, CtxTimers) and Runtime extension traits (RuntimeNaming, RuntimeWatching, RuntimeGroups) wiring monitor/name/watch/timer/group support
- src/worker.rs: replace the hard-coded timer/watch fields with a generic RuntimeExtension factory and add route_to_pool_or_remote for message routing (local pool, then cross-worker address map, then external inboxes)
- tests: split the 4622-line tests/runtime_api.rs into focused suites (actor_lifecycle, message_delivery, runtime_stress, std_extension) plus a shared tests/common/mod.rs harness, and drop watch_api.rs
- benches/fuzz: add runtime_benchmarks and adjust the runtime fuzz target
- tools/docs: add fn_complexity.py and loc_analysis.py analysis scripts and refresh the runtime and worker-thread docs

Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
2026-02-13 15:00:53 +00:00
..
examples feat: realize distribution crate (#33) 2026-02-13 07:55:12 +00:00
src feat: dashboard updates (#38) 2026-02-13 14:42:10 +00:00
tests fix: mild refactor and test coverage (#37) 2026-02-13 15:00:53 +00:00
.gitignore feat: runtime dashboard and docs (#23) 2026-02-09 09:04:57 +00:00
AGENTS.md feat: distributed runtime (#30) 2026-02-12 09:13:50 +00:00
Cargo.toml feat: wasm runner actor skeleton (#32) 2026-02-13 07:42:44 +00:00
README.md feat: distributed runtime (#30) 2026-02-12 09:13:50 +00:00

runtime-dashboard

Visual dashboard for the swactor runtime. Provides a live HTTP dashboard, a terminal UI (TUI), trace recording/replay, and an HTTP API for programmatic runtime investigation.

Features

Feature Default Description
distribution yes /distribution page with SWIM membership, Kademlia routing, and location cache
tui no Terminal UI with overview, worker detail, and distribution views

HTTP Dashboard

Start the dashboard demo and open it in a browser:

cargo run -p runtime-dashboard --example dashboard_demo

Pages:

  • http://localhost:9090 — live overview (workers, actors, message rates)
  • http://localhost:9090/actors — actor table
  • http://localhost:9090/distribution — SWIM membership, Kademlia routing, cache entries

The demo creates a 4-worker runtime with ping-pong and counter actors, plus a 9-node distribution cluster (1 main node + 8 peers) with simulated SWIM membership and actor registrations in the directory/cache.

TUI

A standalone binary that connects to any running dashboard over SSE:

cargo run -p runtime-dashboard --features tui --bin swactor-tui
# or point at a specific endpoint
cargo run -p runtime-dashboard --features tui --bin swactor-tui -- http://localhost:9090

Views (cycle with Tab):

  • Overview — htop-style worker bars, summary line, sortable actor table
  • Worker Detail — focused view of a single worker's actors and phase breakdown
  • Distribution — cluster summary, scrollable members table, cache entries, routing bucket histogram

Key bindings: q quit, Tab cycle views, s sort column, r reverse sort, arrow keys/j/k scroll, Enter drill into worker, Esc back to overview.

Agent HTTP API (Investigate)

All diagnostic commands are available as HTTP endpoints when the dashboard server is running. See AGENTS.md for full protocol documentation.

curl 'http://localhost:9090/api/investigate?cmd=overview'
curl 'http://localhost:9090/api/investigate?cmd=hot&n=5'
curl 'http://localhost:9090/api/investigate?cmd=workers'
curl 'http://localhost:9090/api/investigate?cmd=worker&id=2'
curl 'http://localhost:9090/api/investigate?cmd=actors&sort=mailbox&limit=10'
curl 'http://localhost:9090/api/investigate?cmd=diff&seconds=2'

The same commands are also available via a stdin/stdout REPL for direct programmatic use (see investigate::run_investigate).

Demos

All examples are run from the workspace root.

HTTP dashboard — live workload with distribution cluster, Ctrl+C to stop:

cargo run -p runtime-dashboard --example dashboard_demo
# http://localhost:9090              — runtime overview
# http://localhost:9090/distribution — cluster view

Benchmarks — four automated scenarios (~20 s total):

cargo run -p runtime-dashboard --example bench_dashboard
# open http://localhost:9090

Record & replay — records ~10 s of activity, then serves a replay:

cargo run -p runtime-dashboard --example record_and_replay_demo
# live dashboard at http://localhost:9090 during recording
# replay dashboard at http://localhost:9091 after recording finishes
# Ctrl+C to stop