Commit 7236bb0
committed
feat(spec,metadata-protocol): ADR-0118 — transactions reach plugin space through the contract, and
#4612 asks the platform to choose a debt: transactionalize the engine, bless a
shared migration-journal primitive, or rule both out. Scoping it found the
first option's expensive half was paid three majors ago — ADR-0034's ambient
transaction is implemented, and hooks/validation/internal reads already join it
— while the cheap half was never done. So this records ADR-0118, which splits
the ask along where the work actually is.
D1 (here) — `transaction` joins `IObjectQLEngine`. The mechanism ships; only
the declaration was missing, so the metadata protocol's atomic publish, its
`transactionalBatch` probe, and the sys-metadata repository each reached it
through `as unknown as` casts — unchecked claims about a class none of them
import. The contract's own evidence bar was met three times over. Its caveats
(default-driver only; runs without a transaction when the driver lacks
`beginTransaction`) go into the TSDoc as declared meaning, not behaviour to be
discovered. Narrow host surfaces now type their optional member as
`IObjectQLEngine['transaction']` so they cannot drift from it.
D4 (here) — `batchData`'s `atomic` opened no transaction. It broke a loop:
prior writes stayed committed while the response reported them `success: true`
under the one flag guaranteeing they were undone — #4346's class, silent and
destructive. It now runs the batch inside one `engine.transaction()`, and a
failure rolls back everything and says so (`succeeded: 0`, rows marked
ROLLED_BACK / NOT_ATTEMPTED). A runtime that cannot roll back is REFUSED with
501, never degraded — silent degradation is how the flag came to lie.
`BatchOptionsSchema.atomic`'s declared `.default(true)` is aligned down to the
enforced `false`, so opting in is explicit and no existing caller's failure
semantics change underneath them.
D2 (#4617) specifies a framework-owned migration-journal runner: transactions
cannot span a million-row backfill, a whole-DB-snapshot driver, a multi-
datasource write, or a process crash, so the four queued consumers need journal
+ compensation + resume on top of transactions, not instead of them.
D3 (#4618) retires `IDataEngine.batch?` — declared, implemented by nobody,
called by nobody. Caveat hardening is #4619; the sibling fake-atomics in
`deleteManyData`/`updateManyData` are #4620.
Tests: 10 unit pins on the atomic contract (rollback shape, 501 refusal with
zero writes attempted, precedence, non-atomic regression) and 6 integration
pins over a real engine + transacting driver, including that an internal read
during the batch binds to the open transaction — the no-deadlock coverage whose
absence ADR-0034 was written about.
Closes #4612
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NKcGqCYCCpMkB5UW8jNPXxatomic stops lying (#4612)1 parent 0c681c3 commit 7236bb0
12 files changed
Lines changed: 1039 additions & 16 deletions
File tree
- .changeset
- content/docs/references/api
- docs/adr
- packages
- metadata-protocol/src
- objectql/src
- spec/src
- api
- contracts
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
0 commit comments