Commit 8880de3
feat: make typed random-access structures opt-in (default off)
Typed structures keyed the per-encoder dictionary on per-field value WIDTH, which
caused two production failure modes: an unbounded structure explosion (OOM) on
wide/variably-typed schemas, and cross-replica/thread dictionary divergence
(decode failures: "Record id is not defined" / "Unknown constant"). Classic
shared structures are width-agnostic and bounded, and were the behavior that ran
reliably pre-4.7.13.
Disable typed-struct WRITES by default in RecordEncoder (new records use classic
shared structures); keep READS (_readStruct stays active) so existing
typed-struct data and cross-version replication still decode. Opt in per encoder
via options.randomAccessStructure. Bail the write hook via () => 0 rather than
clearing it, to preserve msgpackr's struct-safe fixint boundary.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent dae3940 commit 8880de3
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
113 | 124 | | |
114 | 125 | | |
115 | 126 | | |
| |||
0 commit comments