feat(plans): milestone-as-plan-container; retire kind=plan (T3)
The milestone becomes the plan container: a new nullable milestones.body holds the design/intent (Goal/Approach/Verification) and individual steps live as first-class child tasks (milestone_id) instead of checkboxes crammed into one kind=plan task body. start_planning now creates a MILESTONE seeded with the body template (not a kind=plan task) and returns it with applicable rules; a new get_milestone MCP tool reads the plan back (body + steps + rules). kind=plan is hard-retired going forward — start_planning never creates one. The 'plan' task_kind enum value stays valid so the 11 historical plan-tasks remain readable in place; no body-shredding backfill (corpus review showed auto-splitting their checklists into tasks would be lossy: embedded code blocks, a non-binary [~] state, tables, ID-encoded hierarchy). - migration 0066: add milestones.body - model/service/route/MCP: body passthrough on create+update; get_milestone - server _INSTRUCTIONS: "plan" = milestone w/ body + child step-tasks - UI: ProjectView shows/edits a milestone's plan body; start_planning expands the new milestone and opens its plan editor - tests updated to the milestone contract + new body/get_milestone coverage Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,17 +4,19 @@ import pytest
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_start_planning_creates_plan_task_and_returns_rules():
|
||||
fake_note = MagicMock()
|
||||
fake_note.to_dict.return_value = {"id": 5, "title": "Plan it", "task_kind": "plan"}
|
||||
async def test_start_planning_creates_milestone_and_returns_rules():
|
||||
# start_planning now creates a MILESTONE (the plan container), not a
|
||||
# kind=plan task; its body holds the seeded design template.
|
||||
fake_milestone = MagicMock()
|
||||
fake_milestone.to_dict.return_value = {"id": 5, "title": "Plan it", "status": "active"}
|
||||
applicable = {
|
||||
"rules": [{"id": 1, "title": "dev is home", "statement": "...",
|
||||
"topic_title": "git-workflow", "rulebook_title": "FabledSword family"}],
|
||||
"truncated": False,
|
||||
"subscribed_rulebooks": [{"id": 2, "title": "FabledSword family"}],
|
||||
}
|
||||
with patch("scribe.services.planning.notes_svc.create_note",
|
||||
AsyncMock(return_value=fake_note)) as mock_create, \
|
||||
with patch("scribe.services.planning.milestones_svc.create_milestone",
|
||||
AsyncMock(return_value=fake_milestone)) as mock_create, \
|
||||
patch("scribe.services.planning.rulebooks_svc.get_applicable_rules",
|
||||
AsyncMock(return_value=applicable)), \
|
||||
patch("scribe.services.planning.notes_svc.list_notes",
|
||||
@@ -24,14 +26,13 @@ async def test_start_planning_creates_plan_task_and_returns_rules():
|
||||
from scribe.services.planning import start_planning
|
||||
out = await start_planning(user_id=7, project_id=3, title="Plan it")
|
||||
|
||||
# Created a plan-task (status set => task, kind=plan)
|
||||
# Created a milestone with the seeded plan-body template.
|
||||
kwargs = mock_create.call_args.kwargs
|
||||
assert kwargs["task_kind"] == "plan"
|
||||
assert kwargs["status"] == "todo"
|
||||
assert kwargs["project_id"] == 3
|
||||
assert kwargs["status"] == "active"
|
||||
assert "## Goal" in kwargs["body"] # seeded template
|
||||
# Returned shape
|
||||
assert out["task"]["id"] == 5
|
||||
assert out["milestone"]["id"] == 5
|
||||
assert out["applicable_rules"][0]["title"] == "dev is home"
|
||||
assert out["subscribed_rulebooks"] == [{"id": 2, "title": "FabledSword family"}]
|
||||
assert out["open_task_count"] == 3
|
||||
|
||||
Reference in New Issue
Block a user