Commit 8dd98bf
A `beforeDelete` handler on a by-id `delete()` may no longer move the delete
onto another row by assigning `ctx.input.id`. It is refused with
`HookTargetRebindError` / `ERR_HOOK_TARGET_REBIND` (`path: 'by-id'`) — the
same refusal the `update()` twin and both per-row paths (D4) already raised.
Nothing is deleted; `afterDelete` and the roll-up recompute never run. The
rule across both verbs is now one line: a by-id target is immutable in a
`before*` handler.
This removes a capability that WORKED. #5272 RE-RESOLVED a repointed target,
re-reading its pre-image and rebinding `previous`, so nothing stale ever
reached a consumer — which is why #5574's engine half (PR #6697) deliberately
left the asymmetry standing rather than folding a behaviour removal into an
ordering change, and filed it as #6752. The 2026-08-09 maintainer ruling on
that card retires it on three measured axes: compatibility cost zero (the
repo-wide grep for assignments into a hook's `input.id`, re-run on this
branch's base, finds six sites and all six are this family's own pins), one
rule beats two individually-correct rules an author must memorize, and "a
hook silently redirects which row gets deleted" is a top-grade footgun for
authored handlers however correctly the redirect is implemented. Aligning the
other way — building `update()` the same re-resolution — stays excluded by
#5574's recorded ruling.
The four recorded landing points move together:
* ADR-0058 Amendment II.1's scope table now shows the REBOUND column
uniform, with the carve-out pointing forward to the new Amendment II.2,
which records the ruling and its three axes.
* `hook-target-rebind-errors.ts`'s "what this error does NOT cover" section
is gone — there is no exception left to remember — replaced by the full
four-cell coverage table and the record of why the last cell arrived late.
The REBOUND message text was written for `update()` only and would have
misdescribed the delete path; it now states the rule for both verbs.
* `engine.ts`'s re-read block is DELETED, not merely bypassed: its guard was
`input.id !== id && input.id`, exactly the case the refusal now throws on,
so it became unreachable code. The single pre-dispatch pre-image read that
binds `previous` for `beforeDelete` is a different read and is untouched.
* The D4 §7 pin is FLIPPED to assert the refusal with its full envelope
(code, name, object, event, path, expectedId, observedId, message), plus
that neither row was deleted and `afterDelete` never ran. Flipped, not
deleted — the case is the record of a ruling. A new negative control pins
that a same-id rewrite stays legal, which is the measurement the
`input.id !== id` check rests on.
Registers the ADR-0087 step-17 semantic entry
`delete-by-id-before-hook-repoint-retired` (a runtime hook surface: no
`sys_metadata` row for the D2 chain to rewrite, and the intent behind a
repoint is not recoverable, so it is a D3 semantic TODO). Artifacts
regenerated (`gen:migration-registry`, `gen:spec-changes`,
`gen:upgrade-guide`).
Refs #6752, #5272, #5574, PR #6697, ADR-0058, ADR-0087
Claude-Session: https://claude.ai/code/session_01CxyoeX26ZjnnwzbegYvTHW
Co-authored-by: Claude <noreply@anthropic.com>
1 parent b3430af commit 8dd98bf
9 files changed
Lines changed: 443 additions & 81 deletions
File tree
- .changeset
- docs
- adr
- packages
- objectql/src
- spec
- src/migrations
- entries/semantic
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
| 336 | + | |
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
339 | 340 | | |
340 | | - | |
| 341 | + | |
341 | 342 | | |
342 | 343 | | |
343 | 344 | | |
344 | 345 | | |
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
359 | 361 | | |
360 | 362 | | |
361 | 363 | | |
| |||
375 | 377 | | |
376 | 378 | | |
377 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
378 | 442 | | |
379 | 443 | | |
380 | 444 | | |
| |||
0 commit comments