# SSE snapshot tests

Recorded SSE transcripts from a live Worldtree at the pinned spec SHA.
Replayed in CI to catch event-shape drift.

## Recording

```bash
# Boot Worldtree at the pinned SHA
( cd ~/development/Worldtree && python -m core.conversation_api ) &

# Record (harness TBD by dev team — likely respx + httpx-sse fixtures)
uv run pytest --record-snapshots tests/snapshots/
```

## Replay

The default `uv run pytest` reads the recorded files and replays them
against the Ratatoskr SSE consumer. Re-record on every spec-pin bump
(see `docs/SPEC-PIN.md`).

## What to capture

At minimum:
- One-turn happy path (`text` + `done`).
- Tool-using turn (`text` + `tool_start` + `tool_result` + `text` + `done`).
- Thinking-enabled turn (`thinking` + `text` + `done`).
- Cancelled turn (`text` + `cancelled` with `reason: "user_cancel"`).
- Errored turn (`text` + `error`).
- `worker_phase` event sequence across `BuildingPrompt` → `CallingLLM` → `ProcessingTools` → `Streaming` → `Finishing`.

Capture also the `id:` and `event:` lines, not just `data:` — those
are load-bearing for SSE resume and easy to forget.
