feat: scaffold agentic interior design workflow

This commit is contained in:
Codex
2026-08-01 21:07:17 +08:00
parent 77779bd3a9
commit 6a15217d55
42 changed files with 7156 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
import httpx
import pytest
from app.main import app
@pytest.fixture
def transport() -> httpx.ASGITransport:
return httpx.ASGITransport(app=app)
@pytest.mark.asyncio
async def test_health(transport: httpx.ASGITransport) -> None:
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
response = await client.get("/v1/health")
assert response.status_code == 200
assert response.json()["status"] == "ok"
@pytest.mark.asyncio
async def test_demo_project_contract(transport: httpx.ASGITransport) -> None:
async with httpx.AsyncClient(transport=transport, base_url="http://test") as client:
response = await client.get("/v1/projects/demo-apartment")
assert response.status_code == 200
body = response.json()
assert body["stage"] == "plan_review"
assert body["plan"]["cad_layer_count"] == 43
+45
View File
@@ -0,0 +1,45 @@
import pytest
from app.domain.models import CommandRequest, WorkflowCommand, WorkflowStage
from app.domain.workflow import InvalidTransitionError, WorkflowConflictError, apply_command
from app.repositories.memory import create_demo_project
def test_confirm_plan_advances_revision_and_stage() -> None:
project = create_demo_project()
updated = apply_command(
project,
CommandRequest(
command=WorkflowCommand.CONFIRM_PLAN,
expected_revision=project.revision,
payload={"ceiling_height_mm": 2900},
),
)
assert updated.stage == WorkflowStage.BLOCKOUT
assert updated.revision == project.revision + 1
assert updated.plan.ceiling_height_mm == 2900
def test_stale_revision_is_rejected() -> None:
project = create_demo_project()
with pytest.raises(WorkflowConflictError):
apply_command(
project,
CommandRequest(
command=WorkflowCommand.CONFIRM_PLAN,
expected_revision=project.revision - 1,
),
)
def test_invalid_command_is_rejected() -> None:
project = create_demo_project()
with pytest.raises(InvalidTransitionError):
apply_command(
project,
CommandRequest(
command=WorkflowCommand.REQUEST_RENDER,
expected_revision=project.revision,
),
)