huskies: merge 730_story_use_numeric_only_story_ids_across_mcp_worktrees_git_branches_and_log_paths

This commit is contained in:
dave
2026-04-27 20:17:03 +00:00
parent 63d5a500de
commit 1388658ae8
10 changed files with 223 additions and 64 deletions
+38 -2
View File
@@ -22,10 +22,11 @@ pub fn create_story_file(
return Err("Name must contain at least one alphanumeric character.".to_string());
}
let story_id = format!("{story_number}_story_{slug}");
let story_id = format!("{story_number}");
let mut content = String::new();
content.push_str("---\n");
content.push_str("type: story\n");
content.push_str(&format!("name: \"{}\"\n", name.replace('"', "\\\"")));
if let Some(deps) = depends_on.filter(|d| !d.is_empty()) {
let nums: Vec<String> = deps.iter().map(|n| n.to_string()).collect();
@@ -167,7 +168,7 @@ mod tests {
fs::write(&filepath, &content).unwrap();
let written = fs::read_to_string(&filepath).unwrap();
assert!(written.starts_with("---\nname: \"My New Feature\"\n---"));
assert!(written.starts_with("---\n"));
assert!(written.contains(&format!("# Story {number}: My New Feature")));
assert!(written.contains("- [ ] It works"));
assert!(written.contains("- [ ] It is tested"));
@@ -230,5 +231,40 @@ mod tests {
assert_eq!(meta.depends_on, Some(vec![489]));
}
// ── Story 730: numeric-only story IDs ─────────────────────────────────────
#[test]
fn create_story_file_returns_numeric_only_id() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let result = create_story_file(tmp.path(), "My Feature", None, None, None, None, false);
assert!(
result.is_ok(),
"create_story_file should succeed: {result:?}"
);
let story_id = result.unwrap();
assert!(
story_id.chars().all(|c| c.is_ascii_digit()),
"story ID must be numeric-only, got: '{story_id}'"
);
}
#[test]
fn create_story_file_writes_type_field_in_front_matter() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let story_id =
create_story_file(tmp.path(), "Type Test Story", None, None, None, None, false)
.unwrap();
let content = crate::db::read_content(&story_id).expect("content must exist");
let meta = crate::io::story_metadata::parse_front_matter(&content)
.expect("front matter should be valid");
assert_eq!(
meta.item_type.as_deref(),
Some("story"),
"front matter must contain type: story"
);
}
// ── Story 504: native JSON types in front_matter ───────────────────────────
}