wire types: use chrono DateTime<Utc> as the timestamp type throughout

This commit is contained in:
damocles 2026-07-03 20:54:33 +02:00 committed by mara
commit 2c5d9ed336
15 changed files with 108 additions and 190 deletions

View file

@ -9,7 +9,7 @@ use serde::Serialize;
use crate::container_view::ContainerView;
use crate::dashboard::{MetaInputView, TombstoneView};
use crate::rebuild_queue::QueueEntry;
use hive_sh4re::wire_time::WireTime;
use chrono::{DateTime, Utc};
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "snake_case", tag = "kind")]
@ -39,7 +39,7 @@ pub enum DashboardEvent {
from: String,
to: String,
body: String,
at: WireTime,
at: DateTime<Utc>,
#[serde(default, skip_serializing_if = "Option::is_none")]
in_reply_to: Option<i64>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
@ -54,7 +54,7 @@ pub enum DashboardEvent {
from: String,
to: String,
body: String,
at: WireTime,
at: DateTime<Utc>,
#[serde(default, skip_serializing_if = "Option::is_none")]
in_reply_to: Option<i64>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
@ -96,7 +96,7 @@ pub enum DashboardEvent {
sha_short: Option<String>,
/// `"approved"` / `"denied"` / `"failed"`.
status: &'static str,
resolved_at: WireTime,
resolved_at: DateTime<Utc>,
note: Option<String>,
description: Option<String>,
},
@ -112,8 +112,8 @@ pub enum DashboardEvent {
question: String,
options: Vec<String>,
multi: bool,
asked_at: WireTime,
deadline_at: Option<WireTime>,
asked_at: DateTime<Utc>,
deadline_at: Option<DateTime<Utc>>,
target: Option<String>,
/// Verified file-path tokens that appear in `question`.
/// Same shape as broker `Sent`/`Delivered` events; the
@ -131,7 +131,7 @@ pub enum DashboardEvent {
id: i64,
answer: String,
answerer: String,
answered_at: WireTime,
answered_at: DateTime<Utc>,
cancelled: bool,
target: Option<String>,
/// Verified file-path tokens that appear in `answer`.
@ -332,7 +332,7 @@ mod tests {
from: "a".into(),
to: "b".into(),
body: String::new(),
at: hive_sh4re::wire_time::WireTime(0),
at: hive_sh4re::wire_time::from_secs(0),
in_reply_to: None,
file_refs: Vec::new(),
},
@ -342,7 +342,7 @@ mod tests {
from: "a".into(),
to: "b".into(),
body: String::new(),
at: hive_sh4re::wire_time::WireTime(0),
at: hive_sh4re::wire_time::from_secs(0),
in_reply_to: None,
file_refs: Vec::new(),
},
@ -363,7 +363,7 @@ mod tests {
approval_kind: "apply_commit",
sha_short: None,
status: "approved",
resolved_at: hive_sh4re::wire_time::WireTime(0),
resolved_at: hive_sh4re::wire_time::from_secs(0),
note: None,
description: None,
},
@ -374,7 +374,7 @@ mod tests {
question: String::new(),
options: Vec::new(),
multi: false,
asked_at: hive_sh4re::wire_time::WireTime(0),
asked_at: hive_sh4re::wire_time::from_secs(0),
deadline_at: None,
target: None,
question_refs: Vec::new(),
@ -384,7 +384,7 @@ mod tests {
id: 1,
answer: String::new(),
answerer: "a".into(),
answered_at: hive_sh4re::wire_time::WireTime(0),
answered_at: hive_sh4re::wire_time::from_secs(0),
cancelled: false,
target: None,
answer_refs: Vec::new(),
@ -447,7 +447,7 @@ mod tests {
seq: 1,
entry: crate::audit_log::AuditEntry {
id: 1,
ts_unix: hive_sh4re::wire_time::WireTime(0),
ts_unix: hive_sh4re::wire_time::from_secs(0),
agent: "atlas".into(),
action: "restart_infra".into(),
target: "hive-ci".into(),
@ -476,7 +476,7 @@ mod tests {
seq: 7,
entry: crate::audit_log::AuditEntry {
id: 42,
ts_unix: hive_sh4re::wire_time::WireTime(1_700_000_000),
ts_unix: hive_sh4re::wire_time::from_secs(1_700_000_000),
agent: "atlas".into(),
action: "restart_infra".into(),
target: "hive-gateway".into(),