Commit cbcffa8
committed
fix(objectql): name the bulk-write limitation instead of blaming the author, and record the per-row contract (#5037)
The rc-window stopgap half of the 2026-08-04 ruling on #4800 / #4862.
A hook `condition` reading `previous` on a predicate (`multi: true`) write is
unevaluable — the engine matches N rows, fires the hook once and binds no prior
record — and since #4775 that rejects the write. #4861 already gave the case its
own sentence, but that sentence predates the ruling and led with "rewrite the
condition without `previous`", which is advice to silently turn a transition
into a state test. The contract is now the opposite: on a bulk write, after
hooks and record-change flow triggers evaluate and fire PER ROW.
- `docs/adr/0058`: addendum recording the contract, today's measured behaviour,
the stopgap and its expiry (#5038), and the consequences #5038 must price.
- `hook-wrappers.ts`: the rejection states it is a CURRENT-VERSION limitation,
cites the contract and #5038, leads with the single-record route, and prices
the rewrite. `HookConditionError.limitation`
(`bulk_write_previous_unbound` | `bulk_write_stored_state_unavailable`) is the
machine-readable discriminator — deliberately not `code`, since ADR-0112 makes
`error.code` a closed wire vocabulary and rest-server promotes a thrown
error's `.code` onto the envelope.
- "does this condition read `previous`" now comes from the parsed CEL AST
(`collectCelRootIdentifiers`), computed once at wrap time, with the fault-text
check as fallback — so the diagnosis no longer rides on cel-js's wording, and
`record.previous_status` is correctly NOT a `previous` reference.
- `scripts/adr-anchors.json`: anchors ADR-0058 + ADR-0112 to hook-wrappers.ts.
Single-record writes, bulk writes whose conditions do not name `previous`, and
the undeclared-key typo report are unchanged; fail loud takes no exception.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NrmBxj8rK2uGCnh9aipjwX1 parent 94f7b6a commit cbcffa8
7 files changed
Lines changed: 692 additions & 23 deletions
File tree
- .changeset
- docs/adr
- packages/objectql/src
- scripts
Lines changed: 55 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 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 | + | |
59 | 113 | | |
60 | 114 | | |
61 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
0 commit comments