storkit: merge 361_story_remove_deprecated_manual_qa_front_matter_field
This commit is contained in:
@@ -254,9 +254,10 @@ mod tests {
|
|||||||
fn run_project_tests_uses_script_test_when_present_and_passes() {
|
fn run_project_tests_uses_script_test_when_present_and_passes() {
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use tempfile::tempdir;
|
|
||||||
|
|
||||||
let tmp = tempdir().unwrap();
|
let tmp = tempfile::Builder::new()
|
||||||
|
.tempdir_in(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.unwrap();
|
||||||
let path = tmp.path();
|
let path = tmp.path();
|
||||||
let script_dir = path.join("script");
|
let script_dir = path.join("script");
|
||||||
fs::create_dir_all(&script_dir).unwrap();
|
fs::create_dir_all(&script_dir).unwrap();
|
||||||
@@ -276,9 +277,10 @@ mod tests {
|
|||||||
fn run_project_tests_reports_failure_when_script_test_exits_nonzero() {
|
fn run_project_tests_reports_failure_when_script_test_exits_nonzero() {
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use tempfile::tempdir;
|
|
||||||
|
|
||||||
let tmp = tempdir().unwrap();
|
let tmp = tempfile::Builder::new()
|
||||||
|
.tempdir_in(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.unwrap();
|
||||||
let path = tmp.path();
|
let path = tmp.path();
|
||||||
let script_dir = path.join("script");
|
let script_dir = path.join("script");
|
||||||
fs::create_dir_all(&script_dir).unwrap();
|
fs::create_dir_all(&script_dir).unwrap();
|
||||||
@@ -313,9 +315,10 @@ mod tests {
|
|||||||
fn coverage_gate_passes_when_script_exits_zero() {
|
fn coverage_gate_passes_when_script_exits_zero() {
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use tempfile::tempdir;
|
|
||||||
|
|
||||||
let tmp = tempdir().unwrap();
|
let tmp = tempfile::Builder::new()
|
||||||
|
.tempdir_in(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.unwrap();
|
||||||
let path = tmp.path();
|
let path = tmp.path();
|
||||||
let script_dir = path.join("script");
|
let script_dir = path.join("script");
|
||||||
fs::create_dir_all(&script_dir).unwrap();
|
fs::create_dir_all(&script_dir).unwrap();
|
||||||
@@ -342,9 +345,10 @@ mod tests {
|
|||||||
fn coverage_gate_fails_when_script_exits_nonzero() {
|
fn coverage_gate_fails_when_script_exits_nonzero() {
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use tempfile::tempdir;
|
|
||||||
|
|
||||||
let tmp = tempdir().unwrap();
|
let tmp = tempfile::Builder::new()
|
||||||
|
.tempdir_in(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.unwrap();
|
||||||
let path = tmp.path();
|
let path = tmp.path();
|
||||||
let script_dir = path.join("script");
|
let script_dir = path.join("script");
|
||||||
fs::create_dir_all(&script_dir).unwrap();
|
fs::create_dir_all(&script_dir).unwrap();
|
||||||
|
|||||||
@@ -1187,14 +1187,7 @@ mod tests {
|
|||||||
|
|
||||||
/// Returns true if a process with the given PID is currently running.
|
/// Returns true if a process with the given PID is currently running.
|
||||||
fn process_is_running(pid: u32) -> bool {
|
fn process_is_running(pid: u32) -> bool {
|
||||||
std::process::Command::new("ps")
|
std::path::Path::new(&format!("/proc/{pid}")).exists()
|
||||||
.arg("-p")
|
|
||||||
.arg(pid.to_string())
|
|
||||||
.stdout(std::process::Stdio::null())
|
|
||||||
.stderr(std::process::Stdio::null())
|
|
||||||
.status()
|
|
||||||
.map(|s| s.success())
|
|
||||||
.unwrap_or(false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -77,10 +77,8 @@ struct FrontMatter {
|
|||||||
merge_failure: Option<String>,
|
merge_failure: Option<String>,
|
||||||
agent: Option<String>,
|
agent: Option<String>,
|
||||||
review_hold: Option<bool>,
|
review_hold: Option<bool>,
|
||||||
/// New configurable QA mode field: "human", "server", or "agent".
|
/// Configurable QA mode field: "human", "server", or "agent".
|
||||||
qa: Option<String>,
|
qa: Option<String>,
|
||||||
/// Legacy boolean field — mapped to `qa: human` (true) or ignored (false/absent).
|
|
||||||
manual_qa: Option<bool>,
|
|
||||||
/// Number of times this story has been retried at its current pipeline stage.
|
/// Number of times this story has been retried at its current pipeline stage.
|
||||||
retry_count: Option<u32>,
|
retry_count: Option<u32>,
|
||||||
/// When `true`, auto-assign will skip this story (retry limit exceeded).
|
/// When `true`, auto-assign will skip this story (retry limit exceeded).
|
||||||
@@ -113,12 +111,7 @@ pub fn parse_front_matter(contents: &str) -> Result<StoryMetadata, StoryMetaErro
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_metadata(front: FrontMatter) -> StoryMetadata {
|
fn build_metadata(front: FrontMatter) -> StoryMetadata {
|
||||||
// Resolve qa mode: prefer the new `qa` field, fall back to legacy `manual_qa`.
|
let qa = front.qa.as_deref().and_then(QaMode::from_str);
|
||||||
let qa = if let Some(ref qa_str) = front.qa {
|
|
||||||
QaMode::from_str(qa_str)
|
|
||||||
} else {
|
|
||||||
front.manual_qa.and_then(|v| if v { Some(QaMode::Human) } else { None })
|
|
||||||
};
|
|
||||||
|
|
||||||
StoryMetadata {
|
StoryMetadata {
|
||||||
name: front.name,
|
name: front.name,
|
||||||
@@ -513,27 +506,6 @@ workflow: tdd
|
|||||||
assert_eq!(meta.qa, None);
|
assert_eq!(meta.qa, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn legacy_manual_qa_true_maps_to_human() {
|
|
||||||
let input = "---\nname: Story\nmanual_qa: true\n---\n# Story\n";
|
|
||||||
let meta = parse_front_matter(input).expect("front matter");
|
|
||||||
assert_eq!(meta.qa, Some(QaMode::Human));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn legacy_manual_qa_false_maps_to_none() {
|
|
||||||
let input = "---\nname: Story\nmanual_qa: false\n---\n# Story\n";
|
|
||||||
let meta = parse_front_matter(input).expect("front matter");
|
|
||||||
assert_eq!(meta.qa, None);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn qa_field_takes_precedence_over_manual_qa() {
|
|
||||||
let input = "---\nname: Story\nqa: server\nmanual_qa: true\n---\n# Story\n";
|
|
||||||
let meta = parse_front_matter(input).expect("front matter");
|
|
||||||
assert_eq!(meta.qa, Some(QaMode::Server));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn resolve_qa_mode_uses_file_value() {
|
fn resolve_qa_mode_uses_file_value() {
|
||||||
let tmp = tempfile::tempdir().unwrap();
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user