core: type agent timestamps

This commit is contained in:
a.tolmachev
2026-04-19 07:11:55 +00:00
parent dddbbac745
commit 8d1f5284ba
9 changed files with 134 additions and 79 deletions
+11 -11
View File
@@ -414,7 +414,7 @@ async fn insert_agent_version_row(
.bind(serialize_enum_text(&version.status, "status")?)
.bind(Json(version.instructions.clone()))
.bind(Json(version.tool_selection_policy.clone()))
.bind(&version.created_at)
.bind(version.created_at)
.execute(&mut **tx)
.await?;
@@ -684,9 +684,9 @@ fn build_agent_summary(
status: String,
current_draft_version: i32,
latest_published_version: Option<i32>,
created_at: String,
updated_at: String,
published_at: Option<String>,
created_at: OffsetDateTime,
updated_at: OffsetDateTime,
published_at: Option<OffsetDateTime>,
) -> Result<AgentSummary, RegistryError> {
Ok(AgentSummary {
id: AgentId::new(id),
@@ -798,7 +798,7 @@ fn build_agent_version_record(
status: String,
instructions_json: Value,
tool_selection_policy_json: Value,
created_at: String,
created_at: OffsetDateTime,
bindings: Vec<AgentOperationBinding>,
) -> Result<AgentVersionRecord, RegistryError> {
let version = from_db_version(version, "version")?;
@@ -809,7 +809,7 @@ fn build_agent_version_record(
workspace_id: summary.workspace_id.clone(),
version,
status,
created_at: created_at.clone(),
created_at,
bindings,
snapshot: AgentVersion {
agent_id: summary.id.clone(),
@@ -1842,7 +1842,7 @@ mod tests {
workspace_id: &test_workspace_id(),
agent_id: &agent.id,
version: version.version,
published_at: "2026-03-25T12:11:00Z",
published_at: &timestamp("2026-03-25T12:11:00Z"),
published_by: Some("alice"),
})
.await
@@ -1922,7 +1922,7 @@ mod tests {
workspace_id: &test_workspace_id(),
agent_id: &agent.id,
version: version.version,
published_at: "2026-03-25T12:11:00Z",
published_at: &timestamp("2026-03-25T12:11:00Z"),
published_by: Some("alice"),
})
.await
@@ -2449,8 +2449,8 @@ mod tests {
status,
current_draft_version: 1,
latest_published_version: None,
created_at: "2026-03-25T11:58:00Z".to_owned(),
updated_at: "2026-03-25T12:00:00Z".to_owned(),
created_at: timestamp("2026-03-25T11:58:00Z"),
updated_at: timestamp("2026-03-25T12:00:00Z"),
published_at: None,
}
}
@@ -2468,7 +2468,7 @@ mod tests {
"mode": "allow_list",
"max_tools": 8
}),
created_at: "2026-03-25T12:00:00Z".to_owned(),
created_at: timestamp("2026-03-25T12:00:00Z"),
}
}