Watch
0
0
Fork
You've already forked hyperhive
0

drop hive and agent response fields the frontend never reads

This commit is contained in:
atlas 2026-11-13 03:25:41 +01:00 • committed by mara
commit a437f9ccd5

View file

@ -124,8 +124,7 @@ async fn wait_for_nodes_plain(socket: &Path, ids: Vec<u64>) -> Result<()> {
}
/// TTY progress: a live `indicatif` render — one braille-spinner line per
/// node (grouped under a per-root header), each with its own elapsed
/// timer, plus an overall-elapsed footer. A node with more than one
/// node (grouped under a per-root header), plus an overall-elapsed footer. A node with more than one
/// dependency (fan-in) gets its own row with an `(after …)` marker rather
/// than being crammed onto a chain line.
async fn wait_for_nodes_animated(socket: &Path, ids: Vec<u64>) -> Result<()> {
@ -149,7 +148,6 @@ async fn wait_for_nodes_animated(socket: &Path, ids: Vec<u64>) -> Result<()> {
let mut failed: Vec<String> = Vec::new();
while !pending.is_empty() {
let now = now_unix();
let batch: Vec<u64> = pending.iter().copied().collect();
let resp = crate::client::request(
socket,
@ -173,11 +171,10 @@ async fn wait_for_nodes_animated(socket: &Path, ids: Vec<u64>) -> Result<()> {
b
});
hdr.set_message(format!(
"{} {} {} · {}",
"{} {} {}",
state_glyph(root.state),
root.payload.label,
node_agents(nodes),
fmt_dur(node_elapsed(root, now)),
));
for n in nodes.iter().filter(|n| n.id != root.id) {
let key = (id, n.id);
@ -195,11 +192,11 @@ async fn wait_for_nodes_animated(socket: &Path, ids: Vec<u64>) -> Result<()> {
bar.finish_with_message(format!(
" {} {}",
state_glyph(n.state),
node_line(nodes, n, now)
node_line(nodes, n)
));
node_done.insert(key);
} else {
bar.set_message(node_line(nodes, n, now));
bar.set_message(node_line(nodes, n));
}
}
if root.state.is_terminal() {
@ -257,24 +254,6 @@ fn node_agents(nodes: &[GraphNode]) -> String {
seen.join(",")
}
/// Current unix time in seconds (0 on the impossible pre-epoch error).
fn now_unix() -> i64 {
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.ok()
.and_then(|d| i64::try_from(d.as_secs()).ok())
.unwrap_or(0)
}
/// Elapsed seconds for a node: `started_at` → `finished_at`/`now` once
/// it's run; `created_at` → `now` while it's still queued. `GraphNode`
/// carries no group-level timestamp separate from its own, so a header
/// line just reads this off whichever node it's summarizing.
fn node_elapsed(n: &GraphNode, now: i64) -> i64 {
let start = n.started_at.unwrap_or(n.created_at);
(n.finished_at.map_or(now, |t| t.timestamp()) - start.timestamp()).max(0)
}
/// Compact duration: `45s` under a minute, else `1m03s`.
fn fmt_dur(secs: i64) -> String {
let s = secs.max(0);
@ -286,11 +265,11 @@ fn fmt_dur(secs: i64) -> String {
}
/// One animated node line: kind, an `(after …)` marker for a fan-in node
/// (>1 node-dependency), its elapsed timer, and a truncated error tail.
/// (>1 node-dependency), and a truncated error tail.
/// Resource deps (`GraphDep::Resource`) don't name another node, so they're
/// filtered out of the fan-in count the same way `hive-c0re`'s own
/// `dag_view` projection already does.
fn node_line(nodes: &[GraphNode], n: &GraphNode, now: i64) -> String {
fn node_line(nodes: &[GraphNode], n: &GraphNode) -> String {
use std::fmt::Write as _;
let mut s = n.payload.label.clone();
let dep_ids: Vec<WireId> = n
@ -311,10 +290,6 @@ fn node_line(nodes: &[GraphNode], n: &GraphNode, now: i64) -> String {
let _ = write!(s, " (after {})", after.join(", "));
}
}
let el = node_elapsed(n, now);
if el > 0 {
let _ = write!(s, " · {}", fmt_dur(el));
}
if let Some(err) = &n.error {
let short: String = err.chars().take(100).collect();
let _ = write!(s, " — {short}");
@ -381,9 +356,6 @@ mod tests {
parent: None,
state,
deps: Vec::new(),
created_at: hive_sh4re::wire_time::from_secs(0),
started_at: None,
finished_at: None,
error: None,
payload: NodePayload {
label: label.to_owned(),
@ -398,9 +370,6 @@ mod tests {
parent: Some(root),
state,
deps: Vec::new(),
created_at: hive_sh4re::wire_time::from_secs(0),
started_at: None,
finished_at: None,
error: None,
payload: NodePayload {
label: label.to_owned(),