swactor/apps/myelin/src/tests/harness.rs
Zachery Aaron Shores-Chmielewski 2bf11e0fdb feat: actor view panels for the dashboard
Add read-only actor overview and per-actor dossier pages to the dashboard, fed by enriched per-actor runtime snapshots.

- `dashboard/swactor/actor_view`: new `ActorPanelView`, a tolerant frame consumer over `runtime.actors`/`runtime.stats` that folds per-actor snapshots and serves `/view/swactor/actor-overview` (roster) and `/view/swactor/actor-dossier` (per-actor detail), each backed by an embedded HTML template (`actor_overview.html`, `actor_dossier.html`)
- `dashboard`: register both views in `DashboardHandle` and export `actor_overview_view()`/`actor_dossier_view()` from the swactor module
- `swactor` core: enrich `ActorSnapshot` with `actor_type` and `message_type` (populated from `slot.actor.metadata()` in `ActorPool`) and add `ActorAddress::to_full_hex()` for untruncated display
- `myelin/orchestration`: publish actor stats to the dashboard via a `runtime.actors` channel producer (`stats_hook_on`) threaded through the distribution stack, and carry the orchestrator actor address into readiness signaling
- workspace `Cargo.toml`: add `default-members` for native iteration and a centralized `[workspace.dependencies] tokio` so members share one feature set; `dashboard/Cargo.toml` switches to `tokio.workspace = true`

Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
2026-08-03 14:18:24 +04:00

50 lines
2 KiB
Rust

//! Test-only constructors and harness type aliases for the `tests` tree.
//!
//! These helpers previously lived in the production modules
//! (`orchestration/run_fsm`, `staging::control`) but serve only test code.
//! Defining them here keeps them compiled under `#[cfg(test)]` only, so
//! production builds stay free of the dead-code warnings they would otherwise
//! trigger. Inherent methods resolve through their type, so existing call sites
//! such as `fsm::RunPlan::test_linear(..)` and
//! `stage::WeightSource::embedded_gguf(..)` work unchanged.
use crate::run_fsm::{NodeId as FsmNodeId, OrchestratorRun, RunId as FsmRunId, RunPlan, StageRef};
use crate::run_plan::{GgufSource, TokenizerSource};
use crate::staging::{DeviceHandle, StageController, WeightSource};
impl RunPlan {
/// Build a linear pipeline plan (stage 0 -> stage 1 -> ... -> last stage).
/// Test-only convenience over the public `RunPlan` fields.
pub(crate) fn test_linear(run_id: FsmRunId, stages: Vec<StageRef>) -> Self {
Self { run_id, stages }
}
/// Node ids in declared stage order.
pub(crate) fn stage_nodes(&self) -> Vec<FsmNodeId> {
self.stages.iter().map(|stage| stage.node_id).collect()
}
}
impl DeviceHandle {
/// A handle on the worker's current (first) generation.
pub(crate) fn new_current(id: u64) -> Self {
Self { generation: 1, id }
}
}
impl WeightSource {
/// Weights carried by an embedded GGUF file with an embedded tokenizer.
pub(crate) fn embedded_gguf(model_id: impl Into<String>, path: impl Into<String>) -> Self {
Self::new(
model_id,
GgufSource::LocalPath(path.into()),
TokenizerSource::EmbeddedGguf,
)
}
}
/// Test alias for the orchestrator run core, retained for readable test prose.
pub(crate) type OrchestratorHarness = OrchestratorRun;
/// Test alias for the stage controller core, retained for readable test prose.
pub(crate) type StageControllerHarness = StageController;