Skip to content

docs: expand the moderated chat room example - #227

Merged
electrohyun merged 1 commit into
mainfrom
electrohyun/thornyhead
Aug 12, 2026
Merged

electrohyun merged 1 commit into
mainfrom
electrohyun/thornyhead

Conversation

@electrohyun

@electrohyun electrohyun commented Aug 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Expand examples/chat-room into a moderated application where Alice, Bob, and Carol join general and support, exchange a room message, handle an authorization rejection, receive a multi-room announcement once, and observe Bob's departure.
  • Separate the server, shared scenario, CLI output, and Node assertions into app.js, scenario.js, index.js, and scenario.test.js, with cleanup verified by running the scenario twice in one process.
  • Make the workflow deterministic with acknowledgements, observable events, and per-socket markers instead of delays or timeouts, while keeping moderator authorization in a server-owned fixture.
  • Run the application test and transcript from pnpm example:chat-room, preserve smocket: workspace:*, and document how the example combines behavior already covered by the dual-run conformance suite.

Related issue

Closes #113

Checklist

  • Tests added or updated
  • Behavior verified against real socket.io

@github-actions github-actions Bot added documentation Improvements or additions to documentation 📏 l Pull request changes 200–999 lines labels Aug 12, 2026
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@electrohyun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ab2a0897-0bfd-44c3-9a73-948e159f2bb6

📥 Commits

Reviewing files that changed from the base of the PR and between 8d67272 and 44ba8b2.

📒 Files selected for processing (1)
  • examples/chat-room/README.md
📝 Walkthrough

Walkthrough

The chat-room example now implements a moderated multi-channel workflow with three participants. It adds deterministic scenario execution, transcript assertions across repeated runs, reliable cleanup, expanded documentation, and explicit separation between Vitest suites and Node application tests.

Changes

Moderated chat-room workflow

Layer / File(s) Summary
Chat application behavior
examples/chat-room/app.js
Adds validated joins, room messaging, moderator-only announcements, departure notifications, and idempotent application shutdown.
Deterministic scenario execution
examples/chat-room/scenario.js, examples/chat-room/index.js
Runs the three-participant workflow with acknowledgement checks, event markers, transcript generation, and cleanup.
Scenario validation and command wiring
examples/chat-room/scenario.test.js, examples/chat-room/package.json, package.json
Tests the workflow twice and runs the example test suite before starting the example.
Vitest test scope
vitest.config.ts, vitest.browser.config.ts
Restricts Vitest projects to Vitest suites while keeping the application test under Node’s test runner.
Example workflow documentation
examples/chat-room/README.md
Documents the workflow, commands, transcript, API usage, synchronization, cleanup, and conformance boundary.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant runScenario
  participant createChatApplication
  participant Alice
  participant Bob
  participant Carol
  runScenario->>createChatApplication: start application
  runScenario->>Alice: connect and join channels
  runScenario->>Bob: connect and join channels
  runScenario->>Carol: connect and join channels
  Alice->>createChatApplication: send channel message
  createChatApplication-->>Bob: deliver targeted room message
  Bob->>createChatApplication: request announcement
  createChatApplication-->>Bob: reject unauthorized request
  Carol->>createChatApplication: send moderator announcement
  createChatApplication-->>Alice: broadcast announcement
  createChatApplication-->>Bob: broadcast announcement
  Bob->>runScenario: disconnect
  createChatApplication-->>Alice: emit departure notification
  runScenario->>createChatApplication: close application
  createChatApplication-->>runScenario: return transcript
Loading

Possibly related issues

Possibly related PRs

Suggested labels: enhancement

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: expanding the moderated chat-room example.
Description check ✅ Passed The description directly explains the moderated chat-room workflow, file structure, testing, cleanup, and execution changes.
Linked Issues check ✅ Passed The changes implement the linked issue objectives for rooms, broadcasts, acknowledgements, targeted delivery, roles, disconnects, deterministic tests, and documentation.
Out of Scope Changes check ✅ Passed The package scripts and Vitest configuration changes support the example workflow and test separation, so no unrelated changes are evident.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@electrohyun
electrohyun force-pushed the electrohyun/thornyhead branch from 2537182 to 8d67272 Compare August 12, 2026 03:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/chat-room/app.js`:
- Around line 23-34: Update the join-channel handler to guard both acknowledge
calls with typeof acknowledge === 'function' before invoking them, preserving
the existing accepted and unknown-channel responses when a callback is supplied.
Add tests covering clients with and without acknowledgement callbacks, and
verify completion using a subsequent marker event.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 041fed91-1640-4a04-b853-9f6d826d5333

📥 Commits

Reviewing files that changed from the base of the PR and between 30c8098 and 8d67272.

📒 Files selected for processing (9)
  • examples/chat-room/README.md
  • examples/chat-room/app.js
  • examples/chat-room/index.js
  • examples/chat-room/package.json
  • examples/chat-room/scenario.js
  • examples/chat-room/scenario.test.js
  • package.json
  • vitest.browser.config.ts
  • vitest.config.ts

Comment thread examples/chat-room/app.js Resolved
@electrohyun
electrohyun force-pushed the electrohyun/thornyhead branch from 8d67272 to 44ba8b2 Compare August 12, 2026 04:05
@electrohyun electrohyun self-assigned this Aug 12, 2026
@electrohyun
electrohyun merged commit fd9e1bf into main Aug 12, 2026
14 checks passed
@electrohyun
electrohyun deleted the electrohyun/thornyhead branch August 12, 2026 04:13
@github-project-automation github-project-automation Bot moved this to Done in smocket Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation 📏 l Pull request changes 200–999 lines

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

docs: expand the chat room into an application workflow

1 participant