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
+3 -3
View File
@@ -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);