Skip to content

docs(claude): add demo-mode subsystem guide#243

Merged
luokerenx4 merged 1 commit into
masterfrom
docs/claude-md-demo-mode-guide
Jun 1, 2026
Merged

docs(claude): add demo-mode subsystem guide#243
luokerenx4 merged 1 commit into
masterfrom
docs/claude-md-demo-mode-guide

Conversation

@luokerenx4
Copy link
Copy Markdown
Contributor

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:

  1. Import the canonical type from `ui/src/api/types.ts` (or wherever the contract lives) when writing a demo handler — don't inline 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.

Diff scope

CLAUDE.md only — +17 lines.

🤖 Generated with Claude Code

…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>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openalice-demo Ready Ready Preview, Comment Jun 1, 2026 4:13am

Request Review

@luokerenx4 luokerenx4 merged commit 04c9f24 into master Jun 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant