mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Schema-level tests for v2 flow request bodies."""
|
|||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from uuid import uuid4
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
from pydantic import ValidationError
|
||
|
|
from roboco.api.schemas.v2.flow import DelegateRequest
|
||
|
|
|
||
|
|
|
||
|
|
def test_delegate_request_requires_task_type() -> None:
|
||
|
|
"""task_type must be supplied explicitly — no magic default.
|
||
|
|
|
||
|
|
Background: the 2026-05-08 smoke-test trace showed main-pm calling
|
||
|
|
delegate without task_type, the schema defaulted to 'code', the
|
||
|
|
cell PM downstream couldn't plan a code-typed parent (pre-fix), and
|
||
|
|
the run deadlocked. Make the field required so misuse fails at the
|
||
|
|
HTTP boundary with a clear 422.
|
||
|
|
"""
|
||
|
|
with pytest.raises(ValidationError) as exc:
|
||
|
|
DelegateRequest(
|
||
|
|
parent_task_id=uuid4(),
|
||
|
|
title="t",
|
||
|
|
description="d",
|
||
|
|
assigned_to="be-dev-1",
|
||
|
|
team="backend",
|
||
|
|
# task_type intentionally omitted
|
||
|
|
)
|
||
|
|
assert "task_type" in str(exc.value)
|
||
|
|
|
||
|
|
|
||
|
|
def test_delegate_request_accepts_explicit_task_type() -> None:
|
||
|
|
req = DelegateRequest(
|
||
|
|
parent_task_id=uuid4(),
|
||
|
|
title="t",
|
||
|
|
description="d",
|
||
|
|
assigned_to="be-dev-1",
|
||
|
|
team="backend",
|
||
|
|
task_type="code",
|
||
|
|
)
|
||
|
|
assert req.task_type == "code"
|