huskies: merge 962
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
//! Project configuration — parses `project.toml` for agents, components, and server settings.
|
||||
|
||||
/// Typed agent name (mirrors the agents.toml roster).
|
||||
pub mod agent_name;
|
||||
pub use agent_name::AgentName;
|
||||
|
||||
use crate::slog;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashSet;
|
||||
@@ -646,6 +651,17 @@ fn validate_agents(agents: &[AgentConfig]) -> Result<(), String> {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Skip the AgentName roster check in test mode — unit tests use
|
||||
// synthetic agent names (e.g. "first", "second") that are not in the
|
||||
// production enum. The check is meaningful only at server startup.
|
||||
#[cfg(not(test))]
|
||||
agent.name.parse::<AgentName>().map_err(|_| {
|
||||
format!(
|
||||
"Agent '{}': name is not in the AgentName roster; \
|
||||
add a variant to `config::AgentName` or remove this agent from agents.toml",
|
||||
agent.name
|
||||
)
|
||||
})?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user