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
@@ -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));