Commit e3b3cdd
Fixes #18997
Clause-②: no
`getDiscovery()` derived `capabilities.transactionalBatch` from the
ENGINE alone — `typeof this.engine?.transaction === 'function'` — while
`runAtomicBatch` refuses `batchData({ atomic: true })` with `501
NOT_IMPLEMENTED` on `engineCanRollBack(this.engine)`, which asks the
DEFAULT DRIVER as well. `engine.transaction` is a function on every real
engine, so `/discovery` answered `true` for exactly the compositions
that then 501 — and the 501's own remedy text sends the caller to that
bit ("probe `capabilities.transactionalBatch` on /discovery first"). The
prescribed remedy routed the caller to a signal that was wrong in the
only case the remedy exists for.
One line at the read site: the advertisement now asks the predicate the
refusal already trusts.
## What a consumer that sees `true` today will see after this lands
`/discovery` is a published surface, so this is stated rather than
assumed.
Two compositions stop advertising `true` and begin advertising `false`.
Both already answered `501 NOT_IMPLEMENTED` to an atomic batch before
this change, so **nothing that was accepted becomes refused** — only a
lying value becomes honest:
- **(a) a default driver with no `beginTransaction` at all** —
pre-existing on `main`, not introduced by #18063;
- **(b) a default driver that inherits `beginTransaction` and declares
`supports.transactionsUnsupported`** — the population #18063 added. The
shipped example is `TursoDriver` on its remote transport
(`packages/drivers/driver-turso/src/turso-driver.ts`,
`transactionsUnsupported: this.transportMode === 'remote'`).
A client that read `true` and proceeded was taking the 501; it now reads
`false` and takes its non-atomic fallback ahead of the failure, which is
what probing the capability was for. A client that hard-asserts
`transactionalBatch === true` at startup against such a composition now
fails at startup instead of at its first atomic batch. The REST
producer's own AND with `api.enableBatch`
(`packages/rest/src/rest-server.ts`) is unchanged and inherits the
corrected input.
Everything else is byte-identical: the key, its type, its `description`
and its place in the closed capability vocabulary do not move.
## Clause-② — measured, not argued
The claim comment grades this `no` on the ground that it narrows. The
falsifier was to be measured, not assumed: if any composition advertised
`true` where `origin/main` advertises `false`, that would be a widening.
Enumerated over all 16 compositions of the four inputs the two
predicates can read (engine has `transaction`; driver registry
inspectable; driver has `beginTransaction`; driver declares
`transactionsUnsupported`), comparing `main`'s derivation with this one:
```
compositions: 16 | widened (false -> true): 0 | narrowed (true -> false): 3
VERDICT: NO WIDENING — accept set untouched, advertisement narrows only
```
The 3 narrowed rows are population (a) x2 (driver has no
`beginTransaction`, with and without the declaration) and population (b)
x1. `Clause-②: no` holds.
## Both directions, or the card is not delivered
"A fix that makes the flag honest by making it always `false` is worse
than the bug." So the TRUE arm is pinned beside the FALSE arm, and each
composition is driven through `batchData({ atomic: true })` in the same
test — the advertisement and the refusal have to agree composition by
composition.
`packages/metadata-protocol/src/protocol.discovery-transactional-batch-honesty.test.ts`
(6 cases):
- a default driver that CAN roll back: still `true`, and the atomic
batch commits;
- a host whose driver registry is not inspectable (test doubles,
metadata-only hosts): still `true` — the engine-level probe is all there
is, which is what `engineCanRollBack` documents;
- population (a): `false`, and the 501 arrives with the remedy sentence
this card is about, having attempted no write;
- population (b): `false`, same refusal;
- no `transaction()` at all: `false` (unchanged);
- and the rule itself — the advertised bit equals `engineCanRollBack()`
for every composition, so a future composition that satisfies one end
and not the other reds here even if nobody adds a case for it.
**Against the shipped driver**, measured on the built `dist/` after the
fix, not inferred:
```
real MemoryDriver: typeof beginTransaction = function | supports.transactionsUnsupported = undefined | driverSupportsTransactions = true
/discovery capabilities.transactionalBatch = {"enabled":true}
```
The default dev composition keeps its `true`.
## Evidence
- **Pre-fix reproduction.** The pin file was written first and run
unmodified against unmodified `protocol.ts`: `Tests 3 failed | 3 passed
(6)` — the two population cases and the predicate-agreement case red,
the TRUE-arm controls already green. Post-fix: `Test Files 1 passed (1)
· Tests 6 passed (6)`.
- **Ablation** through `scripts/ablation-replace.mjs`, from the
committed state, with on-disk proof: anchor `1 -> 0`, blob `0b04d1ff5d3a
-> 7c63e7631f05`, then `3 failed | 3 passed`; restore verified `blob ==
HEAD (0b04d1f)` and `git diff HEAD` empty. No `dist` preflight is
owed: the pin imports `./protocol.js`, so the mutation is on the
resolution path directly.
- **Package suite** `pnpm --filter @objectstack/metadata-protocol test`:
`Test Files 181 passed | 3 skipped (184) · Tests 2591 passed | 19
skipped (2610)`. `typecheck` exit 0, and `tsc --noEmit --listFiles`
names the new pin file among the 750 files in the program, so the type
check really covers it.
- **Cross-package consumer**
`packages/objectql/src/protocol-discovery.test.ts` against the rebuilt
`metadata-protocol` dist: `32 passed (32)` — including the
real-`ObjectQL`-engine pin that must keep advertising `true`.
- **Gates**, derived from the actual diff with `node
scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack
--commands` and reconciled with `--ran`: 59 derived, **56 run, all exit
0**, 3 NOT MEASURED. The 3 exited `3` (PREREQUISITE NOT MET, nothing
measured) because they read a whole-workspace `dist/` this checkout does
not carry — `check:dual-build-cjs-loads`, `check:lean-entry-closure`,
`check:type-check-debt`; CI's `Build Core` supplies the prerequisite
they refuse without. `check:plugin-teardown-shape --self-test` also
exited 3 at first (its fixture commit is unreachable in a shallow clone)
and exits 0 after fetching that commit.
- **`pnpm lint`** (repo-wide `eslint . --no-inline-config`): exit 0.
All readings are from `objectstack-ai/objectstack` at this branch's head
commit.
## Acceptance notes
- `publishPackageDrafts` in the same file keeps an engine-only probe
(`typeof this.engine?.transaction === 'function'`) for its own `inTxn`
helper. Noted, not filed, and deliberately not changed here: it
advertises nothing to a caller, and both of its branches deliver the
same guarantee today — `engine.transaction()` takes its declared
non-transactional path (ADR-0119 D1) for exactly the drivers the probe
would have excluded, so swapping the predicate there is a no-op in
behaviour. It would become a real question only for whoever makes
draft-publish atomicity a promise rather than a best effort.
- The runtime dispatcher's hardcoded `transactionalBatch: { enabled:
false }` (`packages/runtime/src/http-dispatcher.ts`) is correct and
untouched: that face mounts no `/batch` route.
- Scope held to `packages/metadata-protocol/src/` plus the changeset.
`packages/spec` is not touched — the spec half of #18063 is landed and
correct.
- `origin/main` moved two commits while this was in flight (`#19162`
checklist-status workflow, `#19242` hono-server). Neither touches this
package; the `dispatch-gates.mjs` change in that range is to its own
self-test roster and derives the same 59 families for this diff. Not
merged down; the merge queue rebuilds on current `main`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01NcPSwnmJHczmTu6FG7NMjE)_
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 801415a commit e3b3cdd
3 files changed
Lines changed: 237 additions & 8 deletions
File tree
- .changeset
- packages/metadata-protocol/src
| 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 | + | |
Lines changed: 195 additions & 0 deletions
| 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 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6323 | 6323 | | |
6324 | 6324 | | |
6325 | 6325 | | |
6326 | | - | |
6327 | | - | |
6328 | | - | |
6329 | | - | |
6330 | | - | |
6331 | | - | |
6332 | | - | |
6333 | | - | |
| 6326 | + | |
| 6327 | + | |
| 6328 | + | |
| 6329 | + | |
| 6330 | + | |
| 6331 | + | |
| 6332 | + | |
| 6333 | + | |
| 6334 | + | |
| 6335 | + | |
| 6336 | + | |
| 6337 | + | |
| 6338 | + | |
| 6339 | + | |
| 6340 | + | |
| 6341 | + | |
| 6342 | + | |
| 6343 | + | |
| 6344 | + | |
| 6345 | + | |
| 6346 | + | |
| 6347 | + | |
| 6348 | + | |
| 6349 | + | |
| 6350 | + | |
| 6351 | + | |
6334 | 6352 | | |
6335 | 6353 | | |
6336 | 6354 | | |
| |||
0 commit comments