Repository navigation
feat(examples): five showcase apps, each deployable in one click - #333
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (8)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe CI configuration now triggers E2E jobs for ChangesShowcase examples E2E coverage
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant E2EPathFilter
participant GitHubActions
participant ExamplesE2ESuite
participant PlaywrightReports
E2EPathFilter->>GitHubActions: trigger E2E jobs for examples/** changes
GitHubActions->>ExamplesE2ESuite: run pnpm run e2e:examples with CI enabled
ExamplesE2ESuite->>PlaywrightReports: write examples report
GitHubActions->>PlaywrightReports: upload standard and examples reports on failure
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thank you for following the naming conventions! 🙏 |
|
Thank you for confirming the Contributor License Agreement! 🙏 |
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Five runnable apps, each built around a different part of the framework, and
each deployable to a reader's own Cloudflare account from a button in its
README.
- kanban-board — fractional index ordering, server-resolved drop positions,
multi-query optimistic updates, native drag and drop.
- feedback-board — a unique index as the actual one-vote constraint, a
denormalised counter read through an index, and `ctx.ai`
summarising the board from an action.
- team-chat — a Durable Object per channel, all three data tiers in one
schema, `authorizeShard`, per-shard full-text search, and
uploads that go straight to R2.
- chess — a server-authoritative rules engine, serialized mutations as
the turn order, Elo settled inside the transaction that ends
the game, and spectating as nothing more than a subscription.
- tanstack-start — an SSR route loader sharing a cache key with the live
`useQuery`, on one worker serving both SSR and RPC.
Every example was driven end to end rather than only compiled: cards dragged
and reordered, a summary generated against Workers AI, a chat message sent with
an attachment round-tripped through R2, a full game played to checkmate by two
authenticated sessions, and the SSR markup checked for the data in the served
HTML.
Two engine invariants are covered by unit tests where reading the code is not
enough: the fractional-index midpoint (including 200 consecutive inserts into
one gap, which is what breaks float ordering) and the chess move generator.
The `.dev.vars.example` files are what the deploy flow prompts for; `vars` are
deployed verbatim, so nothing environment-specific is hard-coded — the storage
origin and the auth base URL are both derived from the request.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
5bb0f77 to
a6edf23
Compare
✅ Deploy Preview for lunorash ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
React Doctor reported 13 issues across the five apps. Each was real, and three were user-visible bugs rather than style. **Five compiler bailouts, all `try` shapes it cannot lower.** Reproduced locally against `babel-plugin-react-compiler` to get the exact reasons rather than guess: a `try` with no `catch`, a `try` with a `finally`, a `throw` inside a `try`, and a value block (ternary, `??`, optional chain) inside a `try`. Any one of them makes the compiler skip optimizing the whole component silently. Fixing them fixed real behaviour. Every `try`/`finally` here was resetting a spinner with no `catch`, so a failed sign-in, a failed AI summary, and a failed attachment upload each left the UI quiet — the summary path even discarded the coded error the server had gone to the trouble of producing. The conditionals now live in named helpers so the `try` body is a single call, which reads better than what it replaced. **Reading the clock during render.** The chat's presence roster filtered on `Date.now()` while rendering — impure, unoptimizable, and inconsistent between a server render and its hydration. The heartbeat that already runs every 15s now advances a `now` in state instead. **A locale-formatted timestamp during SSR.** `toLocaleTimeString()` resolves against the renderer's locale and time zone, so the server's string and the browser's disagree — a hydration mismatch in the one example whose whole point is server rendering. Renders a deterministic UTC `<time>` instead. Also: the two hand-rolled modals become real `<dialog>` elements opened with `showModal()`, so focus trapping, page inertness, Escape and `::backdrop` come from the platform; `posts.map` looks votes up in a `Set` rather than rescanning an array per row; and three `useMemo`s the React Compiler already covers are gone. No workflow change: React Doctor suggested adding `fetch-depth: 0` to its own job, but that is already configured (react-doctor.yml:28). Its baseline failed because the PR's base at scan time was a stacked branch that has since merged and been deleted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
Merging this PR will improve performance by 13.04%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | 1 shard × 1000 rows (single round-trip) |
3.1 ms | 2.7 ms | +15.22% |
| ⚡ | baseline (Object.keys + toInternal + path spread per field) |
72.1 µs | 65 µs | +10.91% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing examples/showcase-apps (0ae2876) with alpha (b52bcac)2
Footnotes
-
10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
alpha(e3d7b69) during the generation of this report, so b52bcac was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
The scanner reads the standard HTML autocomplete tokens `"new-password"` / `"current-password"` as credentials. They are neither, and dropping them would be a real regression: they are what tells a password manager whether to offer a saved credential or generate a new one. Hoisted out of the JSX because a comment is not valid in attribute position, so the suppression had nowhere to live — and the marker has to sit on the finding's own line, not the one above it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
The advisor scored these between 88 and 97; the two rules doing the damage were `public_mutation_without_ratelimit` and `procedure_without_structured_event`, firing on all 32 public procedures. Rate limits matter most where there is no sign-in. kanban-board, feedback-board and tanstack-start ship a deploy button and no auth, so a limit is the only thing between a deployed instance and a script — those key on caller IP, since there is no user to key on. team-chat and chess key on the user, so one person behind a shared address cannot exhaust another's budget. Buckets are sized per operation rather than shared: dragging cards is a burst of legitimate writes, a heartbeat runs every 15s per open tab, and inference costs money per call, so the AI summary gets a far tighter window than the board's writes. Each app gains the standard `lunora/ratelimit/schema.ts` plugin that `lunora init` scaffolds — these were hand-built, so they never had it. Counters live in the shard's own `ratelimit_buckets`, so they are the same counters every request sees rather than per-isolate memory. Also fixed, all reported by the same pass: - Four storage actions in team-chat had no error handling, so an object-store failure surfaced to the caller unexplained. They now name the dependency. - The public AI generation was unbounded; a board summary has no business being long, and an unbounded public generation is an invitation to burn tokens. - The AI run is logged either side of the call. Left alone: `nondeterministic_query_mutation` on the mutations that stamp a timestamp. The rule is INFO and its own text says no action is needed for an ordinary mutation — it matters only inside a workflow step or queue consumer that can replay. Removing the timestamps to chase a round number would make the code worse. Scores now 100 / 100 / 98 / 98 / 97. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
UI: a shared design chassis across all five examples — layered near-black surfaces, hairline rules, mono-forward chrome, focus-visible rings, staggered entry, dialog transitions and a `prefers-reduced-motion` opt-out — with one accent per app so they stay distinguishable. No web fonts and no new dependencies, so each example is still a copy-one-directory standalone that runs offline under Miniflare. The kanban theme toggle now opts into light instead of dark, matching the palette the design was drawn for. Tests: every example now boots its real schema and real procedures on the in-memory harness, so a broken example fails CI rather than a broken helper. This covers what the previous pure-logic unit tests could not — the chess suite asserts the server rejects an illegal move and refuses to mint two games from one lobby, both of which were live defects that a browser client could not surface. `feedback-board`, `team-chat` and `tanstack-start` had no test script at all; all five are now in the `vis run test` rotation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
Adds a Playwright suite that boots all five examples and exercises them the way a visitor would — 12 specs covering the claims the server-side harness cannot reach: a card reaching a second tab live, an optimistic vote settling on the server's count, a message arriving in another member's open window, a chess move repainting both boards, and SSR markup that is already populated with JavaScript disabled. It runs on Playwright's own `webServer` array rather than a second hand-rolled boot script, and only starts the servers the selected projects need — five Vite plus workerd trees at once is enough to get a run OOM killed. `.dev.vars` is created only when absent: writing it unconditionally restarts every dev server mid-boot, because Vite watches the file and Playwright re-imports the config in each worker process. Three defects surfaced while writing it: - The TanStack example hardcoded `localhost:5173` for its server-side fetch, so it returned 500 on any other port. The port now comes from Vite's resolved config, and `VITE_LUNORA_URL` still overrides. - Every example let the Cloudflare plugin pick the first free inspector port, which two apps starting together can both claim; one then died with EADDRINUSE. Each pins its own, so running several side by side works. - Two controls announced nothing useful: the upvote button read as "▲ 3" and board squares as "e2 white P". Both now carry a spelled-out label. The SSR example also gained a connection indicator — the one thing a server render cannot tell you is whether the socket is up, which is worth showing in an example built around that handover. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
Three CI failures from the previous commit: - The Workers AI binding is proxied to Cloudflare even under `vite dev`, so `feedback-board` cannot boot on a runner with no account and took the whole suite down at startup rather than failing one project. It is now dropped when CI has no `CLOUDFLARE_API_TOKEN`, with a line saying so. Locally it still runs. - The literal password two specs type into a sign-up form tripped the secret scan; suppressed on the finding's own line. - `offerDraw` bound the result of its authorization call and never read it. The call is the point, so only the binding goes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
Both fail only in CI and both assume timing rather than waiting for the condition they care about. `data-browser` snapshots the read count as soon as the first debounced search lands, but a legitimate follow-up read can still be in flight at that moment on a loaded runner — so the "no re-seed loop" assertion was really measuring machine speed. It now waits for the reads to go quiet first, which a re-seed loop can never do, so the property under test is unchanged. `studio`'s migrations panel is lazily mounted and was left on the default 1s findBy window; the schedule panel next to it already carries a 5s window and a comment explaining why. This gives it the same. Neither reproduces locally, so neither fix is verified against the failure — they replace a timing assumption with a condition, which cannot regress the assertion either way. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
The CI-only failures were not timing noise around the assertions — both tests reach for an element that is not in the DOM yet. `data-browser` read the search box with a synchronous `getByTestId` right after the first row painted, but the toolbar mounts after it: seven interactions now go through a helper that awaits the input, which says why once instead of at each call site. The read-count quiescence loop from the previous commit is reverted — it addressed a race that was never the failure. `studio`'s migrations panel timed out on the default 1s findBy window; it is lazily mounted, and the schedule panel beside it already carries a 5s window for that reason. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Five runnable apps, one per area of the framework, each with a Deploy-to-Cloudflare button in its README.
kanban-boardfeedback-boardby_upvotes;ctx.aisummarising the board from an action.team-chat.global());authorizeShard; per-shard.searchIndex(); uploads straight to R2 behind a signed URL.chesstanstack-startuseQuery, so server markup survives hydration with no refetch — one worker serving both SSR and RPC.Verified by running them, not by compiling them
Cards dragged across and within columns and the order re-checked after reload; a summary generated against real Workers AI; a chat message sent with an attachment and the exact bytes round-tripped through R2; a full game played to checkmate by two authenticated sessions with Elo settling 1216/1184; the SSR HTML checked for the data being present in the served bytes.
That mattered — it found four defects that compiling could not, all fixed here: a missing
isValidMovecall that let a knight teleport,ctx.db.patchrejecting explicitundefined, a.global()table read through the legacyquery().withIndex()reader that D1 does not serve, and a worker missing its.global()binding entirely.Security posture
These are reference apps, so an insecure pattern propagates by being copied. After a security review pass:
image/png,PUTtext/html, and the worker serves attacker HTML from the origin its own session cookie is scoped to. Served withnosniff+content-disposition: attachmentbehind that, and a size cap.baseURL.@lunora/authreads its production posture from it: an explicithttp://…origin turns offuseSecureCookiesand downgrades the weak-secret guard. With a deploy button attached, that would ship insecure cookies over HTTPS.varsdeploy verbatim while secrets get prompted, and the signed-URL HMAC binds the host — a shippedhttp://localhost:5173would 403 every attachment on the deployed origin. Derived per request instead.Also worth knowing
team-chatandchesscompose their worker with the generateddefineApp()builder; the two with no bindings usecreateWorkerdirectly.examples/README.mdexplains which to reach for and why, since the repo previously showed both shapes with no guidance.Signed URLs are minted from actions rather than returned by live queries — a signed URL carries an expiry and a fresh HMAC, so it differs on every evaluation and defeats the shard's push suppression. It is a
Date.now()in disguise.Not verified: I could not click a deploy button (needs a Cloudflare account and GitHub OAuth). Cloudflare documents that a subdirectory app must be self-contained, and these use
workspace:*; each README carries the two-command CLI fallback, which I did verify.Checks
All five type-check, 14 unit tests pass, prettier and
package.jsonkey order clean, no secrets or build artifacts staged.🤖 Generated with Claude Code
https://claude.ai/code/session_01CYvgKochPxnrCCtKB1tXGf
Summary by CodeRabbit