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:
@@ -181,6 +181,7 @@ mod tests {
|
||||
"2_current",
|
||||
"42_story_test.md",
|
||||
"---\nname: Test Story\nretry_count: 2\n---\n# Story\n",
|
||||
None,
|
||||
);
|
||||
let output = unblock_cmd_with_root(tmp.path(), "42").unwrap();
|
||||
assert!(
|
||||
@@ -200,6 +201,7 @@ mod tests {
|
||||
"2_blocked",
|
||||
"9903_story_stuck.md",
|
||||
"---\nname: Stuck Story\nblocked: true\nretry_count: 5\n---\n# Story\n",
|
||||
None,
|
||||
);
|
||||
// Seed the story in the CRDT in 2_blocked stage so the typed
|
||||
// Blocked → Coding transition fires and clears `blocked` properly.
|
||||
@@ -267,7 +269,7 @@ mod tests {
|
||||
story_id,
|
||||
stage,
|
||||
body,
|
||||
crate::db::ItemMeta::from_yaml(body),
|
||||
crate::db::ItemMeta::named("Stuck Story"),
|
||||
);
|
||||
// Seed CRDT registers: blocked=true, retry_count=5, with a name so the
|
||||
// response can echo it back instead of falling through to the raw id.
|
||||
@@ -312,14 +314,15 @@ mod tests {
|
||||
#[test]
|
||||
fn unblock_command_finds_story_in_any_stage() {
|
||||
let tmp = tempfile::TempDir::new().unwrap();
|
||||
// Use a high story number (9901) to avoid collisions with other tests in the
|
||||
// global content store.
|
||||
write_story_file(
|
||||
tmp.path(),
|
||||
"3_qa",
|
||||
"9901_story_in_qa.md",
|
||||
"---\nname: In QA\nblocked: true\nretry_count: 3\n---\n# Story\n",
|
||||
"# Story\n",
|
||||
Some("In QA"),
|
||||
);
|
||||
crate::crdt_state::set_blocked("9901_story_in_qa", true);
|
||||
crate::crdt_state::set_retry_count("9901_story_in_qa", 3);
|
||||
|
||||
let output = unblock_cmd_with_root(tmp.path(), "9901").unwrap();
|
||||
assert!(
|
||||
@@ -338,6 +341,7 @@ mod tests {
|
||||
"1_backlog",
|
||||
"9902_story_blocked_one.md",
|
||||
"---\nname: Blocked One\nblocked: true\nretry_count: 2\n---\n",
|
||||
None,
|
||||
);
|
||||
|
||||
let output = unblock_cmd_with_root(tmp.path(), "9902").unwrap();
|
||||
|
||||
Reference in New Issue
Block a user