@voltro/plugin-notifications 0.54.0 → 0.56.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.
package/CHANGELOG.md CHANGED
@@ -39,6 +39,641 @@ _Changes staged for the next release accumulate here (rolled up from
39
39
 
40
40
  ---
41
41
 
42
+ ## [0.56.0] — 2026-08-29
43
+
44
+ ### ⚠ BREAKING
45
+
46
+ - **@voltro/plugin-broadcast, @voltro/cli** — **Three ways the cross-replica bus mishandled a broker that was not there.**
47
+
48
+ **Boot no longer dies when the broker is unreachable.** `attachBroadcastBus` awaited its subscribe, and a rejected subscribe threw out of it, out of `wireBroadcastBus`, and out of boot — so a broker that happened to be restarting turned every replica into a crash loop. That contradicted the package's own first paragraph, which promises that a broker outage "degrades cross-replica fan-out only": true for an outage after boot, false for one during it, and the false half is the worse one, because a broker restart is precisely when every pod is dialling at once. It now warns, keeps local reactivity working, retries in the background, and reports the time it spent unsubscribed as a gap — because that is what it is: the fleet went on writing while this replica was not listening, and pub/sub keeps no log to replay.
49
+
50
+ **A peer that restarts under a stable name no longer switches its own gap detection off.** Gap detection compares a peer's serial against a watermark, and the serial restarts at 1 with the process while the NAME survives it — a StatefulSet pod keeps `POD_NAME`, and `VOLTRO_REPLICA_ID` is stable by definition. A receiver holding a watermark of 500 read the new process's 1, 2, 3… as "not newer", never advanced, and reported nothing for the next five hundred changes. The envelope carries an `epoch` now: a different epoch under a known name means a new process, so the watermark follows the process. A restart is not reported as a gap — it is not evidence that anything was missed.
51
+
52
+ **A transport that re-dials on its own now says so.** ioredis re-subscribes its channels after a reconnect and nats reconnects underneath the subscription; neither mentions that everything published while they were away is gone. Serial accounting finds that only if a peer publishes again, and on a quiet table "nobody wrote" and "we are stale forever" look identical. Providers report their connection lifecycle through a new optional `BroadcastProvider.onTransportEvent`, and a reconnect is treated as the hole it is.
53
+
54
+ Two driver defaults changed with it: the nats connection is now `maxReconnectAttempts: -1` and `waitOnFirstConnect: true`. nats.js defaults to giving up after ten attempts, which for a broker down about twenty seconds meant the connection closed for good, every subscription iterator ended, and the replica was deaf until it restarted — silently. And neither provider memoises a rejected connection promise any more: a broker briefly unreachable at construction was unreachable forever, because every later attempt awaited the same settled rejection and never dialled again.
55
+
56
+ **Breaking:** `attachBroadcastBus`'s `onGap` now receives one `BroadcastGap` object instead of `(origin, missed)`. `origin` and `missed` are still exact when they exist, and optional because a hole with no peer to blame is now reachable. See the codemod note.
57
+ - **@voltro/runtime, @voltro/cli** — **`defineReaction`'s `dedupeKey` was enforced by a per-process set, so the same change acted once per replica.**
58
+
59
+ `dedupeKey` is the one guard `defineReaction` refuses to boot without, and its documented promise is that the same logical change acts exactly once. It was backed by an in-memory `Set` shared across reactions in one process, consulted as `has(key)` then written as `add(key)` after the act returned. Two independent defects in one mechanism:
60
+
61
+ - **Per-process.** N replicas each held their own set, so a reaction whose act starts a workflow started N workflows, and one with `costBudgetUsd` spent N times. Every test and every single-instance run confirmed the gate worked, which is why it survived — it was real in exactly the configuration that cannot observe it. - **Read-then-write.** Even in one process, two concurrent changes with the same key both passed `has` before either reached `add`, because the act between them is awaited.
62
+
63
+ The gate is now a single atomic claim against `_voltro_change_claims` (`insertIgnore` on a `UNIQUE`, the arbiter the cron scheduler uses), taken BEFORE the act. Both boot paths wire it; the per-process set remains only as the fallback for a harness that wires none, and says so loudly at attach time.
64
+
65
+ Taking the claim first is what makes it a gate rather than a report, and the cost is stated rather than hidden: **an act that throws has already consumed its key and is not re-run by a later duplicate.** Durability belongs to the workflow the act starts, not to the trigger.
66
+
67
+ **Breaking:** `ReactionRunDeps.dedupe` is `{ claim: (key) => boolean | Promise<boolean> }` instead of `{ has, add }`. Nothing to do unless you call `runReaction` yourself — `voltro dev` and `voltro serve` build the deps and pass the durable claimer. See the codemod note for why this is not a rename.
68
+ - **@voltro/plugin-billing, @voltro/protocol, @voltro/database, @voltro/plugin-cdc-out, @voltro/cli** — **A CDC meter accrued a usage unit on every replica, so a tenant on two pods was billed twice.**
69
+
70
+ `plugin-billing`'s `metering: { … from: 'cdc' }` accrues one unit per matched row change, through the plugin `onChangeEvent` tap. That tap is delivered to every replica — that is what makes a `changeScope: 'fleet'` store (postgres LISTEN/NOTIFY, mysql binlog) cross-instance in the first place. For a reader that is correct. This is not a reader: `reportUsage` increments a shared counter and the flush reports the delta to the billing provider. So the invoice was multiplied by the replica count, by the plugin whose entire job is counting, with nothing in any log.
71
+
72
+ The tap now claims each change before accruing, through the same INSERT-wins arbiter behind `defineSubscriber({ once })` and a reaction's `dedupeKey`. An ungated tap (single process, memory store) still accrues and says so once — loudly, because an ungated meter is a factor-of-N on an invoice and is indistinguishable from a correct one by looking at the number.
73
+
74
+ **Naming a change needed a shared answer, and one already existed in the wrong place.** A fleet change carries no LSN, no commit id and no `traceId` — that last one deliberately, so a local trace is never mis-attributed to a remote write — so two replicas have no field they can both name it by. `@voltro/plugin-cdc-out` manufactured the missing identity from content plus its position among content-identical repeats, and it was the only consumer until this defect turned up the second one. `changeDigest`, `composeChangeKey`, `parseChangeKey` and `OccurrenceCounter` now live in **`@voltro/database`**, beside `ChangeEvent` itself.
75
+
76
+ Keying on the row id instead would have been worse than the defect for an `op: 'update'` meter: two genuine edits to one row share an id, so the meter would count the first and drop every one after it — a bill that stops growing while the work continues.
77
+
78
+ **Breaking:** `PluginBindContext` gains a REQUIRED `claimChange(scope, key)`. Every plugin's `bindDataStore` receives it; a plugin that constructs a `PluginBindContext` itself (a unit-test harness) must supply one. Required rather than optional because an absent gate reads exactly like a gate that passed. `@voltro/plugin-cdc-out` no longer re-exports the change-identity helpers — import them from `@voltro/database`.
79
+
80
+ **`voltro update` carries you across this** — codemod `0.56.0/05_plugin_bind_context_claims_a_change`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.56.0).
81
+ - **@voltro/cli, @voltro/devtools-ui** — **Every `/_voltro/inspect/*` answer is now an `Observation` — it says what it is about, who answered, and how complete it is.**
82
+
83
+ ```json
84
+ {
85
+ "data": { "…": "what the route returned before" },
86
+ "scope": { "kind": "process" },
87
+ "origin": { "replicaId": "api-7d9f-x2k", "instanceId": "api-7d9f-x2k@1787…", "version": "0.56.0" },
88
+ "completeness": { "complete": false, "fleetSize": 3, "reason": "process-scoped: this is 1 of 3 replicas" },
89
+ "capturedAt": 1787892497073
90
+ }
91
+ ```
92
+
93
+ **Why the payload alone was not enough.** `/subscriptions` answers with the subscriptions of the ONE process that received the request. `/schedules` answers with the whole fleet's, read from the shared store. Both were plain JSON with nothing to tell them apart, so on a multi-replica deployment the first is an unlabelled sample and reads exactly like the second. On ONE replica the difference is invisible — which is every development environment, every e2e and every template, so the environment in which they are indistinguishable is the one the framework is built and tested in.
94
+
95
+ Four scopes, and the fourth is the one an outside report would not have asked for: `process`, `shared-store`, `fleet`, and `declaration` — `/routes`, `/manifest`, `/env` describe the SOURCE TREE, identical on every replica of one version and different across a rolling deploy.
96
+
97
+ **`fleetSize` is the cheap half, and it needs no aggregation at all.** A process-scoped answer states how many replicas exist, so a bare `curl` now says it is a fraction and of what. When membership cannot say, the field is ABSENT rather than `1`: "I am alone" and "I cannot know" must not render identically.
98
+
99
+ **Default-DENY, because a default is a decision nobody made.** A path with no entry in `ROUTE_SCOPES` is refused with the fix in the message, so a new endpoint cannot ship unlabelled — it fails on its first request, in its author's own dev loop. Mutating routes are enumerated as `write` rather than inferred from the HTTP method: `?scope=fleet` on `/agent/call` would run a user's handler once per replica.
100
+
101
+ **Three dispatchers, not one.** Wrapping `handleInspectRequest` looked complete from inside itself while `handleInspectAsyncRequest` and `handleSharedInspectRoute` went on answering bare — `/cluster`, `/schedules` and every workflow read. Nothing in the route table showed it; it was found by asking a running process for every route. `inspectDoors.test.ts` pins all three on every commit and `scripts/observation-e2e.mjs` re-asks a real bundled serve. The same sweep caught a wrapper defect no unit fixture could: a route that builds its response by hand rather than through `json()` was wrapped into an envelope with `data: undefined`, which serialises away — every field around the answer correct, and the answer gone.
102
+
103
+ **The dashboards say it on screen.** `ScopeNotice` renders inside the SHARED `devtools-ui` pages, not in each host dashboard, for the reason every omission in this codebase has been invisible: a label each consumer must remember is a label one consumer will not have, and the page that forgot is indistinguishable from a page with nothing to warn about. It renders nothing when the answer is complete — a banner over a complete answer trains people to ignore banners.
104
+
105
+ **Breaking:** a caller reading `/_voltro/inspect/*` JSON reads `.data` now. Both dashboards unwrap in their single fetch helper and keep the envelope on `_observation` for the notice. A response without the envelope passes through unchanged, so an app on an older framework version is not a broken app.
106
+
107
+ **`voltro update` carries you across this** — codemod `0.56.0/01_inspect_answers_are_observations`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.56.0).
108
+ - **@voltro/cli** — **`voltro serve` on a WEB app now refuses. It used to delete the deployment artefact.**
109
+
110
+ `voltro start` (production) and `voltro dev` (development) are unchanged, and an API app is unchanged. What is removed is the web branch of `serve`, which was advertised in the CLI's own help as *"Production server: web app (vite preview) OR API, auto-detected"*. Both halves of that were measured before it was removed:
111
+
112
+ **In production it never ran.** The launcher's serve fast path requires `.framework/dist-api/serveBundle/serveEntry.js` — an artefact a web build does not produce. A web app got:
113
+
114
+ ```
115
+ [voltro] FATAL: production `voltro serve` requires a precompiled serve bundle at
116
+ …/.framework/dist-api/serveBundle/serveEntry.js
117
+ Run `voltro build` before serving
118
+ ```
119
+
120
+ directly after a `voltro build` that had just succeeded.
121
+
122
+ **Below production it destroyed the build.** The web branch ran a SECOND vite build with `plugins: [react()]` only — no `@tailwindcss/vite`, no image pipeline, no per-page islands entries — and then `vite preview`, which Vite documents as not for production use. Measured on a fixture:
123
+
124
+ - with Tailwind, the build ABORTS: `[postcss] ENOENT: no such file or directory, open 'tailwindcss'`, surfaced as `unhandled cli error` with a raw stack; - without Tailwind it SUCCEEDS — and because both builds write `.framework/dist`, which Vite empties (it sits under its root), it deleted `dist/server`, `island-shells/` and every pre-rendered route directory. Immediately afterwards, `voltro start` refused to boot: *"requires precompiled artefacts: …/dist/server/ssrEntry.js"*.
125
+
126
+ So `voltro build` → `voltro serve` → `voltro start` left the deployment unable to start, and the middle command was the one the help recommended.
127
+
128
+ The codemod is `manual` with `reach: 'beyond-source'`: the command being replaced lives in Dockerfiles, compose files, CI jobs and runbooks, not in `.ts`. It searches every text file git tracks and says plainly that a step defined in a CI runner's own UI is beyond what any repository scan can see.
129
+
130
+ The shipped Dockerfiles were already updated in the same change set and now run the precompiled bundle directly — `node .framework/dist-web/startBundle/startEntry.js` for web, `node .framework/dist-api/serveBundle/serveEntry.js` for an api.
131
+ - **@voltro/runtime, @voltro/cli** — **Every outbox effect was delivered once per replica.** `drainOutbox`'s summary line has always said "claim due rows". It did not: it read every `pending` row and ran its handler, and every replica runs the drain. Not on a crash, not on a retry — on the happy path, every time. Measured with two stores over one postgres: one enqueued row, one drain pass each, handler called twice.
132
+
133
+ The docs told handler authors to be idempotent and justified it with the crash case ("a process that dies between the remote accepting it and us recording that"). That reads as rare. "Your webhook fires once per replica, always" is a different operational fact, and nobody was told it.
134
+
135
+ `OutboxStatus` has always carried a `'delivering'` member that nothing set. That is the gate now, taken atomically: reclaim claims that have outlived their lease, read the due window, CAS `pending → delivering` stamping the claiming PROCESS, then handle only what came back. A racing replica loses the row because the predicate names the state it is leaving. `plugin-cdc-out` has done exactly this since it shipped, with the same `updateMany` CAS and the same state — two outboxes in one repo, one of them right.
136
+
137
+ Delivery is still AT-LEAST-ONCE and handlers must still be idempotent: a process can die between the remote accepting and the row being marked, and no claim closes that. What is gone is the routine N-fold duplicate, which was never a guarantee gap — it was the word "claim" not having been implemented.
138
+
139
+ `_voltro_outbox` gains `claimedBy` / `claimedAt` (nullable), applied by the declarative differ on `voltro db apply` and on a `voltro dev` boot, every dialect.
140
+
141
+ **Breaking:** `DrainDeps.claimedBy` is REQUIRED. It was optional for one draft, which meant a caller who omitted it silently got the old every-replica behaviour — an exactly-once gate that switches off when you leave a field out is not a gate. `voltro dev` / `voltro serve` pass it for you; only a caller driving `drainOutbox` directly is affected. `claimLeaseMs` (default 5 min) is new and optional.
142
+
143
+ **`voltro update` carries you across this** — codemod `0.56.0/03_outbox_drain_needs_an_identity`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.56.0).
144
+
145
+ ### Added
146
+
147
+ - **@voltro/database, @voltro/runtime, @voltro/cli, @voltro/data-transfer** — **`/_voltro/inspect/subscriptions?scope=fleet` — the fleet answer, assembled by READING rather than by asking.**
148
+
149
+ Each replica publishes its counters into `_voltro_replica_observations` on a timer, so any replica can answer a fleet question from the shared store. That is the same mechanism `coordinationState.recentReplicaIds` already used by reading `_voltro_schedule_runs`; this generalises the one case.
150
+
151
+ **Why not a fan-out over the broadcast bus.** The bus can `publish` and `subscribe`. A read-time fan-out would have to build request/response on top: a correlation id, a reply channel, a deadline to guess, a partial-result protocol. And it puts the DIAGNOSTIC on the failure path, so it degrades — by timing out — exactly when it is needed. Writing inverts that: the transport is the database, the one thing that must be up for anything to work, and a dead replica goes STALE rather than silent. Staleness is a number, and a number can be reported; paired with the membership roster, "old" becomes "missing".
152
+
153
+ **Three things make the merge honest, and each is the case a naive `rows.map()` gets wrong:**
154
+
155
+ - A replica membership knows about that has written nothing is **`missing`**, not absent. Dropping it makes a partial answer look complete — the same unlabelled sample this whole feature exists to end, one level up and more expensive, because now the reader believes they asked everybody. - A **stale** row is reported WITH its age rather than filtered out. Removing it hides that the answer is partial; keeping it unmarked presents fiction as current. Neither is available. - **Mixed versions are named.** A rolling deploy spans two shapes, and averaging them silently is wrong in a way nothing downstream can detect.
156
+
157
+ Only the newest GENERATION per replica is counted. A dead process's counters added to its successor's look exactly like a busy replica.
158
+
159
+ **With no shared store the request is refused with `501` and a reason** — never answered with this replica's own numbers. Handing a sample to someone who asked for the fleet in writing would be this feature committing the defect it exists to prevent.
160
+
161
+ `_voltro_replica_observations` holds ONE upserted row per `(replicaId, kind)`, so it is bounded by fleet size × kinds rather than by time. There is no history and must not be: a history needs a retention policy, and this is a cache of the present. It is classified **environment-local** for data transfer — a foreign row would invent a replica that does not exist here, and then report it as present or, once it ages, as one that has stopped answering.
162
+
163
+ The publisher runs on BOTH boot paths, pinned by `bootPathParity.test.ts`: a replica that never publishes is a hole in every other replica's answer, and it reads as "has written nothing", which is indistinguishable from broken.
164
+
165
+ **Measured with two real replicas against one database** (`scripts/fleet-observation-e2e.mjs`): both publish, EITHER answers for BOTH (`responded: 2, expected: 2`), and a killed replica's row keeps being readable with a growing age rather than vanishing — which is the whole design in one assertion, since a dead process going silent is indistinguishable from "nothing happened" and a row that gets old is not.
166
+
167
+ That test found two defects the single-process one could not:
168
+
169
+ - **An unreadable table read as an empty fleet.** Against a database whose schema predated `_voltro_replica_observations`, the merge reported `responded: 0, missing: [every replica]` — a healthy fleet described as gone. The read now raises and the route answers `503` naming the cause and the fix, because "nobody has written yet" and "I could not read the table" produce the same empty list and mean opposite things. - **A check of ours that examined nothing.** The single-process e2e asserted `typeof responded === 'number'`, which `0` satisfies — so it passed for the entire time the write was failing. It asserts `> 0` now.
170
+ - **@voltro/web, @voltro/client, @voltro/cli** — **`web.api.connect: 'lazy'` — a page that reads no data no longer opens a WebSocket.**
171
+
172
+ The default is unchanged (`'eager'`: every declared api connects at mount), so nothing moves unless an app asks for this.
173
+
174
+ Why it exists, measured in a real browser against a `voltro start`:
175
+
176
+ | page | `interactive` | WebSocket attempts | |---|---|---:| | `/pricing` | `'none'` | 0 | | `/info` | `'islands'` | 0 | | `/docs/intro/getting-started` (subscribes to nothing) | default = `'full'` | **6** | | `/` (Todos, subscribes) | `'full'` | 5 |
177
+
178
+ So the two opt-in render modes were already free, and the DEFAULT one connected regardless of whether the page used data. The six are reconnect backoff, not six live sockets — a socket that opens and is held was verified separately (a raw `ws://…/ws` against a running `voltro serve` opens and stays open with no auth, no subscription and no traffic).
179
+
180
+ What a held socket costs is not just a connection: `isIdleNow` returns false while `connectedClients() > 0` (`idleDetector.ts:46` → `singleNodeOrchestrator.ts:147` → `wakeRouter.ts:44`), so **one browser tab on a pricing page prevents scale-to-zero indefinitely** — the feature the framework's own documentation describes two paragraphs above the condition that defeats it.
181
+
182
+ Under `'lazy'` the connection is deferred to the first hook that asks for that api. Demand is expressed in `useFrameworkApi`, the single accessor all 27 data hooks read through — a per-hook signal would be 27 chances to forget one, and a forgotten one is a hook that silently never connects. It is keyed by api NAME, so an app with an analytics api it touches on one page does not open it on every page.
183
+
184
+ Verified on the same page that showed 6: **0 sockets** with `'lazy'`, and the Todos page still 5.
185
+ - **@voltro/runtime, @voltro/cli, @voltro/database** — **`defineSubscriber({ once })` — run a handler once per change across the fleet, instead of once per replica.**
186
+
187
+ A subscriber binds to the change stream on every api instance, so one `INSERT` behind three replicas calls the handler three times. That is the right default and stays the default: a handler that refreshes a search index, warms a local index or drops a process-local cache entry *has* to run everywhere, and a fleet-wide gate would leave every other replica stale. It assumes the handler is idempotent.
188
+
189
+ It is the wrong default for an EFFECT — a notification, a mail, a webhook, a payment — because there is nothing to make idempotent: the effect IS a write, so each run produces another one. `SubscriberDefinition` had no way to say so, while the primitive rubric recommended a subscriber for exactly that job.
190
+
191
+ ```ts
192
+ export default defineSubscriber({
193
+ table: 'absence_requests',
194
+ on: ['insert'],
195
+ once: (event) => String((event.new as { id?: string } | null)?.id ?? ''),
196
+ handler: notifyApprovers,
197
+ })
198
+ ```
199
+
200
+ The key is claimed in the new `_voltro_change_claims` table — `insertIgnore` on a `UNIQUE(scope, key)`, the same INSERT-wins arbiter the cron scheduler uses for a (schedule, bucket) firing — and exactly one replica wins it. The scope is the subscriber's file id, so two subscribers watching one table never lock each other out.
201
+
202
+ Three things the type states rather than leaves to be discovered:
203
+
204
+ - **The key must tell two genuine changes apart.** A row id is enough for `insert` and `delete`. It is not enough for `update`: two edits to one row produce the same id, and the second is dropped as a duplicate. Use `` `${id}:${updatedAt}` ``. - **AT MOST once, not exactly once.** The claim is taken before the handler runs, so a replica that wins and dies takes the event with it. A claim that cannot be written at all is taken by nobody — fail-closed, because `once` promising "at most once" is what makes it worth having. Both are loud in the log; neither is retried. - **Which coordination each subscriber got is in the boot log**, because the two behaviours differ by a factor of the replica count and were otherwise indistinguishable:
205
+
206
+ ```
207
+ subscriber: registered table=absence_requests on=["insert"] once=fleet
208
+ subscriber: registered table=posts on=["insert","update"] once=per-replica
209
+ ```
210
+
211
+ `_voltro_change_claims` is created for every sql app and swept after an hour (`VOLTRO_CHANGE_CLAIMS_TTL_HOURS`). It rides the declarative differ, so `voltro db apply` and a `voltro dev` boot both create it, on every dialect.
212
+ - **@voltro/cli** — **`voltro doctor` now asks the question a subscriber's author is the only one who can answer: should this effect repeat on every replica?**
213
+
214
+ `store.onChange` is a broadcast. That is CORRECT for a reader — a cache drop, an index refresh, a live query must run everywhere — and a multiplier for an effect, because there is nothing to make idempotent: the effect IS the write, so each run produces another one. One `INSERT` behind two replicas writes two notification rows; with a broadcast bus in front, four.
215
+
216
+ `subscriber-effect-without-once` fires when a `*.subscribe.ts` handler writes (`ctx.store.insert` / `update` / `upsert` / …), publishes (`ctx.publish`), or calls a `notify` / `sendWebhook` / `sendMail`-shaped helper, and the subscriber declares no `once:`. Advisory like every rule in that scan — it prints, it never fails a build, because `once:` on a READER would silence it on every replica but one, and only the handler's author knows which of the two they wrote.
217
+
218
+ It reads the handler through the AST, for two reasons at once. `once:` and the handler sit in ONE object literal, so "this file mentions `once`" is not the question. And the effect has to be found inside the handler under whatever name it gave its context parameter — `(event, ctx)`, `(event, { store })`, or a `handler: notifyApprovers` naming a function in the same file, which is the form the primitive's own doc comment teaches. A handler IMPORTED from another module is not judged: its body is not in the file being read, and a finding about code the rule never opened would be a guess wearing a file path.
219
+
220
+ **And `mutation-tail-effect` no longer fires on the file that took its advice.** That rule matches a `notify(...)`-shaped call in any file with an `export default` — which a `*.subscribe.ts` has. So a subscriber calling `notify(...)` was told to move its effect into a subscriber: our own two rules disagreeing on one file, which is how a whole section of the report gets skipped. Detected by the CALL (`defineSubscriber` / `defineReaction`) rather than the filename, for the reason the adoption check already exists — a file can adopt the primitive under any name.
221
+ - **@voltro/protocol, @voltro/database, @voltro/runtime, @voltro/cli** — **`?replica=<id>` — ask ONE named replica, through the one you can reach.** The answer comes back with that replica's `origin`, process-scoped: the proxy does not launder whose answer it is.
222
+
223
+ **The address comes from the shared store, not from membership** — and that is a correction to the obvious design. Membership rides the broadcast bus, so peer addressing built on it works only for an app that configured one, and the operator who most needs to reach a specific pod is not reliably the one who did. The row already exists, every replica already writes it, and the database is already the thing that must be up. `_voltro_replica_observations` gained a `reachableAt` column.
224
+
225
+ **An endpoint that fetches a URL on request is an SSRF primitive unless it is built not to be.** Four rules, each closing a distinct way this could become one, and each with a test:
226
+
227
+ - **The caller names an ID, never a URL.** The address is resolved from a set we wrote; an unknown id is a `404` and no request leaves the process. "Unknown replica" and "published no reachable address" give the same message, because distinguishing them would tell a caller which ids exist. - **A proxied request carries a hop header and is always answered locally**, so `?replica=a` on A pointing at B pointing at A cannot cycle. The forwarded URL also has `replica` stripped and `scope=process` forced. - **The peer call forwards the caller's token and adds nothing.** A replica is not a more privileged caller than the human who asked. - **Only reads are addressable.** `?replica=` on `/invoke`, `/seeds/run`, `/migrations/rollback` or `/agent/call` is refused before any lookup.
228
+
229
+ A peer that does not answer inside a short deadline becomes a `504` naming it: a diagnostic that hangs is worse than one that says no.
230
+
231
+ **A declared address and a fallen-back one are different facts.** An unset `POD_IP` falls back to `127.0.0.1`, which is a shrug — recorded as NOT reachable, and no peer tries it. `VOLTRO_INSPECT_ADVERTISE_HOST` declares one, including `127.0.0.1` when the peers really are on this machine. This is the same posture the framework takes everywhere: we do not second-guess a declaration, and we do not treat a fallback as one.
232
+
233
+ Measured between two real replicas (`scripts/fleet-observation-e2e.mjs`): A answers for B, B's identity survives the hop, an unknown id is refused with no outbound request, and a mutating endpoint is refused with `400`.
234
+
235
+ **And the consumer that nearly shipped broken.** Both dashboards unwrap the envelope in their single fetch helper; the CLI's `inspectFetch` — which thirty-odd subcommands read through — was missed. `voltro cluster status`, `voltro logs`, `voltro schedules` would each have read `undefined` off an envelope and printed an empty table. Found by asking what ELSE reads these routes, not by a failing test, which is why the seam now has one: the payload comes out, the envelope is kept so a command can say "1 of 3", an answer that predates the envelope passes through unchanged, and a payload that merely HAS a `data` key is not mistaken for one.
236
+ - **@voltro/cli** — **`/_voltro/inspect/stream` events carry `origin`.**
237
+
238
+ A live SSE stream is the same defect as an unlabelled `/logs` response, except it keeps producing it: a viewer watching a tail on a three-replica fleet sees one third of it, continuously, and the connection landed on whichever replica the load balancer chose.
239
+
240
+ On **every event**, not on a handshake — because a consumer that connects late never receives a handshake. A reconnect, a second browser tab, a `curl` piped into `jq` all read the buffer, and a handshake they never saw would leave every buffered line unattributed. That is the assertion the test pins.
241
+
242
+ `ts` is that replica's clock. Two origins must not be ordered by it, which is the same rule `events.origin` already states as "serials are only comparable within it".
243
+ - **@voltro/devtools-ui** — **A Fleet panel, in both dashboards.** `FleetPage` renders what every replica published about itself — the self-hosted DevTools wire it over HTTP, the hosted customer console over the cloud RPC proxy, from one shared component.
244
+
245
+ **It renders THREE populations, and the two after the first are the point.** A page that shows only the replicas which ANSWERED is worse than no page: the reader now believes they asked everybody. So the silent replicas get their own section rather than being omitted ("not shown" and "not there" look identical and mean opposite things), and the stale ones are shown WITH their age (filtering them makes a partial answer look complete; leaving them unmarked presents old numbers as current). A mixed-version note appears when the responders disagree, because a rolling deploy means the numbers span two shapes.
246
+
247
+ The completeness banner is a RATIO — "3 of 5 replicas answered" — not a count. A count invites the reader to believe that is the fleet.
248
+
249
+ **Two guards, one per dashboard, because neither repo can see the other.** Each fails when a page the shared package exports has no nav entry in that dashboard, with a declared exemption list whose stale entries also fail. The asymmetry is the argument: the self-hosted dashboard is opened daily and the customer one is opened when something is wrong, so a panel missing from the second fails in the direction nobody notices.
250
+
251
+ **Measured in a real browser** (`voltro-devtools/scripts/fleet-panel-browser-check.mjs`): two replicas behind one dashboard, the panel renders BOTH, the nav link resolves (a page reachable only by typing a URL is not a panel), and the console is clean. That check immediately earned itself — it caught a `<div>` inside `CardDescription`'s `<p>`, invalid HTML that React reports only in a browser and that the page's own jsdom suite passed over.
252
+
253
+ The devtools-ui catalogue also gained an en/de parity test. English is the fallback, so a missing German string does not crash — it renders English in a German console, which looks like a working UI rather than a hole.
254
+ - **@voltro/cli, @voltro/runtime** — **Four serving changes: pre-compressed assets, a CDN prefix, a keep-alive that survives a proxy, and a preconnect for a cross-origin api.**
255
+
256
+ **Pre-compression (automatic).** `voltro build` writes `.br` (quality 11) and `.gz` beside every content-hashed asset over 1 KB; `voltro start` serves the variant when the client accepts it. Before, every hit compressed from scratch — measured on one 321 KB chunk, three requests each:
257
+
258
+ | | time | bytes | |---|---:|---:| | compressed per request | 5.6 / 5.0 / 4.6 ms | 100 665 | | pre-compressed | 1.6 / 1.7 ms | **86 083** |
259
+
260
+ Faster and smaller at once, because a build can afford q11 where a per-request path cannot (the runtime uses q4 precisely so it never stalls a response). Only hashed assets get variants: a stale `.br` beside a changed original is a corrupted response rather than a slow one. The `ETag` is computed over the UNCOMPRESSED file and passed through, so brotli, gzip and identity share one tag — the invariant `httpResponseWrite.ts` states, which hashing the variant would have broken.
261
+
262
+ **`web.assetPrefix`.** Becomes vite's `base`, so every emitted URL is written with the prefix at build time. Without it an app with a single `ssr` route serves every byte of its bundle from the container — `voltro static`, the documented cost-offload, only applies to an app that is entirely static. Verified on a fixture: all ten asset URLs in the shell AND in every pre-rendered page carry the prefix.
263
+
264
+ **`http.keepAliveTimeoutMs`, default 72000.** Node hangs up an idle keep-alive connection after **5 seconds** — confirmed on a running server (`Keep-Alive: timeout=5`) — while nginx holds one for 75s and ALB/Envoy for 60s. The proxy then sends onto a socket the server is closing and answers 502. Rare per request, certain over time, and invisible in testing. `headersTimeout` is derived above it and a declared value at or below `keepAliveTimeout` is RAISED rather than applied: node measures it from connection start, so honouring it would destroy healthy connections. Applied on both serving surfaces from one resolver. Verified: `Keep-Alive: timeout=72`.
265
+
266
+ **`preconnect` for a cross-origin api.** When an api's `wsUrl` is on another host the shell carries `<link rel="preconnect" … crossorigin>`, so the handshake overlaps the bundle download instead of following it. Same-origin apis emit nothing — the browser already has that connection, and a redundant hint costs a wasted socket. `crossorigin` is required: without it the warmed connection is anonymous and the credentialed one the socket needs is a second handshake.
267
+
268
+ **`web.sourcemaps: 'hidden'`.** Emits `.map` files with no `//# sourceMappingURL` comment. `plugin-sentry` reads `SENTRY_RELEASE` explicitly "for release health AND source maps" and there was no way to produce any, so every production stack trace was minified — from an integration advertising the opposite. Off by default, and named for what it does rather than being a boolean.
269
+
270
+ **And `voltro start` now refuses to serve a `.map` at all**, whether or not one is on disk. The docs say to upload the maps and delete them before the image is built, and "say" is not a mechanism: a hidden map is undiscoverable but perfectly REACHABLE — its URL is the chunk's own name plus `.map`. One forgotten deploy step would publish the app's source. 404, not 403, because a 403 confirms the file exists. Red-verified: with the refusal removed, the same request returns **200 and the map's contents**.
271
+ - **@voltro/i18n, @voltro/cli** — **`<LocaleSwitcher>` now ships unstyled from `@voltro/i18n`, and `voltro doctor` reports the failure that made it necessary.**
272
+
273
+ Counted across the shipped templates: 16 declared `@voltro/ui-shadcn`, and **13 of them never imported `@voltro/ui-shadcn/tokens.css`**. The only kit component they used was `LocaleSwitcher`, which is `h-9 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs …` and nothing else. Tailwind v4 emits a utility only when a CSS entry declares it, and the kit deliberately does not import its own stylesheet (the app owns its CSS entry) — so every one of those class names referred to a rule that did not exist. The control rendered as a bare `<select>` with dead `class` attributes, in templates whose own docs say they do not use the kit.
274
+
275
+ Nothing could have caught it: `voltro build` succeeds (a missing utility is absent bytes, not an error), `tsc` succeeds (the import is real), and the page renders.
276
+
277
+ Two changes:
278
+
279
+ - **`@voltro/i18n` exports `LocaleSwitcher`** — the same behaviour (writes the `voltro:locale` cookie, reloads, `onChange` can suppress the reload) as a native `<select>` you style yourself. It belongs here for the same reason `LOCALE_COOKIE` already moved here: an app on the framework's i18n and not on the kit had no way to reach it. `@voltro/ui-shadcn`'s styled version is unchanged. - **`voltro doctor` reports a kit rendered with no stylesheet** — advisory, and it names the offending files. Quiet when the app imports `tokens.css`, quiet when the app declares Tailwind itself, and quiet on a `import type` (which emits nothing and therefore cannot produce a class attribute).
280
+
281
+ The 13 templates now import the unstyled control and no longer declare `@voltro/ui-shadcn` at all — which also drops that package's `shiki` dependency from every one of them.
282
+
283
+ ### Changed
284
+
285
+ - **@voltro/content, @voltro/ui-shadcn, @voltro/cli** — **The production bundles carried 308 syntax grammars and three cloud SDKs for apps that asked for none of them.**
286
+
287
+ Both shiki callers already restricted their languages correctly — `@voltro/content` to nineteen, `@voltro/ui-shadcn` to eighteen — at RUNTIME. A bundler cannot read a runtime list, and the `shiki` barrel maps all 700+ of its languages to their own dynamic import, so every one was emitted as a chunk. Measured, by intersecting the emitted filenames with `@shikijs/langs` + `@shikijs/themes`: **6.67 MB across 308 files, in BOTH the api serve bundle and the web start bundle**. In a browser bundle it is the same set: an app rendering one `<HighlightedCode>` made 308 chunks reachable.
288
+
289
+ Both now build from `shiki/core` with the grammars and themes imported by name. Every specifier stays dynamic and node-gated — `shiki` is an optional dependency and `@voltro/content` is isomorphic, so a static import would both break an app that never renders markdown and put the highlighter in the browser graph of anything importing `renderMarkdown`.
290
+
291
+ The same shape, one layer out: the api serve bundle also carried the Azure Blob SDK (604 KB) and `@react-email/render` + `react-dom/server` (972 KB) for a fixture that declares one plugin and neither storage nor mail — they arrive through `@voltro/cli`'s own dependencies on `plugin-storage` / `plugin-mail`. Each is already reached by a dynamic import inside its plugin and is an optional peer of it, so each joins the runtime-external list beside `ioredis` and `nodemailer`: an app that configured the provider resolves it from its own `node_modules` at boot, one that did not never ships it.
292
+
293
+ Measured end to end, on the reference fixtures:
294
+
295
+ | | before | after | |---|---:|---:| | api serve bundle | 26.9 MB / 535 files | **5.72 MB / 138** | | web start bundle | 13.59 MB / 427 files | **1.48 MB / 39** |
296
+
297
+ Both are pinned now (`bundle-budget.mjs --artifacts`), in bytes AND in file count — 427 is a number somebody notices, where "13.6 MB" reads as "it is a bundle".
298
+
299
+ Highlighting is unchanged and verified through a real build: the docs site's pre-rendered pages still carry `class="shiki shiki-themes github-light github-dark-dimmed"`.
300
+ - **@voltro/cli** — **The artefacts that exist to collapse a cold boot were shipped unminified — and nothing enabled node's code cache.**
301
+
302
+ `VOLTRO_BOOT_TIMING=1` says where a boot goes, and the answer is the phase the bundles were built for: `modules` (node init + loading the precompiled bundle) is **46 %** of a `voltro start` and **65 %** of a `voltro serve`. V8 parse time tracks bytes, and neither `webStartBundle.ts` nor `apiBuild.ts` set `minify`, while vite leaves an SSR build unminified by default.
303
+
304
+ Both are on now, plus `enableCompileCache()` in the launcher. Measured on the reference fixtures, five fresh processes each, median:
305
+
306
+ | | before | after | |---|---:|---:| | `voltro start` boot | 166 ms | **83 ms** | | `voltro serve` boot | 287 ms | **222 ms** | | start bundle | 13.59 MB | 11.75 MB | | serve bundle | 26.9 MB | 18.25 MB | | `dist/server/ssrEntry.js` | 1.91 MB | 0.85 MB |
307
+
308
+ `keepNames: true` is not optional and is the one thing to preserve if you touch this: Effect's tags, error `name`s and the boot-refusal marker (`bootRefusal.ts`) are compared as STRINGS across the bundle boundary, and a mangled class name turns a precise refusal into an anonymous one. It costs a few percent of the saving and buys back every diagnostic the bundle exists to keep.
309
+
310
+ The compile cache is only enabled when `NODE_COMPILE_CACHE` is unset, so an operator's directory always wins. In a scale-from-zero container the OS temp dir starts empty, which is why the shipped standalone Dockerfiles point the variable at a directory the image BAKES during its boot smoke — the run that was already happening.
311
+
312
+ ### Fixed
313
+
314
+ - **@voltro/database** — **Two replicas booting at once against a schema with work to do killed one of them.**
315
+
316
+ `applyPlan` takes the migration advisory lock, so two writers cannot execute at the same time. What it did not do was ask again once it held the lock. Both replicas plan against the same live state, then queue; the winner applies, and the loser wakes holding a plan for a database that no longer exists:
317
+
318
+ ```
319
+ ═══ applier: statement failed (op=add-check) ═══
320
+ statement: ALTER TABLE "actors" ADD CONSTRAINT "actors_kind_check" …
321
+ db.message: constraint "actors_kind_check" for relation "actors" already exists
322
+ dev server exited — supervisor stopping exitCode: 1
323
+ ```
324
+
325
+ A classic time-of-check/time-of-use: the lock serialised the apply and did not protect what the apply rests on. It self-heals — the pod restarts and finds the schema applied — so what it looked like in production was one crash per replica on every deploy against a schema that had work to do, on a plan that was correct when it was made. A cold fleet start is exactly when every replica has work to do.
326
+
327
+ The first thing under the lock is now `ctx.replan` — the same hook the convergence proof uses at the other end, required for the same reason (only the caller knows the planner inputs). Everything downstream reads the re-planned set: the operations, the resume ledger's comparison, and the recorded fingerprint. Using the stale one for any of those would record that a replica applied work it did not.
328
+
329
+ Where the plan is already current — the ordinary case, nobody raced — the re-plan returns what was passed in and costs one introspection. `applyPlan` is not called at all for an empty plan, so that cost lands only where there was real work.
330
+
331
+ A plan that becomes blocked under the lock is refused as loudly as one that started blocked; the pre-lock check judged a different set.
332
+ - **@voltro/cli** — **A proven change-stream gap now drops the cache, not only the live queries.**
333
+
334
+ Re-running every live subscription repairs what a subscriber sees, and that is the half you look at. Cache invalidation rides `store.onChange` — so while the stream was down, nothing was invalidated — and the dispatcher's recompute re-seeds only the entries a LIVE subscription owns. Everything else keeps serving pre-gap rows until its TTL: a `ctx.cache` read, an ISR page, a cached query nobody is currently subscribed to. On a replica that has just announced, in its own log, that it knows it was behind.
335
+
336
+ The recovery now evicts every registered table before refreshing. Blunt for the same reason `refreshAll` is blunt — we do not know which tables the lost changes touched, and guessing narrower is how the silent staleness comes back. Cache first, then the queries: the recompute reads the store directly and writes its result back, so dropping afterwards would throw the fresh rows away again.
337
+
338
+ Both boot paths, through the shared builder, with the parity asserted.
339
+ - **@voltro/cli** — **`voltro start` sets `Cache-Control`. It sent none at all.**
340
+
341
+ Measured against a running production server, on a chunk whose FILENAME carries its content hash:
342
+
343
+ ```
344
+ $ curl -D - http://localhost:5399/assets/index-7N08IhkU.js
345
+ HTTP/1.1 200 OK
346
+ content-type: application/javascript
347
+ vary: Accept-Encoding
348
+ content-encoding: br
349
+ etag: W/"4bff20f74ba2a65fde4443acd7ed80b6"
350
+ ```
351
+
352
+ No `cache-control` and no `last-modified`. RFC 9111 derives heuristic freshness from `Last-Modified`, so with neither header a browser has nothing to reason about and revalidates. The reference fixture's first load is an entry plus nine `modulepreload`s — ten conditional round-trips before the page is interactive, on every visit, for files that by construction can never change. A CDN or reverse proxy in front of the container could cache nothing at all, for the same reason.
353
+
354
+ The framework already knew the rule: `plugin-storage` serves its public objects with `public, max-age=31536000, immutable` and `plugin-atlassian` its avatars. Only the arm serving our OWN chunks had no policy.
355
+
356
+ Now, from one place (`staticCachePolicy.ts`, so the arms cannot disagree): content-hashed assets get a year and `immutable`; anything else out of `public/` gets an hour; a pre-rendered page gets `max-age=0, must-revalidate`, which the existing ETag answers with a `304`.
357
+
358
+ Nothing gets an `s-maxage` by default — a shared cache holding HTML past a deploy serves the previous build's asset URLs, and there is no purge hook to fix that. An app that owns its CDN opts in through the new `http.cache` block (`htmlSMaxAgeSeconds`, `isrShared`, and both lifetimes; `immutableMaxAgeSeconds: 0` turns the immutable header off entirely).
359
+
360
+ The hash detector is the part with an edge: it requires `/assets/` AND a `-<6..12 chars>` suffix, so a hand-named `page-2.js` is never frozen for a year — a mistake that cannot be undone without renaming the file.
361
+ - **@voltro/plugin-row-history** — **`timing: 'post-commit'` recorded one history version per replica, with different version numbers.**
362
+
363
+ The in-transaction timing is safe by construction: the writing replica records the entry inside its own transaction and the tap returns early. Post-commit has no such writer — on a `changeScope: 'fleet'` store the injected event reaches EVERY replica and each one calls `recordChange`.
364
+
365
+ It did not surface as a conflict. `recordChange` numbers a version as `MAX(version) + 1` and derives the row id from it, so two replicas both computed version 1, one won the primary key, and the loser's RETRY re-read MAX, got 2, and appended a SECOND entry for the same change. That retry exists for a genuine concurrent write to the same row and cannot tell that case from this one.
366
+
367
+ Measured with the gate removed: three replicas, one change, versions `1, 2, 3`; two replicas, three changes, `1, 2, 3, 4, 5, 6`. Not merely doubled — mis-ordered, and `selectAsOf` / `sortHistory` / `diffVersionRows` all read `version`. A duplicate can be deduped; a wrong order cannot even be detected from the data.
368
+
369
+ The tap now claims each change fleet-wide before recording, through the same arbiter behind `defineSubscriber({ once })`. The key names the CHANGE, not the row: a row id would collapse two genuine edits to one row, and for a history trail a silently missing version is the worse direction.
370
+
371
+ Nothing to configure. `timing: 'in-transaction'` is unaffected — it never had this.
372
+ - **@voltro/sql-postgres, @voltro/database, @voltro/cli** — **A postgres replica no longer goes permanently deaf when its LISTEN connection drops.** Under `changeStrategy: 'cdc'` — the multi-replica default on postgres — the CDC consumer holds one dedicated connection. `@effect/sql-pg` registers a no-op `client.on('error')` on it, so when that connection dies the socket error is swallowed, the stream neither fails nor ends, and the fiber draining it stays alive forever. Nothing throws. Nothing is logged. No fiber dies.
373
+
374
+ Measured against a live server: kill the backend holding the LISTEN, write from another connection, wait twenty seconds — nothing arrives. Every subsequent change from every other replica is lost too, until the process restarts. A failover, a proxy recycling an idle socket, an admin `pg_terminate_backend`, or the database pod restarting all produce it, and none of them touch the app process, which is exactly why the app process did not notice.
375
+
376
+ The consumer now carries a watchdog. It cannot wait for an error — there is none — so it probes: after silence on the channel it sends a `pg_notify` through the pool and requires the echo back on the LISTEN stream. Any traffic counts as the answer, including another replica's probe, so a busy channel never pays for one and a fleet pays roughly one probe per idle window however many replicas it has. An unanswered probe means the connection is dead; the consumer re-opens it, retrying with backoff, and does not declare success until it has heard its own heartbeat come back.
377
+
378
+ **And the reconnect declares a gap**, which is the half that makes it a recovery rather than merely a pulse: postgres queues nothing for a listener that is not there, so every change written during the outage is gone. Stores expose that through a new optional `DataStore.onChangeStreamGap`, and both `voltro dev` and `voltro serve` wire it to the same refresh the broadcast bus's gap already used — re-run every live query, which is safe and complete because a query is idempotent.
379
+
380
+ `VOLTRO_CDC_HEARTBEAT_MS` (default 20000) and `VOLTRO_CDC_HEARTBEAT_TIMEOUT_MS` (default 10000) tune it.
381
+
382
+ `apiSurface: compatible`: `PostgresDataStore`'s constructor gains a TRAILING OPTIONAL parameter (`cdcLiveness`), which the golden renders as a changed line. Every existing call still compiles — the store is built through `makePostgresDataStore` in any case.
383
+
384
+ The mysql binlog reader has had an error-driven reconnect and a watchdog for a silently-dead stream for some time. This is the postgres half of the same idea, on the dialect the documentation steers people to.
385
+ - **@voltro/plugin-broadcast, @voltro/cli** — **A change delivered by the database was re-published onto the broadcast bus, and the amplification was quadratic.**
386
+
387
+ On a dialect with a native change transport — postgres LISTEN/NOTIFY, mysql binlog — the store injects every change on EVERY replica; that is what makes the transport cross-instance in the first place. `@voltro/plugin-broadcast`'s outgoing listener then published those injected events again, under its own replica's origin, which is not own-origin for any peer. So every peer injected the change a second time.
388
+
389
+ Per change, with N replicas: N deliveries from the transport, N publishes onto the broker, and N(N-1) more injections from the peers — **N² local deliveries**. Every consumer of the change stream paid it: every `*.subscribe.ts` handler, every live-query wake, every plugin tap, every cache invalidation. At two replicas a subscriber's handler ran four times for one `INSERT`, twice per instance — and the per-instance half needs no cluster to reproduce, which is why it does not read as a clustering problem.
390
+
391
+ The suppression required the bus to be mid-inject (`injecting && …`), which only ever covered the bus's own echo. It is provenance alone now: an event stamped `origin: 'injected'` reached this process through some transport, and forwarding a transport delivery to a second transport is the amplification. A local publish that states `origin: 'inline'` — `publishReactivity` does — is still published, so reactivity channels keep crossing replicas.
392
+
393
+ The boot banner said the same thing the code did. It used to read `both paths active (own-origin skip dedups)`; it now names what each path carries:
394
+
395
+ ```
396
+ reactivity: native LISTEN/NOTIFY (postgres) carries table changes;
397
+ @voltro/plugin-broadcast (redis) carries reactivity channels
398
+ ```
399
+
400
+ Nothing to change in an app. If you run postgres or mysql with a broadcast plugin, the duplicate deliveries stop on upgrade.
401
+ - **@voltro/cli** — **`voltro db plan --json` and `voltro db drift --json` were silently truncated when piped.** `fs.writeSync` is not "write this"; it is "write as much as the fd accepts right now, and return how much that was". On a file that is everything — which is why `> plan.json` worked and every manual check passed. On a pipe the kernel takes one pipe buffer, 64 KiB, and the rest is simply not written.
402
+
403
+ A plan crossing 64 KiB therefore reached `| jq`, or a CI step capturing the command, as exactly 65 536 bytes: valid JSON up to the cut and a parse error after it. It reads like a malformed plan and it is a malformed read — and the documented production route is to review that JSON and apply it.
404
+
405
+ The line it replaced carried a comment saying `writeSync` "always flushes", written as the fix for the previous version of this same bug (`console.log` to a non-TTY is block-buffered, and `process.exit` dropped the buffer, so `--json` emitted *nothing*). That fix was right about `console.log` and wrong about its replacement, turning "nothing on a pipe" into "the first 64 KiB on a pipe" — the more dangerous of the two, because an empty output is noticed at once and a truncated one is noticed by whoever parses it later.
406
+
407
+ `writeAllSync` loops over partial writes. Its test spawns a child with a real pipe, because on a file the defect does not exist.
408
+ - **@voltro/plugin-search** — **The search panel could over-count a fleet's sync stats, because the plugin derived its replica id instead of using the one it was handed.**
409
+
410
+ `_voltro_search_stats` keeps one row per replica and aggregates on READ: SUM under `changeScope: 'local'` (each replica counted a different slice) and MAX under `'fleet'` (every replica received the full stream, so each row is already a fleet-wide count — summing three of those is the 3× inflation the design exists to avoid).
411
+
412
+ That only works if the rows are actually per replica. `dataStoreStatsStore` takes the id as a parameter and the plugin never passed one, so it fell back to the process global — which is correct in production and made the identity undiscoverable to the plugin's own configuration. The id now comes from `PluginBindContext.instanceId`, the same value the event bus stamps and the membership registry announces under, and the reason the context carries it.
413
+
414
+ Found as a red test rather than by reading: the fleet-stats case simulates three replicas in one process, which it used to do by setting `VOLTRO_REPLICA_ID` around construction. Once process identity became memoised — one process, one identity — all three "replicas" shared an id, wrote to one row, and the panel reported 3 where the case asserts 1. The property was right and the simulation had become impossible to express; taking the id from the context makes it expressible again, through the same seam production uses.
415
+ - **@voltro/cli** — **`voltro build` could not produce a serve bundle for any app declaring `@voltro/plugin-sentry`** — 35 errors, all `No loader is configured for ".node" files`, and a `fatal: serve bundle build FAILED — refusing to ship a bundle-less image`.
416
+
417
+ `@sentry/profiling-node` reaches `@sentry/node-cpu-profiler`, which `require()`s a per-platform `.node` binary. It is the strongest possible case for the native-leaf list — BOTH of that list's reasons at once, a compiled binding that cannot be inlined AND a `await import(…)` behind a `profiling: true` flag that already degrades to a warn when absent — and it was simply never added.
418
+
419
+ **The second half is why adding the leaf alone would not have fixed it.** The runtime shim resolves a leaf from a chain of roots: the declared SQL drivers, then `@voltro/cli`, then the app root. An optional peer lives under the plugin that dynamic-imports it, and pnpm strict does not hoist it — so `@voltro/cli` covers the peers of the plugins the CLI itself depends on (mail, storage) and nothing else. `@sentry/profiling-node` is an optionalDependency of `@voltro/plugin-sentry`, which the CLI does not depend on, so no root in the chain could have found it at runtime.
420
+
421
+ The chain now includes **every `@voltro/plugin-*` the app declares**, derived from its `package.json` rather than listed. A hard-coded plugin list is the shape that produced the gap: correct until the next plugin ships an optional peer, and silent when it does.
422
+
423
+ Found by the first `--build` run of the template harness. `voltro test` transpiles and `tsc --noEmit` typechecks; neither runs a build, so an unbuildable template stays green in both.
424
+ - **@voltro/protocol, @voltro/cli, @voltro/plugin-ratelimit** — **Two defaults that are correct for one process and silently wrong for several now say so.** Neither default changes — a process-local store is right on one process, and demanding Redis to run a single instance would be worse. What was missing is the deployment noticing.
425
+
426
+ - **The rate limiter.** `rateLimitPlugin` defaults to a process-local counter, so `100/min` on five pods is 500/min. That is not a performance detail: a limiter is usually what stands between an endpoint and abuse, which makes this the one default whose silent multiplication has a security consequence. - **Read-your-writes.** The RYW position store defaults to a process-local Map. With `DB_REPLICA_URLS` set, read-your-writes then holds only when the next request happens to land on the same pod — a user saves, the load balancer sends them elsewhere, and that pod routes the read to a lagging replica and serves the row as it was before the write. The boot line said `ryw policy 'fallback'` as though the policy were in force.
427
+
428
+ Both warn on the same signal the reactivity audit already used (`replicaEvidence`: `POD_NAME`, `FLY_ALLOC_ID`, `K_REVISION`, … and an explicit `REPLICA_COUNT` as a declaration in both directions), and each names the way out.
429
+
430
+ `replicaEvidence` moves to `@voltro/protocol/identity` — it began in the CLI, a plugin cannot import the CLI, and copying twenty env names is how one question acquires three answers. It is still exported from its old place.
431
+ - **@voltro/cli** — **The outbox runner's shutdown could settle the wrong pass.** `close()` awaits the in-flight drain rather than truncating a delivery mid-flight — that is the half of the shutdown gap a `clearTimeout` cannot cover, and it was already tested. What it awaited was `inFlight`, which `kick()` overwrote on every call including one that immediately returned because a pass was already running. So `close()` could await a promise for a pass that never ran while the real one was still inside its handler, and the next step of the real shutdown sequence is `store.close()`.
432
+
433
+ The window only opened when a second kick landed inside the first pass, which is why it survived: it took adding one round trip to the drain to widen it enough for the existing settle test to catch. An early-returning pass now hands back the pass it deferred to, so `inFlight` always names real work.
434
+
435
+ Found by a test that was already asserting the right thing and had been passing for the wrong reason.
436
+ - **@voltro/protocol, @voltro/runtime, @voltro/cli, @voltro/voltro** — **A peer that restarted stopped being heard by reconnecting clients.** `EventEnvelope.origin` says what it is — *"Publishing instance. Serials are only comparable WITHIN one origin"* — and both boot paths handed it the replica NAME. A name survives a restart; a serial does not. A StatefulSet pod keeps its `POD_NAME` and `VOLTRO_REPLICA_ID` is stable by definition, so a restarted peer publishes serials 1, 2, 3… under an origin whose watermark still reads 500.
437
+
438
+ Two silent losses follow from that one stale number. The watermark never advances, so a reconnecting client is told it missed nothing; and the resume replay filters by `n > lastSeen`, so the new process's events are dropped from the replay entirely. The peer is publishing normally the whole time.
439
+
440
+ The event bus now keys on `instanceId()` — `<replicaId>@<startedAt>.<nonce>`, newly exported from `@voltro/protocol/identity`. It carries the replica name as its prefix, so correlating the subsystems across pods still works.
441
+
442
+ `apiSurface: compatible`, and it covers a second thing: regenerating the goldens caught up drift the fleet-observation work left in the `@voltro/voltro` AGGREGATES, which are re-exports and so do not regenerate when their source package does. The one changed line there is `checkFrameworkCompat`, whose `runningVersion` parameter WIDENED to `string | undefined` and whose success result gained an optional `unverified`. A widened parameter accepts every call that compiled before; an added optional field breaks no reader.
443
+
444
+ The membership registry deliberately keeps the NAME: it detects a restart by comparing `startedAt` under a stable id, and a per-process id would turn every restart into a join plus a silent leave.
445
+ - **@voltro/cli, @voltro/database** — **`_voltro_idempotency` grew without bound, and its own documentation said it did not.**
446
+
447
+ The table's doc comment claimed "a periodic sweep / lazy-TTL drops rows past their window". The lazy TTL is real and fires only when the SAME key is claimed again — and an idempotency key is used once by definition, so the row it leaves behind is never read and never deleted. There was no periodic sweep at all: the table was the one member of its family with no entry in the retention registry.
448
+
449
+ It has one now, and the TTL is a FLOOR rather than a setting that can be turned down. A record dropped while still inside the app's own dedup window would let the duplicate request it exists to stop execute a second time, so `VOLTRO_IDEMPOTENCY_TTL_HOURS` may lengthen the window and may not shorten it below the app's `idempotency.ttlMs` plus a clock-skew margin. When it asks for less, the floor wins and the boot says so — a silently-ignored setting is worse than a refused one.
450
+
451
+ The reaction rate-limiter's slot rows used to live in this table too and now use `_voltro_change_claims`, whose window is an hour rather than the idempotency window. Two row families with different lifetimes cannot share one retention policy: the registry is keyed by table, so one table carries exactly one TTL.
452
+
453
+ Also corrected: the table is created for EVERY sql app (`when: 'always'`), not "only when `idempotency` is set in `app.config.ts`" — that is what the config gates, not what the table registry does.
454
+ - **@voltro/plugin-presence** — **`usePresence` re-announced its membership on every render, which is a write loop.** Measured on a real page against a real api, ONE page load, a fresh browser context: **~9 300 uncaught `RateLimited: presence.heartbeat` pageerrors in 3.5 seconds** — about 2 700 per second, and the same rate of mutations arriving at the server. The 60/min rate limiter was the only thing standing between this and an unbounded write loop.
455
+
456
+ `meta` sat in the join effect's dependency array, and the documented way to call the hook is an inline object:
457
+
458
+ ```tsx
459
+ usePresence('room', { key: me.key, meta: { name: me.name } })
460
+ ```
461
+
462
+ which is a new identity every render. So: leave → join → roster push → re-render → leave → join → … The hook already refd its two mutations for exactly this reason and left the one caller-supplied value in.
463
+
464
+ `meta` is refd now, so the interval always sends the CURRENT value, and the join effect is keyed on the membership identity only — a metadata change publishes immediately through a separate effect instead of tearing the membership down and re-announcing it. A serialisation failure degrades to "publish at the next beat" rather than throwing: a roster is not worth a render crash.
465
+
466
+ **Nothing in this package could have seen it.** Closing the loop needs a REAL subscription pushing a real roster back; a mocked transport re-renders once and stops. So the regression test asserts the property that BREAKS the loop — an equal-but-new meta object does not re-announce — and was falsified first: with `meta` back in the deps, two re-renders produce three heartbeats instead of one.
467
+ - **@voltro/protocol, @voltro/runtime, @voltro/cli, @voltro/plugin-billing, @voltro/plugin-search** — **One process, one identity.** `replicaId()` / `processIdentity()` from `@voltro/protocol/identity` is now the only place the framework decides which replica it is running as. It was an expression, sixteen times, in three packages, in FOUR spellings — and the spellings disagreed.
468
+
469
+ Two ignored `POD_NAME` entirely and read `HOSTNAME` alone; one read `HOSTNAME` *before* `POD_NAME`; only one honoured the explicit `VOLTRO_REPLICA_ID` override. The variants landed in different subsystems: the `HOSTNAME`-only one stamps `_voltro_schedule_runs.replicaId` and `claimedBy`, while the `POD_NAME`-first one answers `/_voltro/inspect/cluster`.
470
+
471
+ **So a single inspect response could name the same pod twice, differently.** `instance.replicaId` came from one spelling; `coordinationState.recentReplicaIds` — read back out of the schedule-run rows — came from the other. A dashboard asking "which of these is me" found itself in neither list. The doc comment on that field asserted the two were the same id; it is now true rather than aspirational.
472
+
473
+ This matters beyond tidiness: every aggregation across replicas groups by this id, and grouping by an id that depends on which subsystem wrote it is worse than not aggregating at all.
474
+
475
+ The identity says four things, because two of them were missing:
476
+
477
+ - `replicaId` is the PLACE in the fleet and survives a restart; `instanceId` carries the GENERATION and does not. Conflating them made "one pod restarted forty times" and "there are forty pods" the same number. The generation carries a nonce below the clock's resolution — two generations starting in the same millisecond would otherwise collide, and an aggregation keyed on it would merge two processes into one. - `version` is what this process runs, for the window in which a rolling deploy makes the fleet genuinely mixed. `undefined` when it cannot be determined — never a plausible-looking `0.0.0`, which two of the old resolvers returned and which compares equal to another unknown. - `reachableAt` / `reachable` record where a peer could reach this process, with loopback recorded as NOT reachable — the same distinction `resolveRunnerIdentity` already draws as `localhostRisk`.
478
+
479
+ **The framework VERSION had the same disease, with sharper teeth.** Three resolvers: two hunted for `package.json` relative to their own module, and one read `npm_package_version` — the APP's version when started through an npm script, reported as the framework's. The manifest hunt cannot work inside a bundle, where the framework is inlined and `../package.json` belongs to whatever sits there, so a bundled `voltro serve` fell into its `catch` and reported `'0.0.0'`: right under `voltro dev`, wrong in production, which is the one place nobody can go and read it out of the source tree.
480
+
481
+ And `'0.0.0'` PARSES. It reached `checkFrameworkCompat`, where every plugin declaring a `framework:` range was judged incompatible against a version nobody was running — a warning on every production boot, and a refused boot under `VOLTRO_STRICT_PLUGIN_COMPAT`. That check now treats an unreadable version as **unverified rather than incompatible**, and says so: absence of evidence is not evidence of a mismatch. `voltro build` writes the version into every server bundle's banner (one definition, three bundles — it was a repeated string literal, which is how the injection would have reached one and missed the others).
482
+
483
+ **`mode` gained `'serve'`.** An api under `voltro serve` reported `'start'`, and `voltro start` is web-only — it refuses an api with "no web app found". The readout named a command the process could not have been started by, while `/members` reported `meta: { mode: 'serve' }` for the same process: one fact, two endpoints, two answers. It is now a projection of the resolved boot path, stamped on the function the production container command actually enters (`node serveEntry.js` calls `runServe` directly and never passes through the dispatcher — stamped one level up, a bundled serve reported `'cli'`).
484
+
485
+ Measured against a real bundled production serve, not inferred: `{"voltroVersion":"0.55.0","mode":"serve"}` where it previously read `{"voltroVersion":"0.0.0","mode":"start"}`.
486
+
487
+ `scripts/check-process-identity.mjs` (CI + `pnpm gate`) fails on any second derivation, and ships a `--selftest` that classifies eight shapes — the four that were really in the tree, plus four benign reads that must not trip it.
488
+ - **@voltro/cli, @voltro/devtools-ui** — A sweep of all 31 dashboard pages in a real browser, against a running api, found four defects nothing else was looking for. None threw where a test could see it; three of them blanked a whole page.
489
+
490
+ **A "structured empty" that was not the structure.** `/_voltro/inspect/database` answered `{ migrations: [], seeds: [] }` when the app had no snapshot to give, while `DatabaseStatus` declares `dialect` and `replication` as present. The page read `status.replication.replicaCount`, threw during render, and the Database page went blank with a console trace. A structured empty exists so a reader can render it WITHOUT branching; one that omits half the structure is a differently-shaped payload wearing the word. It answers the full shape now, and the panel tolerates the short one because a customer app on an older version still sends it — a dashboard that crashes on an old app cannot be used to diagnose one.
491
+
492
+ **One endpoint, two shapes, depending on the app.** `/_voltro/inspect/metrics` answers with the runtime registry snapshot (`MetricSample[]`) for a web app and the rpc collector's aggregate (`{ windowMs, capturedAt, totalSamples, buckets }`) for an api — two unrelated types that happen to share the name `MetricSample`. The client declared the first for both, so `samples.filter` threw on every api app, during render, taking the overview down with it.
493
+
494
+ Which shape the endpoint should settle on is a wire decision and is NOT made here. `deriveMetricRows` returning nothing rather than throwing is not a decision: a derivation that cannot read its input must not take the page down.
495
+
496
+ **A 500 for "this app has no workflows".** A framework table exists only when the app declares the feature that owns it, so a workflow read on an app with no workflows fails at the driver — and three handlers turned that into `500 … query failed`. "The server is broken" for a fact that is simply "there is nothing here". They answer the endpoint's own empty shape plus an `unavailable` reason now. The classifier matches the driver message per dialect, which is not something to build a control path on and is not one: it chooses between two ways of REPORTING, and an unrecognised message falls through to the 500 that was there before — the failure direction is always the old behaviour.
497
+
498
+ **And the reason the server sends is no longer discarded.** The inspect surface answers a dev-only path with a 404 whose body says "this endpoint exists and your deployment does not mount it… this is not a missing token" — a sentence written because a deployment reported the bare 404 as unreadable. The dashboard threw it away and rendered `[inspectClient] <url>: HTTP 404`, on six panels against every production app. The CLI's own inspect client had already fixed this exact blind spot and recorded that the fix belongs in the shared helper; this is the same helper on the browser side.
499
+ - **@voltro/cli** — Two defects that produced a console error on every app page of the DevTools dashboard, found by a browser check and by nothing else — neither threw, neither changed a status code any test was watching.
500
+
501
+ **The live inspect stream did not exist under `voltro serve`.** `/_voltro/inspect/stream` was supplied by `dev.ts` and by nothing else, so the URL 404'd in production: the dashboard's log tail, its app-overview feed and the data viewer's CDC refresh all worked while you developed and were dead where it counted. The boot-path parity test had this on its EXCEPTION list, with the reason "there is no overlay" — true about the in-page dev overlay, and wrong about the surface, because the DevTools dashboard opens the same stream against whatever app is registered including a deployed one. An exception list is only as good as the reason on each line, and that line reasoned about one consumer of a surface with two. It is deleted, and the correction is written where it stood.
502
+
503
+ The stream is now mounted by ONE builder both boot paths call (`buildInspectStreamWiring`) — the authorize/replay/subscribe quartet is a security surface carrying the DNS-rebinding host guard and the token resolver, and copying that into a second path is how one copy loses a guard. Serve feeds it the channel it genuinely owns (the subscription registry, via the same snapshot builder its HTTP path uses) and tears both down on shutdown: a stream that connects and never emits is worse than the 404 it replaced, because a silent feed reads as "nothing is happening".
504
+
505
+ **The SSE proxy could only ever present its OWN token.** `EventSource` accepts no headers, so the browser cannot attach a per-app bearer the way every other inspect call does — the proxy fell through to the dashboard process's `VOLTRO_INSPECT_TOKEN`, which is the right token for an app that process minted and the wrong one for an app registered by URL. `voltro dev` mints a token per project, so that was every app, and the stream answered 401.
506
+
507
+ The token now travels as a same-origin cookie scoped to the proxy's own path, `SameSite=Strict`, cleared as soon as the stream opens — not a query parameter, because a bearer in a URL lands in every access log that touches it. It is moved into an Authorization header by the proxy and never reaches the target as a cookie. The precedence (caller's header → stream cookie → this process's own, loopback only) is resolved in ONE function both boot paths call; it had been written out in both, which is how a rule of this kind starts to differ.
508
+
509
+ **And a poll that ran before it knew what it was polling.** The app overview guarded its ISR-cache poll with `status === 'ok' && kind !== 'web'`, so while the status was still `pending` — i.e. before the app's kind was known — every api app fetched the web-only cache endpoint and took a 404. Twice, because the effect re-runs when the status settles.
510
+ - **@voltro/cli** — **`voltro update` said the same thing about two opposite outcomes.** An update that changed nothing printed `codemods: nothing to apply for this jump` whether the jump ships no codemods at all, or ships several and every one of them gated ITSELF out through its own `appliesTo`. A reader takes the first meaning, because that is what the sentence says.
511
+
512
+ The second is the state worth naming. A codemod's `appliesTo` is a predicate, and a predicate can be wrong in the direction that stays quiet: a gate reading the wrong files answers "does not apply" for a project that is fully affected. That has happened here — a `manual` codemod's gate searched the ts-morph project for a subject that only ever appears in a shell script or a CI job, which is why `codemodTextScan` exists. That fix made the GATE see more files; it did not make the SUMMARY admit a gate had run and said no.
513
+
514
+ So the summary now separates them: `none ship for this jump` when the range is empty, and otherwise the count plus every skipped id by name, with a line saying that a subject you recognise in that list is a bug in the check rather than a fact about your code. A partial run reports its skipped ones on one line for the same reason — two applied and one silently gated out reads as "all three considered and handled".
515
+
516
+ **A claim this entry made in its first draft was wrong, and it is corrected here rather than quietly dropped.** It said the dialect half of the framework-table rule "was not covered below the planner at all", and announced a new MariaDB test as the fix. Both halves were false: `sql-postgres/__tests__/frameworkTableEvolution.integration.test.ts` and its `sql-mysql` twin have covered exactly this since the rule landed — on BOTH mysql engines, asserting a column RESHAPE (harder than the ADD the new test made), with a premise assertion, the outcome KIND, and convergence. The new test was deleted; it measured less than what was already there, in the wrong package.
517
+
518
+ ### Internal (no consumer-facing effect)
519
+
520
+ - **@voltro/voltro** — **`packages/voltro` declares `lib: ["ES2024","DOM","DOM.Iterable"]` now, because it compiles `@voltro/i18n`'s source under its own options.**
521
+
522
+ The aggregate re-exports that package's ROOT entry — its browser half — so `tsc` follows the path mapping into `../i18n/src/**` and compiles those files with the AGGREGATE's compiler options, not the ones `@voltro/i18n` declares for itself. The moment i18n exported a component touching `document`, `@voltro/voltro#typecheck` failed with TS2584 while `@voltro/i18n#typecheck` stayed green: legal there, illegal here, one file. The aggregate already carried `jsx: react-jsx`, so this completes a decision that was half made.
523
+
524
+ `apiSurface: compatible`, and this is the part worth stating rather than asserting. DOM declares `Notification`, `Option` and `Cache` as globals, so once they are in scope api-extractor must disambiguate the aggregate's own symbols from them — `interface Notification_2` + `export { Notification_2 as Notification }`, `import { Option as Option_2 }`, `class Cache_2` + `export { Cache_2 as Cache }`. Three goldens therefore show REMOVED lines, which is what the narrowing detector reports and it is right to.
525
+
526
+ Nothing left the surface. Public names extracted from BOTH the `export const|type|interface X` and the `export { X_2 as X }` forms, on both sides of each golden, are identical sets: 965/965 for `voltro-server`, 293/293 for `voltro-ai`, 26/26 for `voltro-cache`. A consumer importing `Cache`, `Notification` or `Option` from `@voltro/voltro` sees no change; only the report spells them differently.
527
+ - **@voltro/runtime** — The event-bus perf budgets are RATIOS now, not absolute microseconds.
528
+
529
+ `expect(full).toBeLessThan(60)` read 87.6 µs on a release runner and took the run down. Nothing had regressed: the runner was ~19x slower than the machine the constant was written on, and 60 µs against a 4.6 µs local reading left only 13x of headroom. Two more assertions in the file had the same shape and had simply not fired yet — the publish budget sat at 86% of its constant on that runner.
530
+
531
+ Each is now a ratio between two measurements taken in the same test on the same machine, so machine speed divides out:
532
+
533
+ - `full < raw * 12` — the assertion the test is NAMED for ("the wrapper is not where the cost is") and never made. Both numbers were already measured three lines apart, and the file even printed `full - raw` before discarding it. - `warm < cold * 5` — the resume test claimed "attaching after 5k publishes must cost about what attaching after 5 does" and then measured only the 5k end. It measures both now, which is the first time it tests its own stated property. - `micros < machineMicros() * 150` — the one claim with no same-code comparand, denominated in a keyed-Map/string reference in a publish's own cost class.
534
+
535
+ The ratio form is also STRICTER than what it replaces: these fire at ~3-6x regressions where the constants needed 13-331x. Each was falsified by tightening its bound and watching it go red — a budget that can no longer fail is the failure mode this file exists to avoid.
536
+
537
+ ---
538
+
539
+ ## [0.55.0] — 2026-08-27
540
+
541
+ ### ⚠ BREAKING
542
+
543
+ - **@voltro/protocol, @voltro/client, @voltro/runtime, @voltro/cli** — **A multi-reference field now flips as instantly as a scalar one.** A mutation target's declared `relations:` reconciled the junction inside the server's transaction and nothing else: the client learned about the link change only when the delta came back. On the same submit, the renamed title flipped immediately and the assigned stores did not — the half of the promise that was never stated.
544
+
545
+ The declaration now drives BOTH. `useMutation`'s auto-optimistic stages a patch on every subscription sourced on the junction table, reconciling that anchor's links against `input[field]` — surplus links removed, new ones staged, surviving links left untouched with their real ids (a diff, mirroring `store.relationLinks(...).set`, not a drop-and-restage that would blink every unchanged row).
546
+
547
+ The patches ride the ordinary optimistic lane, staged under the mutation id, so the rollback rule holds by construction: reverted on failure, kept on success until the base actually moves. Nothing here is on a timer.
548
+
549
+ **Migration — `relations:` values are objects now:**
550
+
551
+ ```ts
552
+ // before
553
+ target: { table: 'employees', op: 'update',
554
+ relations: { assignedStores: 'employee_assigned_stores' } }
555
+
556
+ // after
557
+ target: { table: 'employees', op: 'update',
558
+ relations: { assignedStores: {
559
+ junction: 'employee_assigned_stores',
560
+ anchorColumn: 'employeeId', // the junction reference() pointing at `employees`
561
+ targetColumn: 'storeId', // the junction's other reference()
562
+ } } }
563
+ ```
564
+
565
+ The columns are declaration data because the optimistic patch runs in the BROWSER, which has no table registry to derive them from — `@voltro/database` is server-only by construction, and guessing a column from a table name is exactly what `store.relationLinks` refuses to do. They are not taken on trust: before it writes, the server compares the declaration against the junction's real reference columns and refuses, naming the correct pair, if they disagree. A wrong declaration is a loud error carrying its own fix, never a client that patches one column while the server writes another.
566
+
567
+ Semantics unchanged and now shared by both sides: an absent input field touches nothing (absent ≠ empty), an empty array is the explicit clear. The client uses `input.id` for an update and, for an insert, the same optimistic id it stamped on the new row — the server's `output.id` is not knowable before the response.
568
+
569
+ **`voltro update` carries you across this** — codemod `0.55.0/01_target-relations-declare-columns`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.55.0).
570
+ - **@voltro/client, @voltro/ui, @voltro/ui-shadcn, @voltro/web, @voltro/cli** — **A rich-text field, and the sanitizing contract is the point of it.** `RichTextDocument` (`@voltro/client`) is the value; `widget: 'rich-text'` renders it; `<RichTextView>` (`@voltro/ui`, re-exported by `@voltro/web`) displays it.
571
+
572
+ The contract, stated plainly because the alternatives all look reasonable until you name who the attacker is:
573
+
574
+ - **The value is a closed document tree, not an HTML string.** There is no `html` node, no raw-markup escape hatch, no attribute bag. Anything that is not one of the declared node types fails to decode. - **The boundary is the `Schema` decode**, which is the server's existing, non-bypassable input boundary — the same one every mutation input already passes through. So the guarantee is not "somebody remembered to sanitize this"; it is that a document which reached the database is one of these shapes. - **A link's `href` is the one field that points outward, and it is allowlisted** — `http(s)`, `mailto:`, a `#fragment`, a `/path`; nothing else. Control characters and whitespace are stripped before the check, because `java\tscript:` navigates exactly like `javascript:` and a check on the raw string passes it. - **Client-side is not a boundary and is not treated as one.** The widget's parser runs in the browser for the editing experience; every property it maintains is re-established by the decode on the server. - **Rendering never uses `dangerouslySetInnerHTML`.** Nodes become React elements, text becomes React children — so markup typed into the box is markup the reader SEES. `<RichTextView>` also drops an href that would not survive a decode, for the value that never went through one.
575
+
576
+ Rejected, for the record: sanitizing an HTML string on write (ships an HTML parser and the mXSS surface that comes with it), escaping at render (makes safety a property of every read site), and declaring an unenforced boundary (a convention, not a guarantee).
577
+
578
+ The built-in widget is a `<textarea>` over a small, CLOSED markdown subset — headings, `**bold**`, `*italic*`, `` `code` ``, `[text](href)`, lists, blockquote, fenced code — with everything unrecognised left as literal text. That also closes the no-JS loop: the textarea posts source, `/form/*` parses it, and the same decode validates it. A WYSIWYG belongs at rung 2 (register a `rich-text` widget); the stored value shape does not change.
579
+
580
+ **Not** the collaborative case: `crdtDoc()` + `useCrdtEditor` remains the multi-writer path (a CRDT bytes column, a sync lane, Tiptap). This is one column, one writer, ordinary JSON the server can validate and diff, and no new dependency in the default kit.
581
+
582
+ **Migration:** `WidgetKind` gained `'rich-text'`. Only a registry typed as a TOTAL map (`Record<WidgetKind, Widget>`) notices — add one entry pointing at the exported `RichTextWidget`. Partial registries need nothing.
583
+
584
+ Also fixed alongside: the capability manifest's `MANIFEST_WIDGET_KINDS` is a hand copy of `WidgetKind` (a CLI module cannot import `@voltro/client`) and had silently drifted by two kinds since 0.53.0, telling coding agents a smaller set than the renderer accepts. It is complete again and pinned by a test that reads the union out of the client's source.
585
+
586
+ **`voltro update` carries you across this** — codemod `0.55.0/02_widget-kind-gained-rich-text`. If you pin versions by hand and never run it, print the notes without changing anything: `voltro update --codemods-only --from <your current version> --dry-run` (this one ships in 0.55.0).
587
+
588
+ ### Added
589
+
590
+ - **@voltro/database, @voltro/data-transfer, @voltro/cli, @voltro/voltro** — A staged `--mode replace` now RECORDS the scratch tables it creates, and a boot collects the ones nobody is coming back for.
591
+
592
+ Staging tables are `_voltro_staging_`-prefixed, so the differ correctly ignores them — and nothing else mentioned them either. A run that died between the load and the swap left a full copy of a bundle that only a hand-written introspection could find, on a database whose boot said nothing. The marker row now names the set, carries a heartbeat the run refreshes while rows land, and records whether the run was started `--no-atomic`. That is what lets a boot tell the three cases apart: silent past the threshold and not resumable → the tables are dropped; still beating → an import is loading into them, here or on another replica; resumable → its staging IS the resume point and is left alone however stale. `VOLTRO_STAGING_STALE_MINUTES` moves the threshold (default 30). A staging record is reported, never a refusal — a staged replace destroys nothing until one short server-side swap, so refusing a boot over it would be an alarm on a healthy database. `voltro data clear-staging` reads the same records and labels each table with what its own run says, instead of listing them flat under a warning that it could not tell a leftover from an import in flight.
593
+
594
+ Two smaller things came with it. The raw-SQL seam the staged swap runs on (`DataStore.run`) is a DECLARED optional capability now, in the shape `emptyTables` established, with a parity assertion across the four dialect stores — it was duck-typed against an interface that never mentioned it, so a store that dropped it would have fallen out of the feature detection and taken the slower path forever, on that one dialect, in silence. And a registered staging clone can no longer reach the differ's DECLARED side: `--mode replace` registers each staging table as a clone of its target for the length of the load (a typed write resolves its columns by name), and a plan computed while an import was in flight proposed `create-table _voltro_staging_notes`.
595
+
596
+ Also measured rather than assumed: the staging table `createStagingSql` builds on **sqlite** (`CREATE TABLE … AS SELECT * FROM t WHERE 0`) and on **SQL Server** (`SELECT * INTO … WHERE 1 = 0`) carries the target's columns and ZERO foreign keys, which is what the load needs. Those were the two dialects the postgres and mysql-family measurements had not covered.
597
+ - **@voltro/client, @voltro/ui, @voltro/web** — **`useFormField(path)` finds its binding.** `<FormBindingProvider binding={form}>` (mounted for you by `<AutoForm>`) makes the narrow per-field subscription reachable without threading the binding down to every field component as a prop. That thread was blocking incremental adoption: a codebase moving a hundred-plus forms one at a time keeps its own field context and swaps engines per form, and being asked to prop-drill to ~30 field components at once meant taking the binding and declining the optimisation they had the most to gain from.
598
+
599
+ **Message ids a real catalogue needed**, each because the generic answer is worse at the point of use:
600
+
601
+ - `betweenLength {min,max}` when a field carries BOTH bounds — "at least 2" is a half-truth for a rule that is "between 2 and 50" — and `exactLength {amount}` when they are equal. Read from the schema, not the failing issue: piping nests the later refinement outermost, so the sibling bound is not reachable from the issue that failed. - `invalidEmail` / `invalidUrl` / `invalidUuid` when the refinement declares a JSON-Schema `format`. A bare regex cannot name its own rule, and "Invalid format" beside an email box tells nobody anything. - `minDate` / `maxDate`, because a date bound rendered as a number bound reads "must be at least 2026-01-01". - `invalidFileType` / `fileTooLarge` — not produced by any refinement, carried so an app's own `ctx.validation.fail('doc', 'validation.fileTooLarge')` renders a sentence rather than an id.
602
+
603
+ `apiSurface: compatible` — `useFormField` goes from a const arrow to an overloaded function so it can take `(path)` as well as `(binding, path)`. The golden line for the old signature is replaced rather than removed: every existing `useFormField(form, path)` call compiles unchanged, because that overload is still declared first-class. Only code capturing the function's exact TYPE (rather than calling it) sees a difference.
604
+
605
+ **Counting rules pass `count`.** `minItems` / `maxItems` carry `{ count }` beside `{min}`/`{max}`: i18next selects a plural form on a parameter named exactly `count`, so ids passing only `{min}` could not be pluralised at all.
606
+ - **@voltro/runtime, @voltro/cli** — **The resume census — `/_voltro/inspect/subscriptions` now carries `resume`.** Per query label: how many subscriptions recorded a delta-resume ring, and how many were excluded, counted per reason (`computed`, `row-filter`, `eager-load`, `uncanonical-input`, `not-offered`). `voltro dev` also logs each verdict once per label under the `voltro:resume` scope — debug is the default level outside production, so it is already on where the tuning happens and off where it is served.
607
+
608
+ It exists because the two failure shapes are indistinguishable from outside. A subscription excluded by a row filter and one whose executor returns a **value** rather than a descriptor both reconnect with a fresh snapshot and rows on the screen, so an app measuring its own reconnects cannot tell which of its queries a `tables:` declaration is even capable of helping. The answer is which of the two bind paths the executor took, and nothing on the wire carries it.
609
+
610
+ The reasons are the load-bearing part, not the counts: `computed` means no declaration can ever change this query, `row-filter` means the filter narrows its source and the exclusion is the point, and `eager-load` is reported ONLY when the base table is not itself narrowed — so that verdict always means "drop the `.with(...)` and this one resumes". Counts rather than one verdict per label, because resumability is not purely a property of the label: an input that does not canonicalise is a property of the value, so one query can be resumable for one subscriber and excluded for the next. A label nobody has subscribed to is ABSENT rather than reported as zero — "nothing has subscribed yet" and "every query is excluded" must not read the same.
611
+
612
+ **And a correction to what `tables:` was documented to buy.** The 0.54.0 notes, the `tables:` doc comment and the row-level-security page all said one registration cost delta-resume on every query descriptor in an app, with a count beside it. The count was real; the sentence around it claimed those descriptors would have HAD the feature, and that was never measured. A query only has a delta chain when its executor returns a descriptor — one that maps its rows or wraps them in a page envelope re-runs an opaque handler and emits snapshots, filter or no filter. So the number a declaration gives back is the number of descriptor-returning subscriptions, not the number of queries. The docs now say that where the decision is made, and the census is how you find out which shape each of yours took.
613
+
614
+ ### Changed
615
+
616
+ - `dataTransfer.stagingStaleMinutes` in `app.config.ts` — how long a staged import's silence has to last before a boot treats its scratch tables as abandoned. Previously `VOLTRO_STAGING_STALE_MINUTES` only; the env var still overrides the declaration, on the rule every other tunable here follows.
617
+
618
+ The reason this was not already a field was recorded as "the boot check runs off the store alone, before the app config is threaded to it". That described the function's signature, not the boot: both paths already held the config three lines above the call. Resolution lives inside `stagingLeftoversAtBoot` rather than at either call site, so the two cannot disagree about what a declared value means, and a source-reading assertion fails if either path stops handing the config over.
619
+
620
+ ### Fixed
621
+
622
+ - **@voltro/protocol, @voltro/cli, @voltro/client, @voltro/plugin-notifications, @voltro/plugin-comments, @voltro/plugin-presence, @voltro/plugin-search, @voltro/plugin-flags** — **Installing a plugin under an `alias` now moves its client too.** `alias` exists for one problem — your app already publishes `notifications.*` and cannot install a plugin that wants the same namespace — and it has to move four surfaces or it is worse than not existing. It moved three.
623
+
624
+ The two that did not:
625
+
626
+ - **The generated client sent the tag the PLUGIN authored.** Every lifter is `Rpc.make(descriptor.name, …)`, so the wire tag comes from the descriptor, not from the tag the codegen computed. Under `alias: 'inbox'` the exported identifier became `inboxInboxRpc`, the `appDescriptors` key became `inbox.inbox`, the type key became `inbox.inbox` — and the browser still asked a server that had stopped serving it for `notifications.inbox`. The codegen now lifts every plugin descriptor through `withRpcTag(…)`, unconditionally, so the aliased and un-aliased cases are one code path rather than a branch nothing exercises. - **The plugin's own hooks spelled their namespace as a literal.** `useInbox()`, `useUpload()`, `useComments()`, `usePresence()`, `useFlag()`, `useSearch()` all carried strings like `'notifications.inbox'`, which no alias could reach. `voltro dev` now writes a `registerPluginAliases({ … })` declaration into `rpcGroup.generated.ts` — the module the web client already loads value-level — and every plugin hook resolves its tag through `pluginTag(baseName, route)` from `@voltro/protocol` at call time, not at module load. Aliasing a plugin needs no change at any call site.
627
+
628
+ Two installs of one plugin (`name: 'ops'`) with no un-suffixed primary make `pluginTag` **refuse** rather than pick: a hook has no way to name an install, and guessing would address the wrong one silently. The error names both candidates and points at the full-tag call that says which you mean.
629
+
630
+ `pluginAlias` / `pluginSlug` moved from the CLI into `@voltro/protocol` (and are re-exported from their old path) because the browser has to derive the same namespace the server registered, and a second copy on the client would be a second definition of the rule with nothing comparing them.
631
+
632
+ Also corrected, in the same seam: the list of plugins that deliberately do NOT accept `tables: false` read as exhaustive and omitted `_voltro_storage_grants`, which decides who may read an object. It is named now — along with the reason the option would not have reached it anyway (storage's tables are framework tables, not `extendSchema` contributions).
633
+ - `voltro build` could not produce an api serve bundle on 0.53.0 or 0.54.0.
634
+
635
+ `@voltro/content`'s `get.ts` reaches its render pipeline through a dynamic `import('./serverLoad')`. That is deliberate — an unresolvable-at-build-time specifier is what keeps marked and the shiki grammars out of a consumer's client chunk graph. But `serverLoad` was not in the package's entry map, so nothing emitted `dist/serverLoad.js`, and `dist/index.js` shipped an import of a file beside it that was not there.
636
+
637
+ It resolved in this repo every time, because the workspace `exports` point at `src/` and `serverLoad.ts` sits next to `get.ts`. A consumer resolves `publishConfig.exports` to `dist/index.js`, and the same line cannot resolve. esbuild does not honour `@vite-ignore` — that is a vite directive — so the serve bundle refused to ship. The refusal was right; nothing had ever triggered it.
638
+
639
+ Two things worth knowing, both measured rather than reasoned:
640
+
641
+ - **The build was stopped by a dependency that contributes nothing to it.** An api serve bundle reaches `@voltro/content` through `serveCommand → dev → webDev → contentWiring`, and esbuild resolves before it tree-shakes. After shaking, the content pipeline is **0 bytes** of a 14.42 MB bundle. So an api app with no markdown anywhere was blocked by a markdown loader whose code it would never have carried. - **Shipping the file does not bloat anything.** Same measurement with the fixed package resolved as a consumer resolves it: 14.42 MB, content still 0 bytes. The dynamic import stays shaken away.
642
+
643
+ `scripts/check-dist-internal-specifiers.mjs` now bundles every emitted file of every publishable package — from `.publish/`, the tree users receive — with bare specifiers external, and fails if any relative specifier does not resolve. GATE-2 (`publint`) answers "does a declared subpath resolve"; this is one level below it, where `./serverLoad` lives.
644
+ - **@voltro/client** — Three places still taught the pre-fix contract for a cold-start failure.
645
+
646
+ `SubscriptionFailed` gives it its own state — `loading: false`, `failed: true`, `error` non-optional — precisely so a component branching on `loading` alone cannot render a skeleton forever. But `SubscriptionMeta.error`'s doc comment and two docs pages still said the opposite ("leaves `loading` TRUE … check `error` to break out of it"), which is the sentence a deployment quoted back at us as evidence for the defect that had already been fixed.
647
+
648
+ A comment that predicts a trap the code no longer has is worse than no comment: it teaches the defensive shape as if it were still required, and it invites the reading that `loading` is unreliable. All four now describe the state that exists, with the old behaviour kept only as the history that explains why the field is there.
649
+ - **@voltro/client, @voltro/web, @voltro/cli, @voltro/ui** — Four defects a real migration found, all of which passed `tsc` and a full test suite and only showed up against a running system.
650
+
651
+ **A server render derived a different form than the browser.** Nothing mounts a runtimes provider during SSR, so `useFormBinding` resolved its input schema from an EMPTY descriptor map: no fields, `required: false`. The browser then rendered the real ones and React discarded the subtree — "Hydration failed" on every server-rendered page carrying a bound form, with the diff pointing at a `Mui-required` class. `@voltro/client` keeps a process-global SSR descriptor registry now, and both boot paths fill it before rendering (`voltro dev` and `voltro start`, pinned as a parity test — a CLI module cannot import `@voltro/client`, so the call goes through `@voltro/web/ssr`, which both already load).
652
+
653
+ **A rejected `submit()` had nowhere to go.** A form calls it from an `onSubmit` handler that cannot await it, so the rejection surfaced as `Uncaught (in promise)` while the form sat there looking saved. `submit()` resolves `undefined` now and the failure is state: `state.submitError`, plus an optional `onError`. That covers a composed `onSubmit` whose follow-up write fails on its OWN mutation handle — a failure the binding never saw, and the common shape (create the row, then its first child).
654
+
655
+ **Undeclared fields went on the wire.** The binding validated the mapped input and then sent the object unchanged; the client decode ignores excess properties while the server has refused them since 0.37, so a form carrying anything beyond the mutation's input passed validation and was rejected on the wire with a message pointing at no field. The payload is restricted to the declared keys now — the rule the no-JS path already followed, so the two submits agree — with a dev warning naming what was dropped.
656
+
657
+ **`setValue` with an unchanged value produced a new `values`.** Every React state source is expected to no-op on that; this one did not, so an effect depending on `values` that re-set a field to the value it already held never settled ("Maximum update depth exceeded" on a form mirroring toggles out of a multi-select).
658
+ - A plugin's dashboard panel no longer disappears when the app aliases the plugin.
659
+
660
+ `alias` moves `plugin.name`, and the inspect mount is derived from it, so `alias: 'inbox'` on notifications moved its panel to `/_voltro/inspect/plugins/inbox/...` while both dashboards ask for `/plugins/notifications/...` with the path compiled in. They live in other repositories and cannot follow. The field's own doc comment stated this as a cost you accept — in nine plugins, the protocol helper and the docs.
661
+
662
+ `makePluginInspectRegistry` now mounts each plugin's `inspectEndpoints` under its CANONICAL slug as well, in a second pass so an effective mount always wins the path. Added only where unambiguous: a base name carried by more than one installed plugin gets no shared mount, because showing either install under it would hand a dashboard the other one's rows under a name that looks right — the hazard `pluginTag` refuses rather than guesses. `/_voltro/inspect/plugins` now reports `baseName` and `inspectSlug` per plugin, which is how a caller reaches a specific install.
663
+ - **@voltro/cli, @voltro/data-transfer** — **`voltro data restore --drill` failed every healthy backup of a real app.** It compared the restored schema's fingerprint against the backup stamp's `schemaFingerprint`, which records the SOURCE database's whole live schema — and the artifact never carries that schema. `pg_dump` / `mariadb-dump` exclude `_voltro_replace_in_progress` and `_voltro_data_transfers` on purpose, and the backup command opens a run row in the second one before it dumps, so on any database the framework has run against, the artifact is two tables short of the value it was being measured against. The drill answered:
664
+
665
+ FAIL — restored N table(s), but the schema fingerprint (…) does NOT match the backup's stamp (…). The restore did not reproduce the schema that was backed up — the artifact is inconsistent.
666
+
667
+ about an artifact that was exactly right. A drill exists to be wired to a CI cron, and one that is red on every healthy input gets switched off — taking its two real failures with it.
668
+
669
+ The stamp now carries a second value, `dumpFingerprint`: the same snapshot minus `dumpExcludedTables(dialect)` — what a faithful restore must reproduce. The drill compares against that. A stamp written before this field degrades to a PARTIAL pass that says so, rather than falling back to the value that produces the false failure. `dumpExcludedTables` is per-dialect because only two of the five backup paths carry an exclusion flag at all: the sqlite/turso copy and the mssql export carry everything, and subtracting a set from those would invent the same bug in the other direction.
670
+
671
+ **The drill also checks the one boot-fatal condition a schema comparison cannot see.** `voltro serve`'s boot gate reads the newest `_voltro_migration_plans` row and refuses with `prod-mismatch` when there is none — so a ledger table that restores with exactly the right columns and zero rows is a database no source tree can boot, and its fingerprint is identical to a healthy one's. That is now a FAIL with the reason named. A restored database with no ledger table at all is not a voltro-managed schema and is reported as such, not failed.
672
+
673
+ There is deliberately no app boot in the drill. The boot gate is a comparison, not a startup sequence, so the part that generalises is reachable with a SELECT; booting a fixture app instead would prove something about our fixture rather than about your backup.
674
+
675
+ ---
676
+
42
677
  ## [0.54.0] — 2026-08-27
43
678
 
44
679
  ### ⚠ BREAKING
@@ -114,9 +749,11 @@ _Changes staged for the next release accumulate here (rolled up from
114
749
  Each message is processed inside a `queue.consume` span whose parent is the incoming `traceparent`, parsed by the same `externalSpanFromTraceparent` the inbound-webhook path uses — so a malformed or all-zero header means "no parent" (a fresh root span), never a failed message. The span covers the whole message including retries and the dead-letter publish, and carries the OTel `messaging.*` attributes plus `voltro.queue.outcome`. The topic is an attribute, not part of the span name.
115
750
 
116
751
  Known limit, measured rather than assumed: a span opened from DETACHED work does not reach an OTLP exporter, because the framework's tracer is a `Layer` provided only inside the rpc server's scope. This is framework-wide (`cdcOut.deliver` and `plugin.<name>.schedule-fire` are the same shape) and is stated in the queue docs rather than implied away. The metrics are unaffected — the metric registry is a process global.
117
- - **@voltro/runtime, @voltro/voltro** — `setRowFilter({ …, tables: ['bookmarks', 'recentSearches'] })` — declare which tables your filter may narrow, and delta-resume survives everywhere else.
752
+ - **@voltro/runtime, @voltro/voltro** — `setRowFilter({ …, tables: ['documents', 'comments'] })` — declare which tables your filter may narrow, and delta-resume survives everywhere else.
753
+
754
+ Delta-resume is excluded for a subscription whose row set is re-resolved per delivery: replaying deltas could serve rows the subject has since lost. But the question the runtime could ask was only "is a filter registered in this process?", so ONE registration disabled cheap reconnects for every subscription in the app, including every one whose source the filter could never narrow.
118
755
 
119
- Delta-resume is excluded for a subscription whose row set is re-resolved per delivery: replaying deltas could serve rows the subject has since lost. But the question the runtime could ask was only "is a filter registered in this process?", so ONE registration disabled cheap reconnects for every subscription in the app a deployment measured a filter narrowing 4 tables costing the feature on all 173 of their query descriptors, 55 of whose source tables the filter never touches.
756
+ It does not reach every query. A subscription only has a delta chain when its executor returns a DESCRIPTOR; one that returns a mapped value or a page envelope re-runs an opaque handler and emits snapshots, with or without a filter. `tables:` costs nothing and applies the moment such a query returns a builder but the count it gives back is the count of descriptor-returning subscriptions, not of queries. The resume census on `/_voltro/inspect/subscriptions` reports which shape each of your queries took.
120
757
 
121
758
  The exclusion is per table now. A declared filter keeps resume for every subscription whose source is not in its set; an undeclared filter keeps today's conservative behaviour (the runtime cannot know which tables the predicate may reach, and "unknown" must read as "yes").
122
759