Commit 2fe0d87
committed
fix(objectql): set-to-undefined of an engine-hidden readonly key is a no-op, not a hook write (#16344)
Contract-review finding F1. A `beforeUpdate` hook that assigns a hidden key
from the payload it was shown (`data.x = data.x`) reads `undefined` and
re-creates the key holding it. Three mechanisms then agreed the wrong way: the
recorder's `set` trap counted it as a hook write, the hand-back skipped the key
because `k in target`, and the static strip kept it on that record — so a driver
was handed `{ x: undefined }`.
On the memory driver that ERASES the stored read-only value; on a knex-backed
one `formatInput` does not drop `undefined` and `builder.update(payload)` hands
knex an undefined binding — a bare compile-time Error outside the ADR-0112
envelope. Neither is "the record the engine intends to persist".
At the confluence the key is now deleted, dropped from the sealed record, and
the ordinary hand-back puts the caller's value back for the strip to judge. The
write reads exactly as it would with no hook at all: stripped, reported on
`onFieldsDropped`, warned, refused under `strictReadonlyWrites`.
Dropping the key from `hookWrittenKeys` is load-bearing, not tidiness: handing
the caller's value back over a key the record still calls hook-owned would
credit the forgery with hook provenance. The narrowing reaches only keys this
card's pass hid, and only the one value no driver can store, so #14088's
deliberate blindness to VALUE is unchanged for every key a hook can see.
The pin moves in both directions: the stored value now STANDS
(`completed_at === STAMPED`, the seed), and the FORGED negative stays.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XTBcV7zZHmokdyQgXjbyEU1 parent 6375bc2 commit 2fe0d87
2 files changed
Lines changed: 72 additions & 15 deletions
Lines changed: 31 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
758 | 758 | | |
759 | 759 | | |
760 | 760 | | |
761 | | - | |
| 761 | + | |
762 | 762 | | |
763 | 763 | | |
764 | 764 | | |
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | | - | |
| 797 | + | |
798 | 798 | | |
799 | | - | |
800 | | - | |
| 799 | + | |
801 | 800 | | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
810 | 824 | | |
811 | 825 | | |
812 | 826 | | |
| |||
817 | 831 | | |
818 | 832 | | |
819 | 833 | | |
| 834 | + | |
820 | 835 | | |
821 | | - | |
822 | | - | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
823 | 840 | | |
824 | 841 | | |
825 | 842 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11762 | 11762 | | |
11763 | 11763 | | |
11764 | 11764 | | |
11765 | | - | |
| 11765 | + | |
11766 | 11766 | | |
11767 | 11767 | | |
11768 | 11768 | | |
| |||
11782 | 11782 | | |
11783 | 11783 | | |
11784 | 11784 | | |
| 11785 | + | |
| 11786 | + | |
| 11787 | + | |
| 11788 | + | |
| 11789 | + | |
| 11790 | + | |
| 11791 | + | |
| 11792 | + | |
| 11793 | + | |
| 11794 | + | |
| 11795 | + | |
| 11796 | + | |
| 11797 | + | |
| 11798 | + | |
| 11799 | + | |
| 11800 | + | |
| 11801 | + | |
| 11802 | + | |
| 11803 | + | |
| 11804 | + | |
| 11805 | + | |
| 11806 | + | |
| 11807 | + | |
| 11808 | + | |
| 11809 | + | |
| 11810 | + | |
| 11811 | + | |
| 11812 | + | |
| 11813 | + | |
| 11814 | + | |
11785 | 11815 | | |
11786 | 11816 | | |
11787 | 11817 | | |
11788 | 11818 | | |
11789 | 11819 | | |
| 11820 | + | |
11790 | 11821 | | |
11791 | 11822 | | |
11792 | 11823 | | |
| 11824 | + | |
| 11825 | + | |
| 11826 | + | |
| 11827 | + | |
11793 | 11828 | | |
11794 | 11829 | | |
11795 | 11830 | | |
| 11831 | + | |
| 11832 | + | |
| 11833 | + | |
| 11834 | + | |
| 11835 | + | |
11796 | 11836 | | |
11797 | 11837 | | |
11798 | 11838 | | |
| |||
0 commit comments