serverless-ircd 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/.github/workflows/ci.yml +2 -2
  2. package/.github/workflows/deploy-aws.yml +1 -3
  3. package/.github/workflows/deploy-cf-tcp.yml +87 -0
  4. package/.github/workflows/deploy-cf.yml +1 -1
  5. package/.node-version +1 -0
  6. package/.nvmrc +1 -0
  7. package/CHANGELOG.md +174 -18
  8. package/README.md +63 -30
  9. package/apps/aws-stack/README.md +2 -2
  10. package/apps/aws-stack/bin/aws.ts +7 -0
  11. package/apps/aws-stack/package.json +4 -4
  12. package/apps/aws-stack/src/aws-stack.ts +118 -6
  13. package/apps/aws-stack/tests/stack.test.ts +98 -3
  14. package/apps/cf-tcp-container/Dockerfile +69 -0
  15. package/apps/cf-tcp-container/package.json +34 -0
  16. package/apps/cf-tcp-container/src/config-loader.ts +145 -0
  17. package/apps/cf-tcp-container/src/container-do.ts +38 -0
  18. package/apps/cf-tcp-container/src/container-server.ts +363 -0
  19. package/apps/cf-tcp-container/src/main.ts +77 -0
  20. package/apps/cf-tcp-container/src/persistence.ts +144 -0
  21. package/apps/cf-tcp-container/src/worker.ts +41 -0
  22. package/apps/cf-tcp-container/terraform/provider.tf +24 -0
  23. package/apps/cf-tcp-container/terraform/spectrum.tf +81 -0
  24. package/apps/cf-tcp-container/tests/config-loader.test.ts +217 -0
  25. package/apps/cf-tcp-container/tests/container-server.test.ts +465 -0
  26. package/apps/cf-tcp-container/tests/persistence.test.ts +227 -0
  27. package/apps/cf-tcp-container/tests/tls-e2e.test.ts +275 -0
  28. package/apps/cf-tcp-container/tsconfig.build.json +17 -0
  29. package/apps/cf-tcp-container/tsconfig.test.json +15 -0
  30. package/apps/cf-tcp-container/vitest.config.ts +26 -0
  31. package/apps/cf-tcp-container/wrangler.toml +63 -0
  32. package/apps/cf-worker/package.json +1 -1
  33. package/apps/cf-worker/wrangler.test.toml +6 -0
  34. package/apps/cf-worker/wrangler.toml +28 -2
  35. package/apps/local-cli/package.json +1 -1
  36. package/apps/local-cli/src/config-loader.ts +10 -0
  37. package/apps/local-cli/src/server.ts +20 -3
  38. package/package.json +14 -10
  39. package/packages/aws-adapter/package.json +3 -3
  40. package/packages/aws-adapter/src/account-store.ts +1 -1
  41. package/packages/aws-adapter/src/admission.ts +74 -0
  42. package/packages/aws-adapter/src/aws-runtime.ts +6 -4
  43. package/packages/aws-adapter/src/config-loader.ts +32 -0
  44. package/packages/aws-adapter/src/dynamo-account-store.ts +35 -96
  45. package/packages/aws-adapter/src/handlers/connect.ts +64 -8
  46. package/packages/aws-adapter/src/handlers/default.ts +35 -2
  47. package/packages/aws-adapter/src/handlers/index.ts +69 -3
  48. package/packages/aws-adapter/src/handlers/nlb-stream.ts +481 -0
  49. package/packages/aws-adapter/src/handlers/ping-checker.ts +1 -1
  50. package/packages/aws-adapter/src/index.ts +6 -0
  51. package/packages/aws-adapter/tests/account-store-dynamo.test.ts +45 -34
  52. package/packages/aws-adapter/tests/account-store.test.ts +19 -20
  53. package/packages/aws-adapter/tests/admission.test.ts +70 -0
  54. package/packages/aws-adapter/tests/aws-harness.ts +13 -1
  55. package/packages/aws-adapter/tests/config-loader.test.ts +20 -0
  56. package/packages/aws-adapter/tests/connect.test.ts +78 -0
  57. package/packages/aws-adapter/tests/disconnect-fanout.test.ts +47 -40
  58. package/packages/aws-adapter/tests/gone-exception.test.ts +31 -26
  59. package/packages/aws-adapter/tests/handlers.test.ts +154 -53
  60. package/packages/aws-adapter/tests/nlb-stream.test.ts +478 -0
  61. package/packages/aws-adapter/tests/ping-checker.test.ts +34 -29
  62. package/packages/aws-adapter/tests/sweeper.test.ts +25 -18
  63. package/packages/aws-adapter/tests/transactions.test.ts +25 -20
  64. package/packages/cf-adapter/package.json +1 -1
  65. package/packages/cf-adapter/src/cf-runtime.ts +2 -4
  66. package/packages/cf-adapter/src/config-loader.ts +33 -0
  67. package/packages/cf-adapter/src/connection-do.ts +111 -46
  68. package/packages/cf-adapter/src/d1-account-store.ts +198 -0
  69. package/packages/cf-adapter/src/env.ts +33 -9
  70. package/packages/cf-adapter/src/index.ts +9 -8
  71. package/packages/cf-adapter/tests/cf-harness.ts +11 -1
  72. package/packages/cf-adapter/tests/cf-integration.test.ts +2 -1
  73. package/packages/cf-adapter/tests/config-loader.test.ts +22 -0
  74. package/packages/cf-adapter/tests/connection-do-channel-registration.test.ts +37 -0
  75. package/packages/cf-adapter/tests/connection-do-no-batching-reservation.test.ts +52 -0
  76. package/packages/cf-adapter/tests/connection-do-sasl-d1.test.ts +166 -0
  77. package/packages/cf-adapter/tests/d1-account-store.test.ts +226 -0
  78. package/packages/cf-adapter/tests/raw-modules.d.ts +11 -0
  79. package/packages/cf-adapter/tests/worker/main.ts +8 -1
  80. package/packages/cf-adapter/wrangler.test.toml +8 -0
  81. package/packages/in-memory-runtime/package.json +1 -1
  82. package/packages/irc-core/package.json +6 -1
  83. package/packages/irc-core/scripts/generate-build-info.mjs +31 -0
  84. package/packages/irc-core/src/caps/capabilities.ts +23 -2
  85. package/packages/irc-core/src/cloak.ts +1 -1
  86. package/packages/irc-core/src/commands/cap.ts +8 -1
  87. package/packages/irc-core/src/commands/index.ts +9 -0
  88. package/packages/irc-core/src/commands/ison.ts +61 -0
  89. package/packages/irc-core/src/commands/quit.ts +12 -0
  90. package/packages/irc-core/src/commands/registration.ts +18 -12
  91. package/packages/irc-core/src/commands/sasl.ts +72 -9
  92. package/packages/irc-core/src/commands/server-info.ts +129 -0
  93. package/packages/irc-core/src/commands/userhost.ts +84 -0
  94. package/packages/irc-core/src/commands/whowas.ts +113 -0
  95. package/packages/irc-core/src/config.ts +58 -0
  96. package/packages/irc-core/src/credential-hashing.ts +124 -0
  97. package/packages/irc-core/src/effects.ts +6 -29
  98. package/packages/irc-core/src/index.ts +1 -0
  99. package/packages/irc-core/src/ports.ts +181 -12
  100. package/packages/irc-core/src/protocol/numerics.ts +14 -8
  101. package/packages/irc-core/src/types.ts +38 -1
  102. package/packages/irc-core/tests/account-store.test.ts +45 -2
  103. package/packages/irc-core/tests/caps/capabilities.test.ts +4 -3
  104. package/packages/irc-core/tests/commands/cap.test.ts +33 -1
  105. package/packages/irc-core/tests/commands/ison.test.ts +166 -0
  106. package/packages/irc-core/tests/commands/quit.test.ts +69 -2
  107. package/packages/irc-core/tests/commands/registration.test.ts +151 -6
  108. package/packages/irc-core/tests/commands/sasl.test.ts +118 -10
  109. package/packages/irc-core/tests/commands/server-info.test.ts +274 -0
  110. package/packages/irc-core/tests/commands/tagmsg.test.ts +9 -35
  111. package/packages/irc-core/tests/commands/userhost.test.ts +264 -0
  112. package/packages/irc-core/tests/commands/whowas.test.ts +312 -0
  113. package/packages/irc-core/tests/config.test.ts +95 -1
  114. package/packages/irc-core/tests/credential-hashing.test.ts +170 -0
  115. package/packages/irc-core/tests/effects.test.ts +0 -27
  116. package/packages/irc-core/tests/nick-history-store.test.ts +162 -0
  117. package/packages/irc-core/tests/numerics.test.ts +12 -0
  118. package/packages/irc-core/tests/types.test.ts +35 -1
  119. package/packages/irc-core/tsconfig.build.json +1 -1
  120. package/packages/irc-core/tsconfig.test.json +1 -1
  121. package/packages/irc-server/package.json +1 -1
  122. package/packages/irc-server/src/actor.ts +158 -14
  123. package/packages/irc-server/src/dispatch.ts +0 -3
  124. package/packages/irc-server/src/index.ts +10 -2
  125. package/packages/irc-server/src/routing.ts +12 -0
  126. package/packages/irc-server/src/transport.ts +101 -0
  127. package/packages/irc-server/tests/actor.test.ts +400 -3
  128. package/packages/irc-server/tests/dispatch.test.ts +0 -17
  129. package/packages/irc-server/tests/routing.test.ts +4 -0
  130. package/packages/irc-server/tests/transport.test.ts +230 -0
  131. package/packages/irc-test-support/package.json +1 -1
  132. package/packages/irc-test-support/src/harness.ts +44 -9
  133. package/packages/irc-test-support/src/in-memory-harness.ts +73 -9
  134. package/packages/irc-test-support/src/index.ts +3 -0
  135. package/packages/irc-test-support/src/scenarios.ts +132 -2
  136. package/packages/irc-test-support/tests/in-memory-harness.test.ts +2 -1
  137. package/packages/irc-test-support/tests/in-memory-scenarios.test.ts +23 -9
  138. package/pnpm-workspace.yaml +9 -1
  139. package/tools/ci-hardening/package.json +1 -1
  140. package/tools/package.json +4 -0
  141. package/tools/seed-aws-accounts.ts +5 -6
  142. package/tools/seed-cf-accounts.ts +104 -0
  143. package/tools/tcp-ws-forwarder/package.json +1 -1
  144. package/docs/ADR-001-pure-reducers-and-effect-system.md +0 -74
  145. package/docs/ADR-002-location-of-authority.md +0 -82
  146. package/docs/ADR-003-durable-object-sharding.md +0 -93
  147. package/docs/ADR-004-dynamodb-schema.md +0 -96
  148. package/docs/ADR-005-wss-only-transport-v1.md +0 -83
  149. package/docs/ADR-006-sasl-mechanism-scope.md +0 -86
  150. package/docs/ADR-007-deterministic-ports.md +0 -82
  151. package/docs/ADR-008-monorepo-tooling.md +0 -60
  152. package/docs/AWS-Adapter-Architecture.md +0 -496
  153. package/docs/AWS-Deployment.md +0 -1186
  154. package/docs/Cloudflare-Deployment-Guide.md +0 -660
  155. package/docs/Home.md +0 -11
  156. package/docs/Observability.md +0 -87
  157. package/docs/PlanIRCv3Websocket.md +0 -489
  158. package/docs/PlanWebClient.md +0 -451
  159. package/docs/Release-Process.md +0 -443
@@ -1,443 +0,0 @@
1
- # Release Process
2
-
3
- End-to-end runbook for cutting, publishing, and rolling back a
4
- ServerlessIRCd release. This is the canonical process — every release
5
- follows this document top-to-bottom.
6
-
7
- **Distribution model.** All workspace packages are `"private": true`. A
8
- release is a **signed git tag** plus a **GitHub Release** whose body is
9
- copied from `CHANGELOG.md`. There is no npm publish step in 0.x. See
10
- §10 (Future: npm publish) for the criteria that would flip that on.
11
-
12
- **Current cadence.** 0.x is "tag when ready" — there is no fixed
13
- calendar release. Anyone with push rights may propose a release by
14
- opening a PR that bumps versions and updates `CHANGELOG.md`; the
15
- maintainer team cuts the tag.
16
-
17
- Cross-reference: `README.md` (Roadmap), `progress.md` / `tickets.md`
18
- (release content), `docs/deployment-cf.md` (prod deploy step §6),
19
- `.github/workflows/ci.yml`, `.github/workflows/deploy-cf.yml`.
20
-
21
- ---
22
-
23
- ## 1. Versioning
24
-
25
- ServerlessIRCd follows [Semantic Versioning](https://semver.org/) with
26
- the 0.x convention:
27
-
28
- | Bump | When |
29
- |-------------|-----------------------------------------------------------------|
30
- | `0.x.0 → 0.(x+1).0` | Any user-visible behavior change, new command/cap, new adapter, schema change to persisted DO state. |
31
- | `0.x.y → 0.x.(y+1)`* | Internal-only fixes: tests, docs, refactors that don't change runtime behavior, perf work with identical output. (*Reserved for after 1.0; in 0.x every change is allowed to be a minor.) |
32
- | `1.0.0` | The Cloudflare **and** AWS adapters are deployed to staging, the parametrized contract suite passes on both, ≥3 reference clients connect cleanly (PLAN §9 exit criteria). |
33
-
34
- **The 0.x disclaimer.** Per SemVer 0.x, anything may change at any
35
- minor bump. Consumers of `@serverless-ircd/*` packages (today: only
36
- this repo itself) should pin exact versions.
37
-
38
- ### 1.1 Workspace version lock
39
-
40
- All eight `package.json` files (root + 7 workspace packages) carry the
41
- **same** version string. They are bumped together in the release
42
- commit. The pre-release checklist in §4 enforces this.
43
-
44
- Rationale: even though the packages are private today, keeping a single
45
- version simplifies future npm publishing, release notes, and
46
- bug-report triage ("what version are you on?" has one answer).
47
-
48
- ### 1.2 Persisted-state schema
49
-
50
- A change to `PERSISTED_STATE_VERSION` in
51
- `packages/cf-adapter/src/serialize.ts` (or any equivalent versioned
52
- blob in a future adapter) is a **minor bump minimum**, and requires a
53
- migration entry in `CHANGELOG.md` under a **⚠️ Migration required**
54
- heading. See §9 (Rollback) for why rollback across such a bump is
55
- not always possible.
56
-
57
- ---
58
-
59
- ## 2. Roles & permissions
60
-
61
- | Role | Who has it today | Required for |
62
- |-----------------------------|--------------------------|---------------------------------------|
63
- | Push to `main` | Maintainers | Merging the release PR. |
64
- | Push tags (`v*`) | Maintainers | `git push origin v0.x.0`. |
65
- | Create GitHub Release | Maintainers | Publishing the release notes. |
66
- | `CLOUDFLARE_API_TOKEN` secret | Repo Settings → Secrets | Local prod deploys. CI staging deploys. |
67
- | `CF_SMOKE_URL` variable | Repo Settings → Variables | Staging smoke e2e in CI. |
68
-
69
- There is no separate "release engineer" role. The maintainer who cuts
70
- the tag owns the release end-to-end, including the production deploy
71
- and the post-release smoke check.
72
-
73
- ---
74
-
75
- ## 3. Branch & tag conventions
76
-
77
- - **Releases are cut from `main`.** No release branches in 0.x.
78
- - **Tags** are annotated, signed where possible, formatted `v<semver>`
79
- (e.g. `v0.1.0`, `v0.1.1`, `v1.0.0-rc.1`).
80
- - **Pre-release tags** use SemVer suffixes: `v0.2.0-rc.1`,
81
- `v1.0.0-beta.3`. GitHub marks the release as a pre-release
82
- automatically based on the suffix.
83
- - The release commit message is `chore(release): vX.Y.Z` (matches the
84
- tag).
85
-
86
- ---
87
-
88
- ## 4. Pre-release checklist
89
-
90
- Run every box before tagging. Most are verifiable from the repo root.
91
-
92
- ```bash
93
- # 0. Sanity: clean tree on main, up to date with origin.
94
- git status # working tree clean
95
- git checkout main
96
- git pull --ff-only origin main
97
-
98
- # 1. All desired work merged. No pending tickets targeted for this release.
99
- # Cross-check progress.md — every ticket listed under this release is ✅.
100
-
101
- # 2. CI is green on the tip of main.
102
- # Open: https://github.com/<owner>/<repo>/actions
103
- # - CI workflow: lint / typecheck / coverage all green.
104
- # - deploy-cf workflow: staging deploy + smoke e2e green.
105
-
106
- # 3. Local full verify.
107
- pnpm install --frozen-lockfile
108
- pnpm lint # biome check .
109
- pnpm typecheck # tsc --noEmit across workspace
110
- pnpm test # full suite
111
- pnpm build # every package produces dist/
112
-
113
- # 4. Coverage gate (enforced in CI per package).
114
- # The per-package coverage gate (TICKET-048) runs in CI via
115
- # `pnpm coverage`; Vitest fails the build on any threshold regression.
116
- # Thresholds: 100% (lines/functions/branches/statements) on
117
- # irc-core / irc-server / in-memory-runtime, and ≥90% on every
118
- # other package (cf-adapter / local-cli / tcp-ws-forwarder). See the
119
- # "Coverage gate" step in .github/workflows/ci.yml. CI must already
120
- # be green (step 2), so locally re-run `pnpm coverage` as a
121
- # belt-and-braces check before tagging.
122
-
123
- # 5. Staging smoke e2e passes against the deployed tip-of-main.
124
- node apps/cf-worker/scripts/smoke.mjs \
125
- --url wss://serverless-ircd-staging.<subdomain>.workers.dev
126
-
127
- # 6. CHANGELOG.md is complete and accurate (§5).
128
- # 7. All package.json versions are bumped and lock-step (§6).
129
- # 8. The Release PR is merged (§7).
130
- ```
131
-
132
- If any box fails, **stop**. Fix forward on `main` and restart the
133
- checklist — do not tag over a broken tip.
134
-
135
- ### 4.1 What is explicitly out of scope for a 0.x release
136
-
137
- - AWS adapter (TICKET-039 through TICKET-044).
138
- - SASL authentication (TICKET-026).
139
- - Flood control (TICKET-028).
140
- - Server password / rate limits / cloaking (TICKET-046).
141
- - Config loader (TICKET-047).
142
-
143
- These belong in a later 0.x release. Their absence is **not** a
144
- blocker and should be called out under "Known limitations" in the
145
- GitHub Release body.
146
-
147
- ---
148
-
149
- ## 5. Writing `CHANGELOG.md`
150
-
151
- Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), newest
152
- entry first. One `## [X.Y.Z] - YYYY-MM-DD` section per release.
153
-
154
- Categories (use only what applies):
155
-
156
- - **Added** — new features, commands, caps, adapters.
157
- - **Changed** — behavior changes in existing functionality.
158
- - **⚠️ Migration required** — anything that needs operator action on
159
- upgrade (DO schema bumps, persisted-state version bumps, config
160
- shape changes). One bullet per action item.
161
- - **Deprecated** — functionality scheduled for removal.
162
- - **Removed** — functionality removed in this release.
163
- - **Fixed** — bug fixes.
164
- - **Security** — vulnerability fixes (also request a CVE).
165
- - **Known limitations** — explicit "not in this release" list so
166
- operators aren't surprised.
167
-
168
- Source material for the entry:
169
-
170
- 1. `progress.md` — the ticket table. Every `✅` row since the previous
171
- release tag is a candidate bullet.
172
- 2. `tickets.md` — the per-ticket **Description** field, for the prose.
173
- 3. `git log v<previous>..HEAD --oneline` — for fixes that don't have a
174
- ticket.
175
-
176
- Group by user-facing theme (Registration, Channel ops, IRCv3,
177
- Cloudflare adapter, …) rather than by ticket number. Operators read
178
- themes; developers cross-reference tickets.
179
-
180
- Rule of thumb: a new operator reading only `CHANGELOG.md` should
181
- understand what changed and what they need to do.
182
-
183
- ---
184
-
185
- ## 6. Bumping versions
186
-
187
- There are eight `package.json` files. They must end up at the same
188
- version:
189
-
190
- ```
191
- ./package.json (workspace root)
192
- packages/irc-core/package.json
193
- packages/irc-server/package.json
194
- packages/in-memory-runtime/package.json
195
- packages/cf-adapter/package.json
196
- apps/local-cli/package.json
197
- apps/cf-worker/package.json
198
- tools/tcp-ws-forwarder/package.json
199
- ```
200
-
201
- To cut `v0.X.Y`:
202
-
203
- ```bash
204
- # from the repo root, on a fresh branch off main:
205
- git checkout -b release/v0.X.Y
206
-
207
- # bump each file. The version field is the only change.
208
- # (Optional helper: `pnpm -r exec -- node -e '...'` if you script it.)
209
-
210
- # verify all eight files agree:
211
- rg '"version":' package.json packages/*/package.json apps/*/package.json tools/*/package.json
212
- ```
213
-
214
- The lockfile (`pnpm-lock.yaml`) is unaffected — none of the workspace
215
- dependencies are version-pinned to the workspace root.
216
-
217
- Do **not** run `pnpm publish` or `npm version` — those are for npm
218
- distribution, which is not the current model.
219
-
220
- ---
221
-
222
- ## 7. The release PR
223
-
224
- The release PR contains **exactly two files changed**:
225
-
226
- 1. `CHANGELOG.md` (new entry under the version being cut).
227
- 2. Every `package.json` listed in §6 (version bump).
228
-
229
- Nothing else. If a code change is needed for the release, it lands in
230
- a separate PR first and the release PR is opened only after that PR
231
- merges.
232
-
233
- **PR title:** `chore(release): v0.X.Y`
234
- **PR body:**
235
-
236
- ```
237
- This cuts v0.X.Y. See CHANGELOG.md for the full diff vs. v0.W.Z.
238
-
239
- Pre-release checklist: docs/release.md §4 — all green.
240
- Out-of-scope tickets: docs/release.md §4.1.
241
-
242
- After merge: tag + GitHub Release + manual prod deploy per
243
- docs/release.md §8.
244
- ```
245
-
246
- The PR is squash-merged with the same title as the commit message.
247
-
248
- ---
249
-
250
- ## 8. Cutting the release
251
-
252
- Run **immediately** after the release PR merges, so the tag points at
253
- the exact commit the changelog describes.
254
-
255
- ```bash
256
- git checkout main
257
- git pull --ff-only origin main
258
-
259
- # Confirm the tip commit is the squashed release PR.
260
- git log -1 --oneline # expect: chore(release): v0.X.Y
261
-
262
- # Confirm versions are at the new release.
263
- rg '"version":' package.json packages/*/package.json apps/*/package.json tools/*/package.json
264
- ```
265
-
266
- ### 8.1 Tag and push
267
-
268
- ```bash
269
- git tag -a v0.X.Y -m "v0.X.Y"
270
- git push origin v0.X.Y
271
- ```
272
-
273
- Annotated (`-a`) tags carry tagger + date + message; use them over
274
- lightweight tags. Sign with `-s` if you have a GPG / SSH signing key
275
- configured (`git config tag.gpgSign true`).
276
-
277
- ### 8.2 Create the GitHub Release
278
-
279
- 1. <https://github.com/<owner>/<repo>/releases/new> → choose the tag
280
- just pushed.
281
- 2. **Title:** `v0.X.Y` (matches the tag, nothing fancier).
282
- 3. **Body:** paste the matching section from `CHANGELOG.md`. Strip the
283
- `## [X.Y.Z] - YYYY-MM-DD` heading line (it's redundant with the
284
- release title).
285
- 4. **Set as latest release** unless this is a pre-release. Pre-release
286
- tags (`-rc.N`, `-beta.N`, etc.) get the "Set as a pre-release"
287
- checkbox instead.
288
- 5. **Publish release.**
289
-
290
- ### 8.3 Production deploy (manual)
291
-
292
- There is **no CI auto-deploy to production**. The maintainer runs the
293
- prod deploy by hand, from a clean checkout on the tag:
294
-
295
- ```bash
296
- git checkout v0.X.Y
297
-
298
- # Sanity-check the tag matches the released commit.
299
- git log -1 --oneline # expect: chore(release): v0.X.Y
300
-
301
- pnpm install --frozen-lockfile
302
- pnpm build
303
- pnpm typecheck
304
- pnpm test
305
-
306
- # Deploy the Cloudflare Worker to production.
307
- pnpm deploy:cf:prod
308
- # → wrangler deploy (default env = production)
309
-
310
- # Tail prod logs while the first connections arrive.
311
- npx wrangler tail
312
-
313
- # Smoke-check prod with the same script CI uses on staging.
314
- # You must point it at the prod wss:// URL:
315
- node apps/cf-worker/scripts/smoke.mjs \
316
- --url wss://<prod-workers-subdomain>.workers.dev
317
- ```
318
-
319
- If smoke fails on prod:
320
-
321
- 1. **Do not roll forward blindly.** Tail logs, identify the regression.
322
- 2. If a rollback is required, follow §9.
323
- 3. If the regression is in the *deployed Worker code* (not the
324
- protocol core), a hotfix follows the same process as a normal
325
- release (new patch / minor → tag → GitHub Release → prod deploy).
326
-
327
- ### 8.4 Announce
328
-
329
- - Update `progress.md` Status header (if a "current release" marker
330
- was added there) — not currently present, optional.
331
- - Open an issue with the body "v0.X.Y released" if external tracking
332
- is desired. (Not currently wired to any external channel.)
333
-
334
- ---
335
-
336
- ## 9. Rollback
337
-
338
- There are two independent rollback axes: **code** and **data**.
339
-
340
- ### 9.1 Code rollback
341
-
342
- To redeploy a previous release:
343
-
344
- ```bash
345
- git checkout v0.W.Z # the previous tag
346
- pnpm install --frozen-lockfile
347
- pnpm build
348
- pnpm deploy:cf:prod
349
- ```
350
-
351
- This works as long as the previous release's code is compatible with
352
- the persisted DO state shape (see 9.2).
353
-
354
- There is no in-CI "prod rollback" workflow. The maintainer runs the
355
- commands above from a checkout.
356
-
357
- ### 9.2 Data rollback (persisted DO state)
358
-
359
- **Persisted-state version is one-way.** Once
360
- `packages/cf-adapter/src/serialize.ts` ships a new
361
- `PERSISTED_STATE_VERSION`, old code reading new blobs will reject
362
- them, and new code reading old blobs may or may not migrate them
363
- depending on whether a forward migration was shipped alongside.
364
-
365
- Rules of thumb:
366
-
367
- - If the release's `CHANGELOG.md` has **no ⚠️ Migration required**
368
- entry, code rollback to the previous tag is safe — DO storage is
369
- forward- and backward-compatible.
370
- - If it **does** have a migration entry, assume code rollback will
371
- not work without losing or transforming state. The migration entry
372
- in `CHANGELOG.md` must spell out the recovery procedure.
373
-
374
- In a catastrophic prod failure where the new version's migration
375
- already ran, the path forward is:
376
-
377
- 1. Freeze new connections (set `MOTD_LINES` to a maintenance banner,
378
- or block at the edge with a Route rule).
379
- 2. Decide: fix forward on the new code, or wipe staging-state (NOT
380
- prod-state) and re-test the migration offline.
381
- 3. **Production DO namespaces must never be deleted** — the data is
382
- gone permanently (per `docs/deployment-cf.md` §12.1).
383
-
384
- ---
385
-
386
- ## 10. Future: npm publish
387
-
388
- When `@serverless-ircd/irc-core` becomes the first package consumers
389
- outside this repo depend on (likely: the in-memory runtime is pulled
390
- into a third-party test harness, or someone ships an alternate
391
- adapter), the following gates apply before flipping `"private": false`:
392
-
393
- 1. **Public API audit.** Every export from `src/index.ts` is one we're
394
- willing to support across a minor. Anything experimental goes under
395
- a `/internal` subpath.
396
- 2. **Stable type surface.** No `any`, no `@ts-expect-error` in the
397
- public surface, no `exactOptionalPropertyTypes` surprises.
398
- 3. **README per package**, not just the root.
399
- 4. **`CHANGELOG.md` is already disciplined** (Keep a Changelog format,
400
- one section per version, dated).
401
- 5. **CI coverage gate ≥90%** (TICKET-048) is wired and green.
402
- 6. **Provenance & provenanced verification** — npm publish from CI
403
- with Sigstore signatures, not a local laptop.
404
-
405
- At that point this document grows a §11 "Publishing to npm" with
406
- `pnpm -r publish --filter @serverless-ircd/irc-core --access public`
407
- and a new `publish.yml` workflow. The git-tag-plus-GitHub-Release flow
408
- above stays unchanged — npm publish becomes an *additional* step, not
409
- a replacement.
410
-
411
- ---
412
-
413
- ## 11. Quick reference: cutting v0.X.Y
414
-
415
- ```bash
416
- # 1. Pre-release checklist (docs/release.md §4).
417
- git checkout main && git pull --ff-only origin main
418
- pnpm install --frozen-lockfile
419
- pnpm lint && pnpm typecheck && pnpm test && pnpm build
420
-
421
- # 2. Branch, bump versions + CHANGELOG, open PR (§6, §7).
422
- git checkout -b release/v0.X.Y
423
- # ... edit 8 × package.json + CHANGELOG.md ...
424
- git commit -am "chore(release): v0.X.Y"
425
- git push -u origin release/v0.X.Y
426
- # ... open PR, get it merged ...
427
-
428
- # 3. Tag and push (§8.1).
429
- git checkout main && git pull --ff-only origin main
430
- git tag -a v0.X.Y -m "v0.X.Y"
431
- git push origin v0.X.Y
432
-
433
- # 4. GitHub Release (§8.2): paste CHANGELOG entry, publish.
434
-
435
- # 5. Prod deploy (§8.3).
436
- git checkout v0.X.Y
437
- pnpm install --frozen-lockfile && pnpm build
438
- pnpm deploy:cf:prod
439
- node apps/cf-worker/scripts/smoke.mjs --url wss://<prod>.workers.dev
440
- ```
441
-
442
- Total wall-clock for a routine 0.x release: ~30 minutes including the
443
- prod deploy and smoke check.