huskies: merge 864
This commit is contained in:
@@ -46,8 +46,18 @@ fn next_item_number_increments_from_existing_bugs() {
|
||||
fs::write(backlog.join("1_bug_crash.md"), "").unwrap();
|
||||
fs::write(backlog.join("3_bug_another.md"), "").unwrap();
|
||||
// Also write to content store so next_item_number sees them.
|
||||
crate::db::write_item_with_content("1_bug_crash", "1_backlog", "---\nname: Crash\n---\n");
|
||||
crate::db::write_item_with_content("3_bug_another", "1_backlog", "---\nname: Another\n---\n");
|
||||
crate::db::write_item_with_content(
|
||||
"1_bug_crash",
|
||||
"1_backlog",
|
||||
"---\nname: Crash\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Crash\n---\n"),
|
||||
);
|
||||
crate::db::write_item_with_content(
|
||||
"3_bug_another",
|
||||
"1_backlog",
|
||||
"---\nname: Another\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Another\n---\n"),
|
||||
);
|
||||
assert!(super::super::next_item_number(tmp.path()).unwrap() >= 4);
|
||||
}
|
||||
|
||||
@@ -61,7 +71,12 @@ fn next_item_number_scans_archived_too() {
|
||||
fs::create_dir_all(&archived).unwrap();
|
||||
fs::write(archived.join("5_bug_old.md"), "").unwrap();
|
||||
// Also write to content store so next_item_number sees it.
|
||||
crate::db::write_item_with_content("5_bug_old", "5_done", "---\nname: Old Bug\n---\n");
|
||||
crate::db::write_item_with_content(
|
||||
"5_bug_old",
|
||||
"5_done",
|
||||
"---\nname: Old Bug\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Old Bug\n---\n"),
|
||||
);
|
||||
assert!(super::super::next_item_number(tmp.path()).unwrap() >= 6);
|
||||
}
|
||||
|
||||
@@ -83,12 +98,14 @@ fn list_bug_files_excludes_archive_subdir() {
|
||||
"7001_bug_open",
|
||||
"1_backlog",
|
||||
"---\nname: Open Bug\n---\n# Bug 7001: Open Bug\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Open Bug\n---\n# Bug 7001: Open Bug\n"),
|
||||
);
|
||||
// Bug in done (should NOT appear — list_bug_files only returns Backlog).
|
||||
crate::db::write_item_with_content(
|
||||
"7002_bug_closed",
|
||||
"5_done",
|
||||
"---\nname: Closed Bug\n---\n# Bug 7002: Closed Bug\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Closed Bug\n---\n# Bug 7002: Closed Bug\n"),
|
||||
);
|
||||
|
||||
let result = list_bug_files(tmp.path()).unwrap();
|
||||
@@ -108,16 +125,19 @@ fn list_bug_files_sorted_by_id() {
|
||||
"7013_bug_third",
|
||||
"1_backlog",
|
||||
"---\nname: Third\n---\n# Bug 7013: Third\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Third\n---\n# Bug 7013: Third\n"),
|
||||
);
|
||||
crate::db::write_item_with_content(
|
||||
"7011_bug_first",
|
||||
"1_backlog",
|
||||
"---\nname: First\n---\n# Bug 7011: First\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: First\n---\n# Bug 7011: First\n"),
|
||||
);
|
||||
crate::db::write_item_with_content(
|
||||
"7012_bug_second",
|
||||
"1_backlog",
|
||||
"---\nname: Second\n---\n# Bug 7012: Second\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Second\n---\n# Bug 7012: Second\n"),
|
||||
);
|
||||
|
||||
let result = list_bug_files(tmp.path()).unwrap();
|
||||
@@ -349,6 +369,7 @@ fn create_spike_file_increments_from_existing_items() {
|
||||
"7050_story_existing",
|
||||
"1_backlog",
|
||||
"---\nname: Existing\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Existing\n---\n"),
|
||||
);
|
||||
|
||||
let spike_id = create_spike_file(tmp.path(), "My Spike", None, &[], None).unwrap();
|
||||
|
||||
@@ -325,7 +325,12 @@ mod tests {
|
||||
("4_merge", "9840_story_merge"),
|
||||
("5_done", "9850_story_done"),
|
||||
] {
|
||||
crate::db::write_item_with_content(id, stage, &format!("---\nname: {id}\n---\n"));
|
||||
crate::db::write_item_with_content(
|
||||
id,
|
||||
stage,
|
||||
&format!("---\nname: {id}\n---\n"),
|
||||
crate::db::ItemMeta::from_yaml(&format!("---\nname: {id}\n---\n")),
|
||||
);
|
||||
}
|
||||
|
||||
let ctx = crate::http::context::AppContext::new_test(root);
|
||||
@@ -369,6 +374,7 @@ mod tests {
|
||||
"9860_story_test",
|
||||
"2_current",
|
||||
"---\nname: Test Story\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Test Story\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
let ctx = crate::http::context::AppContext::new_test(root);
|
||||
@@ -404,6 +410,7 @@ mod tests {
|
||||
"9861_story_done",
|
||||
"2_current",
|
||||
"---\nname: Done Story\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Done Story\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
let ctx = crate::http::context::AppContext::new_test(root);
|
||||
@@ -436,6 +443,7 @@ mod tests {
|
||||
"9862_story_pending",
|
||||
"2_current",
|
||||
"---\nname: Pending Story\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Pending Story\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
let ctx = crate::http::context::AppContext::new_test(root);
|
||||
@@ -466,11 +474,15 @@ mod tests {
|
||||
"9863_story_dependent",
|
||||
"1_backlog",
|
||||
"---\nname: Dependent Story\ndepends_on: [10, 11]\n---\n",
|
||||
crate::db::ItemMeta::from_yaml(
|
||||
"---\nname: Dependent Story\ndepends_on: [10, 11]\n---\n",
|
||||
),
|
||||
);
|
||||
crate::db::write_item_with_content(
|
||||
"9864_story_independent",
|
||||
"1_backlog",
|
||||
"---\nname: Independent Story\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Independent Story\n---\n"),
|
||||
);
|
||||
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
@@ -499,11 +511,13 @@ mod tests {
|
||||
"9870_story_view_upcoming",
|
||||
"1_backlog",
|
||||
"---\nname: View Upcoming\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: View Upcoming\n---\n# Story\n"),
|
||||
);
|
||||
crate::db::write_item_with_content(
|
||||
"9871_story_worktree",
|
||||
"1_backlog",
|
||||
"---\nname: Worktree Orchestration\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Worktree Orchestration\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
@@ -530,6 +544,7 @@ mod tests {
|
||||
"9872_story_example",
|
||||
"1_backlog",
|
||||
"---\nname: A Story\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: A Story\n---\n"),
|
||||
);
|
||||
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
@@ -545,11 +560,13 @@ mod tests {
|
||||
"9873_story_todos",
|
||||
"2_current",
|
||||
"---\nname: Show TODOs\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Show TODOs\n---\n# Story\n"),
|
||||
);
|
||||
crate::db::write_item_with_content(
|
||||
"9874_story_front_matter",
|
||||
"1_backlog",
|
||||
"---\nname: Enforce Front Matter\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Enforce Front Matter\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
@@ -569,7 +586,12 @@ mod tests {
|
||||
#[test]
|
||||
fn validate_story_dirs_missing_front_matter() {
|
||||
crate::db::ensure_content_store();
|
||||
crate::db::write_item_with_content("9875_story_no_fm", "2_current", "# No front matter\n");
|
||||
crate::db::write_item_with_content(
|
||||
"9875_story_no_fm",
|
||||
"2_current",
|
||||
"# No front matter\n",
|
||||
crate::db::ItemMeta::from_yaml("# No front matter\n"),
|
||||
);
|
||||
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let results = validate_story_dirs(tmp.path()).unwrap();
|
||||
@@ -588,6 +610,7 @@ mod tests {
|
||||
"9876_story_no_name",
|
||||
"2_current",
|
||||
"---\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -143,6 +143,7 @@ mod tests {
|
||||
"36_story_existing",
|
||||
"1_backlog",
|
||||
"---\nname: Existing\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Existing\n---\n"),
|
||||
);
|
||||
|
||||
let number = super::super::super::next_item_number(tmp.path()).unwrap();
|
||||
|
||||
@@ -175,6 +175,7 @@ mod tests {
|
||||
"8001_story_test",
|
||||
"2_current",
|
||||
"---\nname: Test\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Test\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
let results = make_results();
|
||||
@@ -200,6 +201,9 @@ mod tests {
|
||||
"8002_story_check",
|
||||
"2_current",
|
||||
"---\nname: Check\n---\n# Story\n\n## Acceptance Criteria\n\n- [ ] AC1\n",
|
||||
crate::db::ItemMeta::from_yaml(
|
||||
"---\nname: Check\n---\n# Story\n\n## Acceptance Criteria\n\n- [ ] AC1\n",
|
||||
),
|
||||
);
|
||||
|
||||
let results = make_results();
|
||||
@@ -222,6 +226,9 @@ mod tests {
|
||||
"8003_story_overwrite",
|
||||
"2_current",
|
||||
"---\nname: Overwrite\n---\n# Story\n\n## Test Results\n\n<!-- huskies-test-results: {} -->\n\n### Unit Tests (0 passed, 0 failed)\n\n*No unit tests recorded.*\n",
|
||||
crate::db::ItemMeta::from_yaml(
|
||||
"---\nname: Overwrite\n---\n# Story\n\n## Test Results\n\n<!-- huskies-test-results: {} -->\n\n### Unit Tests (0 passed, 0 failed)\n\n*No unit tests recorded.*\n",
|
||||
),
|
||||
);
|
||||
|
||||
let results = make_results();
|
||||
@@ -241,6 +248,7 @@ mod tests {
|
||||
"8004_story_empty",
|
||||
"2_current",
|
||||
"---\nname: Empty\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Empty\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
let result = read_test_results_from_story_file(tmp.path(), "8004_story_empty");
|
||||
@@ -262,6 +270,7 @@ mod tests {
|
||||
"8005_story_qa",
|
||||
"3_qa",
|
||||
"---\nname: QA Story\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: QA Story\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
let results = StoryTestResults {
|
||||
@@ -286,6 +295,7 @@ mod tests {
|
||||
"8006_story_cov",
|
||||
"2_current",
|
||||
"---\nname: Cov Story\n---\n# Story\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Cov Story\n---\n# Story\n"),
|
||||
);
|
||||
|
||||
write_coverage_baseline_to_story_file(tmp.path(), "8006_story_cov", 75.4).unwrap();
|
||||
|
||||
@@ -17,7 +17,12 @@ pub(crate) fn write_story_content(
|
||||
stage: &str,
|
||||
content: &str,
|
||||
) {
|
||||
crate::db::write_item_with_content(story_id, stage, content);
|
||||
crate::db::write_item_with_content(
|
||||
story_id,
|
||||
stage,
|
||||
content,
|
||||
crate::db::ItemMeta::from_yaml(content),
|
||||
);
|
||||
}
|
||||
|
||||
/// Determine what stage a story is in (from CRDT).
|
||||
@@ -262,7 +267,12 @@ mod tests {
|
||||
#[test]
|
||||
fn next_item_number_increments_beyond_existing() {
|
||||
crate::db::ensure_content_store();
|
||||
crate::db::write_item_with_content("9877_story_foo", "1_backlog", "---\nname: Foo\n---\n");
|
||||
crate::db::write_item_with_content(
|
||||
"9877_story_foo",
|
||||
"1_backlog",
|
||||
"---\nname: Foo\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Foo\n---\n"),
|
||||
);
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
assert!(next_item_number(tmp.path()).unwrap() >= 9878);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user