@voltro/cli 0.46.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/dist/apiBuild-DOnvi2zm.js +2 -0
  3. package/dist/{apiBuild-BKdd0I1Z.js → apiBuild-Dz8TJSxp.js} +1 -1
  4. package/dist/bin.js +1 -1
  5. package/dist/{build-co6yadYz.js → build-DLme2ppa.js} +7 -7
  6. package/dist/{checkCommand-CXAXTjZL.js → checkCommand-BUBqPBlI.js} +1 -1
  7. package/dist/{checkCommand-B-eiW-G_.js → checkCommand-Dals7g-I.js} +4 -4
  8. package/dist/{codegen-sbN1Y8PB.js → codegen-CrMXs4hb.js} +176 -162
  9. package/dist/codegen-DiMn2KkZ.js +2 -0
  10. package/dist/{codegenCommand-CB6_3sX0.js → codegenCommand-L6vacVRW.js} +4 -3
  11. package/dist/{commands-C-hxgAGr.js → commands-CAxFLqG4.js} +18 -18
  12. package/dist/{dashboardCommand-CEVO0GWF.js → dashboardCommand-CJC8Kg-s.js} +1 -1
  13. package/dist/{dataCommand-k0ezbQWa.js → dataCommand-hIaq2iKY.js} +266 -189
  14. package/dist/dbCommand-D1Q33ktl.js +2 -0
  15. package/dist/{dbCommand-BwkyNxn-.js → dbCommand-ZGNItjoJ.js} +4 -4
  16. package/dist/declaredSchemaGates-BlcwObhb.js +25 -0
  17. package/dist/{dev-DyoYst4j.js → dev-cGGsLNn6.js} +1 -1
  18. package/dist/{dev-8hTEnN6s.js → dev-lvnVq5RD.js} +32 -31
  19. package/dist/{doctorCommand-B6D7HH1-.js → doctorCommand-BK0qu7eD.js} +34 -16
  20. package/dist/doctorCommand-CWgUPye-.js +2 -0
  21. package/dist/doctorDecidedSchema-BlbWgCD_.js +23 -0
  22. package/dist/{doctorSourceRelations-CPjSwYuZ.js → doctorSourceRelations-Dd48LPvO.js} +15 -10
  23. package/dist/{dormancyCommand-CrPAwOgo.js → dormancyCommand-CyIk-zq4.js} +1 -1
  24. package/dist/{embeddingsCommand-DsSxsn_b.js → embeddingsCommand-D7TLklps.js} +1 -1
  25. package/dist/{envCommand-B_NPVGUf.js → envCommand-BHxKkGXq.js} +1 -1
  26. package/dist/{evolveCommand-DUuaCIyn.js → evolveCommand-CQh6dw21.js} +1 -1
  27. package/dist/{frameworkTableAssembly-BPlPfU07.js → frameworkTableAssembly-BNod_DKN.js} +124 -143
  28. package/dist/frameworkTableAssembly-Rft-DPUg.js +2 -0
  29. package/dist/index.js +1 -1
  30. package/dist/{migrate-CM1qwalu.js → migrate-CL5Ed01M.js} +4 -4
  31. package/dist/{runtimeTrace-BRNM06vK.js → runtimeTrace-C0SlIoQY.js} +1 -1
  32. package/dist/{sdkgen-CRCw_XcR.js → sdkgen-BXm7zx7F.js} +1 -1
  33. package/dist/{serveCommand-CHOr74WM.js → serveCommand-CV3YO9L3.js} +676 -569
  34. package/dist/serveCommand-ZP_Cb-yz.js +2 -0
  35. package/dist/serveEntry.js +1 -1
  36. package/dist/{test-CHb7UwvE.js → test-rXFq4S76.js} +1 -1
  37. package/dist/{webhooksCommand-BRrG_sGf.js → webhooksCommand-QlAk_tED.js} +1 -1
  38. package/package.json +17 -17
  39. package/templates/AGENTS.md +1 -1
  40. package/templates/agent-docs/_index.md +1 -1
  41. package/templates/agent-docs/cli.md +86 -3
  42. package/templates/agent-docs/database/migrations.md +19 -5
  43. package/templates/agent-docs/whats-new.md +39 -135
  44. package/templates/apps/api-ai/package.json +7 -7
  45. package/templates/apps/api-auth/package.json +8 -8
  46. package/templates/apps/api-backend/package.json +7 -7
  47. package/templates/apps/api-backend-deactivation/package.json +7 -7
  48. package/templates/apps/api-backend-mail/package.json +8 -8
  49. package/templates/apps/api-backend-mariadb/package.json +9 -9
  50. package/templates/apps/api-backend-sqlite/package.json +8 -8
  51. package/templates/apps/api-backend-storage/package.json +8 -8
  52. package/templates/apps/api-cms/package.json +10 -10
  53. package/templates/apps/api-collab/package.json +8 -8
  54. package/templates/apps/api-data-advanced/package.json +8 -8
  55. package/templates/apps/api-durable/package.json +8 -8
  56. package/templates/apps/api-feature-flags/package.json +9 -9
  57. package/templates/apps/api-governance/package.json +8 -8
  58. package/templates/apps/api-kv/package.json +8 -8
  59. package/templates/apps/api-moderation/package.json +8 -8
  60. package/templates/apps/api-observability/package.json +8 -8
  61. package/templates/apps/api-ratelimit/package.json +8 -8
  62. package/templates/apps/api-rbac/package.json +8 -8
  63. package/templates/apps/api-rest/package.json +7 -7
  64. package/templates/apps/api-saas/package.json +11 -11
  65. package/templates/apps/api-saas-starter/package.json +10 -10
  66. package/templates/apps/api-search/package.json +8 -8
  67. package/templates/apps/api-status/package.json +8 -8
  68. package/templates/apps/api-versioning/package.json +8 -8
  69. package/templates/apps/api-webhooks/package.json +9 -9
  70. package/templates/apps/changelog/package.json +6 -6
  71. package/templates/apps/edge-functions/package.json +2 -2
  72. package/templates/apps/frontend-admin/package.json +8 -8
  73. package/templates/apps/frontend-app/package.json +9 -9
  74. package/templates/apps/frontend-auth/package.json +8 -8
  75. package/templates/apps/frontend-blank/package.json +7 -7
  76. package/templates/apps/frontend-cms/package.json +9 -9
  77. package/templates/apps/frontend-collab/package.json +10 -10
  78. package/templates/apps/frontend-contact/package.json +7 -7
  79. package/templates/apps/frontend-dashboard/package.json +7 -7
  80. package/templates/apps/frontend-docs/package.json +7 -7
  81. package/templates/apps/frontend-i18n/package.json +6 -6
  82. package/templates/apps/frontend-landing/package.json +7 -7
  83. package/templates/apps/frontend-portal/package.json +8 -8
  84. package/templates/apps/frontend-saas/package.json +8 -8
  85. package/templates/apps/frontend-spa/package.json +7 -7
  86. package/templates/apps/frontend-ssr/package.json +7 -7
  87. package/templates/apps/frontend-ssr-api/package.json +8 -8
  88. package/templates/apps/frontend-static-blog/package.json +6 -6
  89. package/templates/apps/frontend-status/package.json +8 -8
  90. package/templates/apps/mobile-app/package.json +4 -4
  91. package/dist/apiBuild-P2gewrfQ.js +0 -2
  92. package/dist/codegen-DcE2li1i.js +0 -2
  93. package/dist/dbCommand-C2XK63Dd.js +0 -2
  94. package/dist/doctorCommand-Btl2Jz1a.js +0 -2
  95. package/dist/frameworkTableAssembly-Bob3vj9R.js +0 -2
  96. package/dist/serveCommand-BNHMVXyp.js +0 -2
@@ -0,0 +1,2 @@
1
+ import { n as e } from "./serveCommand-CV3YO9L3.js";
2
+ export { e as runServeDispatch };
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./loadEnv-D9nEOClM.js";
2
2
  import { r as t } from "./appModuleLoader-C9r9mxZt.js";
3
3
  import { i as n } from "./dialectDriver-czCHYpeH.js";
4
- import { t as r } from "./serveCommand-CHOr74WM.js";
4
+ import { t as r } from "./serveCommand-CV3YO9L3.js";
5
5
  export { e as loadDotEnv, t as registerAppModules, n as registerDriver, r as runServe };
@@ -79,7 +79,7 @@ var d = l({ scope: "voltro:test" }), f = (e) => {
79
79
  }, C = async (e) => {
80
80
  let t = m(e);
81
81
  if (!o(t.root)) return console.error(`voltro test: no such directory: ${t.root}`), 1;
82
- let { checkRpcGroupFreshness: n } = await import("./codegen-DcE2li1i.js"), r = await n(t.root);
82
+ let { checkRpcGroupFreshness: n } = await import("./codegen-DiMn2KkZ.js"), r = await n(t.root);
83
83
  if (r.kind === "stale") return console.error(`voltro test: ${r.file} is stale — ${r.reason}.`), console.error(" The tests would run against the previously generated procedure group, pass, and prove nothing about the descriptors you just edited.\n Run `voltro codegen` (or boot `voltro dev` once) and try again."), 1;
84
84
  d.info("running vitest", {
85
85
  root: t.root,
@@ -222,7 +222,7 @@ createVerifier({ secret: [process.env.WEBHOOK_SECRET, process.env.WEBHOOK_SECRET
222
222
  ...t === void 0 ? {} : { payload: t }
223
223
  };
224
224
  }, S = u({ scope: "voltro:webhooks" }), C = ["--out", "--name"], w = async (e) => {
225
- let { walk: t, loadDiscovered: n } = await import("./dev-DyoYst4j.js"), { outgoingFromEvents: r } = await import("./webhookDiscovery-il9ti-HE.js");
225
+ let { walk: t, loadDiscovered: n } = await import("./dev-cGGsLNn6.js"), { outgoingFromEvents: r } = await import("./webhookDiscovery-il9ti-HE.js");
226
226
  return r((await n(await t(e))).events.map((e) => ({
227
227
  file: e.file,
228
228
  descriptor: e.descriptor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/cli",
3
- "version": "0.46.0",
3
+ "version": "0.48.0",
4
4
  "description": "The `voltro` CLI — dev server, codegen, migrations, project scaffolding, agent-docs seeding, and production serve.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -739,22 +739,22 @@
739
739
  "@effect/platform-node": "^0.108.0",
740
740
  "@effect/sql": "^0.52.0",
741
741
  "@effect/workflow": "^0.19.0",
742
- "@voltro/ai": "0.46.0",
743
- "@voltro/cache": "0.46.0",
744
- "@voltro/data-transfer": "0.46.0",
745
- "@voltro/database": "0.46.0",
746
- "@voltro/env": "0.46.0",
747
- "@voltro/kv": "0.46.0",
748
- "@voltro/logger": "0.46.0",
749
- "@voltro/plugin-auth": "0.46.0",
750
- "@voltro/plugin-broadcast": "0.46.0",
751
- "@voltro/plugin-mail": "0.46.0",
752
- "@voltro/plugin-storage": "0.46.0",
753
- "@voltro/plugin-webhooks": "0.46.0",
754
- "@voltro/protocol": "0.46.0",
755
- "@voltro/runtime": "0.46.0",
756
- "@voltro/serverless": "0.46.0",
757
- "@voltro/workflow": "0.46.0",
742
+ "@voltro/ai": "0.48.0",
743
+ "@voltro/cache": "0.48.0",
744
+ "@voltro/data-transfer": "0.48.0",
745
+ "@voltro/database": "0.48.0",
746
+ "@voltro/env": "0.48.0",
747
+ "@voltro/kv": "0.48.0",
748
+ "@voltro/logger": "0.48.0",
749
+ "@voltro/plugin-auth": "0.48.0",
750
+ "@voltro/plugin-broadcast": "0.48.0",
751
+ "@voltro/plugin-mail": "0.48.0",
752
+ "@voltro/plugin-storage": "0.48.0",
753
+ "@voltro/plugin-webhooks": "0.48.0",
754
+ "@voltro/protocol": "0.48.0",
755
+ "@voltro/runtime": "0.48.0",
756
+ "@voltro/serverless": "0.48.0",
757
+ "@voltro/workflow": "0.48.0",
758
758
  "chokidar": "^5.0.0",
759
759
  "ioredis": "^5.11.1",
760
760
  "tinyglobby": "^0.2.17",
@@ -707,7 +707,7 @@ each plugin's own README.
707
707
 
708
708
  | Topic | Open | Summary |
709
709
  |---|---|---|
710
- | **What's new in 0.46.0** | `node_modules/@voltro/cli/templates/agent-docs/whats-new.md` | Everything that changed in this version. Read it before hand-rolling something the framework may now ship. |
710
+ | **What's new in 0.48.0** | `node_modules/@voltro/cli/templates/agent-docs/whats-new.md` | Everything that changed in this version. Read it before hand-rolling something the framework may now ship. |
711
711
  | AI | `node_modules/@voltro/cli/templates/agent-docs/ai.md` | How Voltro treats AI — agents, tools, streaming, RAG — all primitives over the same WebSocket as the rest of the framework. |
712
712
  | Authentication | `node_modules/@voltro/cli/templates/agent-docs/authentication.md` | How @voltro/plugin-auth wires password + session-cookie auth across api + web, plus the pluggable identity-strategy protocol. |
713
713
  | Caching | `node_modules/@voltro/cli/templates/agent-docs/caching.md` | Voltro's caching layer (@voltro/cache) — an always-on memory default, swappable Redis-compatible backends, a low-level wrap primitive, and automatic query-result invalidation. |
@@ -9,7 +9,7 @@ each plugin's own README.
9
9
 
10
10
  | Topic | Open | Summary |
11
11
  |---|---|---|
12
- | **What's new in 0.46.0** | `node_modules/@voltro/cli/templates/agent-docs/whats-new.md` | Everything that changed in this version. Read it before hand-rolling something the framework may now ship. |
12
+ | **What's new in 0.48.0** | `node_modules/@voltro/cli/templates/agent-docs/whats-new.md` | Everything that changed in this version. Read it before hand-rolling something the framework may now ship. |
13
13
  | AI | `node_modules/@voltro/cli/templates/agent-docs/ai.md` | How Voltro treats AI — agents, tools, streaming, RAG — all primitives over the same WebSocket as the rest of the framework. |
14
14
  | Authentication | `node_modules/@voltro/cli/templates/agent-docs/authentication.md` | How @voltro/plugin-auth wires password + session-cookie auth across api + web, plus the pluggable identity-strategy protocol. |
15
15
  | Caching | `node_modules/@voltro/cli/templates/agent-docs/caching.md` | Voltro's caching layer (@voltro/cache) — an always-on memory default, swappable Redis-compatible backends, a low-level wrap primitive, and automatic query-result invalidation. |
@@ -2613,11 +2613,13 @@ Rows are written as newline-delimited JSON — streamable, resumable by line, an
2613
2613
  | *(none)* | Every table the app has DATA in (the default) — see the note below on the handful that describe a deployment rather than filling it. |
2614
2614
  | `--tenant <id>` | Every `tenant()`-scoped table filtered to that tenant, **plus** the FK closure in BOTH directions: (1) the transitive **FK-parent** closure of those rows — closure-pulled shared tables (a global `users` / reference table) are **row-subset to the ids the tenant's rows actually reference**, never exported in full; and (2) the **child** closure — rows that *reference* the tenant's rows (the comments on the tenant's projects) come along too, each scoped to the ids that actually point into the tenant set. The child walk is anchored on the `tenant()` tables, so a row that references **only a shared parent** (a global `users` another tenant also references) is **not** pulled — that would be a cross-tenant leak. A `--tenant` bundle therefore carries the tenant's parents AND children and **no other tenant's rows** — that's what makes it safe as a GDPR / per-tenant takeout. |
2615
2615
  | `--tables a,b` | An explicit set (you own referential integrity; the importer's deferred-FK resolution covers load-order dangles, see below). |
2616
- | `--exclude a,b` | Everything EXCEPT these, expanded against the live table list. Direct target only. Cannot be combined with `--tables` or `--tenant`; a name that does not exist is refused, because an exclusion that excludes nothing leaves the run looking like it worked. |
2616
+ | `--exclude a,b` | Everything EXCEPT these. The scope stays `all` and records what was left out — so the deployment-describing tables are still filtered, and `replace` still accepts the bundle. Works on both targets (the instance resolves it against its own live list). Cannot be combined with `--tables` or `--tenant`; a name that does not exist is refused, because an exclusion that excludes nothing leaves the run looking like it worked. |
2617
2617
 
2618
2618
  #### What `all` deliberately leaves out
2619
2619
 
2620
- A few framework tables hold rows **about a deployment** rather than an app's data — its migration ledger, its file-migration and seed records, its CDC offsets, its schedule claims and wakeups, its workflow watermarks / pending starts / admissions / pauses. They are dropped from `all`, skipped on import, and never emptied by a `replace`, and the run says which ones and why.
2620
+ A number of framework tables hold rows **about a deployment** rather than an app's data. The test is: would a row from elsewhere make this target *act* send, run, admit, refuse, skip a delivery — or assert something untrue about its own history? That covers its migration ledger, file-migration and seed records, CDC offsets and change log, schedule claims, wakeups and firing history, workflow watermarks / pending starts / admissions / pauses / delivered events, its outbox and delivery attempts, its idempotency keys, its storage grants, its spend and usage accounting, and its own traces and undo log. They are dropped from `all`, skipped on import, and never emptied by a `replace`, and the run says which ones and why.
2621
+
2622
+ Every framework table is classified one way or the other, and a new one fails the build until somebody decides — the classification used to live in two places, the module and a hand-kept copy in its test, and the two disagreed about exactly the tables that later caused trouble.
2621
2623
 
2622
2624
  The reason is worth one paragraph, because it cost a real environment ninety minutes. A `scope: all` bundle carried `_voltro_migration_plans`, `replace` wrote it, and the target's next boot refused:
2623
2625
 
@@ -2625,7 +2627,7 @@ The reason is worth one paragraph, because it cost a real environment ninety min
2625
2627
  auto-migrate: SCHEMA FINGERPRINT MISMATCH — declared=6e2c61081a9ed80c live=28af9a54414f22f1
2626
2628
  ```
2627
2629
 
2628
- The refusal was right. That fingerprint is computed over the **declared table set**, which legitimately differs per environment — `NODE_ENV=production` declares `_voltro_traces` and `_voltro_undo_log`, a `development` run does not. So the imported row was not out of date, it was **foreign**: it stated a schema decision made somewhere else. Two of the others would have made the target *act* — a pending workflow start runs a workflow somebody queued elsewhere, a pause silently stops one here.
2630
+ The refusal was right. That fingerprint is computed over the **declared table set**, so the imported row was not out of date, it was **foreign**: it stated a schema decision made somewhere else. (The declared set could also differ per environment then, because `NODE_ENV` decided two of the tables. It no longer does — but that removes one *way* for two deployments to differ, not the reason a foreign ledger row is wrong.) Two of the others would have made the target *act* — a pending workflow start runs a workflow somebody queued elsewhere, a pause silently stops one here.
2629
2631
 
2630
2632
  `all` is the only scope filtered. **Name one of these in `--tables` and you get it** — an explicit name is an expectation, and this command refuses to drop those silently.
2631
2633
 
@@ -2865,6 +2867,87 @@ constraint declared `DEFERRABLE`. Such a run says so and takes the row-by-row
2865
2867
  path, whose deferred-FK pass exists for exactly that shape. A table referencing
2866
2868
  ITSELF is not a cycle: one statement carries the whole table.
2867
2869
 
2870
+ ### A `replace` does not write per-row history
2871
+
2872
+ Write recorders — `versioningPlugin({ timing: 'in-transaction' })` and anything
2873
+ else registered through the same seam — are **suspended for a `replace`**. A
2874
+ replace sets a state; it does not change rows, so a per-row history entry would
2875
+ describe something that did not happen. On a large bundle that is not a detail:
2876
+ one import wrote 242 950 history rows for a deployment, doubling the write load
2877
+ of their most expensive run.
2878
+
2879
+ The reasoning is not the cost. This path already writes through the raw store —
2880
+ no tenant scoping, no row filter, no `audit()` stamping — and the recorder fired
2881
+ anyway because it sits one layer below. Suspending it makes the layers agree.
2882
+
2883
+ `upsert` and `append` still record: those CHANGE existing state, which is what a
2884
+ recorder is for. Every suspended run says so, and the suspension is scoped to the
2885
+ run rather than the process, so requests served alongside it keep recording.
2886
+
2887
+ Instead of per-row history, the operation records **itself**. One row in
2888
+ `_voltro_data_imports` per run: the mode, the transport, the bundle, the source
2889
+ deployment's schema fingerprint, the counts — and the failure, for the run you
2890
+ are usually looking for. A trail that only records successes goes quiet exactly
2891
+ when it is needed.
2892
+
2893
+ It is best-effort, unlike the interrupted-replace marker: that one is a safety
2894
+ interlock and a run which cannot write it must not proceed, while this is
2895
+ history. A target whose schema is not migrated yet still imports, and says the
2896
+ trace could not be written.
2897
+
2898
+ ### Watching an import you cannot see
2899
+
2900
+ Over `--target api` the import runs INSIDE the instance. Everything it decides
2901
+ — whether it stages, whether recorders are suspended, how far it has got — is
2902
+ printed in the pod's log, and someone reaching for `--target api` is by
2903
+ construction someone who cannot reach the database directly and usually cannot
2904
+ read that log either. The run is also deliberately decoupled from the caller:
2905
+ killing the client does not stop it, which is what keeps a dead client from
2906
+ leaving a half-emptied target. Both properties are right, and together they used
2907
+ to mean an operator could neither see the run nor learn how it ended.
2908
+
2909
+ Two things close that, and neither is a streamed response — a chunked body has
2910
+ to survive every proxy in between, and a buffering reverse proxy turns a
2911
+ progress feed into exactly the silence it was meant to replace.
2912
+
2913
+ **Ask before you upload.** A `replace` over the api asks the instance what it is
2914
+ going to do, before a byte of the bundle goes up. The instance answers from the
2915
+ same function the run itself calls, so the answer cannot drift from the run:
2916
+
2917
+ ```
2918
+ $ voltro data import ./bundle --target api --api-url https://app.example --mode replace
2919
+ api replace: the instance WILL stage — 104 table(s) load into copies and the
2920
+ target keeps its rows until one short swap at the end. Interrupting the load leaves the target intact.
2921
+ api import: uploading the bundle — this request stays open until the instance has imported it
2922
+ ```
2923
+
2924
+ With `--bundle-key` the client never holds the bundle, so it sends the key and
2925
+ the instance reads the table list out of the archive itself — the caller about to
2926
+ have an instance empty its own database is the last one who should be told to
2927
+ check a log they cannot read.
2928
+
2929
+ If it will not stage, the line says so and names the reason — a bundle table the
2930
+ target does not have, a foreign-key cycle, a dialect this build cannot stage on.
2931
+ That is the difference between "interrupting this is safe" and "interrupting
2932
+ this empties the target", which is exactly the decision an operator is making
2933
+ while they watch.
2934
+
2935
+ **Read the run from anywhere.** `_voltro_data_imports` is opened before the
2936
+ first table, advanced every couple of seconds as tables land, and closed with the
2937
+ outcome — so polling it IS the progress feed:
2938
+
2939
+ ```
2940
+ $ voltro data imports --target api --api-url https://app.example
2941
+ 1 import(s) IN FLIGHT — re-run this to watch the counters move
2942
+ 2026-08-22T09:04:01.000Z · replace — started and never reported finishing · via api · from /tmp/b
2943
+ 2026-08-20T10:00:00.000Z · replace — 228866 row(s) across 104 table(s) · via api · from /tmp/a
2944
+ ```
2945
+
2946
+ Same data over `GET /_voltro/admin/imports?limit=20`, behind the same
2947
+ data-transfer secret (the row names bundles and schema fingerprints). It works
2948
+ from a different machine than the one that started the import, and through
2949
+ anything that forwards a GET.
2950
+
2868
2951
  ### An interrupted `replace` cannot be silent
2869
2952
 
2870
2953
  The capture only helps if somebody knows to reach for it. A half-replaced database is indistinguishable from an empty one **from the inside** — every table exists, every constraint holds, every query returns nothing without erroring — so a run that emptied a target and disappeared can be served over for hours before anyone asks the right question.
@@ -3179,14 +3179,28 @@ flag flipped alone:
3179
3179
 
3180
3180
  **From 0.35.0 none of them does.** `_voltro_cdc_offsets` follows the DIALECT, so
3181
3181
  a mariadb/mssql app declares it either way; the other two are declared in
3182
- `app.config.ts` and the env vars only choose what a process captures:
3182
+ `app.config.ts` and the env vars only choose what a process captures.
3183
+
3184
+ **And from 0.48.0 `NODE_ENV` does not either.** Until then, `_voltro_traces` and
3185
+ `_voltro_undo_log` defaulted to on outside production — safe for the
3186
+ fingerprint, which only ever compares processes inside ONE deployment, and
3187
+ unsafe for the reader that spans two. `voltro data` is that reader: a bundle
3188
+ exported from a development database carries the tables that database has, and
3189
+ a staged (non-destructive) `replace` needs every bundle table to exist in the
3190
+ target. One source tree therefore produced a bundle a production target could
3191
+ not stage, and the run fell back to truncating it — with nothing red anywhere.
3192
+
3193
+ Both are declared in every environment now. An unused declared table is an empty
3194
+ table; a schema that differs per environment is a class of failure. Declare them
3195
+ only to leave one OUT:
3183
3196
 
3184
3197
  ```ts
3185
3198
  export default {
3186
- // Both default to on outside production. Declare them when you want the
3187
- // table in a production schema `VOLTRO_UNDO` / `VOLTRO_TRACING_PERSIST`
3188
- // alone is no longer enough, because your migrate job does not carry them.
3189
- schema: { undo: true, traces: true },
3199
+ // Declared in EVERY environment by default. Set `false` to keep a table out —
3200
+ // and then set it in every environment, or two deployments of one source tree
3201
+ // declare different schemas again. `VOLTRO_UNDO` / `VOLTRO_TRACING_PERSIST`
3202
+ // still decide what a process WRITES; they no longer decide what exists.
3203
+ schema: { undo: false, traces: false },
3190
3204
  }
3191
3205
  ```
3192
3206
 
@@ -1,4 +1,4 @@
1
- # What's new in 0.46.0
1
+ # What's new in 0.48.0
2
2
 
3
3
  Read this FIRST when a task touches an area you have not worked in recently.
4
4
  It is the cheapest way to notice that the framework grew the thing you were
@@ -7,174 +7,78 @@ workaround for something that shipped two versions ago.
7
7
 
8
8
  BREAKING entries name a codemod; run `voltro update` to apply it.
9
9
 
10
- ### ⚠ BREAKING
11
-
12
- - **@voltro/runtime, @voltro/cli** — An aggregate's `incremental.source` is a table name, and is now typed and audited like one.
13
-
14
- 0.45.0 narrowed a query's and a stream's `source:` for a specific failure: a name matching no table does not error, it produces a subscription that serves once and goes quiet. An aggregate's CDC source misses the same way and is quieter still — the runner subscribes to a table nothing writes, no delta arrives, and the aggregate stops tracking its input while every read of it succeeds and returns a number.
15
-
16
- It stayed `string` in that change, and not because anyone weighed it. It reads differently — `incremental.source`, a single name on a definition, rather than a list on a descriptor — so it did not fit the loop, and a shape that does not fit reads as a type mismatch instead of a gap.
17
-
18
- Both halves close now. The field is `TableName`, so a name no table carries is a compile error from the next `voltro dev`. And the boot audit takes aggregates alongside queries and streams, so a stale one is named in the same warning — the runtime half matters because a source can be correct at the type level and still be a table the deployment does not have.
19
-
20
- The audit's aggregate half runs on both boot paths and needed its OWN call on each, since aggregates are discovered several hundred lines after the existing one — which is precisely the shape that ends up wired on one path only, so it is asserted by name over both files.
21
-
22
- A recompute-only aggregate declares no `incremental` at all and is not audited: reporting an absence as an unresolved source would report a choice as a defect.
23
-
24
- **`voltro update` carries you across this** — codemod `0.46.0/01_typed-aggregate-source`.
25
-
26
10
  ### Added
27
11
 
28
- - **@voltro/data-transfer, @voltro/cli** — A foreign-key cycle is caught BEFORE a staged `replace` loads, and leftover staging tables have a command.
29
-
30
- Two things the staged swap left open, closed.
31
-
32
- **The cycle.** The swap inserts parents first, so two tables referencing each other cannot both be satisfied by a bulk copy on postgres, sqlite or SQL Server — and `SET CONSTRAINTS ALL DEFERRED` does not rescue it, because postgres only defers a constraint declared `DEFERRABLE` and the framework declares none. Until now that surfaced as a FAILED SWAP after the whole bundle had loaded: minutes of work, then a refusal. `topo.ts` already orders parents-first and breaks a cycle at its closing edge, so a cycle is exactly a reference pointing FORWARD in that order — cheap to see before anything is loaded. Such a run says so and takes the row-by-row path, whose deferred-FK pass exists for that shape. A table referencing ITSELF is deliberately not a cycle: one statement carries the whole table, measured on all five engines, and treating it as one would cost every app with an `audit()` mixin the staged path.
33
-
34
- **The leftovers.** A staged run drops-then-creates, so it collects its own; what survives is staging for a table set a later run does not touch. `voltro data clear-staging --yes` lists them and drops them.
35
-
36
- It is a COMMAND and not a boot sweep, which is the decision worth recording: a booting process cannot tell a leftover from a staging table another replica is loading into right now, and with several replicas that is not a rare race — one booting pod would delete an import in flight. The refusal without `--yes` says so, and names the tables so the operator can check before answering.
37
-
38
- **And `--no-atomic` stages too now, which is where the change is largest.** The flag exists for resumability on a large bundle, and it used to be the mode with the WORST failure: the target emptied and partially refilled, in neither state — the kill test measured 889 rows of 8 000. Staged, the ledger keeps its exact meaning (a recorded table is one fully loaded; it just lands in staging) while the target stays untouched until the swap. Resumable AND all-or-nothing, which the two flags could not be at once before.
39
-
40
- Three things came out of wiring it, and none was visible from the design. Dropping staging in the `finally` destroyed exactly what a resume needs, so a second run read from tables that no longer existed — found by the resume test, not by reasoning; staging is dropped only after a successful swap now, and a run that kept its rows says so. The SUCCESS case needed its own guard: after a completed run the ledger still says every table is done while staging is gone, so a re-run would have copied nothing over the target — `ledger.truncated` has always meant "the destructive step already happened" and the old path is guarded by exactly that flag, so it guards this one too. And the test lever was wrong at first: withholding the snapshot disables staging but also fail-closes the rollback capture, so the run refuses before loading — the unstaged case is now driven by the real reason, a registered write recorder.
41
-
42
- Two existing assertions inverted, and BOTH truths are kept rather than one replaced: `--no-atomic` now keeps the target when it can stage, and still costs exactly what it always did when it cannot. A killed staged run leaves the target's rows intact and writes no interrupted-replace marker — that state cannot arise on the staged path, so there is nothing for a boot to refuse over.
43
- - **@voltro/runtime, @voltro/cli** — `voltro dev` says when a query reads a table it did not declare in `source:`.
44
-
45
- The other half of the `source:` problem, and the one no static tool can see. A stale name is a compile error now, and the boot warns about one that resolves to nothing. A name that is simply ABSENT has never had an observer: the write lands, the row is in the database, a reload shows it, and the open panel does not move. The type is satisfied, the audit is satisfied, the write path is correct and its tests are green.
46
-
47
- So while `voltro dev` runs, every read is attributed to the query that made it and compared against that query's own `source:`. The finding names the table and what will not happen, once per query per boot.
48
-
49
- **The design question was never the recording, it was compose-vs-restrict.** Only a read that CONTRIBUTES rows belongs in `source:` — a restricting read re-running on every unrelated write puts every list back on the wire. An app that scanned its own source for this needed two hand-written exceptions to get from a thousand findings to thirty, and a rule needing an exception list on a correct codebase has already spent its attention.
50
-
51
- Neither exception is a list here. A table reached only through a predicate subquery is narrowing BY CONSTRUCTION — it returns no column to anybody — so it classifies itself off the descriptor, on every app, with nothing to maintain. And the framework's own restricting reads are ours: they are issued below the wrapper, or, where the framework runs APP code to decide access (a row filter's loader), marked at the call site we control instead of at the ones we do not.
52
-
53
- Deliberately narrow, and each edge is a decision rather than a limitation: it reports what it SAW and never claims a declaration is otherwise complete; a query with no `source:` at all is left alone, because the finding is about an incomplete list and not a missing one; and it says which tables it did not count, so the classification can be checked rather than trusted.
54
-
55
- Dev only. `voltro serve` installs no sink, which makes every part of it inert — no wrapper, no async-local write, no comparison. `VOLTRO_SOURCE_RECORDER=off` turns it off in dev.
56
-
57
- `restrictingReads` (`@voltro/runtime`) is the escape for an app helper that resolves access somewhere the framework does not call it. It is a no-op outside a recording session, so it can be left in place.
58
-
59
- Measured against a running `voltro dev`, not only in tests: a query declaring one table while reading two is reported once across eleven requests, and the correct queries beside it produce nothing.
60
-
61
- **Eager-loaded relations count, and they were the hole.** `.with({ subTasks: true })` issues no second read — `compileEagerJson` folds the whole spec into ONE round trip — so the loaded table is never a read's own table and never a join. It is a relation NAME on the descriptor, and the recorder resolves it through the relation registry: the target, and for a many-to-many the JUNCTION as well, since a write there changes membership, which is precisely the change a user makes. Nested `with:` recurses against the target's relations, the same walk the compiler does; an unresolvable name yields nothing rather than an invented table, and a throwing target thunk cannot take the request down with it.
12
+ - **@voltro/cli, @voltro/data-transfer** — An import over `--target api` can be asked what it will do, and watched while it does it.
62
13
 
63
- This was the reported failure's own shape, so the first version of the recorder could not see the case it was built for.
14
+ The transport's two correct properties combined into one blind spot: the run happens INSIDE the instance, so every line it produces goes to a pod log; and it is deliberately decoupled from the caller, so killing the client does not stop it (which is what keeps a dead client from leaving a half-emptied target). Someone reaching for `--target api` cannot reach the database directly and usually cannot read that log either, so "watch for the staging line" was advice they could not follow.
64
15
 
65
- Measured against a running `voltro dev` and real `POST /rpc` calls: twelve requests across four queries produced exactly two findings — the two deliberately-incomplete ones. The SAME eager load declared correctly beside them is silent, and so is a query with no `source:` at all. A check that only ever fires is not evidence that it fires for a reason.
66
- - **@voltro/cli** — `--rollback-key <key>` — a `replace` over `--target api` has the INSTANCE store the target's current rows in its own object storage before deleting them.
16
+ **A preflight, before a byte is uploaded.** A `replace` over the api now asks the instance whether it will stage, and prints the answer including the reason when it will not. It answers from `decideStaging`, the same function the run itself calls, so the two cannot drift; a second copy of that decision would answer confidently and diverge on the next change. With `--bundle-key`, where the client never holds the bundle, it sends the key and the instance reads the table list out of the archive's own manifest — the caller about to have an instance empty its own database is the last one who should be told to check a log they cannot read.
67
17
 
68
- The direct path already captured beside the bundle. That is useless on this transport, and the reason is the whole point: the process that would roll a transaction back IS the instance, so a capture in the pod's filesystem goes away with exactly the failure it exists for — a deployment lost 240 172 rows to a run whose api pod disappeared nine minutes in. Object storage is durable, is already configured wherever the storage-push export works, and is reachable afterwards from anywhere.
18
+ **`voltro data imports`** (and `GET /_voltro/admin/imports`, behind the same data-transfer secret) reads the history and the run in flight. `_voltro_data_imports` was write-only; it is now opened before the first table, **advanced every couple of seconds as tables land**, and closed with the outcome so polling it is the progress feed. Not a streamed response on the upload connection: a chunked body has to survive every proxy in between, and a buffering reverse proxy turns a progress feed into exactly the silence it was meant to replace.
69
19
 
70
- Pushed BEFORE the first delete, through the same archive sink the export uses one sink, not two, because two is how an instance comes to push a bundle and fail to keep one. A failure to store it stops the import with the target untouched.
20
+ **And a `replace` that does not stage now says why.** The staging set was an early `return []` three conditions deep, and the empty array met a `length > 0` further down and read as "do not stage". A bundle table the target does not have the ordinary case for a development source against a production target — turned the non-destructive path off in silence. Every reason routes through one message now; the cycle case additionally used to be gated on `atomic`, so the mode where an interrupted run leaves the worst outcome was also the one that said the least.
71
21
 
72
- Fail-closed in both directions, deliberately:
22
+ ### Changed
73
23
 
74
- - asked for and impossible (no storage configured) → **409**, naming the fix. The request is the operator saying "I cannot afford to lose this", and serving them anyway is the one answer that removes their precaution while looking like agreement. - not asked for → the run proceeds and says what it did not keep. A `replace` into a scratch environment is legitimate, and refusing it would push people to the flag that turns the safety off everywhere.
24
+ - **@voltro/cli** The declared framework schema no longer depends on `NODE_ENV`.
75
25
 
76
- The decision is made from the headers alone, before a byte of the bundle is read: a run that cannot take the capture it was asked for must not cost an upload first.
77
- - **@voltro/database, @voltro/data-transfer, @voltro/cli** — An interrupted `replace` cannot be silent any more.
26
+ `_voltro_traces` and `_voltro_undo_log` defaulted to on outside production. That was allowed with an explicit justification one decider makes every command in a deployment agree and the justification was about the schema FINGERPRINT, which only ever compares processes inside ONE deployment.
78
27
 
79
- The capture only helps if somebody knows to reach for it, and a half-replaced database is indistinguishable from an empty one FROM THE INSIDE every table exists, every constraint holds, every query returns nothing without erroring. A deployment served over one for ninety minutes and only found out through an unrelated fingerprint mismatch.
28
+ The declared set has a second reader that spans two, and it was never considered: `voltro data`. A bundle exported from a development database carries the tables that database has, and a staged (non-destructive) `replace` needs every bundle table to exist in the target. So one source tree produced a bundle a production target could not stage, and the run fell back to truncating it with nothing red anywhere, on the one path where that difference is the entire point.
80
29
 
81
- So a `replace` writes one row (`_voltro_replace_in_progress`) before the first delete and removes it after the last insert, and finding it at boot is a REFUSAL on both boot paths, out of one function. The message names how many tables, how long ago, over which transport, and the capture to restore from, with the command spelled out.
30
+ Both tables are declared in **every environment** now. The trade is the one `_voltro_cdc_offsets` already makes: an unused declared table costs one empty table and buys agreement. `VOLTRO_UNDO` / `VOLTRO_TRACING_PERSIST` still decide what a process WRITES; they never decided the schema and still do not. Set `schema: { traces: false, undo: false }` in `app.config.ts` to keep one out in every environment, or the divergence is back by hand.
82
31
 
83
- The row lives in the SAME transaction as the emptying, so it is present exactly when the emptying is: a run that rolls back cleanly takes the marker with it, and a boot over a database nothing happened to is not refused. A completed `replace` clears its own marker and every older one, so the recovery import restores the data and silences the alarm in one command.
32
+ **Upgrade:** a production app that never declared them gains two empty tables. `voltro db apply` (or a `voltro dev` boot) plans and applies them like any other framework table, on every dialect. Run it before the pods roll, as with any schema change a migrate job and a fleet that disagree is exactly what this removes.
84
33
 
85
- Nothing expires a half-replaced database does not become whole with time, so `voltro data clear-replace-marker --yes` is a decision somebody makes.
34
+ `voltro doctor` now prints the three decided tables and what decided each, on a HEALTHY run. That text existed and was reachable only from the `prod-mismatch` refusal a message that appears exclusively after a fleet is down is an explanation, not a warning.
86
35
 
87
- Measured against a live mariadb by killing a run mid-load: the marker is there, the refusal names the capture, and a completing run clears it.
88
- - **@voltro/data-transfer** — The staged-swap primitive for `replace` — load somewhere else, then swap the content in one short transaction.
89
-
90
- `--mode replace` empties the target and loads into it inside ONE transaction, held open for the whole network-bound load. A deployment measured nine minutes for 242 950 rows, and the promise that the target is left as it was found rests entirely on a live process being there to roll it back. A promise that rests on the process surviving is a promise about the weather.
91
-
92
- **The design the plan carried was wrong, and measurably so.** Shadow tables plus a final `RENAME` moves every inbound foreign key WITH the renamed table — postgres 17 by OID, MariaDB 11 and MySQL 8.4 by tracking the rename, including inside MySQL's atomic multi-pair `RENAME TABLE`. After the swap every key points at the table the design then DROPS. The atomicity of the rename, which that design reasoned about carefully, was never the hard part.
93
-
94
- Keeping the table OBJECTS and swapping the CONTENT has none of that: every constraint stays pointed at the same object, and the long client-driven load moves OUT of the destructive transaction, which then holds only server-side bulk SQL.
95
-
96
- **Four of five engines need no integrity switch, which inverts what the design assumed.** Three self-referencing rows — `actors.createdBy → actors`, the framework's own pattern — inserted by one `INSERT … SELECT`: postgres, SQLite and SQL Server take all three (they check at STATEMENT end); MariaDB and MySQL answer `ERROR 1452` (they check per ROW) and need the switch their own `emptyTables` already uses. Measured on each, and measured again after: a genuine violation attempted following the swap is still refused on all five, so the suspension does not leak past it.
97
-
98
- The statement builders refuse a table name outside the framework's identifier class. This module concatenates SQL and its names arrive from a bundle MANIFEST — a file an operator can edit — so the rule applied at declaration is re-asserted where the concatenation happens rather than assumed to have survived the round trip. Staging tables are `_voltro_staging_<t>`, so the boot differ's framework-table asymmetry treats them as ours instead of planning them as user tables somebody forgot to declare.
99
-
100
- **The importer does not use it yet**, and attempting that integration is what surfaced two blockers worth stating: a staged write would fire a change event (waking reactivity, CDC and the analytics mirror for tables nobody declared), and it would miss the target's column metadata (`encodeRowForSchema` looks the table up by NAME, so a `json()` column would be written unencoded — a wrong value, not an error). Both are tractable; neither is a line-level change. Until then the two protections already shipped — the capture written before the first delete, and the marker that refuses the next boot after an interrupted run — remain what covers the reported outcome.
101
- - **@voltro/data-transfer, @voltro/cli** — `--mode replace` writes down what it is about to destroy.
102
-
103
- Before the first delete it exports the target's CURRENT rows — exactly the tables it will empty — as an ordinary bundle beside yours, and says where:
104
-
105
- rollback capture: 240172 row(s) across 75 table(s) → ./out.rollback-2026-… If this run does not finish, restore with: voltro data import ./out.rollback-… --mode replace
106
-
107
- It is on disk BEFORE anything is destroyed, so it depends on no transaction and on no process being alive to roll one back. That is the whole point: a deployment lost 240 172 rows to a `replace` whose api pod disappeared nine minutes in, and recovered from an export they had taken twenty minutes earlier out of HABIT. This is that habit as behaviour. It is NOT the fix for the class — the emptying must not become visible until the load stands, which is a rebuild — it is the small half that covers the reported outcome today.
108
-
109
- **Fail-closed.** A capture that cannot be taken stops the import before it starts, target untouched. A net you believe in and do not have is worse than none: the belief is what stops you taking your own export.
110
-
111
- The capture is a COMPLETE bundle over a snapshot narrowed to the emptied tables, not a `tables`-scoped one over the whole schema. Same files, different manifest — and the manifest decides whether it can be restored at all, since `replace` refuses a partial bundle for a reason that is exactly false here.
112
-
113
- `--no-rollback` opts out, `--rollback-dir <path>` relocates it. Only `replace` takes one: `upsert` and `append` destroy nothing.
114
-
115
- **Not on `--target api`, and it says so.** The capture would live inside the instance — the thing that can go away, which is the failure it exists for. A replace over that transport warns and names the export to take first.
116
- - **@voltro/database, @voltro/data-transfer** — Staging clones — the load-side half of the staged swap for `replace`.
117
-
118
- The swap primitive shipped without the importer using it, and two things stood in the way. Both are solved by ONE answer.
119
-
120
- A typed write resolves its table by NAME: `encodeRowForSchema` and `stampGeneratedId` both look it up in the registry. Writing to `_voltro_staging_notes` therefore found nothing — and the failure mode is not an error, it is a `json()` column written UNENCODED. Separately, every dialect store's insert ends in `routeEvent`, whose reactive guard reads `isTableReactive`, which is `isReactive !== false` — so an UNREGISTERED name counts as reactive, and loading a large bundle into staging would emit an event per row for tables nobody declared.
121
-
122
- A staging table registered as a CLONE of its target, marked `isReactive: false`, answers both: the columns resolve, and the guard the framework already has returns before the emit. `.nonReactive()` is the documented way to say exactly that, so nothing at the store needed a special case — and it is the clone rather than the absence that makes the load quiet, which is the part worth remembering if this is ever simplified.
123
-
124
- `registerStagingClones` returns a REQUIRED undo instead of trusting a caller to remember one. `allRegisteredTables()` feeds the declared set, the boot differ and `voltro doctor`, so a clone left in the registry reads as a table the app declares and nobody created. A failure part-way through registers nothing at all.
125
-
126
- `unregisterTable` is new in `@voltro/database` for this: narrow on purpose. `clearTableRegistry` wipes everything and exists for tests; this removes ONE name a bounded operation owns for its duration.
127
-
128
- **The precision is recovered, and it is strictly better than what it replaces.** Staging carries no foreign keys — required, since a staged row whose parent has not been staged yet must not be refused — so a violation moves from load time to swap time, where the database answers with one message naming a constraint. `stagedReferences` reads the edges INSIDE the replaced set off the snapshot the importer already holds (deliberately not `incomingForeignKeys`, which answers the already-answered question of keys pointing in from OUTSIDE), and `danglingProbeSql` asks STAGING the question the database was asking — against the STAGED parent set, because the swap inserts parents from staging and what matters is whether the reference resolves AFTER it.
129
-
130
- Measured against a live postgres with four staged children — one good, one NULL, two dangling — driven through a real failing swap: the database named `ghost`; the probe named `ghost` AND `phantom`, skipping the NULL and the good row. The row-by-row path stops at the FIRST failure, so a bundle with four bad references costs four round trips; this reports all of them in one pass. The target was verified unchanged afterwards, which is the first thing the message says.
131
-
132
- **The importer uses it now.** `--mode replace` stages when it can: create a staging table per table, load into those OUTSIDE any transaction, then swap the content across in one short transaction of server-side SQL. A process that dies during the load leaves the target exactly as it was, because nothing has been deleted yet — the destructive window shrinks from the length of the load to the length of a copy.
36
+ ### Fixed
133
37
 
134
- Wiring it surfaced two more things, and neither was visible from the design.
38
+ - **@voltro/cli, @voltro/data-transfer** `voltro data export --exclude a,b` made the bundle BIGGER, and made it unusable for a `replace`.
135
39
 
136
- `INSERT SELECT *` fails the moment the target has a STORED generated column `CREATE TABLE (LIKE t)` copies such a column as a PLAIN one (measured: `is_generated: NEVER`), so the select hands the target a value for a column it computes itself: `cannot insert a non-DEFAULT value into column "slug"`. The swap names its columns now, minus the generated ones, and `swapStatements` REFUSES an empty column list rather than falling back to `SELECT *`, so the trap cannot return by omission.
40
+ It expanded into `{ kind: 'tables', tables: <everything else> }`, on the reasoning that a manifest should record what was exported rather than claim "everything". Right goal, wrong mechanism, and it cost two things at once. `all` is the only scope that filters out the tables which describe a deployment, so excluding two names silently added nine others back the migration ledger among them, whose foreign row takes an environment down at the next boot. And `replace` refuses a named scope, so the honest way to leave a table out was also the way to make the bundle unusable for the mode it was being prepared for.
137
41
 
138
- And a WRITE RECORDER on any table in the set rules staging out. A recorder is keyed by table NAME, so a staged write looks up `_voltro_staging_notes`, finds none, and never runs `versioningPlugin({ timing: 'in-transaction' })` promises "if the change committed, the entry is there", and the swap's bulk SQL has no per-row hook to keep that with. Measured, not guessed: the recorder went from more than one call to zero. Such a run keeps the path that honours it and SAYS why, as does a `--no-atomic` run or a store the framework cannot send DDL to.
42
+ The exclusion is a FIELD of the `all` scope now: the filter still runs, the manifest still says "everything except these" (a different and truer claim than "these"), and `replace` accepts it while naming the tables it will therefore not touch. `--exclude` also works over `--target api` now it no longer expands against a table list only the instance has, so the instance resolves it where that list already is.
139
43
 
140
- Every staged run says it staged. The two paths are indistinguishable from outside — both end with the target holding the bundle and an operator deciding whether they can afford to interrupt needs to know which one is running.
44
+ Every framework table is classified as portable or environment-local, with the reason, and a new one fails the build until somebody decides. That guard existed and did not help: it was satisfied by a second, hand-kept list inside its own test, and the two disagreed about `_voltro_traces` and `_voltro_undo_log`nothing was unclassified, something was classified twice, once wrongly. There is one list now, read by both guards. Traces, undo, the outbox and its attempts, idempotency keys, storage grants, spend and usage accounting, delivery attempts and schedule-firing history joined the environment-local side: a row from elsewhere would make the target act, or claim history it did not live.
45
+ - **@voltro/sql-turso** — Opening a second pooled turso connection could fail instantly with `database is locked` — from inside the constructor, before a single query ran.
141
46
 
142
- Verified through the real importer, and falsified before being kept: with staging off, the assertion that the target still holds its own rows WHILE the bundle loads goes red. On real postgres the staged path runs the existing foreign-key replace suite unchanged.
47
+ `makeConnection` set its pragmas in the order `journal_mode` `foreign_keys` `busy_timeout`. The engine defaults `busy_timeout` to **0**, so a statement that meets a held lock fails on the spot instead of waiting and `journal_mode= experimental_mvcc` needs the file exclusively. Since `makeConnection` runs once per POOLED connection (default 4), opening connection two while connection one held the file hit that exclusive pragma with no lock-wait configured yet:
143
48
 
144
- ### Fixed
49
+ SqlError: Failed to enable Turso MVCC (journal_mode=experimental_mvcc): database is locked
145
50
 
146
- - **@voltro/protocol, @voltro/voltro** A `_voltro_*` name in `source:` is no longer narrowed against the generated table declaration.
51
+ `busy_timeout` is set FIRST now. Nothing else changed same value, same pragmas, same connection.
147
52
 
148
- Which framework tables an app declares is DEPLOYMENT-dependent. The measurement is already in the maintainer notes: at one `NODE_ENV`, on one dialect, flipping a single flag adds or removes `_voltro_traces`, `_voltro_undo_log` or `_voltro_cdc_offsets` from the declared set. The generated `voltro-tables.generated.d.ts` is written by ONE `voltro dev` run, on one machine, with one set of those inputs.
53
+ **Why it hid for so long.** The file already carried a long, correct note about `busy_timeout` being mandatory with a pool, and a separate fix had closed the DDL half (`retryFilter` + bounded retries in `applySchema`). Both are about the same lock class, so the constructor read as covered but a setting cannot protect the two pragmas that run before it.
149
54
 
150
- Narrowing framework names against it therefore made `source: '_voltro_traces'` compile for whoever generated the file and fail for a colleague a type error decided by an environment variable, which is the exact class the declared-schema rule forbids one layer up. An app's own tables are unaffected: `_voltro_` is a reserved prefix, so every name a user writes for their own data narrows exactly as before.
55
+ It surfaces as an unrelated flaky test, because the failure lands wherever the second connection happens to be opened: a `CREATE TABLE` in one run, an MVCC pragma in the next. It cost three release gates twice locally, once on a CI runner and was twice diagnosed as machine contention and closed. It is contention-DEPENDENT, which is not the same as being the machine's fault.
151
56
 
152
- **How it surfaced is the part worth recording.** Until now `keyof VoltroTableNames` was always `never` inside this repo, so `TableName` was always `string`, so the narrow and wide types were the same type and every rule about them held vacuously. The first time an augmentation was ever present a fixture that boots a real server writing the declaration beside its generated rpc group — four framework source files stopped compiling. The split had shipped without once being exercised in the direction that matters.
57
+ Verified: 8 serial runs and 6 concurrent suites at load 12 0 failures, 0 occurrences of the message. The failure was intermittent before, so this is evidence rather than proof; the mechanism, however, is not in doubt.
58
+ - **@voltro/runtime, @voltro/data-transfer, @voltro/cli** — The `source:` recorder broke every WRITE on the in-memory store, and actions are recorded now.
153
59
 
154
- Two things now stop that from going quiet again. A type-test program compiles the framework's own sources under an augmentation that deliberately declares NONE of its tables, and it lives in its OWN tsconfig: `declare module` merging is program-global, so a sibling type test's augmentation had silently rescued the very assertion this one exists to make. And `scripts/check-type-tests.mjs` (CI + `pnpm gate`) DISCOVERS type-test programs and runs them because nothing did. The existing narrowing assertions had never been compiled once: excluded from their package's tsconfig for a good reason, and picked up by nothing else. It refuses a zero-program run, and a program that compiles zero `*.test-d.ts` files, for the same reason every other check here carries a floor.
60
+ The recording wrapper is a `Proxy`, and it handed methods back unbound so `this` was the PROXY, and a class with `#private` fields answers that with `TypeError: Receiver must be an instance of class InMemoryDataStore`. Under `voltro dev` on the memory store, where the recorder is installed by default, that is every write in the app.
155
61
 
156
- **Why `apiSurface: compatible`, and how to check it rather than take it.** The gate flagged the golden line as CHANGED and asked the right question can this turn code that compiled into code that does not? Here it cannot, because the edit WIDENS a union, and every public position the type appears in is an INPUT: `source?:` on a descriptor, and `normalizeSource`'s parameter. Nothing in the published surface RETURNS `TableName` or `ReactivitySource`, which is the only direction in which widening breaks a consumer an assignment FROM the type into something narrower. `@voltro/voltro` is listed beside `@voltro/protocol` because it re-exports the type, so its golden moved too; the gate matches per package, and one package's classification must not vouch for another's.
157
- - **@voltro/sql-mssql** — A `json()` column could not take a value on mssql. At all.
62
+ Every test passed throughout, and the reason is worth more than the fix: `query` is the one method the wrapper invokes with an explicit receiver, so everything that only READ through it worked. The wrapper's whole purpose is reading, so nothing in its own suite ever wrote. It was found by a test about something else entirely asking what `crud.create` reads which needed a write to answer.
158
63
 
159
- store.insert(t, { payload: { a: 1 } }) -> TypeError: Invalid string. [EPARAM] store.insert(t, { payload: null }) -> OK
64
+ **Actions are recorded too now**, and an action's `source:` means something different from a query's. A query's is a reactive trigger set; an action's declares what it TOUCHES, and the field's own documentation records what an undeclared read costs: `voltro check` reported a table five action paths read and wrote as an orphan, and advised removing it. That is not a quiet subscription, it is advice to delete a live table.
160
65
 
161
- So the column worked only while it held nothing. Reached first through `@voltro/plugin-versioning`, whose history row carries a full-row snapshot in exactly such a column: the versioning recorder could not write on that dialect, and therefore neither could any write to a table it covers.
66
+ **Measured rather than reasoned about:** `crud.create`, `crud.update` and `crud.remove` issue NO read at all, so a read recorder has nothing to say about them but `crud.getById` does read, and with `include:` it eager-loads, so it is covered like `crud.list`.
162
67
 
163
- The store handed the caller's row straight to `sql.insert(row)`. The mysql store runs `encodeRowForSchema` first the schema-driven step that turns a json value into text a driver can bind and mssql had no equivalent anywhere on its write path, so tedious received a JS object for an NVARCHAR parameter and refused it.
68
+ **And a kill test for the one moment nobody had reproduced.** The existing test kills mid-LOAD, which staging turned into the harmless part; the destructive second went untested precisely because it became short. The new case kills as the swap begins and asserts the property rather than the race: the target is one state or the other, never a mix, and never empty. Two defects in the harness came out of writing it — a worker that died SILENTLY (its failure now goes into the marker the parent already reads, instead of looking like a slow start), and an `exit` listener attached only after the SIGKILL, which hung to the full timeout whenever the child finished first.
164
69
 
165
- **Encoding alone would have been worse than the bug.** A value written as text and handed back as text means a WRITE returns a string where a READ of the same row returns an object, and nothing errors the caller gets a different type depending on how it got there. So every `OUTPUT INSERTED.*` path decodes too (insert, insertMany, update, updateMany, patchJson, the delete old-image, and the MERGE upsert), and the test asserts the ROUND TRIP rather than the absence of an error, against a live SQL Server.
70
+ **And the import trace was never written on the path most likely to be used.** A deployment ran a successful `voltro data import` against a database that HAD the table, and got no row and no message at all. The write was gated on this PROCESS's table registry, and `voltro data`'s own boot builds a store and introspects the live schema it never registers the framework set, so the gate was `undefined` exactly there. The authority for "does the target have this table" is the target's SCHEMA, which that boot already introspects; the table is also registered before the write, because a CLI run has not done it and the write needs the column metadata.
166
71
 
167
- With it, the mssql case is back in the versioning key-length suite — the bound on `id()` exists on that dialect too, and it was absent for one release only because nothing could write there.
168
- - **@voltro/data-transfer, @voltro/cli** — A `scope: all` bundle carried the exporting deployment's own bookkeeping, and `replace` wrote it into the target. The target's next boot refused to start:
72
+ The sharper half is the silence, and it was self-inflicted: the skip was written three lines under a comment about how an absent table cannot be detected by the write failing. The message now lives in `voltro data import`, which is the layer that INTROSPECTEDa first attempt put it in the importer, where a `targetSnapshot` may legitimately be narrow rather than complete, so it fired at callers whose snapshot simply did not mention a framework table.
169
73
 
170
- auto-migrate: SCHEMA FINGERPRINT MISMATCH — declared=6e2c61081a9ed80c live=28af9a54414f22f1
74
+ ### Internal (no consumer-facing effect)
171
75
 
172
- The refusal was correct and the row was the defect. A migration-ledger row is not DATA it states which schema THIS deployment applied — and the fingerprint is computed over the declared table set, which legitimately differs per environment (`NODE_ENV=production` declares `_voltro_traces` and `_voltro_undo_log`; a `development` run does not). So the imported row was not stale, it was FOREIGN. The environment was down for ninety minutes, and the ledger row also HID the incident it travelled with: the api would not start, and the reason looked like the failed import rather than a row in a bookkeeping table.
76
+ - **@voltro/data-transfer** — `SAVEPOINT_BATCH_SIZE` carries its documentation again.
173
77
 
174
- Ten framework tables are now classified as environment-local — the migration ledger, the file-migration and seed records, CDC offsets, schedule claims, wakeups, workflow watermarks / pending starts / admissions / pauses. They are dropped from an export's `all` scope, skipped on import, and never emptied by a `replace`, each with the reason a foreign row would be wrong stated beside it. Two of them would have made the target ACT: a pending start runs a workflow somebody queued elsewhere, a pause silently stops one here.
78
+ A new `TRACE_ADVANCE_MS` was declared BETWEEN the constant's doc block and the constant, so TypeScript attached the block to whatever now followed it and the exported symbol was left bare the api golden recorded it as `// @public (undocumented)` and the published report shipped it that way.
175
79
 
176
- `all` is the only scope filtered. A caller who NAMES one of these tables gets itan explicit name is an expectation, and this module already refuses to drop those silently.
80
+ Third time this exact shape has appeared (`sourceKeys`, `recordsTable`, now this one), always the same mechanism: an insertion above a documented declaration silently re-homes the comment. Nothing warns, because both the code and the doc block are individually valid only the golden's `(undocumented)` marker notices, and it reads as noise unless someone diffs it against the last TAG.
177
81
 
178
- The classification refuses to be incomplete: a guard scans every framework table and fails until a new one is decided either way. A hand-list rots by omission, and the omission cost ninety minutes.
82
+ Documentation only; no behaviour, no signature change.
179
83
 
180
- Also fixed, found while reading that path: the admin import endpoint spread `atomic` only when truthy, so an explicit `atomic: false` was dropped and the importer applied its own default which for `replace` is `true`. The one value a caller can only express by asking for it was the one the wire discarded.
84
+ **`apiSurface: compatible`, and the reason is the whole point of the change.** The golden line that moved is `// @public (undocumented)` `// @public`: an api-extractor MARKER describing whether a doc comment is present. No type, no signature, no name. `SAVEPOINT_BATCH_SIZE` is still `= 200`, still exported, still the same literal type nothing that compiled can stop compiling.