refactor(#2591): DagView carries host-computed timestamps + NodeView.has_log

Reconcile with mara + argus's review on the frontend PR (#2660):

- DagView regains started_at/finished_at (DateTime<Utc>), computed
  host-side as min/max over ALL subtree nodes (including the Done ones
  filtered off the wire). The client can't derive these — the
  earliest/only-started node is often Done and absent — so the backend
  sets them, per mara's call.
- NodeView gains has_log: bool = build_log_id.is_some(), the precise
  old 'node has a captured build log' guard so the dashboard only shows
  a log link for nodes that actually produce one.
This commit is contained in:
atlas 2026-07-23 15:20:29 +02:00 committed by mara
commit 02e2bf895e
2 changed files with 34 additions and 0 deletions

View file

@ -121,6 +121,12 @@ pub struct NodeView {
/// node. Display-only payload, not derivable from the graph.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub inputs: Vec<String>,
/// Whether this node has a captured build log fetchable at
/// `GET /api/build-log/<id>`. Only the nix-heavy nodes that stream build
/// output set one; the client gates its log link on this so lock / noop /
/// store-only nodes don't render a link that 404s.
#[serde(default)]
pub has_log: bool,
}
/// A queued / running / failed DAG — a thin projection of one container
@ -137,6 +143,17 @@ pub struct DagView {
pub reason: String,
/// When the DAG was enqueued.
pub created_at: DateTime<Utc>,
/// When the DAG's first node started (min over *all* its nodes) — computed
/// host-side, **not** derived on the client: `Done` nodes are excluded from
/// `nodes` below, so the earliest-started node is usually absent from the
/// wire and the client can't take the min itself. `None` until a node runs.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub started_at: Option<DateTime<Utc>>,
/// When the DAG finished (max `finished_at` over all its nodes), set only
/// once the DAG has settled terminal. Host-computed for the same reason as
/// `started_at`. `None` while the DAG is still live.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finished_at: Option<DateTime<Utc>>,
/// Nodes of this DAG with `Done` ones excluded. A DAG whose nodes are
/// all `Done` is omitted from the snapshot entirely; a `Failed` DAG
/// lingers until aged out by the history cap.