Add Service Definition of Mature policy and health-route test

Establish policies/service-dom.md as the service-level companion to the repo
DoI and workstream DoD. Its load-bearing Core criterion is a cheap, side-effect
free health endpoint for availability probing — satisfied by the existing
GET /state/health (DB readiness, 200/503). Served automatically at
/policy/service-dom by the existing policy router.

Add a regression test asserting /state/health returns 200 with the expected
shape, since none existed (DoM Standard criterion #4).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 15:58:51 +02:00
parent 044141de48
commit e4126bc755
2 changed files with 123 additions and 0 deletions

View File

@@ -1512,3 +1512,20 @@ class TestFabricGraphReadModel:
summary = r.json()
assert summary["schema_version"] is None
assert summary["nodes_by_fabric"] == {}
# ---------------------------------------------------------------------------
# Health route — Service Definition of Mature (policies/service-dom.md), Core #1
# ---------------------------------------------------------------------------
async def test_health_route_reports_ok_when_db_reachable(client):
"""The health endpoint is a cheap availability probe with no business logic.
It must return 200 and a small JSON body so agents and monitors can tell
"service available" from "request wrong" without side effects.
"""
r = await client.get("/state/health")
assert r.status_code == 200, r.text
body = r.json()
assert body["status"] == "ok"
assert body["db"] == "connected"