feat(realtime): wrap NATS wire protocol in nats, keep the seam - #79
Conversation
- delete 1,019 LOC of hand-rolled protocol (nats-protocol/commands/socket/ connection) and the 431-line fake nats-server; nats@2.29.3 pinned exact, the first external runtime dep any @ultimat3/* package has taken - add the port (nats-client.ts) and its one adapter (nats-lib-client.ts) — the only file in the repo that imports nats - keep the seam: Transport, NatsTransport, NatsTransportOptions and selectTransport unchanged; presence.live.test.ts passes unmodified - reconnect and re-subscription are the library's now, with our thundering-herd jitter handed down as its reconnectDelayHandler; the JetStream KV layer stays ours (per-message TTL, batch multi_last) - test seam moves from an injected byte stream to an injected client; nats-fake.ts is now an in-memory bus implementing the port - Bun compatibility gate passed: verified on Bun 1.3 against a real nats-server 2.11.17 Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 46 seconds Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (30)
Comment |
|
This PR looks ready — CI is green and there are no risk signals. The internal NATS protocol implementation swap to the official Feel free to apply a 🤖 Posted by developerz.ai — the maintainer agent, not a human. |
Summary
nats(nats.js) library behind the existingTransport/NatsTransport/selectTransportseam — 1,019 LOC of hand-rolled protocol code deleted; zero caller-facing change. Documented indocs/idea/18-build-vs-wrap.md.nats-transport.live.test.tsandpresence.live.test.ts(bothdescribe.skipIf(TEST_NATS_URL === undefined)) actually run and pass, unmodified, against a real JetStream-enablednats-server— not just the in-memory fake they were co-written with.Test plan
TEST_NATS_URL=nats://localhost:14222 bun test packages/realtime/src/nats-transport.live.test.ts→ 6 pass, 0 failTEST_NATS_URL=nats://localhost:14222 bun test packages/realtime/src/presence.live.test.ts→ 3 pass, 0 failTEST_NATS_URL=nats://localhost:14222 bun test packages/realtime→ 441 pass, 0 fail (9 more than without the env var — exactly the two live suites)bun run scripts/verify.ts --json, with and withoutTEST_NATS_URL→ 14/17 both times,livestepok:true, no regressiondocs/idea/18-build-vs-wrap.md) was not neededgit statusclean — live suites required zero modification to pass🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.