@voltro/runtime 0.42.0 → 0.43.1

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,166 @@ _Changes staged for the next release accumulate here (rolled up from
39
39
 
40
40
  ---
41
41
 
42
+ ## [0.43.1] — 2026-08-18
43
+
44
+ ### Fixed
45
+
46
+ - **@voltro/database** — A write recorder that fails inside someone's transaction now says which recorder, on which write, and what the database actually said.
47
+
48
+ `@effect/sql` renders every driver failure as `SqlError: Failed to execute statement` — one sentence that fits a missing column, a dangling foreign key, an over-long value and a duplicate key equally. The driver's own words hang off a SYMBOL on a `FiberFailure`, so a caller who reaches for `.cause` gets `undefined` and concludes there is nothing there.
49
+
50
+ That is expensive precisely where recorders run: the caller's write was ordinary, and what failed was framework machinery one table over. The message now reads
51
+
52
+ ```
53
+ write recorder '_voltro_row_history' failed while recording an update on 'users':
54
+ Duplicate entry 'rowver_…' for key 'PRIMARY' [code=ER_DUP_ENTRY errno=1062 …]
55
+ ```
56
+
57
+ and the original error is kept as `cause` for anyone who does walk the chain. The failure still takes the transaction down — that is the guarantee and it is unchanged.
58
+
59
+ `describeDriverError` (`@voltro/database`) is the shared summariser, built on the existing cause extractor rather than a second walker. It returns nothing when the chain carries nothing driver-shaped, so an ordinary programming error from a recorder arrives as itself instead of wrapped in prose about a database.
60
+ - **@voltro/database** — On MariaDB, a `varchar` column could introspect as `json` because a DIFFERENT table had a json column with the same column name.
61
+
62
+ MariaDB names a column-level CHECK after the COLUMN, and those names are unique per table, not per schema. `information_schema.check_constraints` on MySQL has no `TABLE_NAME`, so the introspector recovered it by joining `table_constraints` on `(schema, constraint_name)` — which on MariaDB cross-products every same-named check across every table. Measured on 11.8:
63
+
64
+ ```
65
+ a.payload LONGTEXT CHECK (json_valid(`payload`))
66
+ b.payload VARCHAR(255) CHECK (`payload` in ('x','y'))
67
+
68
+ join result: a → json_valid, a → in(…), b → json_valid, b → in(…)
69
+ ```
70
+
71
+ So `b.payload` reads as `json`, and `a.payload` picks up an enum it does not have. Downstream that is not a cosmetic label: the planner emits a blocked `alter-column-type` with `from: 'json'` that no `.narrowedFrom()` can honestly acknowledge, because the premise is false — and since the data-transfer manifest records introspected types, the same misreading travels into the bundle and reappears as schema drift on import.
72
+
73
+ MariaDB's own `check_constraints` HAS `TABLE_NAME`. The introspector asks for it directly now and keeps the join as the MySQL path, where check-constraint names are schema-unique and the join is sound. That asymmetry is why a single-engine test could not see this: the wrong query passes on MySQL.
74
+ - **@voltro/database** — `voltro db apply` could not drop a CHECK constraint on the mysql family at all, and each of the three reasons hid the next.
75
+
76
+ **1. `DROP CHECK` is MySQL-8 syntax.** MariaDB has never had it — measured on 11.8, `ALTER TABLE t DROP CHECK c` is `ERROR 1064`, while `DROP CONSTRAINT c` works on both engines. A plan containing a `drop-check` therefore died on the first one, on a family whose migrations are NOT atomic: the run stopped with the earlier statements committed and no rollback.
77
+
78
+ **2. The name was assumed, not read.** The applier dropped `<table>_<column>_check` — which is only what its own `add-check` would have named it. A CHECK created at table bring-up is INLINE and UNNAMED, so the server names it (`CONSTRAINT_1` / `<table>_chk_1` / the column name). Dropping a name that does not exist reports "does not exist", which is indistinguishable from the "already gone" a resume legitimately produces — so the statement succeeded, the constraint stayed, and the plan re-proposed the identical `drop-check` forever. The name comes from the catalog now.
79
+
80
+ **3. A column-level CHECK cannot be dropped by name on MariaDB at all.** Measured: the catalog lists it under the column's name, `DROP CONSTRAINT` on that name answers 1091, and only redefining the column removes it. The applier now drops by catalog name, ASKS whether the constraint survived, and redefines the column when it did — so a rebuild happens only in the case that needs one.
81
+
82
+ **And the same investigation closed the MySQL `.oneOf()` round-trip gap.** `parseEnumCheck` was documented as handling MySQL's rendering and did not: MySQL backslash-escapes the string DELIMITERS (`_utf8mb4\'draft\'`), and the parser rewrote those to the SQL doubling `''` — which is how a quote INSIDE a value is written. Every delimiter became escaped content, every value came back empty, and the filter dropped them. `.oneOf()` now round-trips on MySQL, and the suite that asserted the gap as a known one asserts the round-trip instead.
83
+
84
+ Plus, on a failed apply: the error now states how many operations were already applied and whether this dialect rolls back. The ledger held that number; it never reached the operator, who had to re-plan and diff the counts to learn how far the run got.
85
+ - **@voltro/plugin-versioning** — `versioningPlugin({ timing: 'in-transaction' })` built its history row's primary key from `(rowId, version)` while the version counter three lines above was scoped to `(tableName, rowId)`. Two versioned tables carrying the same row id therefore collided — permanently.
86
+
87
+ The shape is not exotic: `actors.id === users.id` is what the framework's own audit trail asks for, an `actors` row whose id is the user's so an audited write satisfies `createdBy → actors`. In an app that follows it, every user row has a twin.
88
+
89
+ The collision does not heal, and that is what turns a duplicate into an outage. The second table's insert fails, so its history row is never written, so `maxOf` for that table stays `null`, so the next attempt computes the same version and the same id. Every write to that row is dead from then on — surfacing as `ER_DUP_ENTRY` on an ordinary `store.update`, naming a row id in a table the caller never wrote to.
90
+
91
+ The key is `(table, rowId, version)` now — the same shape the post-commit path always built. It stays deterministic (no clock, no process-local counter), which is what lets it survive a replica restart; it just carries every part of the key it claims to be unique over.
92
+
93
+ **No cleanup is needed for rows already written.** They keep their old ids and belong to whichever table wrote them; the new keys cannot collide with them, and `byRow` is not unique. An app blocked by this is unblocked by the upgrade alone.
94
+
95
+ Covered twice: the recorder against a port that refuses duplicates (the mechanism, including that a repeat does not settle), and two versioned tables sharing an id against live postgres (the real primary key, inside the caller's transaction). The suite that existed exercised ONE table, which cannot produce a collision at all — and read exactly like a suite that covered this.
96
+
97
+ ### Internal (no consumer-facing effect)
98
+
99
+ - **@voltro/sql-mysql** — Two test-only defects in `sql-mysql`, both found by a release gate, both of the same family: a check that could not fail, and a failure reported in the wrong place. No product code changed.
100
+
101
+ **An assertion that could not fail.** `dropCheckSyntax.integration.test.ts` fell back to a HAND-BUILT plan when the planner produced no operations — and the fabricated operation was a `drop-check`, which is exactly what the next line asserts the plan contains. So an engine whose planner stopped emitting it would have been handed one and reported green. The fallback is deleted; both engines produce the operation now, which is what this release fixed, and the assertion is load-bearing again (4/4 on mysql AND mariadb without it).
102
+
103
+ It surfaced as a TYPE error rather than a false pass, because the fallback's object widened `plan` into a union `applyPlan` does not accept. Worth noting which check caught it: `vitest` transpiles without type-checking, so the suite was green and only `tsc` objected — the gate's `typecheck` and `lint` steps are what went red.
104
+
105
+ **A wait that gave up in silence.** `waitFor` in both binlog CDC suites looped to a deadline and then RETURNED, so a "prove the reader is live" wait that expired let the test carry on, kill the binlog dump thread, and fail twenty lines later on `expect(ids).toContain('todo_wd_before')` — an assertion about a different claim, in a different place. It throws now, naming the wait and the window, and all twelve call sites carry a label.
106
+
107
+ The window is named too: `FIRST_ATTACH_MS = 30_000`, up from 12 s. The reasoning is the 40 s window already in the same file, whose comment says a re-attach plus binlog catch-up takes longer under a loaded full-suite run — a FIRST attach does both and only skips the backoff, so 12 s beside 40 s was an asymmetry the file's own reasoning did not support. That is an argument from the neighbouring comment, not a measurement; if it expires again, `waitFor` now says which wait and for how long, and that number is the one to argue with rather than raising this one twice.
108
+
109
+ ---
110
+
111
+ ## [0.43.0] — 2026-08-18
112
+
113
+ ### ⚠ BREAKING
114
+
115
+ - **@voltro/data-transfer, @voltro/cli** — `DanglingReferenceError` is now `RowsRefusedError`, and it separates the rows that failed from the rows that failed because those rows did.
116
+
117
+ **The name.** The import raised it for EVERY row still refused after deferred-FK resolution, whatever the reason — a NOT NULL violation, a duplicate key, a value the database computes for itself. The tag named ONE possible cause and put it where a reader looks first, so any other refusal arrived mislabelled. The new name states the outcome; each row's `reason` states the cause, which is where a cause can honestly be claimed.
118
+
119
+ **The split.** A row is `derived` when one of its reference columns holds the primary key of another row that also failed in this run: it could not have landed whatever it contained, so its reason describes the parent's problem. The relation is transitive, decided from the DATA (the failed ids against the reference-typed values), so no schema knowledge is needed. `primaryCount` is the number an operator acts on, `rows` lists primary failures FIRST so the cap never spends its budget on consequences, and the CLI leads with both numbers:
120
+
121
+ ```
122
+ import refused 300 row(s), of which 1 are the actual failures — the rest could
123
+ not land because a row they reference did not.
124
+ teams t1 foreign key teams_ibfk_1: the referenced row does not exist [1452]
125
+ … and 299 row(s) behind them. Fix the 1 above and re-run; they resolve with
126
+ their parents.
127
+ ```
128
+
129
+ In an FK-dense bundle one refused parent takes its whole subtree with it, so the length of a flat list says how connected the data is, not how many problems there are — and the single row that explains all of them sits somewhere in the middle of it.
130
+
131
+ The codemod rewrites the import and every use of the symbol. It does NOT rewrite a tag STRING (`Effect.catchTag('DanglingReferenceError', …)`, `err._tag === '…'`) — change those to `'RowsRefusedError'` — and the payload gained `primaryCount` plus a `derived` flag per row.
132
+
133
+ ### Fixed
134
+
135
+ - **@voltro/cli** — `voltro doctor`'s `subject-write-no-guard` rule reads the DESCRIPTOR before it reports. It looked only at the executor, and the access decision is not declared there.
136
+
137
+ Every form of access decision the framework has — `internal: true`, `guards: [...]`, `openAccess:` — is declared on the DESCRIPTOR. So an app that declares them properly got a finding for each one, and on a codebase whose procedures are mostly `internal: true` the rule fires on essentially all of them and is wrong essentially every time.
138
+
139
+ That is worse than a rule that finds nothing: it is the longest line in the report and it reads like a security finding, so it teaches the reader to skim the place a real finding would have appeared.
140
+
141
+ The premise was structurally impossible for most of them, and the framework says so itself: `security.defaultDeny` refuses at boot any wire-exposed procedure declaring neither `guards:` nor `openAccess:`. So "an anonymous caller reaches the write" can only be true of an `openAccess` procedure. That is what the rule looks for now — plus the handler check it always honoured, plus an ownership comparison against `subject.id`, which is the refusal the rule says is missing. Where no descriptor can be read, it says nothing: the claim is about a declaration, and a finding whose evidence was never opened is the failure mode this fixes.
142
+
143
+ The `use:` line changed with it. It recommended `.guard(requireScope('…'))`; the shipped guide teaches declarative `guards:` and calls a hand-written per-executor scope check the thing `guards:` exists to delete. A rule may not recommend the shape the guide argues against.
144
+ - **@voltro/database, @voltro/data-transfer** — A `voltro data` transfer no longer carries GENERATED column values, and no longer loses every row that has one.
145
+
146
+ The export wrote the computed values into the bundle and the import sent them back in the `INSERT` column list. MariaDB refuses that for any value except NULL (`1906: The value specified for generated column 'x' in table 't' has been ignored`); postgres refuses a non-DEFAULT value outright. So the transfer failed per ROW, not per table, and only for the rows whose generated value was non-NULL.
147
+
148
+ That selectivity is the dangerous part. `.uniqueActive()` lowers to exactly such a column on mysql/mariadb — a STORED generated column holding the key while the row is live and NULL once it is soft-deleted — so the refused rows are the LIVE ones and the accepted ones are the tombstones. A table can come out looking like "a few rows failed" or empty, depending only on how many of its rows are deleted, and any table with a foreign key into it fails behind it.
149
+
150
+ Both ends are fixed from one source of truth: **introspection now reports generated columns on every dialect** (`generatedAs`, from `information_schema.generation_expression` on mysql/mariadb, `is_generated` on postgres, `PRAGMA table_xinfo`'s hidden flag on sqlite, `sys.computed_columns` on mssql). It was declared-side only before — invisible to the planner, which does not compare it, and load-bearing for anything that writes rows back.
151
+
152
+ The exporter omits those columns, values and all. The importer strips them from every incoming row using the TARGET's snapshot, because a bundle already written still carries them and a file on disk is data, read where it is.
153
+
154
+ **`voltro serve`'s admin export/import needed a second fix, and without it this one reached only the direct transport.** The running instance hands those handlers `declaredSnapshot(tables)` — no dialect — and `.uniqueActive()` lowers to a generated column only when the snapshot knows the engine. So over `--target api` the snapshot described a schema with no generated columns while the database had several, and the export wrote their values back into the bundle exactly as before. It passes the dialect now (the variable was already on the next line).
155
+
156
+ `generatedAs` is also kept OUT of the schema fingerprint. Introspection can read the fact back but not a comparable value — the engine returns its own normalisation of the expression, never the declared spelling — so hashing it would make declared and live disagree permanently: a schema nobody touched reporting a changed declaration on every boot, and a transfer target that matches its bundle exactly refused as drifted.
157
+
158
+ Covered by a live mariadb→mariadb and mysql→mysql round trip over a `.uniqueActive()` table with live and soft-deleted rows, asserting the target recomputed the value rather than that the row merely arrived.
159
+ - **@voltro/sql-mysql** — On mysql/mariadb, a write REJECTED by the database through `insertIgnore` was reported as a conflict when the caller was not inside a transaction — and never reached the caller as a typed `ConstraintViolation` at all.
160
+
161
+ Two causes, both measured against live MySQL 8.4 and MariaDB 11.
162
+
163
+ **The connection.** `INSERT IGNORE` demotes every error to a warning, so the store reads `SHOW WARNINGS` to tell a rejection from a conflict. That describes the last statement on a CONNECTION, and outside a transaction every statement acquires its own from the pool — so the read was unattributable and came back empty. The rejected write then surfaced as "the insert was skipped as a conflict, but no existing row matches conflictColumns […] the constraint that fired is unknown", whose enumeration lists only conflict causes. A rejection described as a conflict is the exact sentence this path was fixed once already for producing; it survived on the path that had no transaction to read on. The store now pins one connection for the whole decision — the same pinning `insertRecoverAutoId` does for `LAST_INSERT_ID()`.
164
+
165
+ **The classification.** The store swallowed the driver's error and raised a prose one of its own, so `classifyConstraintViolation` had nothing to read: this was the one write path where the typed error could not fire, while every other one produced it. The warning IS the driver's payload — `INSERT IGNORE` only changed how it was delivered — so it is handed on in the shape the driver would have thrown. A rejection now arrives as the same `ConstraintViolation { kind: 'foreignKey', … }` a plain `insert` produces. Nothing new crosses the wire: the classifier extracts the constraint NAME as a delimited group, never the sentence.
166
+
167
+ This is the default `voltro data import` path (`--mode append`, `--on-conflict skip`, without `--atomic`), so a row rejected by a foreign key was reported to the operator as a conflict with an unknown cause.
168
+
169
+ `constraintViolation.integration.test.ts` now asserts the `insertIgnore` seam per dialect against live postgres 17, MySQL 8.4, MariaDB 11 and SQL Server 2022. It was the missing assertion behind a claim derived from the wiring — the classification does sit on all ten write paths, which is not the same as a classifiable error arriving on all ten.
170
+ - **@voltro/protocol, @voltro/runtime** — The framework's store errors — `ConstraintViolation`, `TenantScopeViolation`, `TenantRowNotFound`, `ServerOnlyColumnWrite`, `TableValidationFailed`, `StoreOperationFailed` — are exported from `@voltro/protocol` and can therefore be declared in a descriptor's `error:` union. They could not be.
171
+
172
+ They lived in `@voltro/runtime`, which reaches `node:child_process`, `node:http` and `node:crypto`. A descriptor is loaded VALUE-LEVEL by the web client (the `RpcClient` needs every procedure's Schema), so a descriptor importing from there is refused at boot by the browser-safety guard — correctly. The typed half of these errors was therefore unreachable: the docs told you to declare them, and the boot said no.
173
+
174
+ What that leaves is the untyped half only. The error still arrives as an `InternalError` carrying a readable sentence, so telling `foreignKey` ("the row you picked is gone") from `foreignKeyInUse` ("this row is still referenced") — two different messages for the user — means parsing that sentence. Over a set of generated delete mutations that is a string comparison per procedure, which is the thing the typed error exists to delete.
175
+
176
+ `@voltro/runtime` re-exports all six, so server code is unchanged. The classes have no server dependency of any kind — the file imports `Schema` from `effect` and nothing else, and `browserSafetyGuard.test.ts` now pins a descriptor that declares one, so moving them back reads as a boot failure rather than as a passing rename.
177
+ - **@voltro/database, @voltro/sql-mysql** — A blocked `alter-column-type` told every dialect to write a postgres cast.
178
+
179
+ The refusal is correct — a bare type change may not be value-preserving, so it is refused until acknowledged. Its `fix:` line was not:
180
+
181
+ ```
182
+ acknowledge it on the column: `.narrowedFrom('json', { using: 'meta::text' })`
183
+ ```
184
+
185
+ `USING <expr>` is postgres syntax and a postgres capability. The mysql arm of the applier emits `MODIFY COLUMN`, the mssql arm `ALTER COLUMN`, and sqlite rebuilds the table — none of them can carry a cast expression and none of them reads `using`. So an operator on any other engine was handed a line to paste into their schema containing syntax their database has never seen, inside an argument that is discarded. A refusal is read as an instruction, and the more carefully it is read the more thoroughly a wrong one is followed.
186
+
187
+ The fix line is dialect-aware now: postgres keeps the `using` half, everything else gets `.narrowedFrom('<type>')` plus the fact that the engine converts in place — because a refusal that offers no expressible fix reads as "the framework cannot do this at all".
188
+
189
+ Covered on live MySQL and MariaDB by both halves at once: what the refusal SAYS, and that following it applies AND converges with the row intact. A message test alone would keep passing over a broken apply; a convergence test alone is what let the wrong message survive this long.
190
+
191
+ Also on the same path: `upsert` with a PARTIAL row (one omitting a NOT NULL column that has no default) failed on MariaDB and succeeded on MySQL. The native `INSERT … ON DUPLICATE KEY UPDATE` validates its insert half even when only the update half runs, so the row was rejected although the target existed and only needed patching. A partial row takes the lookup path on both engines now; the single-statement form still covers the complete-row case, which is what a data transfer and every generated CRUD write send.
192
+ - **@voltro/sql-mysql** — On MariaDB, `upsert` could write a DIFFERENT row than the one it was given and report success.
193
+
194
+ `INSERT … ON DUPLICATE KEY UPDATE` fires on ANY unique key, not on the one named in `conflictColumns`. So an incoming row whose (say) `email` already belonged to a different primary key updated THAT row instead — and since `id` is excluded from the SET list, the row the caller handed over was never written. Measured on a live server: the call returned a row, the target kept the old id, the new row was absent, and the existing row had silently taken the incoming values. A bulk transfer on top of that prints `import complete` over missing data, which is the worst failure shape available: there is nothing to investigate.
195
+
196
+ The two engines of the family disagreed here, which is part of why it survived. The non-RETURNING path (MySQL) looks the row up by `conflictColumns` first, does not find it, and lets the INSERT fail with a duplicate-key error. Loud was always right.
197
+
198
+ Both refuse now, with a message naming both ids and the fact that the collision was on a constraint other than the one named. The check runs inside a transaction — a short one of the store's own when the caller is not already in one — so the wrong row is rolled back rather than reported after the fact: detecting this afterwards still leaves someone else's row overwritten.
199
+
200
+ ---
201
+
42
202
  ## [0.42.0] — 2026-08-17
43
203
 
44
204
  ### ⚠ BREAKING
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ import { ConnectionKind } from '@voltro/protocol';
14
14
  import { ConnectionState } from '@voltro/protocol';
15
15
  import { ConstraintFacts } from '@voltro/database';
16
16
  import { ConstraintKind } from '@voltro/database';
17
+ import { ConstraintViolation } from '@voltro/protocol';
17
18
  import { Context } from 'effect';
18
19
  import { createServer } from 'node:http';
19
20
  import { Cron } from 'effect';
@@ -76,9 +77,12 @@ import { Sampler } from '@opentelemetry/sdk-trace-base';
76
77
  import { Schedule } from 'effect';
77
78
  import { Schema } from 'effect';
78
79
  import { ScopeError } from '@voltro/protocol';
80
+ import { ServerOnlyColumnWrite } from '@voltro/protocol';
79
81
  import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
80
82
  import { spawn } from 'node:child_process';
81
83
  import { SqlClient } from '@effect/sql';
84
+ import { StoreError } from '@voltro/protocol';
85
+ import { StoreOperationFailed } from '@voltro/protocol';
82
86
  import { Stream } from 'effect';
83
87
  import { Subject } from '@voltro/protocol';
84
88
  import { SubjectResolution } from '@voltro/protocol';
@@ -87,6 +91,9 @@ import { SubscriptionEvent } from '@voltro/protocol';
87
91
  import { sweepRetention } from '@voltro/database';
88
92
  import { SyncLogger } from '@voltro/logger';
89
93
  import { TableLike } from '@voltro/database';
94
+ import { TableValidationFailed } from '@voltro/protocol';
95
+ import { TenantRowNotFound } from '@voltro/protocol';
96
+ import { TenantScopeViolation } from '@voltro/protocol';
90
97
  import { Tracer } from 'effect';
91
98
  import { Unauthenticated } from '@voltro/protocol';
92
99
  import { WorkflowParentClosePolicy } from '@voltro/protocol';
@@ -1007,7 +1014,7 @@ export declare interface AppContext {
1007
1014
  *
1008
1015
  * This was typed as the OLD string-emitter facade (`emit(name, data)`) long
1009
1016
  * after that facade was deleted, so the documented call was a `tsc` error
1010
- * while the runtime carried only `publish` — a consumer measured
1017
+ * while the runtime carried only `publish` — a deployment measured
1011
1018
  * `eventKeys: ["publish"], emitType: undefined` with a cron probe because the
1012
1019
  * type and the docs disagreed and they could not tell which was lying.
1013
1020
  *
@@ -1516,7 +1523,7 @@ export declare const bindMutation: <Input, Output, E = never>(execute: (input: I
1516
1523
  * ~2 KB for a one-line cause, with the message at the END so every tool that
1517
1524
  * truncates shows the useless half.
1518
1525
  *
1519
- * A consumer met it with `TenantScopeViolation`. Adding that tag to
1526
+ * A deployment met it with `TenantScopeViolation`. Adding that tag to
1520
1527
  * `INFRA_ERROR_TAGS` would have been wrong: `effectStore.ts` documents
1521
1528
  * `error: Schema.Union(TenantScopeViolation, StoreOperationFailed, …)` as a
1522
1529
  * supported declaration, so an app that DECLARES it must still receive it
@@ -1698,7 +1705,7 @@ export declare interface CacheScopeLeak {
1698
1705
  * serving another org's rows out of memory, with a TTL. The author has to be
1699
1706
  * wrong exactly once, in a field whose two legal values differ by one word.
1700
1707
  *
1701
- * A consumer named this precisely while asking for the third option: *"'global'
1708
+ * A deployment named this precisely while asking for the third option: *"'global'
1702
1709
  * would share across tenant boundaries. For data derived from
1703
1710
  * `subject.tenantId` that is not a cache, it is a leak."* They chose to
1704
1711
  * recompute an org-wide figure once per employee rather than write it — the
@@ -2141,63 +2148,7 @@ export { ConstraintFacts }
2141
2148
 
2142
2149
  export { ConstraintKind }
2143
2150
 
2144
- /**
2145
- * The database refused a write because it broke an integrity rule the SCHEMA
2146
- * declares — a foreign key, a unique index, a NOT NULL, a CHECK.
2147
- *
2148
- * **Why this is typed at all.** Without it the driver failure is a `SqlError`,
2149
- * which the rpc layer collapses to a bare `InternalError` on purpose (a
2150
- * `SqlError`'s text is not safe to forward — see below). The caller then gets
2151
- * "something went wrong" for a failure that is entirely about the input it just
2152
- * sent, and the only way to find out which rule fired is to re-run the
2153
- * statement by hand against the database. A consumer reported doing exactly
2154
- * that.
2155
- *
2156
- * **Why it carries names and not the driver's sentence.** The temptation is to
2157
- * forward `cause.message`, and it is measured to be wrong: postgres attaches
2158
- * `Failing row contains (…)` — the complete row, every column — to a not-null
2159
- * and a check violation; mysql and mssql echo the duplicate VALUE on a unique
2160
- * violation. A constraint or column NAME is schema, which this framework
2161
- * already puts on the wire (`TableValidationFailed.table`). A row is data, and
2162
- * the caller who provoked the error is not automatically entitled to it.
2163
- *
2164
- * **Not every dialect can fill every field.** sqlite reports a foreign-key
2165
- * failure as the bare sentence `FOREIGN KEY constraint failed` — no name, no
2166
- * column, no direction — so `constraint` is absent there and the direction is
2167
- * inferred from the operation. `kind` is the field that is always right.
2168
- */
2169
- export declare class ConstraintViolation extends ConstraintViolation_base {
2170
- /**
2171
- * A sentence built from the fields above and nothing else.
2172
- *
2173
- * It exists because an undeclared tagged error reaches the client through
2174
- * `defectMessage`, which renders `String(error)` — and a `Schema.TaggedError`
2175
- * with no `message` renders as `[object Object]`. Without this getter the
2176
- * caller would get a correctly-typed error carrying no information, which is
2177
- * the same dead end in a different shape.
2178
- */
2179
- get message(): string;
2180
- }
2181
-
2182
- declare const ConstraintViolation_base: Schema.TaggedErrorClass<ConstraintViolation, "ConstraintViolation", {
2183
- readonly _tag: Schema.tag<"ConstraintViolation">;
2184
- } & {
2185
- /**
2186
- * Which rule fired. `foreignKey` = the row you referenced does not exist;
2187
- * `foreignKeyInUse` = this row may not go, others still reference it. They
2188
- * are opposite situations with opposite fixes, so a UI branches on them
2189
- * separately.
2190
- */
2191
- kind: Schema.Literal<["foreignKey", "foreignKeyInUse", "unique", "notNull", "check"]>;
2192
- /** The table the write targeted — the framework's own name for it, not the driver's. */
2193
- table: typeof Schema.String;
2194
- /** Which store op was attempted: 'insert' | 'update' | 'delete' | …. */
2195
- operation: typeof Schema.String;
2196
- /** The constraint / index name, when the dialect names one. */
2197
- constraint: Schema.optional<typeof Schema.String>;
2198
- /** The column, when the dialect names one instead of (or beside) a constraint. */
2199
- column: Schema.optional<typeof Schema.String>;
2200
- }>;
2151
+ export { ConstraintViolation }
2201
2152
 
2202
2153
  export declare type CoordinatedEffect = () => void | CoordinatedTickOutcome | Promise<void | CoordinatedTickOutcome>;
2203
2154
 
@@ -2897,7 +2848,7 @@ export declare const DEFAULT_ROW_FILTER_RETRY: Schedule.Schedule<unknown, unknow
2897
2848
  * `error:` union. It cannot match, by definition: a defect is precisely the
2898
2849
  * thing that is not in the union. What reached the browser was the entire
2899
2850
  * decode tree — every union member, the full `ExitEncoded<…>` type, and the
2900
- * real cause on the last line. ~2 KB of type names, which one consumer's
2851
+ * real cause on the last line. ~2 KB of type names, which one deployment's
2901
2852
  * account page rendered verbatim where a reason belonged, and which every app
2902
2853
  * otherwise has to condense heuristically to avoid putting a schema on screen.
2903
2854
  *
@@ -3080,7 +3031,7 @@ export declare class DeleteBuilder {
3080
3031
  * nothing at all. Reporting a fixed 1 for all of them (which this used to do)
3081
3032
  * turned the `rows` attribute into a liveness signal that reads like a data
3082
3033
  * signal: an `employees.me` that resolved to `null` still traced `rows=1`, and
3083
- * a downstream consumer used exactly that span to conclude the server had
3034
+ * a downstream deployment used exactly that span to conclude the server had
3084
3035
  * produced a value when it had not. Absent is 0, a single value is 1, an array
3085
3036
  * is its length. */
3086
3037
  export declare const deliveredRowCount: (value: unknown) => number;
@@ -3344,7 +3295,7 @@ export declare const drainForShutdown: (options: {
3344
3295
  readonly exit: () => void;
3345
3296
  /** How the drain ended, for the caller to report. A completed drain and one
3346
3297
  * CUT at the deadline are different incidents and were indistinguishable in
3347
- * the log — asked for by a consumer who could see neither. */
3298
+ * the log — asked for by a deployment who could see neither. */
3348
3299
  readonly onOutcome?: (outcome: {
3349
3300
  readonly reason: "drained" | "deadline";
3350
3301
  readonly ms: number;
@@ -3433,7 +3384,7 @@ export declare const enableGraphObservation: () => void;
3433
3384
  * `cipher.encrypt(JSON.stringify(v))` — two encodings, one `enc:v1:` envelope,
3434
3385
  * nothing to tell them apart. The doc above promises these helpers "expose the
3435
3386
  * SAME registered cipher so those paths can encrypt on write and decrypt on read
3436
- * by hand", and a consumer read that as interchangeable, which it said and was
3387
+ * by hand", and a deployment read that as interchangeable, which it said and was
3437
3388
  * not: their session rows written here were unreadable through the store, and
3438
3389
  * the error blamed the key.
3439
3390
  */
@@ -3616,7 +3567,7 @@ export declare class EventBus {
3616
3567
  /**
3617
3568
  * Called SYNCHRONOUSLY at attach with the route's current watermarks.
3618
3569
  *
3619
- * It is how a consumer learns where the stream stood the instant it joined,
3570
+ * It is how a deployment learns where the stream stood the instant it joined,
3620
3571
  * with no window for a publish to slip in between reading and subscribing.
3621
3572
  * The bridge needs it because a delivery dropped BEFORE the client's first
3622
3573
  * read would otherwise be invisible: with no baseline, the first serial it
@@ -3632,7 +3583,7 @@ export declare class EventBus {
3632
3583
  * since its last serial (from the watermark, which survives ring eviction);
3633
3584
  * `replayed` is what we can actually hand over. An origin the client never
3634
3585
  * mentioned is one that appeared while it was away, so everything retained
3635
- * from it is owed. A `gap` is emitted BEFORE the replay so a consumer reading
3586
+ * from it is owed. A `gap` is emitted BEFORE the replay so a deployment reading
3636
3587
  * in order learns it is behind before it starts processing.
3637
3588
  */
3638
3589
  private replayForResume;
@@ -3719,7 +3670,7 @@ export declare interface EventEnvelope {
3719
3670
  /** `tenant · event · key`, NUL-separated — built by `eventRoute`, read with
3720
3671
  * `parseEventRoute`. Never construct or split one by hand. */
3721
3672
  readonly route: string;
3722
- /** Declared event name, carried separately so a consumer of the raw envelope
3673
+ /** Declared event name, carried separately so a deployment of the raw envelope
3723
3674
  * (broadcast bridge, inspect, metrics) needn't re-parse the route. */
3724
3675
  readonly event: string;
3725
3676
  /** Publishing instance. Serials are only comparable WITHIN one origin. */
@@ -5260,7 +5211,7 @@ export declare const makeActionRunner: (deps: ActionRunnerDeps) => (action: Muta
5260
5211
  *
5261
5212
  * The bucket keying makes claims self-expiring as a DECISION: a crashed
5262
5213
  * winner doesn't block the next firing (= next bucket = new key). It did
5263
- * not make them self-expiring as ROWS, and that distinction cost a consumer
5214
+ * not make them self-expiring as ROWS, and that distinction cost a deployment
5264
5215
  * their whole deployment — 86 214 rows / 33 MB over two days, read in full
5265
5216
  * on every claim check, ten of a fifteen-slot pooler pinned on the scan, an
5266
5217
  * SSR render behind them at 300 490 ms, and a `rollout restart` that could
@@ -5704,7 +5655,7 @@ export declare const materializeIvm: (shape: AggregateShape, state: IvmState) =>
5704
5655
  }>;
5705
5656
 
5706
5657
  /** Told when the membership changes. `restarted` is a `left` + `joined` pair
5707
- * for one id, reported as such so a consumer drops the old state rather than
5658
+ * for one id, reported as such so a deployment drops the old state rather than
5708
5659
  * resuming it. */
5709
5660
  export declare type MembershipEvent = {
5710
5661
  readonly kind: 'joined';
@@ -5728,7 +5679,7 @@ export declare interface MembershipHeartbeat {
5728
5679
  *
5729
5680
  * Carried as an IDENTITY, never compared to our clock. Its job is to make a
5730
5681
  * restart distinguishable from a hiccup: an instance that comes back with a
5731
- * NEW `startedAt` is a fresh process whose owned state is gone, so a consumer
5682
+ * NEW `startedAt` is a fresh process whose owned state is gone, so a deployment
5732
5683
  * must drop what it held for the old one rather than resume it. A returning
5733
5684
  * instance with the SAME value only ever missed a few beats.
5734
5685
  */
@@ -8801,32 +8752,7 @@ export declare interface ServeRequestContext {
8801
8752
  */
8802
8753
  export declare const serverOnlyColumnNames: (tableName: string) => ReadonlyArray<string>;
8803
8754
 
8804
- /**
8805
- * A generated CRUD write (`crud.create` / `crud.update`) was handed a
8806
- * `.serverOnly()` column in its INPUT.
8807
- *
8808
- * `.serverOnly()` is the WIRE-exposure axis: the column never crosses the
8809
- * boundary in EITHER direction. Reads strip it; a write that accepts it is the
8810
- * same violation mirrored — mass assignment of a column the schema declared the
8811
- * client may not see, let alone set.
8812
- *
8813
- * Refused rather than silently stripped: a stripped field makes an attack
8814
- * indistinguishable from a no-op and leaves an honest caller wondering why the
8815
- * value it sent never landed. `columns` names what was rejected so the fix
8816
- * (drop the field from the descriptor's input schema, or from the caller) is
8817
- * mechanical.
8818
- */
8819
- export declare class ServerOnlyColumnWrite extends ServerOnlyColumnWrite_base {
8820
- }
8821
-
8822
- declare const ServerOnlyColumnWrite_base: Schema.TaggedErrorClass<ServerOnlyColumnWrite, "ServerOnlyColumnWrite", {
8823
- readonly _tag: Schema.tag<"ServerOnlyColumnWrite">;
8824
- } & {
8825
- /** The table the write targeted. */
8826
- table: typeof Schema.String;
8827
- /** The `.serverOnly()` columns the input tried to set. */
8828
- columns: Schema.Array$<typeof Schema.String>;
8829
- }>;
8755
+ export { ServerOnlyColumnWrite }
8830
8756
 
8831
8757
  /** One leak: a wire query that declares a serverOnly column in its output. */
8832
8758
  export declare interface ServerOnlyLeak {
@@ -9101,12 +9027,7 @@ export declare interface StoreCredentialInput {
9101
9027
  readonly now?: () => Date;
9102
9028
  }
9103
9029
 
9104
- /**
9105
- * Discriminated union of all framework-owned store errors. Use it on
9106
- * a mutation's `error:` schema when you want every kind surfaced
9107
- * typed to the client.
9108
- */
9109
- export declare type StoreError = TenantScopeViolation | TenantRowNotFound | ServerOnlyColumnWrite | StoreOperationFailed | TableValidationFailed | ConstraintViolation;
9030
+ export { StoreError }
9110
9031
 
9111
9032
  export declare interface StoreMiddlewareContext {
9112
9033
  readonly subject: Subject;
@@ -9132,25 +9053,7 @@ export declare interface StoreMiddlewareContext {
9132
9053
  readonly rowFilter?: RowFilterScope;
9133
9054
  }
9134
9055
 
9135
- /**
9136
- * Anything else the underlying `DataStore` raised during a write or
9137
- * query. `cause` is the stringified original error — sufficient for
9138
- * logs + UI, doesn't try to serialise complex error chains across the
9139
- * rpc boundary. The `_tag` discriminator stays cheap to pattern-match.
9140
- */
9141
- export declare class StoreOperationFailed extends StoreOperationFailed_base {
9142
- }
9143
-
9144
- declare const StoreOperationFailed_base: Schema.TaggedErrorClass<StoreOperationFailed, "StoreOperationFailed", {
9145
- readonly _tag: Schema.tag<"StoreOperationFailed">;
9146
- } & {
9147
- /** Which DataStore op was attempted: 'query' | 'insert' | 'update' | 'delete' | 'hardDelete'. */
9148
- operation: typeof Schema.String;
9149
- /** The table the op targeted. */
9150
- table: typeof Schema.String;
9151
- /** `String(originalError)` — round-trip-safe diagnostic form. */
9152
- cause: typeof Schema.String;
9153
- }>;
9056
+ export { StoreOperationFailed }
9154
9057
 
9155
9058
  /**
9156
9059
  * Drop `columns` from every row. Preserves array AND per-row object identity when
@@ -9423,30 +9326,7 @@ export declare interface TableRoutingStats {
9423
9326
  readonly distinctTupleKeys: number;
9424
9327
  }
9425
9328
 
9426
- /**
9427
- * Pre-INSERT row validation against a table's `.validate(Schema)`
9428
- * decoder failed. The MutationStore runs the table's `insertSchema`
9429
- * AFTER defaults + computed + audit/tenant stamps; failure means
9430
- * the stamped row didn't satisfy the decoder. `issues` is the
9431
- * formatted ArrayFormatter output (cheap to render in UI, doesn't
9432
- * leak the original Schema instance).
9433
- */
9434
- export declare class TableValidationFailed extends TableValidationFailed_base {
9435
- }
9436
-
9437
- declare const TableValidationFailed_base: Schema.TaggedErrorClass<TableValidationFailed, "TableValidationFailed", {
9438
- readonly _tag: Schema.tag<"TableValidationFailed">;
9439
- } & {
9440
- /** The table the row targeted. */
9441
- table: typeof Schema.String;
9442
- /** Top-level explanation for logs + UI ("user.email failed pattern check"). */
9443
- summary: typeof Schema.String;
9444
- /** Flat list of `{ path, message }` per failing leaf. Path uses dot-notation. */
9445
- issues: Schema.Array$<Schema.Struct<{
9446
- path: typeof Schema.String;
9447
- message: typeof Schema.String;
9448
- }>>;
9449
- }>;
9329
+ export { TableValidationFailed }
9450
9330
 
9451
9331
  /** The standing compute-cost attribution for one tenant — the chargeback /
9452
9332
  * showback row + the "why is my bill high" breakdown. Maintained incrementally:
@@ -9464,59 +9344,9 @@ export declare interface TenantCostState {
9464
9344
  readonly lastUpdatedAt: number | null;
9465
9345
  }
9466
9346
 
9467
- /**
9468
- * A keyed-by-primary-key write (`ctx.store.update(table, id, patch)`,
9469
- * `delete(table, id)`, `hardDelete(table, id)`, `patchJson(table, id, …)`) on a
9470
- * `tenant()`-scoped table did not resolve to a row inside the CALLER's tenant.
9471
- *
9472
- * **One error for two situations, on purpose.** It is raised identically when
9473
- * the row does not exist at all and when it exists but belongs to another
9474
- * tenant, and it carries no field that separates them. That is the whole point:
9475
- *
9476
- * - Reporting "forbidden" for a foreign row and "not found" for a missing one
9477
- * turns any keyed write into a cross-tenant EXISTENCE ORACLE — an attacker
9478
- * walks ids and learns which ones are real in someone else's tenant, which
9479
- * is exactly the isolation the `tenant()` mixin exists to provide.
9480
- * - Collapsing the other way — silently affecting zero rows — is worse than
9481
- * either: the handler reads it as "the row is gone", not "you may not touch
9482
- * it", so a genuine isolation breach shows up in an app as a confusing
9483
- * absent-row branch and never as a security signal.
9484
- *
9485
- * So both cases fail LOUDLY and IDENTICALLY. `id` is the key the caller itself
9486
- * supplied — never another tenant's data.
9487
- */
9488
- export declare class TenantRowNotFound extends TenantRowNotFound_base {
9489
- }
9490
-
9491
- declare const TenantRowNotFound_base: Schema.TaggedErrorClass<TenantRowNotFound, "TenantRowNotFound", {
9492
- readonly _tag: Schema.tag<"TenantRowNotFound">;
9493
- } & {
9494
- /** The table the keyed write targeted. */
9495
- table: typeof Schema.String;
9496
- /** The primary key the CALLER supplied. Echoing it leaks nothing. */
9497
- id: typeof Schema.String;
9498
- /** Human-readable explanation for diagnostics + UI. */
9499
- reason: typeof Schema.String;
9500
- }>;
9347
+ export { TenantRowNotFound }
9501
9348
 
9502
- /**
9503
- * A write was attempted against a `tenant()`-scoped table, but the
9504
- * authenticated subject's `tenantId` is null — either anonymous, or
9505
- * an apiKey / serviceAccount without a tenant binding. Refusing the
9506
- * write at the boundary is the safe default; a future "system writes"
9507
- * subject type can opt out.
9508
- */
9509
- export declare class TenantScopeViolation extends TenantScopeViolation_base {
9510
- }
9511
-
9512
- declare const TenantScopeViolation_base: Schema.TaggedErrorClass<TenantScopeViolation, "TenantScopeViolation", {
9513
- readonly _tag: Schema.tag<"TenantScopeViolation">;
9514
- } & {
9515
- /** The table the violating write targeted. */
9516
- table: typeof Schema.String;
9517
- /** Human-readable explanation for diagnostics + UI. */
9518
- reason: typeof Schema.String;
9519
- }>;
9349
+ export { TenantScopeViolation }
9520
9350
 
9521
9351
  export declare type TimeBucket = 'minute' | 'hour' | 'day' | 'week' | 'month';
9522
9352
 
@@ -9770,7 +9600,7 @@ export declare interface TransportSecurityOptions {
9770
9600
  * `on:` takes a `defineEvent` descriptor and reads its NAME, so the trigger and
9771
9601
  * the producer cannot drift: rename the event and this call site moves with it,
9772
9602
  * where the string form silently stops matching and the workflow simply never
9773
- * runs again. That failure is exactly what a consumer reported having with their
9603
+ * runs again. That failure is exactly what a deployment reported having with their
9774
9604
  * own string channels — `on-game-scores` beside `games/evo5/on-game-scores`,
9775
9605
  * both live, one dead since the day it was written — and it is the reason the
9776
9606
  * string form is going away rather than being kept as an alternative.
@@ -9827,7 +9657,7 @@ export declare type TupleSource = (req: {
9827
9657
  * The whole caller, not just their id.
9828
9658
  *
9829
9659
  * `subjectId` alone cannot express a credential that is NARROWER than the
9830
- * person holding it, and an API key is exactly that. A consumer reported it
9660
+ * person holding it, and an API key is exactly that. A deployment reported it
9831
9661
  * precisely: their key carries its binding in `metadata` (`keyType`,
9832
9662
  * `teamId`), while `subject.id` is the OWNING USER — so a tuple source could
9833
9663
  * only resolve the owner's memberships and was blind to which team the key