Skip to content

[SLOP(claude-opus-4-8)] docs(examples): split effect example into hello-world-effect and chat-room-effect#5252

Open
NathanFlurry wants to merge 1 commit into
stack/slop-gpt-5-fix-rivetkit-normalize-protocol-args-source-side-lvpxytwlfrom
stack/slop-claude-opus-4-8-docs-examples-split-effect-example-into-hello-world-effect-and-chat-room-effect-wolqzmyo
Open

[SLOP(claude-opus-4-8)] docs(examples): split effect example into hello-world-effect and chat-room-effect#5252
NathanFlurry wants to merge 1 commit into
stack/slop-gpt-5-fix-rivetkit-normalize-protocol-args-source-side-lvpxytwlfrom
stack/slop-claude-opus-4-8-docs-examples-split-effect-example-into-hello-world-effect-and-chat-room-effect-wolqzmyo

Conversation

@NathanFlurry

Copy link
Copy Markdown
Member

No description provided.

@NathanFlurry

Copy link
Copy Markdown
Member Author

Stack for rivet-dev/rivet

Get stack: forklift get 5252
Push local edits: forklift submit
Merge when ready: forklift merge 5252

@claude

claude Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Code Review: Split effect example into hello-world-effect and chat-room-effect

Overview

This PR renames examples/effectexamples/chat-room-effect (the complex multi-actor example) and adds a new examples/hello-world-effect (a minimal counter). Both examples gain Vitest test suites, and a new Effect.ts quickstart doc page is added at /docs/actors/quickstart/effect.


Issues

Dual top-level execution in hello-world-effect/src/main.ts

The file runs Layer.launch(MainLayer).pipe(NodeRuntime.runMain) and evaluates export const { handler, dispose } = Registry.toWebHandler(...) at the top level. When tsx src/main.ts is invoked (as in the dev/start scripts), both execute, potentially creating two registry instances. The intent seems to be showing an alternative pattern for serverless, but as written a developer copy-pasting this will end up with both running. Extract the web-handler export into a separate comment block or a separate file to avoid the confusion.

Hardcoded actor keys in counter tests

hello-world-effect/tests/counter.test.ts uses fixed keys ("t-increment", "t-iso-a", "t-iso-b"). Against a persistent engine these keys will carry state from previous runs, making the increment assertion === 1 flaky on a second run. The chat-room-effect tests solve this correctly with the freshRoom helper that appends a random UUID. Apply the same pattern here:

const freshCounter = Effect.gen(function* () {
    return (yield* Counter.client).getOrCreate(`counter_${yield* Random.nextUUIDv4}`);
});

Inconsistent key format in documentation

In the quickstart doc, the Effect client calls counterClient.getOrCreate("my-counter") (string), while the TypeScript tab calls client.Counter.getOrCreate(["my-counter"]) (array). Readers comparing the two tabs will be confused about when to use which form. Unify or add a note explaining the difference.


Minor observations

  • @nocheck on doc code blocks: Adding @nocheck to every TypeScript snippet in the MDX file disables type checking. Inline examples with @nocheck won't catch future API drift. Consider removing it and fixing any type errors instead, or at least limiting it to tabs where the type is genuinely unresolvable in a standalone snippet.

  • Missing events test in hello-world-effect: The README and quickstart both highlight events (rawRivetkitContext.broadcast) as a feature, but no test covers the event path. A test that subscribes to newCount and asserts it fires on Increment would close the gap and serve as runnable documentation.

  • rawRivetkitContext without explanation: The wake-function signature { rawRivetkitContext, state } will surprise Effect users since broadcast escapes the Effect layer. A one-line comment in the example noting why this is an escape hatch (events aren't yet lifted to Effect-native APIs) would reduce confusion.


What looks good

  • The contract/implementation split (api.ts vs live.ts) is a clean pattern and is well-explained in both the READMEs and the quickstart doc.
  • The freshRoom helper in chat-room-effect tests correctly isolates state across cases.
  • Vitest + @effect/vitest versions are consistent across both examples.
  • Sitemap is updated with the new page as required.
  • The Rust quickstart badge upgrade from Preview → Beta is a clean fix alongside the new Effect addition.
  • hello-world-effect/package.json correctly sets "skipVercel": true to opt out of the Vercel mirror.

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