feat(929): delete db/yaml_legacy.rs entirely — CRDT is the sole source of truth
Final 929 sweep: every YAML-shaped helper is gone. No production code
parses or writes YAML front matter anywhere.
Surface removed:
- db/yaml_legacy.rs (FrontMatter/StoryMetadata structs, parse_front_matter,
set_front_matter_field, yaml_residue marker) — file deleted.
- ItemMeta::from_yaml — deleted; callers pass typed ItemMeta::named(...) or
ItemMeta::default() and use typed CRDT setters (set_depends_on,
set_blocked, set_retry_count, set_agent, set_qa_mode, set_review_hold,
set_item_type, set_epic, set_mergemaster_attempted) for the rest.
- write_coverage_baseline_to_story_file + read_coverage_percent_from_json —
the coverage_baseline YAML field was write-only (nothing read it back);
removed along with its caller in agent_tools/lifecycle.rs.
- update_story_in_file's generic `front_matter` HashMap parameter —
tool_update_story now intercepts every known field name and routes it
to a typed CRDT setter; unknown keys are rejected with an explicit error
pointing at the typed setters. The function only takes user_story /
description sections now.
- All 117 ItemMeta::from_yaml callsites migrated. Where tests previously
passed a YAML-shaped content blob and relied on the helper to extract
name/depends_on/blocked/agent/qa, they now pass:
write_item_with_content(id, stage, content, ItemMeta::named("Foo"))
crate::crdt_state::set_depends_on(id, &[...]) // when needed
crate::crdt_state::set_blocked(id, true) // when needed
crate::crdt_state::set_agent(id, Some("...")) // when needed
- write_story_content + write_story_file (test helper) now take an
explicit `name: Option<&str>` instead of parsing it from content.
- db::ops::move_item_stage stopped re-parsing YAML on every stage
transition; metadata is read straight from the CRDT view when mirroring
the row into SQLite.
New CRDT setters added for symmetry:
- crdt_state::set_name (mirrors set_agent — explicit name updates).
cargo fmt --check, clippy --all-targets -- -D warnings, and the
2830-test suite all pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -293,9 +293,10 @@ mod tests {
|
||||
crate::db::write_item_with_content(
|
||||
"9932_story_waiting",
|
||||
"2_current",
|
||||
"---\nname: Waiting\ndepends_on: [9999]\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Waiting\ndepends_on: [9999]\n---\n"),
|
||||
"# Waiting\n",
|
||||
crate::db::ItemMeta::named("Waiting"),
|
||||
);
|
||||
crate::crdt_state::set_depends_on("9932_story_waiting", &[9999]);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
pool.auto_assign_available_work(root).await;
|
||||
@@ -332,15 +333,16 @@ mod tests {
|
||||
"999_story_dep",
|
||||
"5_done",
|
||||
"---\nname: Dep\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Dep\n---\n"),
|
||||
crate::db::ItemMeta::named("Dep"),
|
||||
);
|
||||
// Story 10 depends on 999 which is done.
|
||||
crate::db::write_item_with_content(
|
||||
"10_story_unblocked",
|
||||
"2_current",
|
||||
"---\nname: Unblocked\ndepends_on: [999]\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Unblocked\ndepends_on: [999]\n---\n"),
|
||||
"# Unblocked\n",
|
||||
crate::db::ItemMeta::named("Unblocked"),
|
||||
);
|
||||
crate::crdt_state::set_depends_on("10_story_unblocked", &[999]);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
pool.auto_assign_available_work(root).await;
|
||||
@@ -523,10 +525,8 @@ mod tests {
|
||||
crate::db::write_item_with_content(
|
||||
"9860_story_conflict",
|
||||
"4_merge_failure",
|
||||
"---\nname: Conflict\nmerge_failure: \"CONFLICT (content): server/src/lib.rs\"\n---\n",
|
||||
crate::db::ItemMeta::from_yaml(
|
||||
"---\nname: Conflict\nmerge_failure: \"CONFLICT (content): server/src/lib.rs\"\n---\n",
|
||||
),
|
||||
"CONFLICT (content): server/src/lib.rs",
|
||||
crate::db::ItemMeta::named("Conflict"),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
@@ -561,10 +561,8 @@ mod tests {
|
||||
crate::db::write_item_with_content(
|
||||
"9861_story_nothing",
|
||||
"4_merge_failure",
|
||||
"---\nname: Nothing\nmerge_failure: \"nothing to commit, working tree clean\"\n---\n",
|
||||
crate::db::ItemMeta::from_yaml(
|
||||
"---\nname: Nothing\nmerge_failure: \"nothing to commit, working tree clean\"\n---\n",
|
||||
),
|
||||
"nothing to commit, working tree clean",
|
||||
crate::db::ItemMeta::named("Nothing"),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
@@ -599,10 +597,12 @@ mod tests {
|
||||
crate::db::write_item_with_content(
|
||||
"9863_story_blocked_conflict",
|
||||
"4_merge",
|
||||
"---\nname: Blocked conflict\nmerge_failure: \"CONFLICT (content): foo.rs\"\nblocked: true\n---\n",
|
||||
crate::db::ItemMeta::from_yaml(
|
||||
"---\nname: Blocked conflict\nmerge_failure: \"CONFLICT (content): foo.rs\"\nblocked: true\n---\n",
|
||||
),
|
||||
"CONFLICT (content): foo.rs",
|
||||
crate::db::ItemMeta {
|
||||
name: Some("Blocked conflict".to_string()),
|
||||
blocked: Some(true),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
@@ -636,11 +636,10 @@ mod tests {
|
||||
crate::db::write_item_with_content(
|
||||
"9862_story_attempted",
|
||||
"4_merge",
|
||||
"---\nname: Already tried\nmerge_failure: \"CONFLICT (content): foo.rs\"\nmergemaster_attempted: true\n---\n",
|
||||
crate::db::ItemMeta::from_yaml(
|
||||
"---\nname: Already tried\nmerge_failure: \"CONFLICT (content): foo.rs\"\nmergemaster_attempted: true\n---\n",
|
||||
),
|
||||
"CONFLICT (content): foo.rs",
|
||||
crate::db::ItemMeta::named("Already tried"),
|
||||
);
|
||||
crate::crdt_state::set_mergemaster_attempted("9862_story_attempted", true);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
pool.auto_assign_available_work(tmp.path()).await;
|
||||
@@ -677,10 +676,8 @@ mod tests {
|
||||
crate::db::write_item_with_content(
|
||||
"920_story_transient",
|
||||
"4_merge_failure",
|
||||
"---\nname: Transient\nmerge_failure: \"CONFLICT (content): foo.rs\"\n---\n",
|
||||
crate::db::ItemMeta::from_yaml(
|
||||
"---\nname: Transient\nmerge_failure: \"CONFLICT (content): foo.rs\"\n---\n",
|
||||
),
|
||||
"CONFLICT (content): foo.rs",
|
||||
crate::db::ItemMeta::named("Transient"),
|
||||
);
|
||||
// Simulate two previous transient exits (below cap of 3) recorded in DB.
|
||||
crate::db::write_content("920_story_transient:mergemaster_spawn_count", "2");
|
||||
@@ -719,10 +716,8 @@ mod tests {
|
||||
crate::db::write_item_with_content(
|
||||
"920_story_genuine",
|
||||
"4_merge_failure",
|
||||
"---\nname: Genuine\nmerge_failure: \"CONFLICT (content): bar.rs\"\n---\n",
|
||||
crate::db::ItemMeta::from_yaml(
|
||||
"---\nname: Genuine\nmerge_failure: \"CONFLICT (content): bar.rs\"\n---\n",
|
||||
),
|
||||
"CONFLICT (content): bar.rs",
|
||||
crate::db::ItemMeta::named("Genuine"),
|
||||
);
|
||||
// The CRDT register is the sole authority; set it explicitly as the
|
||||
// spawn exit path would after report_merge_failure.
|
||||
|
||||
@@ -168,7 +168,7 @@ mod tests {
|
||||
"9970_story_archived",
|
||||
"6_archived",
|
||||
"---\nname: Archived\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Archived\n---\n"),
|
||||
crate::db::ItemMeta::named("Archived"),
|
||||
);
|
||||
|
||||
// Also place a stale .md file in a temp 1_backlog/ dir.
|
||||
@@ -205,19 +205,19 @@ mod tests {
|
||||
"9942_story_foo",
|
||||
"2_current",
|
||||
"---\nname: foo\n---",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: foo\n---"),
|
||||
crate::db::ItemMeta::named("foo"),
|
||||
);
|
||||
crate::db::write_item_with_content(
|
||||
"9940_story_bar",
|
||||
"2_current",
|
||||
"---\nname: bar\n---",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: bar\n---"),
|
||||
crate::db::ItemMeta::named("bar"),
|
||||
);
|
||||
crate::db::write_item_with_content(
|
||||
"9935_story_baz",
|
||||
"2_current",
|
||||
"---\nname: baz\n---",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: baz\n---"),
|
||||
crate::db::ItemMeta::named("baz"),
|
||||
);
|
||||
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -176,7 +176,7 @@ async fn pipeline_advance_sends_agent_state_changed_to_watcher_tx() {
|
||||
"173_story_test",
|
||||
"2_current",
|
||||
"---\nname: test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: test\n---\n"),
|
||||
crate::db::ItemMeta::named("test"),
|
||||
);
|
||||
|
||||
// Write a project.toml with a qa agent so start_agent can resolve it.
|
||||
|
||||
@@ -51,7 +51,7 @@ async fn mergemaster_blocks_and_sends_story_blocked_when_no_commits_ahead() {
|
||||
"9919_story_no_commits",
|
||||
"2_current",
|
||||
"---\nname: Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Test"),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
@@ -146,13 +146,13 @@ stage = "qa"
|
||||
"292_story_first",
|
||||
"3_qa",
|
||||
"---\nname: First\nqa: human\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: First\nqa: human\n---\n"),
|
||||
crate::db::ItemMeta::named("First"),
|
||||
);
|
||||
crate::db::write_item_with_content(
|
||||
"293_story_second",
|
||||
"3_qa",
|
||||
"---\nname: Second\nqa: human\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Second\nqa: human\n---\n"),
|
||||
crate::db::ItemMeta::named("Second"),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
@@ -252,7 +252,7 @@ async fn stale_mergemaster_advance_for_done_story_is_noop() {
|
||||
story_id,
|
||||
"5_done",
|
||||
content,
|
||||
crate::db::ItemMeta::from_yaml(content),
|
||||
crate::db::ItemMeta::named("Zombie Merge Test"),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
@@ -389,7 +389,7 @@ async fn work_survived_advances_to_qa_instead_of_blocking() {
|
||||
"9945_story_survived",
|
||||
"2_current",
|
||||
"---\nname: Survived Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Survived Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Survived Test"),
|
||||
);
|
||||
|
||||
// Simulate a passing run_tests call during the agent's session (bug 668):
|
||||
@@ -483,7 +483,7 @@ async fn no_committed_work_still_retries_and_blocks() {
|
||||
"9946_story_nowork",
|
||||
"2_current",
|
||||
"---\nname: No Work Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: No Work Test\n---\n"),
|
||||
crate::db::ItemMeta::named("No Work Test"),
|
||||
);
|
||||
|
||||
// Write a project.toml with max_retries = 1.
|
||||
@@ -611,7 +611,7 @@ async fn gates_failed_no_test_evidence_does_not_advance() {
|
||||
"9947_story_no_evidence",
|
||||
"2_current",
|
||||
"---\nname: No Evidence Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: No Evidence Test\n---\n"),
|
||||
crate::db::ItemMeta::named("No Evidence Test"),
|
||||
);
|
||||
|
||||
// Explicitly ensure no test evidence exists for this story.
|
||||
@@ -741,7 +741,7 @@ async fn gates_failed_with_test_evidence_and_committed_work_advances() {
|
||||
"9948_story_with_evidence",
|
||||
"2_current",
|
||||
"---\nname: With Evidence Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: With Evidence Test\n---\n"),
|
||||
crate::db::ItemMeta::named("With Evidence Test"),
|
||||
);
|
||||
|
||||
// Write the run_tests evidence — simulates the agent having called run_tests
|
||||
@@ -825,7 +825,7 @@ stage = "coder"
|
||||
"9950_story_warm_resume",
|
||||
"2_current",
|
||||
"---\nname: Warm Resume Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Warm Resume Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Warm Resume Test"),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
|
||||
@@ -553,7 +553,7 @@ async fn zero_commit_coder_exit_stays_in_coding_not_promoted_to_merge() {
|
||||
"9910_zero_exit",
|
||||
"2_current",
|
||||
"---\nname: Zero Exit Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Zero Exit Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Zero Exit Test"),
|
||||
);
|
||||
|
||||
fs::create_dir_all(project_root.join(".huskies")).unwrap();
|
||||
|
||||
@@ -651,7 +651,7 @@ async fn server_side_merge_happy_path_advances_to_done() {
|
||||
"757a_happy",
|
||||
"4_merge",
|
||||
"---\nname: Happy path test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Happy path test\n---\n"),
|
||||
crate::db::ItemMeta::named("Happy path test"),
|
||||
);
|
||||
|
||||
let pool = Arc::new(AgentPool::new_test(3001));
|
||||
@@ -788,7 +788,7 @@ async fn server_side_merge_conflict_sets_merge_failure() {
|
||||
"757b_conflict",
|
||||
"4_merge",
|
||||
"---\nname: Conflict test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Conflict test\n---\n"),
|
||||
crate::db::ItemMeta::named("Conflict test"),
|
||||
);
|
||||
|
||||
let pool = Arc::new(AgentPool::new_test(3001));
|
||||
@@ -901,7 +901,7 @@ async fn server_side_merge_gate_failure_sets_merge_failure() {
|
||||
"757c_gates",
|
||||
"4_merge",
|
||||
"---\nname: Gate failure test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Gate failure test\n---\n"),
|
||||
crate::db::ItemMeta::named("Gate failure test"),
|
||||
);
|
||||
|
||||
let pool = Arc::new(AgentPool::new_test(3001));
|
||||
|
||||
@@ -641,7 +641,7 @@ mod tests {
|
||||
story_id,
|
||||
"2_current",
|
||||
"---\nname: Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Test"),
|
||||
);
|
||||
crate::crdt_state::set_retry_count(story_id, 1);
|
||||
|
||||
@@ -679,7 +679,7 @@ mod tests {
|
||||
story_id,
|
||||
"2_current",
|
||||
"---\nname: Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Test"),
|
||||
);
|
||||
// retry_count is 0 (default — never bumped).
|
||||
|
||||
@@ -744,7 +744,7 @@ mod tests {
|
||||
story_id,
|
||||
"2_current",
|
||||
"---\nname: Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Test"),
|
||||
);
|
||||
|
||||
let db_key = format!("{story_id}:abort_respawn_count");
|
||||
|
||||
@@ -433,7 +433,7 @@ async fn start_agent_rejects_mergemaster_on_coding_stage_story() {
|
||||
"310_story_foo",
|
||||
"2_current",
|
||||
"---\nname: Foo\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Foo\n---\n"),
|
||||
crate::db::ItemMeta::named("Foo"),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3099);
|
||||
@@ -472,7 +472,7 @@ async fn start_agent_rejects_coder_on_qa_stage_story() {
|
||||
"8842_story_qa_guard",
|
||||
"3_qa",
|
||||
"---\nname: QA Guard\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: QA Guard\n---\n"),
|
||||
crate::db::ItemMeta::named("QA Guard"),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3099);
|
||||
@@ -511,7 +511,7 @@ async fn start_agent_rejects_qa_on_merge_stage_story() {
|
||||
"55_story_baz",
|
||||
"4_merge",
|
||||
"---\nname: Baz\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Baz\n---\n"),
|
||||
crate::db::ItemMeta::named("Baz"),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3099);
|
||||
|
||||
@@ -147,7 +147,7 @@ mod tests {
|
||||
"60_story_cleanup",
|
||||
"2_current",
|
||||
story_content,
|
||||
crate::db::ItemMeta::from_yaml(story_content),
|
||||
crate::db::ItemMeta::default(),
|
||||
);
|
||||
|
||||
let pool = AgentPool::new_test(3001);
|
||||
|
||||
@@ -46,7 +46,7 @@ mod tests {
|
||||
"10_story_test",
|
||||
"2_current",
|
||||
"---\nname: Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Test"),
|
||||
);
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
assert!(matches!(
|
||||
@@ -62,7 +62,7 @@ mod tests {
|
||||
"11_story_test",
|
||||
"3_qa",
|
||||
"---\nname: Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Test"),
|
||||
);
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
assert!(matches!(
|
||||
@@ -78,7 +78,7 @@ mod tests {
|
||||
"12_story_test",
|
||||
"4_merge",
|
||||
"---\nname: Test\n---\n",
|
||||
crate::db::ItemMeta::from_yaml("---\nname: Test\n---\n"),
|
||||
crate::db::ItemMeta::named("Test"),
|
||||
);
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
assert!(matches!(
|
||||
|
||||
Reference in New Issue
Block a user