wip(929): stage 3 — migrate http/mcp/* off yaml_legacy + introduce yaml_residue marker

Three MCP files touched:

- status_tools.rs (story-status JSON dump): every field with a CRDT
  equivalent now reads from WorkItem (name, agent, blocked, qa_mode,
  retry_count, depends_on, claimed_by, claimed_at) or MergeJob.error
  (merge_failure detail). One field — review_hold — has no CRDT register
  yet (sub-story 932) and is wrapped in `yaml_residue(parse_front_matter(...))`
  so the gap is visible at every code-search.

- qa_tools.rs:
  • tool_approve_qa wraps the legacy `clear_front_matter_field("review_hold")`
    write in `yaml_residue(...)` pending sub-story 932.
  • tool_reject_qa now reads the agent name from the CRDT WorkItem instead
    of parsing front matter on disk.

- story_tools/epic.rs: the entire epic feature (item_type, epic link)
  has no CRDT analog — sub-story 933. Every parse_front_matter call here
  is wrapped in `yaml_residue(...)`.

Also: new identity wrapper `db::yaml_legacy::yaml_residue<T>(v: T) -> T`
that marks a yaml_legacy callsite blocked on a CRDT-register gap. Pure
identity at runtime; the distinctive name makes the residue grep-findable
(`grep -rn yaml_residue`). Sub-stories 932 and 933 enumerate the gaps.

Filed:
- 932: Add CRDT register for review_hold
- 933: Add CRDT registers for the epic mechanism

All 2854 tests pass; fmt + clippy clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Timmy
2026-05-12 18:54:32 +01:00
co-authored by Claude Opus 4.7
parent 9eb5116f7e
commit b8945654bf
4 changed files with 61 additions and 47 deletions
+10 -14
View File
@@ -54,12 +54,16 @@ pub(super) async fn tool_approve_qa(args: &Value, ctx: &AppContext) -> Result<St
let project_root = ctx.services.agents.get_project_root(&ctx.state)?;
// Clear review_hold before moving
// Clear review_hold before moving.
// review_hold has no CRDT register yet — story 932. Marked with
// `yaml_residue` so the gap is grep-findable.
let qa_path = project_root
.join(".huskies/work/3_qa")
.join(format!("{story_id}.md"));
if qa_path.exists() {
let _ = crate::db::yaml_legacy::clear_front_matter_field(&qa_path, "review_hold");
let _ = crate::db::yaml_legacy::yaml_residue(
crate::db::yaml_legacy::clear_front_matter_field(&qa_path, "review_hold"),
);
}
if is_spike(story_id) {
@@ -136,18 +140,10 @@ pub(super) async fn tool_reject_qa(args: &Value, ctx: &AppContext) -> Result<Str
// Move story from work/3_qa/ back to work/2_current/ with rejection notes
reject_story_from_qa(story_id, notes)?;
// Restart the coder agent with rejection context
let story_path = project_root
.join(".huskies/work/2_current")
.join(format!("{story_id}.md"));
let agent_name = if story_path.exists() {
let contents = std::fs::read_to_string(&story_path).unwrap_or_default();
crate::db::yaml_legacy::parse_front_matter(&contents)
.ok()
.and_then(|meta| meta.agent)
} else {
None
};
// Restart the coder agent with rejection context.
// Agent name comes from the CRDT WorkItem register (story 929).
let agent_name =
crate::crdt_state::read_item(story_id).and_then(|w| w.agent().map(str::to_string));
let agent_name = agent_name.as_deref().unwrap_or("coder-opus");
let context = format!(