diff --git a/api/routers/state.py b/api/routers/state.py index 9171ef0..7e5e01d 100644 --- a/api/routers/state.py +++ b/api/routers/state.py @@ -199,7 +199,7 @@ async def build_state_summary(session: AsyncSession) -> StateSummary: ) open_ws = list(open_ws_rows.scalars().all()) - # Task counts per workplan (used to enrich open_workplans / open_workstreams) + # Task counts per workplan (used to enrich open_workplans) task_per_ws: dict = {} task_statuses_per_ws: dict = {} for ws_id, tstat, cnt in await session.execute( @@ -430,7 +430,6 @@ async def build_state_summary(session: AsyncSession) -> StateSummary: open_capability_requests=open_cap_req_count, ranked_suggestions=ranked_suggestions, open_workplans=open_workplan_rows, - open_workstreams=open_workplan_rows, ) return result @@ -793,7 +792,7 @@ async def _build_domain_summaries(session: AsyncSession) -> list[DomainSummary]: async def get_deps(session: AsyncSession = Depends(get_session)) -> list[WorkstreamWithDeps]: """Lightweight dep-graph endpoint: open workstreams with their dependency edges only. - Returns the same structure as open_workstreams in /state/summary but skips + Returns the same structure as open_workplans in /state/summary but skips the 10-table full-summary computation. Task counts are omitted (all zero). Used by workstreams.md and dependencies.md which only need dep edges. """ diff --git a/api/schemas/state.py b/api/schemas/state.py index a3e5dfa..d665585 100644 --- a/api/schemas/state.py +++ b/api/schemas/state.py @@ -83,7 +83,6 @@ class StateSummary(BaseModel): waiting_tasks: list[TaskRead] blocked_tasks: list[TaskRead] = [] recent_progress: list[ProgressEventRead] - open_workstreams: list[WorkstreamWithDeps] open_workplans: list[WorkstreamWithDeps] = [] next_steps: list[NextStep] = [] domains: list[DomainSummary] = [] diff --git a/dashboard/src/data/summary.json.py b/dashboard/src/data/summary.json.py index b98f713..3dce491 100644 --- a/dashboard/src/data/summary.json.py +++ b/dashboard/src/data/summary.json.py @@ -38,5 +38,4 @@ except urllib.error.URLError as e: "blocked_tasks": [], "recent_progress": [], "open_workplans": [], - "open_workstreams": [], })) diff --git a/dashboard/src/index.md b/dashboard/src/index.md index 83fc057..3a8edc4 100644 --- a/dashboard/src/index.md +++ b/dashboard/src/index.md @@ -437,7 +437,7 @@ display(html`
[w.id, w])); +const wsById = Object.fromEntries((summary.open_workplans ?? []).map(w => [w.id, w])); const todayCount = (summary.recent_progress ?? []).filter(e => e.created_at?.startsWith(new Date().toISOString().slice(0, 10))).length; const decCount = (decisions.open ?? 0) + (decisions.escalated ?? 0); diff --git a/mcp_server/server.py b/mcp_server/server.py index f61753a..e85416a 100644 --- a/mcp_server/server.py +++ b/mcp_server/server.py @@ -263,9 +263,7 @@ def get_domain_summary(domain_slug: str) -> str: topic_id = topic["id"] state_summary = _get("/state/summary") - open_workplans = state_summary.get("open_workplans") or state_summary.get( - "open_workstreams", [] - ) + open_workplans = state_summary.get("open_workplans", []) workstreams = [ws for ws in open_workplans if ws.get("topic_id") == topic_id] blocking = _get("/decisions", {"decision_type": "pending", "topic_id": topic_id}) recent = _get("/progress", {"topic_id": topic_id, "limit": 5}) diff --git a/tests/test_mcp_smoke.py b/tests/test_mcp_smoke.py index 960fecf..ebf6360 100644 --- a/tests/test_mcp_smoke.py +++ b/tests/test_mcp_smoke.py @@ -48,14 +48,14 @@ class TestGetStateSummary: assert r.status_code == 200 body = r.json() # Required top-level fields - for key in ("open_workstreams", "blocking_decisions", "blocked_tasks", + for key in ("open_workplans", "blocking_decisions", "blocked_tasks", "domains", "contribution_counts", "licence_risk_count"): assert key in body, f"missing key: {key}" async def test_empty_db_returns_zero_counts(self, client): r = await client.get("/state/summary") body = r.json() - assert body["open_workstreams"] == [] + assert body["open_workplans"] == [] assert body["blocking_decisions"] == [] assert body["blocked_tasks"] == [] diff --git a/tests/test_routers_core.py b/tests/test_routers_core.py index 4c5b36c..c1601f6 100644 --- a/tests/test_routers_core.py +++ b/tests/test_routers_core.py @@ -433,9 +433,7 @@ class TestStateSummary: r = await client.get("/state/summary") assert r.status_code == 200 body = r.json() - assert "open_workstreams" in body assert "open_workplans" in body - assert body["open_workplans"] == body["open_workstreams"] assert "blocking_decisions" in body assert "blocked_tasks" in body assert "domains" in body @@ -471,7 +469,7 @@ class TestStateSummary: r = await client.get("/state/summary") assert r.status_code == 200 body = r.json() - summaries = {item["id"]: item for item in body["open_workstreams"]} + summaries = {item["id"]: item for item in body["open_workplans"]} assert summaries[blocked_ws["id"]]["status"] == "blocked" assert summaries[blocked_ws["id"]]["blocked_reasons"][0]["id"] == "dependencies.all_complete" diff --git a/tests/test_summary_cache.py b/tests/test_summary_cache.py index e08f9b2..3b82423 100644 --- a/tests/test_summary_cache.py +++ b/tests/test_summary_cache.py @@ -142,7 +142,7 @@ def test_summary_cache_unit_progress_section(): blocking_decisions=[], waiting_tasks=[], recent_progress=[], - open_workstreams=[], + open_workplans=[], ) cache.store(summary, rev) @@ -181,7 +181,7 @@ def test_invalidate_summary_cache_scopes(): blocking_decisions=[], waiting_tasks=[], recent_progress=[], - open_workstreams=[], + open_workplans=[], ) cache.store(summary, rev)