docs(claude): add demo-mode subsystem guide#243
Merged
Conversation
…nging /api/* surfaces Three recent demo crashes (#235 / #238 / #240) all came from the same pattern: a refactor changed what production code returns or expects, but the parallel demo handler in `ui/src/demo/handlers/` kept the old (or invented an ad-hoc) shape. `pnpm test` doesn't catch it because esbuild doesn't enforce types. Adds demo mode to the existing "Subsystem guides" section alongside the event/listener/producer guide. The text names the two cheap habits that prevent the failure mode: 1. Import the canonical type from `ui/src/api/types.ts` (or wherever the contract lives) when writing a demo handler, instead of inlining an ad-hoc shape. 2. Run `pnpm -F open-alice-ui dev:demo` and walk the affected surface before declaring the refactor done. The catchAll's `[demo] unmocked …` warn surfaces missing endpoints; visible crashes surface shape mismatches. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Demo mode entry to CLAUDE.md's "Subsystem guides" section so future sessions check the parallel demo handlers when changing any `/api/*` surface — a habit that would have prevented the last three demo-crash PRs.
Context
Three recent crashes — PR #235 (`AgentWorkResultProbe` shape), PR #238 (Chat sidebar empty because `'demo-template'` ≠ real `'chat'` template name), PR #240 (`/api/news` returned `{articles, hasMore}` instead of `{items, count, lookback}`) — all came from the same pattern. A refactor changed what production code returns or expects, but the parallel demo handler kept the old shape (or invented an ad-hoc one). `pnpm test` didn't catch it because esbuild doesn't enforce types; the breakage only surfaced when a visitor clicked into the broken surface.
The new entry sits next to the event/listener/producer guide and names two cheap habits that prevent this:
Diff scope
CLAUDE.md only — +17 lines.
🤖 Generated with Claude Code