wip(929): stage 1 — migrate chat/commands/* off yaml_legacy

Each chat command that previously read parse_front_matter for story
metadata (name, agent, depends_on, blocked, retry_count, merge_failure,
qa_mode) now reads from the typed CRDT API:

- WorkItem (via crdt_state::read_item) for pipeline-item registers.
- MergeJobView (via crdt_state::read_merge_job) for the merge failure
  detail text, which has its own LWW-map CRDT entry.

Files migrated: depends.rs, freeze.rs, move_story.rs, overview.rs,
status/render.rs, triage.rs, unblock.rs, unreleased.rs.

unblock.rs: also removes the legacy front-matter cleanup branch that
fired when the typed Blocked→Coding transition failed. Post-929 there
is no YAML on disk to clean; the fallback now just resets retry_count
in the CRDT.

triage.rs: drops the YAML-only `review_hold` and `coverage_baseline`
fields from the dump. These have no CRDT register and were never
load-bearing on the triage output; if needed later, add a CRDT register
and surface it back.

Tests:
- The three status/render merge-failure rendering tests now seed a
  MergeJob CRDT entry via write_merge_job instead of writing YAML.
- The unblock test that asserted YAML cleanup on disk is now an assertion
  on the CRDT registers (blocked=false, retry_count=0). Also re-seeded
  in `2_blocked` stage so the typed Blocked → Coding transition actually
  fires (not the fallback path).

All 2855 tests pass; fmt clean; clippy clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Timmy
2026-05-12 18:41:43 +01:00
parent b940b95ec3
commit a49a1cf7cb
9 changed files with 88 additions and 180 deletions
+21 -29
View File
@@ -522,14 +522,15 @@ fn merge_item_with_active_agent_shows_robot() {
fn merge_item_with_failure_shows_stop_sign_and_snippet() {
use tempfile::TempDir;
let tmp = TempDir::new().unwrap();
crate::crdt_state::init_for_test();
crate::db::ensure_content_store();
crate::db::write_item_with_content(
// Post-929: merge_failure detail lives on the MergeJob CRDT entry, not in YAML.
crate::crdt_state::write_merge_job(
"903_story_merge_fail",
"4_merge",
"---\nname: Failed Story\nmerge_failure: \"conflicts in src/lib.rs\"\n---\n",
crate::db::ItemMeta::from_yaml(
"---\nname: Failed Story\nmerge_failure: \"conflicts in src/lib.rs\"\n---\n",
),
"failed",
0.0,
None,
Some("conflicts in src/lib.rs"),
);
let items = vec![make_item(
"903_story_merge_fail",
@@ -552,14 +553,16 @@ fn merge_item_with_failure_shows_stop_sign_and_snippet() {
fn merge_item_failure_snippet_truncated_at_120_chars() {
use tempfile::TempDir;
let tmp = TempDir::new().unwrap();
crate::crdt_state::init_for_test();
crate::db::ensure_content_store();
let long_reason = "x".repeat(200);
let content = format!("---\nname: Long Fail\nmerge_failure: \"{long_reason}\"\n---\n");
crate::db::write_item_with_content(
// Post-929: merge_failure detail lives on the MergeJob CRDT entry, not in YAML.
crate::crdt_state::write_merge_job(
"904_story_long_fail",
"4_merge",
&content,
crate::db::ItemMeta::from_yaml(&content),
"failed",
0.0,
None,
Some(&long_reason),
);
let items = vec![make_item("904_story_long_fail", "Long Fail", merge_stage())];
let agents = AgentPool::new_test(3000);
@@ -585,27 +588,16 @@ fn merge_item_failure_snippet_truncated_at_120_chars() {
fn merge_item_failure_snippet_is_first_non_empty_line() {
use tempfile::TempDir;
let tmp = TempDir::new().unwrap();
crate::crdt_state::init_for_test();
crate::db::ensure_content_store();
// Multi-line failure reason — first non-empty line should be used.
let reason = "\nfirst line of error\nsecond line";
let content = format!(
"---\nname: Multi Line\nmerge_failure: \"{}\" \n---\n",
reason.replace('\n', "\\n")
);
crate::db::write_item_with_content(
// Post-929: merge_failure detail lives on the MergeJob CRDT entry.
crate::crdt_state::write_merge_job(
"905_story_multiline",
"4_merge",
&content,
crate::db::ItemMeta::from_yaml(&content),
);
// Write with literal \n as the content (simulating stored text with newlines).
let content2 =
"---\nname: Multi Line\nmerge_failure: |\n \n first line of error\n second line\n---\n";
crate::db::write_item_with_content(
"905_story_multiline",
"4_merge",
content2,
crate::db::ItemMeta::from_yaml(content2),
"failed",
0.0,
None,
Some("\nfirst line of error\nsecond line"),
);
let items = vec![make_item(
"905_story_multiline",