story-kit: merge 306_story_replace_manual_qa_boolean_with_configurable_qa_mode_field
This commit is contained in:
@@ -11,6 +11,10 @@ pub struct ProjectConfig {
|
||||
pub agent: Vec<AgentConfig>,
|
||||
#[serde(default)]
|
||||
pub watcher: WatcherConfig,
|
||||
/// Project-wide default QA mode: "server", "agent", or "human".
|
||||
/// Per-story `qa` front matter overrides this. Default: "server".
|
||||
#[serde(default = "default_qa")]
|
||||
pub default_qa: String,
|
||||
}
|
||||
|
||||
/// Configuration for the filesystem watcher's sweep behaviour.
|
||||
@@ -46,6 +50,10 @@ fn default_done_retention_secs() -> u64 {
|
||||
4 * 60 * 60 // 4 hours
|
||||
}
|
||||
|
||||
fn default_qa() -> String {
|
||||
"server".to_string()
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[allow(dead_code)]
|
||||
pub struct ComponentConfig {
|
||||
@@ -124,6 +132,8 @@ struct LegacyProjectConfig {
|
||||
agent: Option<AgentConfig>,
|
||||
#[serde(default)]
|
||||
watcher: WatcherConfig,
|
||||
#[serde(default = "default_qa")]
|
||||
default_qa: String,
|
||||
}
|
||||
|
||||
impl Default for ProjectConfig {
|
||||
@@ -145,6 +155,7 @@ impl Default for ProjectConfig {
|
||||
inactivity_timeout_secs: default_inactivity_timeout_secs(),
|
||||
}],
|
||||
watcher: WatcherConfig::default(),
|
||||
default_qa: default_qa(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,6 +197,7 @@ impl ProjectConfig {
|
||||
component: legacy.component,
|
||||
agent: vec![agent],
|
||||
watcher: legacy.watcher,
|
||||
default_qa: legacy.default_qa,
|
||||
};
|
||||
validate_agents(&config.agent)?;
|
||||
return Ok(config);
|
||||
@@ -206,6 +218,7 @@ impl ProjectConfig {
|
||||
component: legacy.component,
|
||||
agent: vec![agent],
|
||||
watcher: legacy.watcher,
|
||||
default_qa: legacy.default_qa,
|
||||
};
|
||||
validate_agents(&config.agent)?;
|
||||
Ok(config)
|
||||
@@ -214,12 +227,20 @@ impl ProjectConfig {
|
||||
component: legacy.component,
|
||||
agent: Vec::new(),
|
||||
watcher: legacy.watcher,
|
||||
default_qa: legacy.default_qa,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the project-wide default QA mode parsed from `default_qa`.
|
||||
/// Falls back to `Server` if the value is unrecognised.
|
||||
pub fn default_qa_mode(&self) -> crate::io::story_metadata::QaMode {
|
||||
crate::io::story_metadata::QaMode::from_str(&self.default_qa)
|
||||
.unwrap_or(crate::io::story_metadata::QaMode::Server)
|
||||
}
|
||||
|
||||
/// Look up an agent config by name.
|
||||
pub fn find_agent(&self, name: &str) -> Option<&AgentConfig> {
|
||||
self.agent.iter().find(|a| a.name == name)
|
||||
|
||||
Reference in New Issue
Block a user