refactor(#2302): type socket wire fields as ident, validated by serde on deserialize

This commit is contained in:
damocles 2026-07-20 21:21:03 +02:00 committed by mara
commit 84b750fba5
33 changed files with 333 additions and 263 deletions

View file

@ -66,7 +66,7 @@ pub(super) fn gc_orphans(coord: &Coordinator, approvals: Vec<Approval>) -> Vec<A
) {
return true;
}
let Ok(agent) = hive_host_sock::Ident::parse(&a.agent) else {
let Ok(agent) = hive_types::Ident::parse(&a.agent) else {
let _ = coord.approvals.mark_failed(a.id, "invalid agent name");
tracing::warn!(id = a.id, agent = %a.agent, "auto-failed approval with invalid agent name");
return false;

View file

@ -23,7 +23,7 @@ mod extra_forges;
// owning agent-path facts) so every dashboard path-param validates through the
// same type used to build agent paths. Re-exported so submodules + the socket
// server reach it as `crate::dashboard::Ident`.
pub(crate) use hive_host_sock::Ident;
pub(crate) use hive_types::Ident;
mod infra_containers;
mod journal;
mod lifecycle_ops;

View file

@ -344,7 +344,7 @@ pub(super) async fn get_stale_permissions(
let kept: std::collections::HashSet<String> =
crate::coordinator::Coordinator::kept_state_names()
.into_iter()
.map(hive_host_sock::Ident::into_string)
.map(hive_types::Ident::into_string)
.collect();
// Known = live roster kept-state names.
let known: std::collections::HashSet<&String> = live.iter().chain(kept.iter()).collect();