Watch
0
0
Fork
You've already forked hyperhive
0

remove what no longer has a reader: build-log store, dashboard sent/delivered events, graph resource dep

This commit is contained in:
atlas 2026-11-13 10:08:19 +01:00 • committed by mara
commit 49266e4410

View file

@ -1,39 +1,16 @@
//! Unified dashboard event channel — all near-real-time browser events
//! flow through `Coordinator.dashboard_events`. Design rationale
//! (single channel, broker forwarder isolation):
//! (single channel):
//! `docs/4-implementation/web-ui/shape.md::One unified channel`.
use serde::Serialize;
use crate::container_view::ContainerView;
use crate::dashboard::TombstoneView;
use chrono::{DateTime, Utc};
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "snake_case", tag = "kind")]
pub enum DashboardEvent {
/// Broker `Sent` event mirrored onto the dashboard channel.
Sent {
/// Broker row id. Allows the dashboard to track reply threads.
id: i64,
from: String,
to: String,
body: String,
at: DateTime<Utc>,
#[serde(default, skip_serializing_if = "Option::is_none")]
in_reply_to: Option<i64>,
},
/// Broker `Delivered` event mirrored onto the dashboard channel.
Delivered {
/// Broker row id. Allows the dashboard to track reply threads.
id: i64,
from: String,
to: String,
body: String,
at: DateTime<Utc>,
#[serde(default, skip_serializing_if = "Option::is_none")]
in_reply_to: Option<i64>,
},
/// A lifecycle action started for an agent (spawn / start / stop
/// / restart / rebuild / destroy). Clients render a spinner next
/// to the row; the client computes "seconds in this state"
@ -107,7 +84,7 @@ pub enum DashboardEvent {
impl DashboardEvent {
/// Snake-case identifier matching this variant's serde `tag`
/// (e.g. `Sent` → `"sent"`, `ContainerStateChanged` →
/// (e.g. `TransientSet` → `"transient_set"`, `ContainerStateChanged` →
/// `"container_state_changed"`). Lets `/dashboard/stream`'s
/// `?kinds=` filter decide whether to forward a frame without
/// paying the JSON-serialise cost first.
@ -119,8 +96,6 @@ impl DashboardEvent {
#[must_use]
pub fn kind_tag(&self) -> &'static str {
match self {
DashboardEvent::Sent { .. } => "sent",
DashboardEvent::Delivered { .. } => "delivered",
DashboardEvent::TransientSet { .. } => "transient_set",
DashboardEvent::TransientCleared { .. } => "transient_cleared",
DashboardEvent::ContainerStateChanged { .. } => "container_state_changed",
@ -154,22 +129,6 @@ mod tests {
)]
fn kind_tag_matches_serde_kind_field() {
let samples: Vec<DashboardEvent> = vec![
DashboardEvent::Sent {
id: 1,
from: "a".into(),
to: "b".into(),
body: String::new(),
at: hive_sh4re::wire_time::from_secs(0),
in_reply_to: None,
},
DashboardEvent::Delivered {
id: 1,
from: "a".into(),
to: "b".into(),
body: String::new(),
at: hive_sh4re::wire_time::from_secs(0),
in_reply_to: None,
},
DashboardEvent::TransientSet {
name: "x".into(),
transient_kind: "rebuilding".into(),