[F015] flow_qa/flow_doc: add i_am_blocked route (manifest-registered escape hatch was 404)

This commit is contained in:
Renn F
2026-06-28 10:45:18 +02:00
parent ba7c35a613
commit 34034dbdf5
4 changed files with 84 additions and 0 deletions
+22
View File
@@ -190,3 +190,25 @@ async def test_resume_dispatches() -> None:
)
assert resp.status_code == _HTTP_200
mock_chore.resume.assert_awaited_once()
@pytest.mark.asyncio
async def test_i_am_blocked_dispatches_to_choreographer() -> None:
"""F015: POST /api/v1/flow/documenter/i_am_blocked must exist (the
documenter manifest registers i_am_blocked) and return an envelope, not 404
with a non-envelope body. Without this route a blocked documenter's escape
hatch 404s."""
mock_chore = MagicMock()
mock_chore.i_am_blocked = AsyncMock(
return_value=_make_envelope(status="blocked", task_id=_TASK_ID)
)
client = TestClient(_build_app(mock_chore))
resp = client.post(
"/api/v1/flow/documenter/i_am_blocked",
json={"task_id": _TASK_ID, "reason": "PR diff unavailable"},
headers=_HEADERS,
)
assert resp.status_code == _HTTP_200
body = resp.json()
assert body["status"] == "blocked"
mock_chore.i_am_blocked.assert_awaited_once()
+21
View File
@@ -219,3 +219,24 @@ async def test_i_am_idle_dispatches_agent_id() -> None:
)
assert resp.status_code == _HTTP_200
mock_chore.i_am_idle.assert_awaited_once()
@pytest.mark.asyncio
async def test_i_am_blocked_dispatches_to_choreographer() -> None:
"""F015: POST /api/v1/flow/qa/i_am_blocked must exist (the QA manifest
registers i_am_blocked) and return an envelope, not 404 with a non-envelope
body. Without this route a blocked QA agent's escape hatch 404s."""
mock_chore = MagicMock()
mock_chore.i_am_blocked = AsyncMock(
return_value=_make_envelope(status="blocked", task_id=_TASK_ID)
)
client = TestClient(_build_app(mock_chore))
resp = client.post(
"/api/v1/flow/qa/i_am_blocked",
json={"task_id": _TASK_ID, "reason": "PR diff won't load"},
headers=_HEADERS,
)
assert resp.status_code == _HTTP_200
body = resp.json()
assert body["status"] == "blocked"
mock_chore.i_am_blocked.assert_awaited_once()