Migrate remaining in-repo workstream REST callers to /workplans
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 6s

Point cleanup_stale_tasks, validate_repo_adr, custodian_cli, dashboard data
loaders, extensions poll, MCP legacy resource, and consistency_check task
queries at preferred /workplans routes. Add caller inventory evidence doc.
This commit is contained in:
tegwick 2026-07-09 00:25:45 +02:00
parent 050cbbceb9
commit b05ca2ca8c
10 changed files with 66 additions and 16 deletions

View file

@ -78,7 +78,7 @@ def main() -> int:
try:
tasks = get("/tasks/?limit=500")
workstreams = get("/workstreams/")
workstreams = get("/workplans/")
except urllib.error.URLError as e:
print(f"[cleanup-stale] ERROR: API unreachable — {e}", file=sys.stderr)
print("[cleanup-stale] Start the API with: cd ~/state-hub && make api", file=sys.stderr)

View file

@ -936,7 +936,7 @@ def check_repo(api_base: str, repo_slug: str, repo_path_override: str | None = N
# Continue to check drift even with mismatched repo
tasks = get_tasks_from_workplan(meta, body)
db_tasks = _api_get(api_base, "/tasks", {"workstream_id": ws_id})
db_tasks = _api_get(api_base, "/tasks", {"workplan_id": ws_id})
file_task_statuses = [
str(task.get("status", "")).strip()
for task in tasks
@ -2046,7 +2046,7 @@ def _write_custodian_brief(api_base: str, repo_slug: str, repo_path: str) -> boo
for ws in workstreams:
ws_title = ws.get("title", ws.get("slug", "?"))
ws_id = ws["id"]
tasks = _api_get(api_base, "/tasks", {"workstream_id": ws_id}) or []
tasks = _api_get(api_base, "/tasks", {"workplan_id": ws_id}) or []
if not isinstance(tasks, list):
tasks = []

View file

@ -339,7 +339,7 @@ def check_api(api_base: str, metas: list[dict], domain_slug: str | None,
file_ws_ids.add(ws_id)
if meta.get("_active_file", True):
active_file_ws_ids.add(ws_id)
ws = _api_get(api_base, f"/workstreams/{ws_id}")
ws = _api_get(api_base, f"/workplans/{ws_id}")
if ws is None:
report.add(Level.FAIL, "workstream-ref-exists",
f"state_hub_workstream_id {ws_id} not found in DB (stale reference)",
@ -373,7 +373,7 @@ def check_api(api_base: str, metas: list[dict], domain_slug: str | None,
if t_domain not in domains_to_check:
continue
t_id = topic["id"]
workstreams = _api_get(api_base, "/workstreams", {"topic_id": t_id})
workstreams = _api_get(api_base, "/workplans", {"topic_id": t_id})
if not isinstance(workstreams, list):
report.add(Level.WARN, "orphan-detection",
f"Could not fetch workstreams for topic {t_id[:8]}… (domain={t_domain})")