Commit afb83d3
* refactor(objectql): extract ObjectQL.update's dispatch into a shared producer-side predicate (#5480)
`delete` has had one since #4550 (`resolveEngineDeleteDispatch`), so any test
double standing in for the engine can import the producer's own decision and
cannot be looser than it. `update`'s identical three-way dispatch was an inline
literal throw in `engine.ts` with no exported constant and no reusable function
— so #5393 could pin its fake's `delete` to the producer and structurally could
not do the same for `update`, on a verb whose predicate branch rewrites every
matching row's fields.
- new `packages/objectql/src/engine-update-dispatch.ts`:
`resolveEngineUpdateDispatch` / `assertEngineUpdateDispatch` / `scalarUpdateId`
/ `ENGINE_UPDATE_REJECT_MESSAGE` / `ENGINE_UPDATE_DISPATCH_CASES`, all exported
from `@objectstack/objectql`.
- `ObjectQL.update` now uses it — producer and predicate are one copy.
Behaviour-preserving: the three branches, the `$in` predicate test and the
reject message text are unchanged. Two places where update is not delete are
copied verbatim rather than "improved", and documented as such: `data.id` is
taken without a scalar test and outranks both `where` and `multi`
(objectstack#5748), and the branch reads truthiness, so `where: { id: 0 }` is
not an identifying call.
`engine-update-dispatch.test.ts` drives the REAL engine with a recording driver
over the case set and asserts observed behaviour equals the predicate's verdict
case by case — verified non-vacuous by perturbing the engine's own branch, which
turns the `real ObjectQL.update` half red while the predicate half stays green.
check-engine-double-contract grows an `update` slice on the same criterion:
ledger entries are now keyed on (file, verb) with a required `verb` and a new
DECLARED invariant, the driver-only-member veto applies at every arity (a fake
driver spelling its key `_i` had 19 of its doubles read as engine doubles), and
the self-test covers the update slice on both sides of every decision including
cross-slice credit. Measured: delete unchanged at 108 doubles / 91 files / 27
pinned; update 126 doubles / 110 files, 10 pinned (objectql's own fakes), 116 in
the shrink-only ledger.
Fixes #5480
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V7WetGmnfoXNn8cLieKKmx
* test(scripts): ledger the update double #5738 landed after this slice was measured (#5480)
Base crossing, not a regression on either side.
`packages/services/service-automation/src/plugin-startup-log-cause.test.ts`
arrived on main in #5738 (from #5661) after this branch measured the update
slice and while main still had no update slice at all — so its own CI could not
have flagged its fake engine's `update`, and this ledger could not have recorded
it. It becomes a violation only on the merge ref, where the new slice and the
new file meet for the first time.
Re-measured on the merge with origin/main rather than transcribed: 1 unguarded
engine double at line 170. The package already carries @objectstack/objectql in
devDependencies, so the pin is one line, but the file is under
`packages/services/**` — outside this PR's scope — so it goes to the services
lane's batch alongside the `crud-bulk-intent.test.ts` upgrade step 3 leaves it.
Like every other update entry, it claims no dormancy probe.
Verified on the merged tree: engine-double-contract OK (self-test + run),
delete unchanged at 108 doubles / 91 files / 27 pinned with zero RECONCILED,
update 127 / 111 with 10 pinned and 117 ledgered; query-options-erasure ratchet
holds; check-nul-bytes clean; @objectstack/objectql typecheck clean and 124
files / 2044 tests green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V7WetGmnfoXNn8cLieKKmx
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent dde9202 commit afb83d3
17 files changed
Lines changed: 1822 additions & 150 deletions
File tree
- .changeset
- packages/objectql/src
- 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 | + | |
| 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 | + | |
0 commit comments