STATE-WP-0069 T04: Sunset headers and POST /progress body metering
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s

Add Sunset to legacy compat responses (Jun 2027 planning horizon).
Meter POST /progress/ bodies that use workstream_id; wire hub-core body
hook. Consolidate workstreams deprecation headers via legacy_compat.
This commit is contained in:
tegwick 2026-07-08 23:06:45 +02:00
parent 05a138bc1c
commit 6e5e150803
8 changed files with 126 additions and 14 deletions

View file

@ -77,6 +77,7 @@ class TestWorkplanAliasesAndLegacyMeter:
)
assert r.status_code == 200
assert r.headers["Deprecation"] == "true"
assert r.headers.get("Sunset")
assert r.headers["X-StateHub-Replacement"] == "/workplans/"
summary = (await client.get("/legacy-meter/summary")).json()
@ -189,6 +190,50 @@ class TestWorkplanAliasesAndLegacyMeter:
assert item["window"]["calls"] == 1
assert item["window"]["components"] == {"old-progress-client": 1}
async def test_legacy_workstream_id_body_on_progress_post_is_metered(self, client):
await _create_domain(client)
topic = await _create_topic(client)
wp = await _create_workplan(client, topic["id"])
r = await client.post(
"/progress/",
json={
"workstream_id": str(wp["id"]),
"event_type": "note",
"summary": "legacy body field",
"author": "test",
},
headers={"X-StateHub-Component": "old-progress-writer"},
)
assert r.status_code == 201
assert r.headers["Deprecation"] == "true"
assert r.headers["X-StateHub-Replacement"] == "POST /progress/ with workplan_id"
summary = (await client.get("/legacy-meter/summary")).json()
item = _summary_by_key(summary)["rest_api:POST /progress/ workstream_id"]
assert item["window"]["calls"] == 1
assert item["window"]["components"] == {"old-progress-writer": 1}
async def test_workplan_id_body_on_progress_post_is_not_metered(self, client):
await _create_domain(client)
topic = await _create_topic(client)
wp = await _create_workplan(client, topic["id"])
r = await client.post(
"/progress/",
json={
"workplan_id": str(wp["id"]),
"event_type": "note",
"summary": "preferred body field",
"author": "test",
},
)
assert r.status_code == 201
assert r.headers.get("Deprecation") != "true"
summary = (await client.get("/legacy-meter/summary")).json()
assert _summary_by_key(summary).get("rest_api:POST /progress/ workstream_id") is None
async def test_workplan_id_query_param_on_tasks_is_not_metered(self, client):
await _create_domain(client)
topic = await _create_topic(client)