Add story-style examples suite (27 stories + harness + CI) - #2957
Code review found 1 important issue
Found 4 candidates, confirmed 3. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 1 |
| 🟡 Nit | 2 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | examples/stories/legacy_routing/server.py:16-20 |
legacy_routing CORS recipe omits Mcp-Method/Mcp-Name from allowed request headers, blocking modern browser clients |
| 🟡 Nit | examples/stories/serve_one/server.py:99-110 |
serve_one: bare --http self-host run hangs ~30s because server.py ignores --http/--port |
| 🟡 Nit | examples/stories/README.md:147 |
Stories index references closeSSE(), a function name that does not exist in the Python SDK |
Annotations
Check failure on line 20 in examples/stories/legacy_routing/server.py
claude / Claude Code Review
legacy_routing CORS recipe omits Mcp-Method/Mcp-Name from allowed request headers, blocking modern browser clients
MCP_ALLOWED_HEADERS omits `Mcp-Method` and `Mcp-Name`, but every modern (2026-07-28) SDK request carries `Mcp-Method` (and `Mcp-Name` for name-bearing methods like `tools/call`), so a browser preflight including those headers is rejected by Starlette's CORSMiddleware and modern browser clients are blocked by the very CORS recipe this story teaches. Adding `'Mcp-Method'` and `'Mcp-Name'` to the list fixes both `server.py` and `server_lowlevel.py` (which reuses the constant).
Check warning on line 110 in examples/stories/serve_one/server.py
claude / Claude Code Review
serve_one: bare --http self-host run hangs ~30s because server.py ignores --http/--port
Following the suite-wide convention from the top-level stories README, `python -m stories.serve_one.client --http` self-hosts `server.py --http --port <N>`, but this file's `__main__` is `anyio.run(main)` — the hand-built stdio loop — which never reads `sys.argv`, never binds the port, and never exits, so the harness's readiness poll spins until the 30s `fail_after` fires. Either honor the `run_server_from_args`-style argv convention here, or have `run_client` refuse `--http` for this story (e.g
Check warning on line 147 in examples/stories/README.md
claude / Claude Code Review
Stories index references closeSSE(), a function name that does not exist in the Python SDK
The story index table describes `sse_polling` as "SEP-1699 `closeSSE()` + `Last-Event-ID` resume via `EventStore`", but `closeSSE()` is the TypeScript-SDK spelling and doesn't exist anywhere in this repository — the Python API the story actually teaches is `ctx.close_sse_stream()`. Update the table entry to `close_sse_stream()` (or describe the SEP feature without code formatting) so readers grepping the SDK find the real name.