wire types: WireTime newtype for timestamps instead of adaptor-annotated i64

This commit is contained in:
damocles 2026-07-03 19:18:33 +02:00 committed by mara
commit 1e205289c5
12 changed files with 148 additions and 162 deletions

View file

@ -27,6 +27,7 @@ use tokio_stream::{Stream, StreamExt};
use crate::container_view::{ContainerView, claude_has_session};
use crate::coordinator::Coordinator;
use crate::lifecycle::{self, MANAGER_NAME};
use hive_sh4re::wire_time::WireTime;
mod approvals;
mod build_logs;
@ -433,8 +434,7 @@ struct ApprovalHistoryView {
/// `approved` / `denied` / `failed`.
status: &'static str,
/// RFC 3339 UTC. Renders as a relative time on the dashboard.
#[serde(with = "hive_sh4re::wire_time::iso")]
resolved_at: i64,
resolved_at: WireTime,
/// Operator-supplied deny reason (for `denied`) or build error
/// (for `failed`). None on `approved`.
#[serde(skip_serializing_if = "Option::is_none")]
@ -475,8 +475,7 @@ struct ApprovalView {
/// RFC 3339 UTC time the approval was queued. Rendered as a
/// relative time on the card so the operator can spot a stale
/// request.
#[serde(with = "hive_sh4re::wire_time::iso")]
requested_at: i64,
requested_at: WireTime,
}
/// Replace silent `.unwrap_or_default()` on the data sources behind
@ -908,7 +907,7 @@ fn history_view(a: Approval) -> ApprovalHistoryView {
kind,
sha_short,
status,
resolved_at: a.resolved_at.unwrap_or(0),
resolved_at: a.resolved_at.unwrap_or_default(),
note: a.note,
}
}
@ -1101,7 +1100,7 @@ async fn dashboard_history(State(state): State<AppState>) -> Response {
from,
to,
body,
at,
at: hive_sh4re::wire_time::WireTime(at),
in_reply_to,
file_refs,
})
@ -1121,7 +1120,7 @@ async fn dashboard_history(State(state): State<AppState>) -> Response {
from,
to,
body,
at,
at: hive_sh4re::wire_time::WireTime(at),
in_reply_to,
file_refs,
})
@ -1376,7 +1375,7 @@ async fn api_operator_inbox(State(state): State<AppState>) -> Response {
"id": id,
"from": from,
"body": body,
"at": hive_sh4re::wire_time::to_iso(at),
"at": hive_sh4re::wire_time::WireTime(at),
"in_reply_to": in_reply_to,
"file_refs": file_refs,
}))