STATE-WP-0069 T04/T06: body metering and workplan-first state internals
Share LegacyWorkstreamIdBodyMixin across create schemas; meter POST /tasks/ and /decisions/ workstream_id bodies. State summary uses workplan flow; NextStep dual-writes workplan_* fields alongside legacy workstream_*.
This commit is contained in:
parent
6e5e150803
commit
388b330809
11 changed files with 157 additions and 36 deletions
|
|
@ -234,6 +234,49 @@ class TestWorkplanAliasesAndLegacyMeter:
|
|||
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_legacy_workstream_id_body_on_tasks_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(
|
||||
"/tasks/",
|
||||
json={
|
||||
"workstream_id": str(wp["id"]),
|
||||
"title": "legacy task body",
|
||||
"status": "todo",
|
||||
},
|
||||
headers={"X-StateHub-Component": "old-task-writer"},
|
||||
)
|
||||
assert r.status_code == 201
|
||||
assert r.headers["Deprecation"] == "true"
|
||||
|
||||
summary = (await client.get("/legacy-meter/summary")).json()
|
||||
item = _summary_by_key(summary)["rest_api:POST /tasks/ workstream_id"]
|
||||
assert item["window"]["calls"] == 1
|
||||
assert item["window"]["components"] == {"old-task-writer": 1}
|
||||
|
||||
async def test_legacy_workstream_id_body_on_decisions_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(
|
||||
"/decisions/",
|
||||
json={
|
||||
"workstream_id": str(wp["id"]),
|
||||
"title": "legacy decision body",
|
||||
"decision_type": "pending",
|
||||
},
|
||||
headers={"X-StateHub-Component": "old-decision-writer"},
|
||||
)
|
||||
assert r.status_code == 201
|
||||
assert r.headers["Deprecation"] == "true"
|
||||
|
||||
summary = (await client.get("/legacy-meter/summary")).json()
|
||||
item = _summary_by_key(summary)["rest_api:POST /decisions/ workstream_id"]
|
||||
assert item["window"]["calls"] == 1
|
||||
|
||||
async def test_workplan_id_query_param_on_tasks_is_not_metered(self, client):
|
||||
await _create_domain(client)
|
||||
topic = await _create_topic(client)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue