feat(933): add item_type + epic CRDT registers + migrate epic mechanism
Replaces the YAML-only `type: epic` / `epic: <id>` front-matter fields with typed CRDT registers on PipelineItemCrdt. The epic-mechanism MCP tools (`tool_list_epics`, `tool_show_epic`), the epic-context injection in agent spawn, and the type-classifier helpers (`item_type_from_id`, `is_bug_item`, `is_refactor_item`) now all read from the CRDT. Schema: - PipelineItemCrdt: `item_type: LwwRegisterCrdt<String>` and `epic: LwwRegisterCrdt<String>` registers. - WorkItem: typed `item_type()` and `epic()` accessors returning `Option<&str>`. - crdt_state::set_item_type(story_id, Option<&str>) and crdt_state::set_epic(story_id, Option<&str>) typed setters. Write paths populate the new registers: - create_story_file / create_bug_file / create_spike_file / create_refactor_file / create_epic_file — each calls set_item_type after write_story_content. - tool_update_story intercepts `epic` and `type` fields and routes them to the typed setters (same pattern as qa / depends_on). Read paths migrated off yaml_legacy: - http/mcp/story_tools/epic.rs: tool_list_epics + tool_show_epic. - agents/lifecycle.rs::item_type_from_id (numeric-only IDs). - agents/pool/start/spawn.rs epic-context injection. - http/workflow/bug_ops/bug.rs::is_bug_item, refactor.rs::is_refactor_item. - http/workflow/pipeline.rs::load_pipeline_state — review_hold/qa/epic_id all come from the CRDT now; only merge_failure is still YAML (sweep in 929 stage 10). All `yaml_residue(...)` wraps for item_type / epic are removed; the remaining residue marker doc no longer references 933. cargo fmt --check, clippy --all-targets -- -D warnings, and the 2857-test suite all pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -227,17 +227,9 @@ pub(super) async fn run_agent_spawn(
|
||||
}
|
||||
|
||||
// Prepend epic context when the story belongs to an epic (AC3, story 880).
|
||||
// Read the story's front matter to find the epic ID, then load the epic's
|
||||
// content and prepend it to the system prompt so the agent treats it as
|
||||
// authoritative context.
|
||||
//
|
||||
// Epic linkage has no CRDT register yet (story 933) — wrap the parse in
|
||||
// `yaml_residue` so the gap is grep-findable.
|
||||
if let Some(story_content) = crate::db::read_content(&sid)
|
||||
&& let Ok(meta) = crate::db::yaml_legacy::yaml_residue(
|
||||
crate::db::yaml_legacy::parse_front_matter(&story_content),
|
||||
)
|
||||
&& let Some(ref epic_id) = meta.epic
|
||||
// Story 933: epic linkage is now a typed CRDT register on PipelineItemCrdt.
|
||||
if let Some(view) = crate::crdt_state::read_item(&sid)
|
||||
&& let Some(epic_id) = view.epic()
|
||||
&& let Some(epic_content) = crate::db::read_content(epic_id)
|
||||
{
|
||||
let block = format!(
|
||||
|
||||
Reference in New Issue
Block a user