@voltro/plugin-audit 0.31.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -39,6 +39,374 @@ _Changes staged for the next release accumulate here (rolled up from
39
39
 
40
40
  ---
41
41
 
42
+ ## [0.33.0] — 2026-08-11
43
+
44
+ ### ⚠ BREAKING
45
+
46
+ - **@voltro/protocol, @voltro/runtime, @voltro/voltro** — `CoordinatedScheduleHandle` gained `wake()`, `currentIntervalMs()` and `isArmed()`.
47
+
48
+ The type change that carries the poller work in this release (see *A coordinated tick is a FLOOR*). Two of the three shapes it touches are NOT breaking and are listed here so the classification is checkable rather than asserted:
49
+
50
+ - the effect parameter was **widened** — it may now return a tick outcome, and an existing `() => Promise<void>` still satisfies it; - `Coordinator.tryClaim` gained an **optional** third parameter (the caller's bucket width), so an existing implementation still conforms.
51
+
52
+ (The plugin-facing `scheduleCoordinated` also gained an OPTIONAL fourth argument, `{ disarmWhenIdle }` — additive, and how a plugin opts its own task out of polling entirely.)
53
+
54
+ What breaks is code that **constructs** a handle rather than receiving one: a hand-written test double of `PluginBindContext`, which is the ordinary way to unit-test a plugin's `bindDataStore`. Four of the framework's own suites carried one, and three of those compiled only because the stub was cast — which is also why the two new members must be REQUIRED rather than optional. An optional `wake()` would let a caller subscribe a change channel to a handle that silently has none, and a poller that never wakes is the failure this release exists to remove, arriving quietly.
55
+
56
+ The codemod is `manual`: the object literal needing the two fields carries no importable symbol and usually sits behind an `as never`, so no transform can tell it apart from an unrelated literal in the same test file. It is gated on the app mentioning `scheduleCoordinated` at all.
57
+ - **@voltro/runtime** — `@effect/opentelemetry` is now an **optional peer** of `@voltro/runtime` instead of a dependency. **If you export traces or metrics, install it:**
58
+
59
+ ```sh
60
+ pnpm add @effect/opentelemetry
61
+ ```
62
+
63
+ If you do not (no `FRAMEWORK_TRACING`, no `FRAMEWORK_METRICS`, no `OTEL_EXPORTER_OTLP_*`), nothing changes and your install gets 24 lines quieter.
64
+
65
+ It is reached from one dynamic `import()`, only when tracing is on, and it declares seven non-optional OpenTelemetry peers of which we supply five. So every `pnpm install` of every consumer ended with an unmet-peer block describing a condition that broke nothing. Declaring the two missing peers as real dependencies was the wrong direction — one of them is `@opentelemetry/sdk-trace-web`, the BROWSER tracer — and 0.64.0 is the current stable, so there is no upstream release marking them optional to wait for.
66
+
67
+ The reporting consumer's argument is what decided it: *"a check that is loud on every upgrade teaches people to skip the output, and the next warning in that block is the one that matters. We read past this one for four releases."*
68
+
69
+ A boot with tracing enabled and the package absent fails with a message naming this install line — a startup failure, not a silent loss of telemetry.
70
+
71
+ **`voltro update` carries you across this** — codemod `0.33.0/01_opentelemetry-optional-peer`.
72
+
73
+ ### Added
74
+
75
+ - **@voltro/cli** — `voltro agents-md` now reports which `@voltro/cli` it seeded from, and warns when that is not the one the project installs.
76
+
77
+ ```
78
+ seeded from @voltro/cli 0.31.0 (project has 0.32.0; whats-new describes 0.31.0;
79
+ modules COPIED into ./agent-docs)
80
+ WARN the `voltro` binary that ran is 0.31.0, but this project installs 0.32.0 —
81
+ everything just written describes the OLDER version.
82
+ ```
83
+
84
+ A consumer reported a freshly-seeded `agent-docs/whats-new.md` one release behind their installed version, twice. The published packages are correct (verified with `npm pack`), so the content came from a different `@voltro/cli` than the one they installed — the command reads its templates relative to the RUNNING binary, and a globally-installed `voltro`, a stale `dist`, or a parent workspace's copy all produce exactly that, with output that looked identical either way.
85
+
86
+ It does not refuse and does not pick a cli for you: running the workspace binary against a checkout is legitimate and common.
87
+ - **@voltro/cli** — `voltro db encrypt-column <table>.<column>` — the data migration `.encrypted()` always needed.
88
+
89
+ `.encrypted()` encrypts on WRITE, so adding it to a populated column converts nothing that is already there, and there was no supported way to convert it. A consumer carried three plaintext credential columns for months with no next step: *"`.encrypted()` braucht einen Cipher UND eine Datenmigration der bestehenden Zeilen; gemeldet, nicht behoben."*
90
+
91
+ ```sh
92
+ voltro db encrypt-column integrations.webhookSecret --dry-run
93
+ voltro db encrypt-column integrations.webhookSecret employees.meilisearchKey --yes
94
+ ```
95
+
96
+ Five guards, each for a way a naive version succeeds and destroys data:
97
+
98
+ - **Idempotent** — an already-ciphertext value is skipped, so an interrupted run is resumed by running it again. Double encryption is unrecoverable without the key history. - **Round-trip verified before the write** — every value is decrypted back in-process first, so a broken cipher fails with nothing written. - **Key checked against what the column already holds** — a *different* key round-trips fine, so the check above cannot see it. Resuming with the wrong key would leave a column readable with neither key alone. - **Width pre-flight** — ciphertext is `49 + 4×ceil(bytes/3)` characters, so a 64-char key needs 137 and a `varchar(100)` fails partway. Refuses with both numbers and the `.maxLength()` to set. Measured in BYTES: `'ä'.repeat(10)` is 10 characters and 20 bytes. - **`--yes` required**, `--dry-run` shows the counts, and no value — plaintext or ciphertext — is ever printed.
99
+
100
+ Verified against a real postgres: the conversion, the re-run no-op, both refusals writing nothing, and a decrypt back to the original including multi-byte content.
101
+
102
+ ### Changed
103
+
104
+ - **@voltro/runtime** — `_voltro_schedule_claims` swaps its `(scheduleName, bucket)` index for `(scheduleName, claimedAt)`.
105
+
106
+ A consumer read `pg_stat_user_indexes` on their live table and measured, over its whole lifetime:
107
+
108
+ ```
109
+ _voltro_schedule_claims_pkey 348 978 scans
110
+ _voltro_schedule_claims_claimedAt_idx 3 949
111
+ _voltro_schedule_claims_scheduleName_bucket_idx 4
112
+ ```
113
+
114
+ Four. It was declared "for the case where you would rather ask by field", and nothing ever asks by field — every read of this table goes through the primary key, which *is* `<scheduleName>@<bucket>`. An index nothing uses is not free: it is written on every INSERT, into a table written once per tick per schedule.
115
+
116
+ `(scheduleName, claimedAt)` is the shape of a query that now exists — the per-schedule prune a winning claim runs (`WHERE scheduleName = ? AND claimedAt < ?`). The `claimedAt` index stays: the retention sweep's cutoff spans every schedule and needs it leading, which the composite cannot provide.
117
+
118
+ No codemod: a `_voltro_*` change rides the declarative differ on `voltro db apply` and on a `voltro dev` boot, on every dialect.
119
+
120
+ The same measurement corrected something the reporter had said in an earlier round and we had repeated back to them — that both indexes went unused. The primary key is used constantly. That makes the finding sharper rather than weaker: the ability to answer this question in one lookup is not merely available, it is demonstrably in use on the same table, and the one read path that needed it was the one not taking it.
121
+
122
+ ### Fixed
123
+
124
+ - **@voltro/database** — A column ADDED with a `reference()` now gets its foreign key in the same plan.
125
+
126
+ `ADD COLUMN` emits no `REFERENCES` clause on any dialect, and the planner's FK branch lived only in the path for a column present on both sides — so adding a `reference()` column to an existing table planned an `add-column` and nothing else. The constraint appeared on the SECOND `voltro db apply`, when the column was live and the diff finally saw a live column with no FK.
127
+
128
+ Two applies converged, so the state was reachable, which is why this survived as a low-priority note for a long time. It is worse under `voltro dev`: the boot diff refuses to record a fingerprint while the re-plan is non-empty, so an app whose only pending change was such a column re-planned on every boot and never converged.
129
+
130
+ Both callers share one `addForeignKeyOps` builder now, and the existing dependency tiering already orders `add-column` before `add-foreign-key`.
131
+ - **@voltro/runtime, @voltro/protocol, @voltro/workflow, @voltro/cli** — A coordinated tick is a FLOOR now, and a claim no longer outlives its bucket.
132
+
133
+ A consumer's `_voltro_schedule_claims` reached **86 214 rows / 33 MB** on two days of uptime and took their deployment down: ten of a fifteen-slot pooler pinned on the claim read, an SSR render measured at **300 490 ms** behind them, every page in three frontends unusable, and a `rollout restart` that could not complete because the surge pod could not get a connection. Two hours of their own measurement produced the diagnosis, and both halves of it were right.
134
+
135
+ **Where the rows came from.** They declare one workflow, have never started it, use no flow control and no offloaded inference. Over one hour, with two replicas:
136
+
137
+ ```
138
+ voltro.ai.inference 1 259 rows/h (250 ms ticks) framework
139
+ voltro.workflow.admission 1 247 rows/h (1 s ticks) framework
140
+ their own eight schedules 18 rows/h
141
+ ```
142
+
143
+ 99.3 % of the ledger was the framework polling two structurally empty queues. A fixed interval has no way to learn that, so:
144
+
145
+ - **`scheduleCoordinated`'s effect may now REPORT its tick.** Return `{ idle: true }` and the runner backs off toward a ceiling; return `{ idle: true, nextDueInMs }` and it arms for that instant instead — which is what keeps a `debounce` window from being slept through. Returning nothing keeps the fixed interval, so every existing plugin task ticks exactly as before. - **Where an arrival is guaranteed to wake it, an idle task STOPS ENTIRELY** (`{ disarmWhenIdle: true }`). Both framework tasks do, on any deployment where a peer replica's write is visible locally — Postgres LISTEN/NOTIFY, or a broadcast broker. Measured against a real Postgres on a deployment that uses neither queue: **2 claim rows in five minutes**, one per task, both at boot. Where that guarantee does not hold, the ceiling (`VOLTRO_POLL_CEILING_MS`, default 30 s) is the correct behaviour and is what they get. - **`handle.wake()` runs a tick now.** Both framework queues are tables with the framework's own CDC triggers on them, so an enqueue already produces a change event on every replica; both dispatchers subscribe to it. The idle case gets ~120× cheaper and the busy case gets FASTER — work starts on the INSERT rather than up to a tick later. - The claim bucket stays floored by the BASE interval. Replicas do not share a backoff state, and two replicas computing different keys for one moment would both win.
146
+
147
+ **The cadence is declarable.** `scheduling: { admissionDrainMs, inferenceTickMs, cancelSweepMs, pollCeilingMs }` in `app.config.ts`, each with a matching `VOLTRO_*` env var that overrides it — the same ordering as `VOLTRO_TENANT_ISOLATION` over `tenancy.isolation`. They were internal constants, and a number the framework picks on a user's behalf belongs somewhere they can read it without reading our source. One resolver, called by both boot paths, so there is no second default to drift.
148
+
149
+ **Why the rows never left.** A claim answers one question about one bucket and was already answered the moment the bucket passed. A winning claim now deletes that schedule's own predecessors, so the table's size is a small multiple of the number of schedules rather than a function of uptime. How far back it prunes scales with the caller's bucket width — a cron keeps ~68 minutes of them (its firings carry their own instant, so a stalled one can re-present an old bucket), a 250 ms task ~1 minute (it recomputes its bucket at tick time, so an old one is unreachable). Deleting too early is a double fire; that grace is the whole safety argument. The 24-hour retention sweep stays as the backstop for a schedule that was renamed or deleted, which the per-schedule prune can never revisit.
150
+
151
+ Where reactivity is absent — a non-Postgres dialect with no broadcast broker — a remote replica's enqueue produces no local event and the ceiling is the whole latency budget. `VOLTRO_POLL_CEILING_MS` is there for that case and documented as such.
152
+ - **@voltro/logger** — The pretty log format now prints a nested `Error`'s `message`. It did not, and the JSON format did.
153
+
154
+ `Error.prototype.message` is non-enumerable, so `JSON.stringify(err)` emits the metadata and drops the message. `expandCauseForJson` has existed for a long time to solve exactly that — and it was wired into `jsonFormat` only. The section heading above it said "(JSON path)", which was literally accurate.
155
+
156
+ `voltro dev` prints the pretty format. What a consumer saw when their boot died on a saturated pooler:
157
+
158
+ ```
159
+ auto-migrate failed — aborting boot
160
+ err={"failure":{"cause":{"length":117,…,"code":"XX000"},"message":"PgClient: Failed to connect"}}
161
+ ```
162
+
163
+ `length: 117` is the length of a message that is not there. Recovered by hand, it was `(EMAXCONNSESSION) max clients reached in session mode - max clients are limited to pool_size: 15` — the whole diagnosis in one sentence, naming the fix.
164
+
165
+ Both the field tail and the plain-object cause branch expand now. The fix is in the formatter, not at the reporting call site: every `log.error('…', { err })` anywhere had the same hole.
166
+ - **@voltro/cli** — Every `@voltro/*` package now exports its own `package.json`, so `require('@voltro/cli/package.json').version` works.
167
+
168
+ It threw. Node has enforced this since 12: a package with an `exports` field exposes only what that field lists, and none of the 77 packages listed `"./package.json"`.
169
+
170
+ Reported by a consumer for whom it was the instruction WE gave for settling whether a security command had been running on stale code — so the verification step for a security question could not run at all. Both the workspace `exports` and the shipped `publishConfig.exports` are fixed, and a guard sweeps every package so a new one cannot ship without it.
171
+ - **@voltro/cli, @voltro/sql-postgres** — The `db pool:` boot line now counts the connections this process holds OUTSIDE the pool, and names them.
172
+
173
+ It reported `max × replicas` and called that the connection count. A consumer sizing a per-pod budget against a pooler measured the gap:
174
+
175
+ > `LISTEN` läuft außerhalb von `dbMaxConnections` (eine pro Pod, gemessen sogar > 3). Der echte Bedarf ist `dbMaxConnections + 1`.
176
+
177
+ Their measurement was right and their conclusion was one short. The framework opens a standalone connection in three places, and a full deployment holds all three:
178
+
179
+ | Process | Connection | When | |---|---|---| | api `voltro serve` | CDC `LISTEN` consumer | `changeStrategy: 'cdc'` | | web `voltro start` | ISR invalidator `LISTEN` | a page declares `cacheInvalidatesOn` | | web `voltro start` | postgres ISR cache client | `SSR_CACHE=postgres` |
180
+
181
+ The third is not a `LISTEN`, which is why counting `LISTEN` rows in `pg_stat_activity` undercounts, and why `+1` could not have been documented as a constant: the count is per PROCESS and only the process knows what it armed.
182
+
183
+ The line says `No connections outside the pool in this process` when there are none — silence about it is what made "counted, zero" indistinguishable from "not counted". The `maxConnections` docstring, which promised `+1` as if it were the deployment's number, is corrected. Production-hardening docs (both languages) gain the table plus the `maxSurge` arithmetic a rolling update needs.
184
+ - **@voltro/cli** — The retention sweep is registered on every dialect — it was postgres-only, and silently.
185
+
186
+ `wireRetentionSweep` opened with `if (dialect !== 'postgres') return`, so on mariadb, mysql, mssql and sqlite **none of its seven policies was registered, nothing was ever deleted, and the boot printed no armed-policies line** — so there was nothing to notice either. A consumer on MariaDB 11.8.8 measured it by reading the published bundle rather than their logs:
187
+
188
+ ```
189
+ _voltro_schedule_claims 109 520 rows 32.8 MB over 20 days
190
+ _voltro_schedule_runs 17 507 rows 7.4 MB
191
+ ```
192
+
193
+ Their seven `VOLTRO_*_TTL_HOURS` variables were inert — read only inside the branch that never ran — and two of them were already set in their Helm chart.
194
+
195
+ **The gate was aimed at the right thing and applied to the wrong scope.** What is postgres-specific is the fast DELETE (`"camelCase"` quoting, `DELETE … RETURNING`), which is one branch of one function that has always had a portable fallback beside it. Gating the REGISTRATION on it turned a performance choice into a feature that does not exist. The dialect check now sits on the branch it describes.
196
+
197
+ Two things came out with it:
198
+
199
+ - **The fallback deleted row by row.** Acceptable while the path was unreachable; against the reporter's backlog it is 20 000 round trips per sweep pass. It reads a bounded batch of ids and issues ONE set-based delete for them — still bounded, so the DELETE never grows to lock the whole backlog. - **Two tests asserted the defect as intended behaviour**, with reasoning that was internally consistent and rested on the premise that was itself the bug (*"the sweep is postgres-only, and announcing a delete that will not happen is the mirror image of the defect"*). Both are inverted now and run across all five dialects.
200
+
201
+ This is the third turn of the same screw, and the reporter's framing is the one to keep: we fixed *a standing delete that never introduces itself*, then shipped *one that introduces itself and does not run* — and beside both of those sat one that silently did not exist.
202
+ - **@voltro/cli** — `voltro db scan-credentials` no longer reports the framework's own redaction markers as credentials, and no longer claims a match was a *key*.
203
+
204
+ A consumer with correctly-redacting plugins got:
205
+
206
+ ```
207
+ ✗ _voltro_row_history.data — 69 of 149 row(s) match a credential-shaped key
208
+ matched (rows per needle, may overlap): token (69)
209
+ ```
210
+
211
+ All 69 rows were `"_omitted": ["token"]` — `@voltro/plugin-versioning`'s record that a `.serverOnly().sensitive('secret')` column was deliberately left OUT of the snapshot. The scan matched the proof that nothing is stored there, called it a credential, and printed *purge them AND rotate the credentials* underneath.
212
+
213
+ Two changes. The headline says what the predicate does — it is a substring match over the whole serialized column, so it finds a credential-shaped **name** anywhere in the value, which it always did. And each hit is now EXPLAINED: a bounded second pass (500 matched rows per target) reads them back in-process and separates a JSON **key** from a **redaction marker** (`_omitted`, `__redacted`). Values are never printed and never logged.
214
+
215
+ A target whose every matched row is a marker reports as explained and exits `0`. The bar is deliberately high — every matched row examined, every one a marker and nothing else. A capped read-back, one real key, or one row that will not parse as JSON keeps the target a finding and still exits `1`.
216
+
217
+ The shape mattered more than the one key name: the more columns an app classifies correctly, the more markers it writes, and the redder the scan turned.
218
+ - **@voltro/runtime, @voltro/cli** — `advisoryLock` scheduling no longer reads the whole `_voltro_schedule_claims` table to answer whether one claim row exists, and that table is now swept on the scale it fills.
219
+
220
+ The existence check ran `SELECT "id" FROM "_voltro_schedule_claims"` with no `WHERE` and no `LIMIT`, then filtered in JavaScript — twice per claim attempt (the fast path, and the re-read that separates "lost the race" from "the claims table is broken"), on every replica, for every schedule firing. A consumer measured ten concurrent copies of that scan holding every connection of a 15-slot pooler, with an SSR render behind them at **300 490 ms**. It is a primary-key lookup bounded to one row now (`id` *is* the claim key).
221
+
222
+ The pool-acquire bound added in 0.32.0 turns that from a hang into an error; it does not stop the scan from filling the pool. Both are needed.
223
+
224
+ `VOLTRO_SCHEDULE_CLAIMS_TTL_HOURS` also defaults to **24 hours** instead of 30 days. The 30-day default was copied from the framework's history tables (`_voltro_schedule_runs` and friends), and a claim row is a lock ledger — it answers a question about one firing instant and nothing reads yesterday's. At the 1 557 rows/hour that consumer measured, a 30-day window reaches ~1.1 million rows before the first one ages out. Raise it deliberately if you need to; the number to reason about is the longest a replica may be paused and still be trusted not to re-fire a bucket it already lost.
225
+
226
+ The boot announcement can now express an age under a day (`older than 1h`); it previously rounded every TTL to whole days, so an operator setting one hour read their own policy back as `older than 0d`.
227
+ - **@voltro/runtime** — A coordinated periodic task armed below one second now runs at the interval it was given.
228
+
229
+ `scheduleCoordinated` floors the wall clock to its `intervalMs` and races on that instant; the claim key truncated it to second precision. A task at 250 ms therefore produced four bucket instants per second that collapsed to one key — the first tick won and the other three were dropped as "lost the claim". Measured: 1 of 4.
230
+
231
+ `voltro.ai.inference` is armed at 250 ms and was dispatching once per second, on every multi-replica deployment, with nothing above `warn` to say so.
232
+
233
+ This is the defect the coordinator's own comment describes at minute precision (6-field crons firing once a minute), one decimal place down; that comment was written before `scheduleCoordinated` existed, and `scheduleCoordinated` is the caller that goes below a second.
234
+
235
+ Milliseconds join the claim key only when non-zero, so every cron key is byte-identical to before — load-bearing during a rolling deploy, where old and new replicas computing different keys for one firing would both win and double-fire.
236
+
237
+ Note the consequence for table size: a sub-second task now writes claim rows at its true rate. Bounded by `VOLTRO_SCHEDULE_CLAIMS_TTL_HOURS` (24 h), and `ai.tickIntervalMs` raises the interval if you want fewer.
238
+
239
+ ### Internal (no consumer-facing effect)
240
+
241
+ - **@voltro/cli** — No separate consumer-facing note on purpose: this refines the per-needle breakdown described in the UNRELEASED 0.32.0 section, and that section — which is what a reader will actually see — carries the correction. Documenting it twice would describe one change as two.
242
+
243
+ The refinement: the per-needle counts OVERLAP and do not sum to the hit count (a row holding both a token and a secret is counted by both). The output line says so now, because two numbers printed under a total invite being added up, and a reader who adds them and gets more than the total loses confidence in the whole report.
244
+
245
+ ---
246
+
247
+ ## [0.32.0] — 2026-08-10
248
+
249
+ ### ⚠ BREAKING
250
+
251
+ - **@voltro/plugin-audit** — **`auditPlugin` stored what a call RETURNED, verbatim, with no option to reach it. `redactOutcome` now exists and defaults to `'all'`.**
252
+
253
+ Found on the first run of `voltro db scan-credentials` after we widened its columns, against a real database:
254
+
255
+ ```
256
+ ✗ _voltro_audit_log.outcome — 9 of 263 row(s) match a credential-shaped key
257
+ ```
258
+
259
+ Four were `webhooks.create` rows carrying a live 64-character `signingSecret` in full. The reporter had BOTH existing options on — `redactInput: 'all'`, `redactSubject: 'metadata'` — and there was no third to reach this field with.
260
+
261
+ **The option that existed covers the field these calls leave empty.** `redactInput`'s own docstring names "an API key at issuance" as its motivating case, and for a credential-ISSUING call the secret is never in the input:
262
+
263
+ ```ts
264
+ apiKeys.createPersonalApiKey({ name, scopes }) // input: nothing sensitive
265
+ → { keyValue: '<the plaintext key>' } // outcome: the whole point
266
+ webhooks.create({ url, subscribedEvents }) // input: nothing sensitive
267
+ → { signingSecret: '<live secret>' } // outcome: returned once, by design
268
+ ```
269
+
270
+ MIGRATION: `outcome.value` and `outcome.error` become `{ __redacted: 'all' }`. The error's `_tag` SURVIVES — a trail recording "something failed" without saying what is not a trail, and a tag is a schema-declared discriminant that structurally cannot be a secret. `kind` and `durationMs` are untouched, the caller still receives the real result, and a `record` predicate still sees the live outcome. Set `redactOutcome: 'none'` to keep the old behaviour.
271
+
272
+ Also documented: a FUNCTION sink gets neither the `_voltro_audit_log` table nor the retention sweep — both are gated on `sink` being the literal `'datastore'`. A function that redacts and delegates to `dataStoreAuditSink` still writes rows on a database where the table exists, while creating it nowhere and arming the TTL nowhere. It works where you tested it and fails on the next fresh database. `redactOutcome` removes the reason to reach for that composition; the docstring now names the cliff for anyone who reaches for it anyway.
273
+
274
+ **`voltro update` carries you across this** — codemod `0.32.0/01_audit-redacts-outcome`.
275
+
276
+ ### Added
277
+
278
+ - **@voltro/cli** — **`voltro doctor` said nothing when the unknown-scope rule did not run, which read exactly like a clean result.**
279
+
280
+ The rule needs a declared scope vocabulary — with `@voltro/plugin-rbac` that is the union of its `roles` map. An app doing RBAC without the plugin (roles as plain literal arrays in `lib/teamRoles.ts`) publishes none, so the rule stays quiet. A consumer confirmed it empirically: doctor reports **0** unknown-scope findings on the tree that contains the exact bug the rule was built for — `webhooks.test` guarded by `webhooks:test` while no role grants it. Silence read as coverage.
281
+
282
+ Two things now:
283
+
284
+ - **The dormant state SAYS it is dormant**, in the human report and in `--json` (`evaluated: false`, which used to be an empty findings array indistinguishable from a clean app). It ends with the sentence that matters: this section is not a clean bill of health. - **An app can point the rule at its own vocabulary**, which the consumer proposed and which doctor now reads:
285
+
286
+ ```ts
287
+ // app.config.ts
288
+ doctor: { scopeVocabulary: './lib/teamRoles.ts#ALL_TEAM_SCOPES' }
289
+ ```
290
+
291
+ Deliberately a plain read of an exported string array. Anything cleverer (evaluating a roles map, following a builder) fails differently per app and lands back at "quiet for reasons you cannot see".
292
+
293
+ ### Changed
294
+
295
+ - **@voltro/cli** — **`voltro db scan-credentials` now says its name set is a heuristic, so a clean run stops reading as an all-clear.**
296
+
297
+ Reported with the case that proves it: on the same table, in the same column, the scan found `signingSecret` and missed `keyValue` — the plaintext API key an `apiKeys.*` mutation returns. `keyValue` matches none of the needles and never will; no name list covers every convention an app can invent.
298
+
299
+ Not a defect, a heuristic being a heuristic — and the reporter's framing is the fix: *"one line in the output saying the name set IS a heuristic would stop a clean run reading as an all-clear."* The report ends with what a clean result actually means: no credential-SHAPED key found, which is not the same as no credential.
300
+ - **@voltro/cli** — **`voltro db scan-credentials` reported a hit count without saying which key matched, under advice that could not be carried out or argued with.**
301
+
302
+ The output was `69 of 149 row(s) match a credential-shaped key` followed by `Purge them AND rotate the credentials`. Purge what? Rotate which credential? And a column mentioning the word `token` in prose reads identically to one holding a live one — the reporter had both kinds in the same column and no way to separate them from the output.
303
+
304
+ Each hit line now names the needles and their row counts — which OVERLAP and
305
+ do not sum to the hit count, because a row holding both a token and a secret is
306
+ counted by both, and two numbers printed under a total otherwise invite being
307
+ added up:
308
+
309
+ ```
310
+ ✗ _voltro_audit_log.outcome — 69 of 149 row(s) match a credential-shaped key
311
+ matched (rows per needle, may overlap): token (61), secret (12)
312
+ ```
313
+
314
+ One extra COUNT per needle, taken only for a target that already matched — so the cost lands exactly where somebody is about to do work and nowhere else.
315
+
316
+ ### Fixed
317
+
318
+ - **@voltro/cli** — **`voltro update --dry-run` could never preview a jump's codemods — the manifest it reads has never been published.** Checked against the registry rather than inferred: `@voltro/cli` at 0.25.0, 0.29.0, 0.30.2 and 0.31.0 all ship no `voltro` field at all, while the repo's own `package.json` carries 65 entries.
319
+
320
+ `scripts/prepare-publish.mjs`'s `cleanManifest` builds a fresh publish manifest field by field rather than deleting from a copy — an allowlist by construction — so a new top-level key is dropped in silence and nothing downstream mentions it.
321
+
322
+ **What this did NOT cost, stated because the alarming reading is the wrong one:** no user has ever missed a codemod that should have run. The manifest feeds the PREVIEW only; the actual run happens after the install, out of the target CLI's own registry, which is present by then. And the missing case was already handled loudly — the preview printed *"could not preview … This is NOT the same as 'no codemods'"* rather than an confident "none". An honest "I could not look" for four releases, where the feature was built to look.
323
+
324
+ The fix carries `voltro` through, and the guard that goes with it is the part worth keeping: `codemodManifest.test.ts` asserts the REPO's package.json carries every codemod, and it was green on every one of those releases. A source-reading guard cannot see what the publish pipeline does downstream of it. So the assertion is made against the STAGED file, read back off disk after it is written, and it runs inside `prepare-publish` itself — which the gate's `Pack + verify` step already invokes, so it needs no separate wiring.
325
+
326
+ Red-verified by removing the one-line fix and re-running: the staged manifest comes back with NO entries against the source's 65, and publishing aborts.
327
+ - **@voltro/cli** — **`voltro dev` read the COMPILED config, so editing `app.config.ts` had no effect in any app that had ever run `voltro build`.**
328
+
329
+ `loadConfig` preferred `.framework/dist/server/appConfig.js` whenever it existed — a build output, i.e. whatever the config said the last time somebody built. The comment on that branch said the `.ts` source is the fallback "for dev", but the condition was `existsSync`, which cannot know which command is running.
330
+
331
+ Measured on the fixture: `app.config.ts` set to `locales: ['de','en'], defaultLocale: 'de'`, `voltro dev` booted, SSR response `<html lang="en">` — the value from a build hours earlier. Neither the declared default nor the first declared locale reached the render.
332
+
333
+ Found while reproducing a consumer's report that a declared `locales:` did not affect `<html lang>` in dev. An app that has never built is unaffected, which is why this survived.
334
+
335
+ **And the second half of the same report: dev never negotiated `Accept-Language` in resolver-only mode.** `makeSsrI18nResolver` returns `() => undefined` for an empty wrap set — right for the PROVIDER, wrong for the locale — so the caller fell through to `cookie ?? defaultLocale`. `voltro build` had already grown the resolver-only runtime; dev had not. The same dev/build drift as the release before, one release later, in the opposite direction.
336
+
337
+ Measured after the fix, all three signals: no headers → the declared default; `Accept-Language: en` → `en`; cookie beats `Accept-Language`. `ssrIntlDiagnostic` is gated on a REAL provider now, so resolver-only mode does not claim one was supplied.
338
+ - **@voltro/cli** — **The duplicate-version check read the pnpm store, so it fired for everyone on the release right after they upgraded.**
339
+
340
+ Last release taught it to see copies a walk from the app root cannot reach — a second version pulled in by a SIBLING workspace package. It did that by reading the pnpm virtual store directly, and the store also holds every version pnpm ever unpacked. On a real tree, one release later:
341
+
342
+ ```
343
+ @voltro/cli — 0.29.0, 0.30.0, 0.30.1, 0.30.2, 0.31.0
344
+ ```
345
+
346
+ …while EVERY `@voltro/*` in that workspace was linked at exactly 0.31.0. The extras were residue: nothing links them, `pnpm store prune` removes them, they cannot be loaded. The reporter's summary is the right one — *"the rule moved from blind-to-the-real-case to noisy-on-every-upgrade, and both endings are the same: the reader stops looking."* This ending is the worse of the two, because it fires for everyone at exactly the moment they are reading the output.
347
+
348
+ **A package manager's cache is not a statement about the program.** It counts what is LINKED now: one `package.json` per (workspace package × framework package), derived from `pnpm-workspace.yaml` or the conventional `packages/*` / `apps/*` layout. That is cheaper than the store walk it replaces, free of residue, and still finds the sibling case it was widened for.
349
+ - **@voltro/cli** — **The declared-event scan searched for the event NAME, so it missed every app following the typed path — 19 findings, 0 real.**
350
+
351
+ `emit` is typed `(event: string | OutgoingEventDescriptor<P> | DeclaredEventLike, …)`, and the DESCRIPTOR overload is the type-safe one — the path the schema-decode behaviour rewards. An app on it writes `emitEvent(ctx, apiKeyCreated, …)` and never repeats the name string anywhere near the emit.
352
+
353
+ So the rule found apps that emit by string literal and missed apps that emit by descriptor, which is backwards: the second group is the one doing it properly. The ADVISORY caveat we shipped was exact and useless — it said "an emit through a variable will read as missing here", and the variable IS the idiomatic call.
354
+
355
+ It resolves the binding now. The exported const and the `name:` are in ONE statement (`export const apiKeyCreated = defineEvent({ name: 'apiKey.created' … })`), so this is a local read of the declaring file rather than a resolution. Both spellings count as an emit. The caveat is narrowed to what actually remains invisible: a name assembled at runtime.
356
+
357
+ Reported with a working reference implementation attached, which is where the three lines came from.
358
+ - **@voltro/sql-postgres** — **A query with no free pooled connection waited forever, with no error and no log line.**
359
+
360
+ `new pg.Pool({...})` was constructed without `connectionTimeoutMillis`, and node-postgres defaults it to `0` — wait indefinitely. Reported as: *"ein Query ohne freie Verbindung wartet unbegrenzt, ohne Fehler und ohne Logzeile."*
361
+
362
+ The distinction that makes this worth a default: `statementTimeoutMs` bounds a query the SERVER is running; nothing bounded a query the CLIENT had not sent yet. Those are the two halves of "a request is stuck", and only one was covered.
363
+
364
+ Defaults to 10 s (`DEFAULT_ACQUIRE_TIMEOUT_MS`), overridable per connection with `acquireTimeoutMs`; `0` restores the driver's unbounded wait. A bounded failure is more useful than an unbounded wait even when the pool would have freed up: it names the pool as the cause at the moment it IS the cause, instead of surfacing as unexplained latency somewhere with no connection information in it.
365
+
366
+ **Also documented, from the same report:** with `changeStrategy: 'cdc'` a process needs `maxConnections + 1`. The LISTEN consumer cannot use a pooled connection, so `@effect/sql-pg` opens a standalone `new Pg.Client(pool.options)` that is outside `max` and outside every number derived from it. A per-pod budget built on `maxConnections` is short by exactly one, which surfaces as the last pod of a rollout failing to connect rather than as a pool warning.
367
+ - **@voltro/cli** — **Shipping `whats-new.md` for the right release depended on a human remembering a step between two other steps.**
368
+
369
+ The module is generated from the top CHANGELOG section, and the command that writes a new one (`changelog-release.mjs --release`) did not regenerate it. So whether the published guide described the release you just installed came down to whether someone ran the generator in the window between the roll and the publish.
370
+
371
+ Measured across the published tarballs rather than asserted:
372
+
373
+ | `@voltro/cli` | ships | |---|---| | 0.28.0 | `# What's new in 0.27.0` | | 0.29.0 – 0.31.0 | each names its own version |
374
+
375
+ So it has gone wrong once in the last six, not every time — and the four that are right are right because a human did the step, which is exactly the property being removed here. One in six is not a small number for a module whose whole job is *"read this FIRST when a task touches an area you have not worked in recently"*: on that release it was the one piece of the shipped guide guaranteed to be wrong about the version the reader had just installed. And it fails in the direction that reads as fine — a real version, described correctly, just not theirs.
376
+
377
+ The roll regenerates now, in the same command, rather than as a checklist line: a step a human must remember between two others is the step that gets skipped on the release nobody is watching. A regeneration failure is loud and non-fatal, and `check-whats-new-version.mjs` (which already gates this in static-checks) stays as the backstop for the paths that bypass the roll.
378
+
379
+ **If you are looking at a stale `whats-new.md` in your own project, this is probably not the cause.** The per-project copy is seeded once and never overwritten on boot — it refreshes only on `voltro agents-md --force`. That file being behind is the seeder's documented behaviour, not this defect, and no framework release fixes it for you.
380
+ - **@voltro/cli** — **The retention sweep was armed, announced at every boot, and never ran in a process that restarted more often than every five minutes.**
381
+
382
+ It was `setInterval(sweepAll, 5 * 60_000)` with no initial run, so the first sweep was always five minutes away. `voltro dev` restarts on every file save, and at least one consumer runs `voltro dev` as their deployment: their `_voltro_schedule_claims` reached **86 214 rows / 33 MB** with the policy registered, and the boot printing `retention: N policy(ies) armed — rows older than the TTL are DELETED` every time.
383
+
384
+ That is this file's own lesson one turn further in. We fixed "a standing delete that never introduces itself" and shipped a standing delete that introduces itself and then does not run.
385
+
386
+ The first sweep now fires 30 s after boot, then on the interval. The delay is a compromise with the failures on either side: zero would put a multi-table DELETE in front of the first request of every boot, five minutes is what produced the report. The timer is `unref`'d, so it never holds a process open on its own.
387
+ - **@voltro/cli** — **`voltro dev` reported `engine: "in-memory"` while running a cluster engine, and a consumer built a diagnosis on it.**
388
+
389
+ The line derived its label from `store === 'postgres' ? 'cluster-postgres' : 'in-memory'` — so mariadb, mysql, sqlite and mssql all printed `in-memory` while the block directly above had just built `cluster-sql` for exactly those stores. The boot therefore printed two lines that contradicted each other:
390
+
391
+ ```
392
+ workflow engine: cluster-sql, dialect=mariadb
393
+ workflow engine selected · engine: "in-memory"
394
+ ```
395
+
396
+ A consumer read the second — later, more definitive-sounding — and concluded that `voltro dev` runs workflows on a different engine than a deployment does. That is a fair reading of a line that is simply false, and it sent them down the wrong half of an investigation into why their outgoing webhooks delivered in dev and produced zero rows under `voltro serve`.
397
+
398
+ The label is now decided where the engine is chosen. A log line is an assertion the framework makes about itself, and this one had no reader that could catch it: it is not typed against the layer it describes, and nothing asserted the pair agreed.
399
+
400
+ **Both boot paths also report WHICH workflow entity types they registered.** `API listening … workflowWorkers: 0` counts app-exported worker LAYERS — an advanced surface almost no app uses — and reads as "nothing consumes durable work here", which is the question the consumer could then answer from no other line. A delivery that fails with `Entity type 'Workflow/voltro.deliverWebhook' not registered` and one that never starts look identical from outside; this separates them before anyone reproduces anything.
401
+
402
+ ### Internal (no consumer-facing effect)
403
+
404
+ - **@voltro/database** — The count of `descriptor.order` read sites is ASSERTED rather than stated: the prose said ELEVEN and there are twelve (three in `sqlCompiler.ts`, nine in `jsonEagerCompiler.ts`). Written from memory of a replacement run instead of from the file — the exact mistake two consumer rounds have been about, made inside the document describing it.
405
+
406
+ `queryDescriptorOrderAbsent.test.ts` now pins `{ 'sqlCompiler.ts': 3, 'jsonEagerCompiler.ts': 9 }`, so a compiler growing or losing a read site fails the suite instead of drifting quietly into a number somebody quotes. No behaviour change.
407
+
408
+ ---
409
+
42
410
  ## [0.31.0] — 2026-08-10
43
411
 
44
412
  ### Added
package/dist/index.d.ts CHANGED
@@ -133,6 +133,20 @@ export declare interface AuditPluginOptions {
133
133
  * like — e.g. an `Effect<void>` sink that
134
134
  * writes rows to your own audit table on top
135
135
  * of `@effect/sql`.
136
+ *
137
+ * **A function sink gets NEITHER the table NOR the retention sweep**, and the
138
+ * cliff is invisible until the next environment. Both are gated on `sink`
139
+ * being the literal `'datastore'`, so a function that redacts and then
140
+ * delegates to `dataStoreAuditSink` still writes rows on a database where
141
+ * `_voltro_audit_log` already exists — while creating the table nowhere and
142
+ * arming the TTL policy nowhere. It works where you tested it and fails on
143
+ * the next `voltro dev` against a fresh database.
144
+ *
145
+ * Reported by a consumer who reached for exactly that composition to redact a
146
+ * field, before {@link AuditPluginOptions.redactOutcome} existed. If you want
147
+ * the durable trail with different redaction, use `sink: 'datastore'` plus
148
+ * `redactInput` / `redactSubject` / `redactOutcome` — those compose; the sink
149
+ * does not.
136
150
  */
137
151
  readonly sink?: 'console' | 'memory' | 'datastore' | AuditSink;
138
152
  /**
@@ -276,6 +290,45 @@ export declare interface AuditPluginOptions {
276
290
  * the plugin can compute.
277
291
  */
278
292
  readonly redactSubject?: 'metadata' | 'none' | ((subject: Subject) => unknown);
293
+ /**
294
+ * What happens to `AuditEvent.outcome`'s payload before it is handed to the
295
+ * sink.
296
+ *
297
+ * - `'all'` (DEFAULT) — `outcome.value` on success, and `outcome.error` on
298
+ * failure, are replaced by `{ __redacted: 'all' }`. `kind`, `durationMs`
299
+ * and the error's TAG survive, which is what the trail is read for.
300
+ * - `'none'` — the outcome verbatim. What every sink did before this
301
+ * option existed.
302
+ * - a function — `(event) => unknown`, for field-level control.
303
+ *
304
+ * **This is `redactInput`'s reasoning applied to the field it structurally
305
+ * cannot cover.** `redactInput`'s own docstring names "an API key at issuance"
306
+ * as its motivating case — and for a credential-ISSUING call the secret is
307
+ * never in the input:
308
+ *
309
+ * apiKeys.createPersonalApiKey({ name, scopes }) // input: nothing sensitive
310
+ * → { keyValue: '<the plaintext key>' } // outcome: the whole point
311
+ *
312
+ * webhooks.create({ url, subscribedEvents }) // input: nothing sensitive
313
+ * → { signingSecret: '<live secret>' } // outcome: returned once
314
+ *
315
+ * The option that existed covered the field those calls leave empty; the
316
+ * field they fill had none. Found by a consumer on the first run of
317
+ * `voltro db scan-credentials` after we widened its columns: nine rows of
318
+ * `_voltro_audit_log.outcome` matched, four of them `webhooks.create` carrying
319
+ * a live 64-character signing secret in full. They had BOTH existing options
320
+ * on — `redactInput: 'all'`, `redactSubject: 'metadata'` — and no way to
321
+ * reach this field.
322
+ *
323
+ * The default is `'all'` for the same reason the other two default to
324
+ * redacting: losing the payload is visible the first time you read a row,
325
+ * leaking a credential is not visible at all. Opt out per app once you know
326
+ * your own outcomes.
327
+ *
328
+ * A `record` predicate still sees the LIVE outcome, so a filter that keys on
329
+ * the result keeps working — redaction applies to what is STORED.
330
+ */
331
+ readonly redactOutcome?: 'all' | 'none' | ((event: AuditEvent) => unknown);
279
332
  }
280
333
 
281
334
  /** The narrow read surface the entry points need. */
package/dist/index.js CHANGED
@@ -137,6 +137,28 @@ var m = "_voltro_audit_log", h = d(m, {
137
137
  input: n === "all" ? l : n(t)
138
138
  };
139
139
  }, f = (t) => {
140
+ let n = e.redactOutcome ?? "all";
141
+ if (n === "none") return t;
142
+ let r = n === "all" ? l : n(t), i = t.outcome;
143
+ if (i.kind === "ok") return {
144
+ ...t,
145
+ outcome: {
146
+ ...i,
147
+ value: r
148
+ }
149
+ };
150
+ let a = i.error, o = typeof a == "object" && a ? a._tag : void 0;
151
+ return {
152
+ ...t,
153
+ outcome: {
154
+ ...i,
155
+ error: o === void 0 ? r : {
156
+ _tag: o,
157
+ ...r
158
+ }
159
+ }
160
+ };
161
+ }, p = (t) => {
140
162
  let n = e.redactSubject ?? "metadata";
141
163
  if (n === "none") return t;
142
164
  if (typeof n == "function") return {
@@ -153,15 +175,15 @@ var m = "_voltro_audit_log", h = d(m, {
153
175
  metadata: l
154
176
  }
155
177
  };
156
- }, p = (e) => s(e) ? a(f(d(e))) : t.void, h = (t) => {
178
+ }, h = (e) => s(e) ? a(f(p(d(e)))) : t.void, _ = (t) => {
157
179
  if (e.resolveScope !== void 0) try {
158
180
  return e.resolveScope(t);
159
181
  } catch {
160
182
  return;
161
183
  }
162
- }, _ = (e, n) => o(n.tag) ? t.suspend(() => {
163
- let r = Date.now(), i = h(n);
164
- return e.pipe(t.tap((e) => p({
184
+ }, v = (e, n) => o(n.tag) ? t.suspend(() => {
185
+ let r = Date.now(), i = _(n);
186
+ return e.pipe(t.tap((e) => h({
165
187
  ts: r,
166
188
  tag: n.tag,
167
189
  subject: n.subject,
@@ -173,7 +195,7 @@ var m = "_voltro_audit_log", h = d(m, {
173
195
  value: e,
174
196
  durationMs: Date.now() - r
175
197
  }
176
- }).pipe(t.catchAllCause(() => t.void))), t.tapErrorCause((e) => p({
198
+ }).pipe(t.catchAllCause(() => t.void))), t.tapErrorCause((e) => h({
177
199
  ts: r,
178
200
  tag: n.tag,
179
201
  subject: n.subject,
@@ -186,7 +208,7 @@ var m = "_voltro_audit_log", h = d(m, {
186
208
  durationMs: Date.now() - r
187
209
  }
188
210
  }).pipe(t.catchAllCause(() => t.void))));
189
- }) : e, v = _, y = _, b = _;
211
+ }) : e, y = v, b = v, S = v;
190
212
  return n({
191
213
  name: "@voltro/plugin-audit",
192
214
  description: "Records every mutation invocation; ships an audit() schema mixin for row-level metadata.",
@@ -202,9 +224,9 @@ var m = "_voltro_audit_log", h = d(m, {
202
224
  i = x(e);
203
225
  }
204
226
  } : {},
205
- interceptMutation: v,
206
- interceptAction: y,
207
- ...e.recordQueries === !0 ? { interceptQuery: b } : {}
227
+ interceptMutation: y,
228
+ interceptAction: b,
229
+ ...e.recordQueries === !0 ? { interceptQuery: S } : {}
208
230
  });
209
231
  };
210
232
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-audit",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "description": "Audit plugin — ships the `audit()` schema mixin (createdAt/updatedAt/createdBy/updatedBy → Actor) plus an optional mutation interceptor that records every call to a configurable sink (console / memory / custom function).",
5
5
  "keywords": [
6
6
  "voltro",
@@ -27,7 +27,8 @@
27
27
  "types": "./dist/mixin.d.ts",
28
28
  "import": "./dist/mixin.js",
29
29
  "default": "./dist/mixin.js"
30
- }
30
+ },
31
+ "./package.json": "./package.json"
31
32
  },
32
33
  "main": "./dist/index.js",
33
34
  "module": "./dist/index.js",
@@ -37,9 +38,9 @@
37
38
  "node": ">=24.0.0"
38
39
  },
39
40
  "dependencies": {
40
- "@voltro/database": "0.31.0",
41
- "@voltro/logger": "0.31.0",
42
- "@voltro/protocol": "0.31.0"
41
+ "@voltro/database": "0.33.0",
42
+ "@voltro/logger": "0.33.0",
43
+ "@voltro/protocol": "0.33.0"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "effect": "^3.22.0"