Skip to content

Commit 265f391

Browse files
mpstatonclaude
andcommitted
changelog(nats-migration), plan(status): record the 10-service nats@2 -> @nats-io/* v3 migration as shipped
The migration executed across the preceding 10 commits (pilot bcca58a through the workspace hub) is now on the record: changelog entry with the mapping, the two verification gates (pilot live round-trip; 12/12 full-stack scripted sweep through rebuilt Docker images), and the decisions kept out of scope (shared nats helper stays a follow-on). The plan's frontmatter moves Draft -> Implemented with an execution revision noting the @nats-io/nats-core type fallback was never needed. Files changed: - changelog/2026-07-01_01_Whole-Bus-Off-Deprecated-nats-2-Onto-nats-io-v3.md - context-v/plans/Migrate-off-Deprecated-nats-Package-to-nats-io-Scoped-v3.md Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 02ddd8f commit 265f391

2 files changed

Lines changed: 105 additions & 2 deletions

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
date_created: 2026-07-01
3+
date_modified: 2026-07-01
4+
title: "The whole bus moves off deprecated nats@2 onto @nats-io/transport-node v3"
5+
lede: "All 10 services swapped the deprecated monolithic nats package for the scoped @nats-io/* v3 client — 27 files, one codec rewrite, zero wire-protocol changes — and every service round-tripped live on the rebuilt stack before the branch moved on."
6+
publish: true
7+
authors:
8+
- Michael Staton
9+
augmented_with:
10+
- Claude Code on Claude Fable 5
11+
files_changed:
12+
- services/record-surrealdb-resolver/src/{server,handlers,domains}.ts
13+
- services/xlsx-ingest/src/server.ts
14+
- services/ingest/src/server.ts
15+
- services/prompt-store/src/{server,handlers}.ts
16+
- services/response-store/src/{server,handlers}.ts
17+
- services/row-store/src/{server,handlers}.ts
18+
- services/content-ingest/src/{server,handlers}.ts
19+
- services/social-search/src/{search,server,entity-pulse/dispatch}.ts
20+
- services/prompt-runner/src/{apply,chat-turn,drafter,preview,run,server}.ts
21+
- services/workspace/src/{nats,capabilities,chat,workspaces,ws}.ts
22+
- services/*/package.json
23+
- pnpm-lock.yaml
24+
tags:
25+
- Progress-Update
26+
- Dependency-Migration
27+
- NATS
28+
- Message-Bus
29+
- Services
30+
- Deprecation
31+
---
32+
33+
## Why Care?
34+
35+
Every `pnpm install` printed `WARN deprecated nats@2.29.3` — the monolithic
36+
nats.js v2 package is end-of-life, split upstream into scoped `@nats-io/*`
37+
packages. This was the one dependency deliberately parked during the
38+
2026-07-01 upgrade campaign (Zod 4, Rsbuild 2 + MF 2.6, TypeScript 6,
39+
csv-parse 7) because it isn't a version bump: the codec utilities were
40+
**removed** in v3, so the swap rewrites how every inter-service message is
41+
encoded and decoded, across the message plumbing of all 10 backend services
42+
at once. A blind bump would have compiled fine in places and broken the bus
43+
at runtime.
44+
45+
## What Shipped
46+
47+
All 10 services (`record-surrealdb-resolver`, `xlsx-ingest`, `ingest`,
48+
`prompt-store`, `response-store`, `row-store`, `content-ingest`,
49+
`social-search`, `prompt-runner`, `workspace`) now declare
50+
`@nats-io/transport-node@^3.4.0` instead of `nats@^2.28.0`. The whole
51+
migration is five mechanical rewrites, per the plan's mapping table:
52+
53+
- `from 'nats'``from '@nats-io/transport-node'`
54+
- `JSONCodec` import — dropped (removed in v3)
55+
- `const jc = JSONCodec();` — deleted (10 copies)
56+
- `jc.encode(obj)``JSON.stringify(obj)` (publish / request / respond all
57+
accept strings)
58+
- `jc.decode(X.data) as T``X.json() as T` — contextual on the `Msg`
59+
variable name (`msg`, `reply`, `saveReply`, `parentReply`, `ingestReply`)
60+
61+
`connect()`, `subscribe()`, `publish()`, `request()`, `respond()`, and the
62+
`for await (const msg of sub)` iteration are unchanged. The NATS server,
63+
subjects, message shapes, and capability contracts are untouched — the wire
64+
protocol is identical.
65+
66+
## How It Was Proven
67+
68+
Per the plan's two load-bearing gates:
69+
70+
1. **Pilot gate**`record-surrealdb-resolver` migrated first and proven on
71+
the live broker before fan-out: a real `resolver.search.requested`
72+
request/reply round-tripped against SurrealDB (`ok:true`, 8 candidates)
73+
through the new encode/decode path.
74+
2. **Full-stack gate** — after the nine-service fan-out, the Docker images
75+
were rebuilt (`docker compose up --build`) and a scripted sweep fired one
76+
real round-trip through **every** service: workspace active-query,
77+
record-set list, prompt list, response list, connector inventory,
78+
resolver search, corpus list-for-record, prompt-run cancel, and full
79+
create-then-delete ingest cycles for both CSV and XLSX. 12/12 passed;
80+
service logs show zero JSON decode errors.
81+
82+
`pnpm install` no longer prints a deprecation warning; the lockfile no
83+
longer resolves `nats@2.x`; tree-wide typecheck is clean.
84+
85+
## Decisions On The Record
86+
87+
- **No shared `@augment-it/nats` helper yet.** Ten near-identical `connect`
88+
call sites still beg for consolidation, but folding a refactor into a
89+
migration doubles the risk surface. It stays a follow-on, per the plan's
90+
Open Questions.
91+
- **`as T` casts kept over `msg.json<T>()`** — smaller, more literal diff
92+
matching the existing style.
93+
- One commit per service (pilot + nine), each atomic with its
94+
`package.json` and lockfile, so any service can be bisected or reverted
95+
independently.
96+
97+
## See Also
98+
99+
- `context-v/plans/Migrate-off-Deprecated-nats-Package-to-nats-io-Scoped-v3.md`
100+
— the plan this executed, mapping table and all
101+
- nats.js v2→v3 migration guide —
102+
`https://github.com/nats-io/nats.js/blob/main/migration.md`

context-v/plans/Migrate-off-Deprecated-nats-Package-to-nats-io-Scoped-v3.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ authors:
77
- Michael Staton
88
augmented_with:
99
- Claude Code on Claude Opus 4.8 (1M context)
10-
semantic_version: 0.0.0.1
10+
semantic_version: 0.0.1.0
1111
revisions:
1212
- 2026-07-01 — Initial draft. Written at the tail of a workspace-wide dependency-upgrade campaign (Zod 4, Rsbuild 2 + Module Federation 2.6, TypeScript 6, csv-parse 7). `nats` was the one item deliberately parked because it's a deprecation-migration, not a version bump — the inter-service bus across ~10 services, needing real import-path and codec changes plus a live round-trip test, not a blind `pnpm update`. Authored to be handed to a fresh session whose agents execute it.
13+
- 2026-07-01 — Executed, same day, on `feature/resolve-db`. All four phases ran as written: pilot proven on the live broker (resolver.search round-trip, ok:true, 8 candidates), nine-service fan-out in the planned order (one atomic commit each), hygiene sweep clean (deprecation warning gone, no nats@2 in the lockfile, tree-wide typecheck green), and a scripted full-stack sweep through the rebuilt Docker images — one real round-trip per service incl. CSV + XLSX create-then-delete ingest cycles, 12/12 passed, zero decode errors in the logs. Types re-exported from `@nats-io/transport-node` cleanly (the `@nats-io/nats-core` fallback flagged in Open Questions was never needed). Shipped as changelog/2026-07-01_01.
1314
tags:
1415
- Plan
1516
- Augment-It
@@ -18,7 +19,7 @@ tags:
1819
- Dependency-Migration
1920
- Services
2021
- Deprecation
21-
status: Draft
22+
status: Implemented
2223
---
2324

2425
# Migrate off the deprecated `nats` package to `@nats-io/*` v3

0 commit comments

Comments
 (0)