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:
Timmy
2026-05-12 20:55:25 +01:00
parent 6c62e0fa31
commit 69d91d7707
58 changed files with 433 additions and 1344 deletions
@@ -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.
+4 -4
View File
@@ -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();