Files
turnstone/tests/test_resume_flow.py
Patrick Buckley 2bb55590bf feat: replace Redis MQ with direct HTTP transport (Phase 1)
Delete the entire turnstone/mq/ package (broker, bridge, protocol,
client) and turnstone/sim/ package. Remove Redis as a dependency.

Channel gateway and console now communicate with server nodes via
direct HTTP (httpx + httpx-sse) instead of Redis pub/sub and queues.
Single-node deployments work with zero infrastructure beyond the
database.

Key changes:
- Channel adapters use httpx POST for create/send/approve/close
  and httpx-sse for per-workstream event streaming
- Console collector discovers nodes via services table instead of
  Redis SCAN
- Console scheduler dispatches tasks via HTTP POST with DB-based
  leader election
- Server registers in services table with 30s heartbeat
- Server accepts optional ws_id in create request (for Phase 2
  console-generated routing)
- SDK events gain IntentVerdictEvent and OutputWarningEvent types
- All docs, examples, bootstrap wizard updated

63 files changed, -5968 net lines (Redis transport fully removed)
2026-03-30 20:30:05 -07:00

40 lines
1.5 KiB
Python

"""Tests for the workstream resume request schema.
Verifies that the create-workstream JSON payload carries the resume_ws field
correctly, matching the server's ``CreateWorkstreamRequest`` schema.
"""
from __future__ import annotations
# ---------------------------------------------------------------------------
# CreateWorkstreamRequest resume_ws field
# ---------------------------------------------------------------------------
class TestCreateWorkstreamResumeField:
def test_resume_ws_defaults_empty(self) -> None:
body: dict[str, str] = {"name": "test"}
assert body.get("resume_ws", "") == ""
def test_resume_ws_set(self) -> None:
body = {"name": "test", "resume_ws": "ws-abc"}
assert body["resume_ws"] == "ws-abc"
def test_resume_ws_present_in_payload(self) -> None:
body = {"name": "test", "resume_ws": "ws-xyz"}
assert "resume_ws" in body
assert body["resume_ws"] == "ws-xyz"
def test_pydantic_schema_has_resume_ws(self) -> None:
"""CreateWorkstreamRequest schema includes resume_ws."""
from turnstone.api.server_schemas import CreateWorkstreamRequest
req = CreateWorkstreamRequest(name="test", resume_ws="ws-123")
assert req.resume_ws == "ws-123"
def test_pydantic_schema_default_empty(self) -> None:
from turnstone.api.server_schemas import CreateWorkstreamRequest
req = CreateWorkstreamRequest(name="test")
assert req.resume_ws == ""