Skip to content

Migrate room-service & room-worker RPCs to pkg/natsrouter#274

Open
vjauhari-work wants to merge 3 commits into
mainfrom
claude/zen-brown-Atb7v
Open

Migrate room-service & room-worker RPCs to pkg/natsrouter#274
vjauhari-work wants to merge 3 commits into
mainfrom
claude/zen-brown-Atb7v

Conversation

@vjauhari-work
Copy link
Copy Markdown
Collaborator

@vjauhari-work vjauhari-work commented Jun 4, 2026

Summary

Migrates all 18 room-service NATS request/reply RPC handlers and room-worker's single RPC (serverCreateDM) off the legacy nc.QueueSubscribe + hand-written wrapper + wrappedCtx pattern onto pkg/natsrouter typed handlers.

This unblocks per-message concurrency (handlers previously dispatched serially per subscription) and centralizes JSON marshal/unmarshal, error replies, panic recovery, request-ID handling, and logging — bringing both services in line with search-service / history-service. room-worker's JetStream consumer is intentionally untouched.

It's a pure transport/plumbing swap: subjects, request/response JSON, DB calls, and business logic are preserved.

Commits (3, grouped by area)

  1. docs — design spec, implementation plan, and client-api.md (rename malformed-body error → bad_request / "invalid request payload", plus a §6 note that the transport layer rejects malformed bodies uniformly).
  2. feat(pkg) — strict RequireRequestID() middleware (rejects missing/invalid X-Request-ID, never mints, nil-Msg-safe); 15 {name} *Pattern subject builders, proven byte-identical to the existing *Wildcard subscriptions; StatusReply / StatusWithRequestReply / RoomRenameRequest model types.
  3. refactor(services) — all 18 room-service RPCs + room-worker's serverCreateDM converted to typed Register / RegisterNoBody handlers; both main.gos cut over to a natsrouter.Router (Recovery → RequireRequestID → Logging; router.Shutdown before nc.Drain).

Behavior

  • Preserved: subjects, request/response schemas, status strings, error envelopes, and the DB/publish call surface — verified by a diff showing not one store/keyStore/Cassandra/publish call line changed.
  • Intended deltas (2): malformed request body now returns bad_request / "invalid request payload" uniformly (was per-handler; rename/restricted previously collapsed to internal — a latent bug fix). The app-handler response-size cap is preserved.

Testing

  • make lint 0 issues · full make test green · gosec + errcode-semgrep clean.
  • Integration suites pass against real NATS/MongoDB/Cassandra/Valkey: room-service ok 183s, room-worker ok 11s.

https://claude.ai/code/session_01MnoZcdKefMvNcAFi1SkbZZ


Generated by Claude Code

Summary by CodeRabbit

  • Documentation

    • Standardized client API error docs: malformed RPC payloads return bad_request / "invalid request payload"; Create/Rename Room X-Request-ID cases documented as bad_request / reason: request_id_required. Added migration plan and design for router-based room-service/worker migration.
  • New Features

    • Router-based wiring, strict request‑ID enforcement middleware, typed request/response payloads, and subject pattern builders for room RPCs.
  • Bug Fixes

    • Clarified pinned-message test queries to use the correct timestamp column.
  • Tests

    • Expanded unit/integration coverage for models, middleware, router flows, and migrated handler paths.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR migrates room-service (18 RPCs) and a room-worker RPC to pkg/natsrouter: adds strict RequireRequestID middleware, typed request/response models, subject-pattern builders, converts handlers to typed natsrouter signatures, updates main shutdown wiring, and refactors unit/integration tests and client API docs.

Changes

NATS Router Migration: room-service & room-worker

Layer / File(s) Summary
Design spec and implementation plan
docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md, docs/superpowers/plans/2026-06-04-room-service-natsrouter-migration.md
Adds migration scope, middleware ordering, subject-pattern rules, typed contracts, per-RPC inventory, and rollout/testing sequencing.
Models, middleware, and pattern tests
pkg/model/event.go, pkg/model/model_test.go, pkg/natsrouter/middleware.go, pkg/natsrouter/middleware_test.go, pkg/subject/subject.go, pkg/subject/subject_test.go
Adds StatusReply, StatusWithRequestReply, RoomRenameRequest; implements RequireRequestID() and four unit tests; adds room-service subject pattern builders and wildcard-equivalence test.
room-service handler conversions
room-service/handler.go, room-service/helper.go
Converts 18 RPCs to typed natsrouter handlers, introduces Handler.Register(r *natsrouter.Router), returns typed response structs (e.g., *model.StatusReply, *model.StatusWithRequestReply, *model.CreateRoomReply), and replaces NATS-specific bounded-reply plumbing with boundedReply[T].
room-service wiring, integration tests, and docs
room-service/main.go, room-service/integration_test.go, room-service/memberlist_client.go, room-service/store.go, docs/client-api.md
Wires router + middleware in main, replaces RegisterCRUD usage with router registration and shutdown, refactors integration tests to use natsrouter contexts and direct handler calls, and updates client API docs to document router-level bad_request / "invalid request payload" and request_id_required behaviors.
room-worker handler, tests, and wiring
room-worker/handler.go, room-worker/handler_test.go, room-worker/integration_test.go, room-worker/main.go
Adds Handler.serverCreateDM(c *natsrouter.Context, model.SyncCreateDMRequest), removes legacy NATS entrypoints, refactors unit/integration tests to call serverCreateDM with router contexts, and updates main to register the handler on a natsrouter with middleware and router shutdown.

Sequence Diagram

sequenceDiagram
  participant Client
  participant RoomServiceRouter
  participant RequireRequestID
  participant RoomHandler
  participant StreamPublisher
  Client->>RoomServiceRouter: publish request (subject + body + X-Request-ID)
  RoomServiceRouter->>RequireRequestID: validate X-Request-ID
  RequireRequestID->>RoomHandler: invoke typed handler with context
  RoomHandler->>StreamPublisher: publish canonical stream request (when applicable)
  RoomHandler-->>RoomServiceRouter: return typed response (Status/CreateRoomReply)
  RoomServiceRouter-->>Client: marshal & reply
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • hmchangw/chat#164: Prior work on the sync DM endpoint and its tests that this migration builds on.
  • hmchangw/chat#41: Earlier pkg/natsrouter work extended here via middleware additions.
  • hmchangw/chat#131: Related request-ID propagation/validation changes reused by RequireRequestID.

Suggested reviewers

  • mliu33

"🐰
I hopped through subjects, patterns tight,
Stamped each request-id, kept replies polite.
Typed structs now answer every call,
Routers hum softly, middleware stands tall.
A nibble of docs — migration done, delight!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.37% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: migrating room-service and room-worker RPCs from legacy NATS patterns to pkg/natsrouter.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/zen-brown-Atb7v

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 `@room-worker/integration_test.go`:
- Around line 1153-1156: The test reuses a single mutable natsrouter.Context
(ctx) across multiple handler.serverCreateDM calls which can leak state; create
a fresh natsrouter.Context for each simulated delivery/replay invocation and
pass that new context into serverCreateDM (e.g., newCtx1 :=
natsrouter.NewContext(...) / construct a fresh context per call and use
handler.serverCreateDM(newCtx1, req), then newCtx2 for the next call). Apply the
same change for the other duplicated invocations (the pairs around the regions
noted for lines 1188-1189 and 1216-1217) so each serverCreateDM call gets its
own independent context.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: eefd33c9-8107-4125-954a-cbb9ed904ac6

📥 Commits

Reviewing files that changed from the base of the PR and between de844af and 0a0dbc4.

📒 Files selected for processing (20)
  • docs/client-api.md
  • docs/superpowers/plans/2026-06-04-room-service-natsrouter-migration.md
  • docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md
  • pkg/model/event.go
  • pkg/model/model_test.go
  • pkg/natsrouter/middleware.go
  • pkg/natsrouter/middleware_test.go
  • pkg/subject/subject.go
  • pkg/subject/subject_test.go
  • room-service/handler.go
  • room-service/handler_test.go
  • room-service/helper.go
  • room-service/integration_test.go
  • room-service/main.go
  • room-service/memberlist_client.go
  • room-service/store.go
  • room-worker/handler.go
  • room-worker/handler_test.go
  • room-worker/integration_test.go
  • room-worker/main.go

Comment thread room-worker/integration_test.go Outdated
@vjauhari-work vjauhari-work force-pushed the claude/zen-brown-Atb7v branch 2 times, most recently from 40e25ec to 3faf8e3 Compare June 5, 2026 01:52
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@docs/superpowers/plans/2026-06-04-room-service-natsrouter-migration.md`:
- Around line 121-137: The example calls errnats.Reply(c, c.Msg, err)
unconditionally which panics when c.Msg is nil (test contexts); update
RequireRequestID to check c.Msg != nil before invoking errnats.Reply and
otherwise handle the error without replying (e.g., log the error on c.ctx or
c.Logger and call c.Abort()), ensuring you only call errnats.Reply when c.Msg is
non-nil.

In
`@docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md`:
- Around line 82-94: The example in RequireRequestID replies with c.Msg
unconditionally on error which can panic when c.Msg is nil; update the error
path to guard the reply with a nil check (e.g. if c.Msg != nil {
errnats.Reply(c, c.Msg, err) }) before calling c.Abort(), keeping the rest of
the logic and the call to natsutil.RequireRequestID unchanged.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5c88f297-1246-41bf-8583-ab986f5b7664

📥 Commits

Reviewing files that changed from the base of the PR and between 0a0dbc4 and 3faf8e3.

📒 Files selected for processing (20)
  • docs/client-api.md
  • docs/superpowers/plans/2026-06-04-room-service-natsrouter-migration.md
  • docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md
  • pkg/model/event.go
  • pkg/model/model_test.go
  • pkg/natsrouter/middleware.go
  • pkg/natsrouter/middleware_test.go
  • pkg/subject/subject.go
  • pkg/subject/subject_test.go
  • room-service/handler.go
  • room-service/handler_test.go
  • room-service/helper.go
  • room-service/integration_test.go
  • room-service/main.go
  • room-service/memberlist_client.go
  • room-service/store.go
  • room-worker/handler.go
  • room-worker/handler_test.go
  • room-worker/integration_test.go
  • room-worker/main.go
✅ Files skipped from review due to trivial changes (2)
  • room-service/store.go
  • room-service/memberlist_client.go
🚧 Files skipped from review as they are similar to previous changes (13)
  • pkg/subject/subject_test.go
  • room-worker/main.go
  • pkg/natsrouter/middleware_test.go
  • room-service/main.go
  • pkg/model/event.go
  • pkg/model/model_test.go
  • docs/client-api.md
  • pkg/subject/subject.go
  • room-worker/integration_test.go
  • pkg/natsrouter/middleware.go
  • room-service/integration_test.go
  • room-worker/handler_test.go
  • room-service/handler.go

@vjauhari-work vjauhari-work force-pushed the claude/zen-brown-Atb7v branch from 3faf8e3 to bf175f0 Compare June 5, 2026 02:04
Copy link
Copy Markdown
Collaborator

@GITMateuszCharczuk GITMateuszCharczuk left a comment

Choose a reason for hiding this comment

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

Correct migration, everything checks out. No issues.

@vjauhari-work vjauhari-work force-pushed the claude/zen-brown-Atb7v branch from bf175f0 to 3d2cb62 Compare June 7, 2026 06:31
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@docs/superpowers/plans/2026-06-04-room-service-natsrouter-migration.md`:
- Line 5: The plan's migration counts are out of sync: include the additional
typed routes/builders `member.statuses` and `subscription.mentionable` in the
scope and update the overall RPC/pattern totals (previously "18 RPCs / 15 room
patterns") wherever those totals are stated; search for references to
`member.statuses`, `subscription.mentionable`, `room-service`,
`natsServerCreateDM`, and `pkg/natsrouter` in the doc and increment the
checklist numbers and any numbered ranges to reflect the true count so the
migration checklist and all mentions match the actual wired surface.

In
`@docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md`:
- Around line 121-123: The spec uses the placeholder `{org}` but the
code/handler contract uses `{orgID}`; update this section (and any other
occurrences in the file) to use `{orgID}` so the token names are consistent with
the implemented pattern and future c.Param(...) wiring, and ensure the example
subject names/subject_test.go cases for RoomsInfoBatchSubscribe, RoomKeyEnsure
and RoomRestricted are described using `{orgID}` rather than `{org}`.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: d25d8a2a-cb82-4eb0-bdc0-db4d513d2356

📥 Commits

Reviewing files that changed from the base of the PR and between 3faf8e3 and 3d2cb62.

📒 Files selected for processing (20)
  • docs/client-api.md
  • docs/superpowers/plans/2026-06-04-room-service-natsrouter-migration.md
  • docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md
  • pkg/model/event.go
  • pkg/model/model_test.go
  • pkg/natsrouter/middleware.go
  • pkg/natsrouter/middleware_test.go
  • pkg/subject/subject.go
  • pkg/subject/subject_test.go
  • room-service/handler.go
  • room-service/handler_test.go
  • room-service/helper.go
  • room-service/integration_test.go
  • room-service/main.go
  • room-service/memberlist_client.go
  • room-service/store.go
  • room-worker/handler.go
  • room-worker/handler_test.go
  • room-worker/integration_test.go
  • room-worker/main.go
✅ Files skipped from review due to trivial changes (3)
  • room-service/store.go
  • room-service/memberlist_client.go
  • docs/client-api.md
🚧 Files skipped from review as they are similar to previous changes (12)
  • pkg/subject/subject_test.go
  • pkg/model/event.go
  • pkg/natsrouter/middleware.go
  • room-worker/main.go
  • pkg/natsrouter/middleware_test.go
  • room-service/main.go
  • pkg/model/model_test.go
  • room-worker/integration_test.go
  • room-worker/handler.go
  • room-service/helper.go
  • room-service/integration_test.go
  • room-worker/handler_test.go

Comment thread docs/superpowers/plans/2026-06-04-room-service-natsrouter-migration.md Outdated
Comment thread docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md Outdated
@vjauhari-work vjauhari-work force-pushed the claude/zen-brown-Atb7v branch from 3d2cb62 to a374fca Compare June 7, 2026 06:40
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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
`@docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md`:
- Around line 5-6: The doc's totals are inconsistent: reconcile the RPC and
pattern counts between the design spec and implementation plan by auditing every
NATS RPC in room-service and room-worker (including natsServerCreateDM) that are
moving off raw nc.QueueSubscribe + handwritten pattern builders; produce a
single authoritative list mapping each RPC name to its pattern-builder status
(e.g., migrated vs pending) and update the summary counts (total RPCs and total
pattern builders) in the spec text and the per-RPC inventory so the numbers at
lines referenced (including the counts near the 18/15 vs 20/17 discrepancy)
match the actual listed RPC entries and implementation plan.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 27ead81f-bbe8-45fd-ba03-f39a16110c94

📥 Commits

Reviewing files that changed from the base of the PR and between 3d2cb62 and 79a5c9f.

📒 Files selected for processing (21)
  • docs/client-api.md
  • docs/superpowers/plans/2026-06-04-room-service-natsrouter-migration.md
  • docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md
  • history-service/internal/cassrepo/reactions_integration_test.go
  • pkg/model/event.go
  • pkg/model/model_test.go
  • pkg/natsrouter/middleware.go
  • pkg/natsrouter/middleware_test.go
  • pkg/subject/subject.go
  • pkg/subject/subject_test.go
  • room-service/handler.go
  • room-service/handler_test.go
  • room-service/helper.go
  • room-service/integration_test.go
  • room-service/main.go
  • room-service/memberlist_client.go
  • room-service/store.go
  • room-worker/handler.go
  • room-worker/handler_test.go
  • room-worker/integration_test.go
  • room-worker/main.go
✅ Files skipped from review due to trivial changes (2)
  • room-service/memberlist_client.go
  • room-service/store.go
🚧 Files skipped from review as they are similar to previous changes (14)
  • pkg/model/event.go
  • pkg/model/model_test.go
  • pkg/subject/subject_test.go
  • pkg/natsrouter/middleware.go
  • pkg/natsrouter/middleware_test.go
  • docs/client-api.md
  • room-service/helper.go
  • room-service/main.go
  • pkg/subject/subject.go
  • room-worker/integration_test.go
  • room-worker/main.go
  • room-worker/handler_test.go
  • room-service/handler.go
  • room-service/integration_test.go

Comment thread docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md Outdated
@vjauhari-work vjauhari-work force-pushed the claude/zen-brown-Atb7v branch from 79a5c9f to d5be424 Compare June 7, 2026 15:28
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md (1)

246-246: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use orgID consistently in the org-members contract text.

The spec still mixes org / orgId with the {orgID} token used by the pattern-builder contract. Please align these references to orgID to avoid c.Param(...) naming drift in implementation/tests.

Also applies to: 263-266

🤖 Prompt for 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.

In
`@docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md`
at line 246, The org-members contract mixes `org`/`orgId` with the `{orgID}`
token causing naming drift; update the spec so all references use `orgID`
consistently (including the table row for `list-org-members` and the related
text around `OrgMembersPattern` and `ListOrgMembersResponse`), ensure the
pattern token is `{orgID}` everywhere and any example param mentions
`c.Param("orgID")` instead of `org`/`orgId`; also apply the same change to the
referenced block around lines 263-266 so the entire org-members contract
consistently uses `orgID`.
🤖 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.

Duplicate comments:
In
`@docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md`:
- Line 246: The org-members contract mixes `org`/`orgId` with the `{orgID}`
token causing naming drift; update the spec so all references use `orgID`
consistently (including the table row for `list-org-members` and the related
text around `OrgMembersPattern` and `ListOrgMembersResponse`), ensure the
pattern token is `{orgID}` everywhere and any example param mentions
`c.Param("orgID")` instead of `org`/`orgId`; also apply the same change to the
referenced block around lines 263-266 so the entire org-members contract
consistently uses `orgID`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6afe9a7-7359-4c43-be66-aba8a8aefbdf

📥 Commits

Reviewing files that changed from the base of the PR and between 79a5c9f and d5be424.

📒 Files selected for processing (21)
  • docs/client-api.md
  • docs/superpowers/plans/2026-06-04-room-service-natsrouter-migration.md
  • docs/superpowers/specs/2026-06-04-room-service-natsrouter-migration-design.md
  • history-service/internal/cassrepo/reactions_integration_test.go
  • pkg/model/event.go
  • pkg/model/model_test.go
  • pkg/natsrouter/middleware.go
  • pkg/natsrouter/middleware_test.go
  • pkg/subject/subject.go
  • pkg/subject/subject_test.go
  • room-service/handler.go
  • room-service/handler_test.go
  • room-service/helper.go
  • room-service/integration_test.go
  • room-service/main.go
  • room-service/memberlist_client.go
  • room-service/store.go
  • room-worker/handler.go
  • room-worker/handler_test.go
  • room-worker/integration_test.go
  • room-worker/main.go
✅ Files skipped from review due to trivial changes (1)
  • room-service/store.go
🚧 Files skipped from review as they are similar to previous changes (14)
  • room-service/memberlist_client.go
  • pkg/subject/subject_test.go
  • room-service/main.go
  • room-worker/main.go
  • pkg/model/model_test.go
  • history-service/internal/cassrepo/reactions_integration_test.go
  • pkg/natsrouter/middleware.go
  • pkg/subject/subject.go
  • pkg/natsrouter/middleware_test.go
  • docs/client-api.md
  • room-service/helper.go
  • room-worker/handler.go
  • room-service/handler.go
  • room-service/integration_test.go

claude added 3 commits June 7, 2026 15:47
…t-api

Design spec + implementation plan for migrating room-service (20 RPCs, incl.
member.statuses and subscription.mentionable) and room-worker's serverCreateDM
onto pkg/natsrouter. client-api.md: rename malformed-body error is now
bad_request/"invalid request payload", with a note that the transport layer
rejects malformed bodies uniformly, plus a consolidated request-id-required note.

https://claude.ai/code/session_01MnoZcdKefMvNcAFi1SkbZZ
…ter migration

- pkg/natsrouter: strict RequireRequestID() middleware (rejects missing/invalid
  X-Request-ID, never mints, nil-Msg-safe) + tests.
- pkg/subject: 17 {name} *Pattern builders, proven byte-identical to the
  existing *Wildcard subscription subjects.
- pkg/model: StatusReply, StatusWithRequestReply, RoomRenameRequest + round-trips.

https://claude.ai/code/session_01MnoZcdKefMvNcAFi1SkbZZ
Move all 20 room-service request/reply RPCs and room-worker's serverCreateDM off
raw nc.QueueSubscribe + hand-written wrappers onto pkg/natsrouter typed handlers;
cut both main.go's over to a Router (Recovery -> RequireRequestID -> Logging,
router.Shutdown before nc.Drain). Includes member.statuses and
subscription.mentionable (added on main in #260). Subjects, request/response
JSON, DB calls, and business logic preserved; rename/restricted malformed-body
now returns bad_request instead of internal.

Also fixes a pre-existing, unrelated CI failure on main: the history-service
reactions integration tests referenced a non-existent pinned_at column on
messages_by_room and mis-keyed pinned_messages_by_room; aligned both with the
actual Cassandra schema.

https://claude.ai/code/session_01MnoZcdKefMvNcAFi1SkbZZ
@vjauhari-work vjauhari-work force-pushed the claude/zen-brown-Atb7v branch from d5be424 to bdd2bfd Compare June 7, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants