feat(api): CUST-WP-0018 — API hardening & code quality

T01: Fix datetime.utcnow() → datetime.now(tz=timezone.utc) in MCP server
T02: Wrap _get/_post/_patch/_delete with try/except; return error dicts
T03: Log warnings when write_log skips missing project path
T04: Add priority + due_date_before filters to GET /tasks/
T05: Add owner + slug filters to GET /workstreams/
T06: Add offset param to GET /progress/ for proper pagination
T07: Low-severity bundle:
  - CORS origins from CORS_ORIGINS env var (TD-017)
  - seed.py upsert domains+topics on re-run (TD-011)
  - normalise filter bar CSS → filter-text-input everywhere (TD-016)
  - add 30.5 avg-days-per-month comment in decisions.md (TD-019)
  - TD-009, TD-018 already resolved by existing code

Closes CUST-WP-0018.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-18 02:17:04 +01:00
parent 9c9d5db632
commit 9aa54f8133
12 changed files with 106 additions and 48 deletions

View File

@@ -3,7 +3,7 @@ id: CUST-WP-0018
type: workplan
title: "State Hub — API Hardening & Code Quality"
domain: custodian
status: active
status: done
owner: custodian
topic_slug: custodian
created: "2026-03-18"
@@ -36,7 +36,7 @@ TD-CUST-005 (N+1 selectin) deferred — not pressing at current scale.
```task
id: CUST-WP-0018-T01
status: todo
status: done
priority: high
state_hub_task_id: "5045749c-22a5-4f37-81b1-6fc87ae7c580"
```
@@ -54,7 +54,7 @@ impact.
```task
id: CUST-WP-0018-T02
status: todo
status: done
priority: high
state_hub_task_id: "8aadbaf8-d898-436e-8df0-7f095c916613"
```
@@ -83,7 +83,7 @@ except Exception as e:
```task
id: CUST-WP-0018-T03
status: todo
status: done
priority: medium
state_hub_task_id: "26f8d132-b2f4-4939-9497-a9ad64e0a73e"
```
@@ -100,7 +100,7 @@ was skipped. Resolves TD-CUST-012.
```task
id: CUST-WP-0018-T04
status: todo
status: done
priority: medium
state_hub_task_id: "18da9d84-54a4-4028-8b8e-014d2b2f6ed6"
```
@@ -116,7 +116,7 @@ Add `priority: str | None` and `due_date_before: date | None` query params to
```task
id: CUST-WP-0018-T05
status: todo
status: done
priority: medium
state_hub_task_id: "488f448f-396d-4924-98a5-a2e84d4b1b95"
```
@@ -132,7 +132,7 @@ Add `owner: str | None` and `slug: str | None` query params to
```task
id: CUST-WP-0018-T06
status: todo
status: done
priority: medium
state_hub_task_id: "dd7e9da8-19fb-4b02-a100-972c582dbaa9"
```
@@ -148,7 +148,7 @@ Add `offset: int = 0` query param to `list_progress()` alongside existing
```task
id: CUST-WP-0018-T07
status: todo
status: done
priority: low
state_hub_task_id: "b949805b-dd3e-43d6-89cc-631e3183f67c"
```