feat: extend operational investigation workflows
Generic Container CI/CD / test-build-publish (push) Successful in 3m53s
Server CI/CD v2 / build-test-publish-and-deploy (push) Successful in 3m52s

This commit is contained in:
2026-10-30 17:30:19 +08:00
parent 63af998045
commit 05183aff93
82 changed files with 4644 additions and 330 deletions
@@ -33,6 +33,7 @@ def test_dynamic_investigation_routes_are_in_the_public_contract():
assert "get" in paths["/api/v1/operational-tasks/{task_id}/reports"]
assert "get" in paths["/api/v1/operational-tasks/{task_id}/reports/{revision}"]
assert "post" in paths["/api/v1/operational-tasks/{task_id}/presentation-events"]
assert "get" in paths["/api/v1/operational-tasks/{task_id}/presentation-events"]
assert "get" in paths["/api/v1/operational-tasks/{task_id}/presentation-cursor"]
context_params = paths["/api/v1/operational-tasks/{task_id}/agent-context"]["get"]["parameters"]
assert any(item["name"] == "report_revision" and item["in"] == "query" for item in context_params)
@@ -123,3 +124,21 @@ async def test_report_endpoints_preserve_interactive_blocks_and_version_context(
schemas = app.openapi()["components"]["schemas"]
assert "ui_blocks" in schemas["InvestigationReportInput"]["properties"]
assert "ui_blocks" in schemas["InvestigationReport"]["properties"]
@pytest.mark.anyio
async def test_presentation_history_route_forwards_read_only_paging_and_domain_errors(monkeypatch):
service = SimpleNamespace(presentation_history=AsyncMock(return_value={"items": []}))
monkeypatch.setattr(endpoints, "_service", lambda _ctx, _conn: service)
task_id = uuid4()
await endpoints.get_operational_task_presentation_history(
task_id, after=7, through=30, limit=20, ctx=_service_context(), conn=object(),
)
service.presentation_history.assert_awaited_once_with(task_id, after=7, through=30, limit=20)
from app.domain.domain_errors import DomainError
service.presentation_history.side_effect = DomainError("TASK_NOT_FOUND", "missing", status=404)
with pytest.raises(HTTPException) as error:
await endpoints.get_operational_task_presentation_history(
task_id, after=0, through=None, limit=100, ctx=_service_context(), conn=object(),
)
assert error.value.status_code == 404