@auspicion/provident-storeroom-js-wasm 0.0.0-stage → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1278 @@
1
+ // `D-2` (`docs/L1/entry-subdivision.md` §1 part `5`; the split is `D-33`'s) — bytes moved from `bindings/js/index.mjs`; no logic changed.
2
+ // **⟶ AND THE `Proxy` PREDICATE IS THE INSTALLED CLASS-DECISION INSTRUMENT FROM 2026-11-17** (`D-156` item 1 and
3
+ // the loader split's row for these five parts, `docs/L3/wasm-realm/design.md` §5: the host import line is *"swapped
4
+ // for a local helper"* — **neutralised**, conditional on that design's §4 instrument). **`isProxyOf` IS
5
+ // `class-instrument.mjs`'s one predicate and this file carries no host specifier for the class decision any more**:
6
+ // every site below takes the answer `util.types.isProxy` gave, because **the NODE entry installs `types.isProxy`
7
+ // ITSELF at load** (`index.mjs`, at the head of the module), and on the other arm the instrument is
8
+ // `structuredClone` while **the ANSWER does not move** (`D-156` item 1: the refusal stays rank-neutral and
9
+ // class-for-class what this arm answers). **NO DECISION, NO ORDER AND NO ANSWER OF THIS FILE MOVES** — only the
10
+ // predicate's name and its home.
11
+ // **⟶ AND THE CARRIER PREDICATE JOINS THE IMPORT FROM 2026-11-17 — `D-167`.** `class-instrument.mjs` holds two
12
+ // answers now: `isProxyOf` is THE DATA QUESTION (*does this value enter the Rust store?* — the `structuredClone`
13
+ // probe on the WASM arm) and `isProxyOfCarrier` is THE CARRIER QUESTION (*is this the package's own `cfg` /
14
+ // listeners / constraints carrier?* — `false` on that arm, with the declaration at the predicate itself).
15
+ // **EVERY `isProxyOf` SITE BELOW KEEPS ITS ANSWER BYTE-FOR-BYTE**: each is about a value's class or a value's
16
+ // PROTOTYPE LINK, and a link is data. **THE CARRIER ANSWER IS TAKEN BY ONE PREDICATE AND ONE ONLY** —
17
+ // `isPlainObjectCarrier` below, the carrier-shaped sibling of `isPlainObjectValue`, whose one reader is
18
+ // `frame.mjs`'s `encodeConfig`. **The split cannot live inside the shared predicate** (`isPlainObjectValue`
19
+ // classifies both carriers and values), so it lives at the call.
20
+ import { isProxyOf, isProxyOfCarrier } from './class-instrument.mjs';
21
+ import { boundaryReject } from './addon-slot.mjs';
22
+ import { appendOwn } from './refusal.mjs';
23
+
24
+ // ⟶ CARVED UP 2026-10-24 (`D-2`/`D-33`): `inDomainAddress` and `isLawfulListenerElement`, with the doc blocks that
25
+ // explain them, are taken out of the delivery part, where `index.mjs:5078`–`:5112` held them: the config frame's own
26
+ // encoder (`admittedConstraintBatch`) reads `isLawfulListenerElement`, so leaving them there made the walk depend on
27
+ // the part that owns the terminal arm. No byte of either body changed and neither name has a second declaration.
28
+
29
+ // ---------------------------------------------------------------------------------------------
30
+ // THE CLASS DECISION, TAKEN FIRST — `A76`'S PART (1), VERBATIM: *"EVERY JS VALUE IS TESTED FOR COMPLIANCE
31
+ // WITH THE PERMITTED SHAPE BEFORE IT IS ADMITTED — the class decision is made first, on the value as it
32
+ // IS, never after a coercion"*. **NO COERCION IS PERFORMED ANYWHERE BELOW: every predicate here READS a
33
+ // class and CLASSIFIES it, and the classified value is what crosses.**
34
+ // ---------------------------------------------------------------------------------------------
35
+
36
+ /// `crossing.md §1.2` row 1's dated clause of 2026-10-11 and `§1.4` item 9: **a JS `string` carrying a
37
+ /// LONE SURROGATE is REFUSED `ValueNotAdmitted` AT THE PACKAGE'S OWN WALK, BEFORE ANY VERB IS CALLED** —
38
+ /// no Rust `String` can carry one, and the value is never silently replaced, dropped or normalized into a
39
+ /// replacement character. **The class is BOUNDARY-ONLY and this is its one site.**
40
+ ///
41
+ /// **⟶ AMENDED 2026-10-24 (`contract.md §2.1`'s clause of this date on `F6-2`, items `(2a)`–`(2d)`): THE
42
+ /// PREDICATE INVOKES NOTHING TAKEN FROM A MUTABLE PROTOTYPE — it reads the string's own code units by a LOCAL
43
+ /// INDEX READ.** The block above stands byte-for-byte and is read THROUGH this clause; **the class, its one
44
+ /// site, its four other readings and every admission stand unmoved.** **THE DEFECT, AT ITS BYTES:** the shipped
45
+ /// read was `text.charCodeAt(i)` and `text.charCodeAt(i + 1)` — A MEMBER READ OFF `String.prototype` AT THE
46
+ /// MOMENT OF THE CALL — and this predicate is the SOLE gate on `§2` rows `9` and `10` with NO downstream
47
+ /// refuser, so an override answering `0x41` at every index made `a string carrying a lone surrogate`
48
+ /// UNREACHABLE at both positions and a lone-surrogate value and key crossed, repaired to U+FFFD on the far
49
+ /// side. **THE FORM IS THE CLAUSE'S FIRST LAWFUL ONE AND IT IS TAKEN FOR THE REASON `C-11` GIVES:** `text[i]`
50
+ /// is a string's OWN EXOTIC INDEX PROPERTY — answered by the string wrapper and by no link of any prototype
51
+ /// chain — and `text.length` is the wrapper's own property, so no method is invoked and no intrinsic is
52
+ /// captured at load (a captured `String.prototype.charCodeAt` is the frozen prototype fact `C-11` forbids, so
53
+ /// the clause's second form, `String.prototype.charCodeAt.call(...)`, is NAMED THERE AND NOT TAKEN HERE).
54
+ /// **AND THE PAIR READ CARRIES ITS OWN BOUND, WHICH IS PART OF THE FORM AND NOT AN OPTIMISATION:**
55
+ /// `text[i + 1]` is read ONLY WHERE `i + 1 < text.length`, because an out-of-range canonical index is NOT the
56
+ /// wrapper's own property — an unguarded read would reach a caller's `String.prototype[i + 1]` and PAIR a high
57
+ /// surrogate the caller never paired. Where that index does not exist the answer is LONE, the same answer the
58
+ /// shipped `NaN` comparison gave.
59
+ export function hasLoneSurrogate(text) {
60
+ for (let i = 0; i < text.length; i += 1) {
61
+ const unit = text[i];
62
+ if (unit >= '\uD800' && unit <= '\uDBFF') {
63
+ // THE PAIR READ IS BOUNDED (item `(2b)`): an out-of-range canonical index is not the wrapper's own
64
+ // property, so it is never asked of the chain.
65
+ if (i + 1 >= text.length) return true;
66
+ const low = text[i + 1];
67
+ if (!(low >= '\uDC00' && low <= '\uDFFF')) return true;
68
+ i += 1;
69
+ } else if (unit >= '\uDC00' && unit <= '\uDFFF') {
70
+ return true;
71
+ }
72
+ }
73
+ return false;
74
+ }
75
+
76
+ /// **THE ECMASCRIPT STANDARD `Object.prototype` MEMBER SET — A FIXED, REALM-INDEPENDENT LIST, SPELLED HERE
77
+ /// AND NOT READ FROM ANY PROTOTYPE.**
78
+ ///
79
+ /// **⟶ `contract.md §1`'s clause of 2026-10-24 (`docs/defects.md` · `DEF-2026-10-24-C`), items `(1)(c)`,
80
+ /// `(2)` and `(3)`, ARE THIS LIST'S WHOLE AUTHORITY.** Item `(1)(c)` makes the plain-object limb a
81
+ /// CARRYING test against the standard `Object.prototype` member set, item `(2)` makes the array limb the
82
+ /// same test against the standard `Array.prototype` set with an `Object.prototype`-SHAPED prototype above it,
83
+ /// and item `(3)` is why the sets are SPELLED rather than read: **an INJECTED own member on EITHER realm's
84
+ /// prototype must leave a lawful value's verdict unchanged, and a set derived from a live prototype would
85
+ /// carry the injected name and then DEMAND it of the other realm's values** — the realm-agreement failure
86
+ /// `DEF-2026-10-24-C` measured. **THE CENSUS THE TEST READS OFF THE VALUE'S OWN PROTOTYPE IS STILL READ PER
87
+ /// CALL (`plainProtoNames`, `arrayProtoNames`, `arrayProtoSymbols` below); what is fixed here is only the
88
+ /// STANDARD half of the reference set, which is a fact about ECMAScript and not about any realm's state.**
89
+ /// **`Object.prototype` carries no own SYMBOL member**, so item `(1)(c)`'s symbol half is empty for the
90
+ /// object limb and no symbol is compared there.
91
+ const OBJECT_PROTO_STANDARD_NAMES = [
92
+ 'constructor',
93
+ '__defineGetter__',
94
+ '__defineSetter__',
95
+ 'hasOwnProperty',
96
+ '__lookupGetter__',
97
+ '__lookupSetter__',
98
+ 'isPrototypeOf',
99
+ 'propertyIsEnumerable',
100
+ 'toString',
101
+ 'valueOf',
102
+ '__proto__',
103
+ 'toLocaleString',
104
+ ];
105
+
106
+ /// **THE ECMASCRIPT STANDARD `Array.prototype` NAME SET AND SYMBOL-DESCRIPTION SET — a fixed,
107
+ /// realm-independent pair of lists, for the reason `OBJECT_PROTO_STANDARD_NAMES` states** (`contract.md §1`'s
108
+ /// clause of 2026-10-24, items `(2)` and `(3)`). **The symbols are compared BY DESCRIPTION and never by
109
+ /// identity** — `Symbol.iterator` in another realm is a DIFFERENT symbol value, and a cross-realm array must
110
+ /// be ADMITTED (`docs/specs/storeroom-js/crossing.md §1.2` row `5`).
111
+ const ARRAY_PROTO_STANDARD_NAMES = [
112
+ 'length',
113
+ 'constructor',
114
+ 'at',
115
+ 'concat',
116
+ 'copyWithin',
117
+ 'fill',
118
+ 'find',
119
+ 'findIndex',
120
+ 'findLast',
121
+ 'findLastIndex',
122
+ 'lastIndexOf',
123
+ 'pop',
124
+ 'push',
125
+ 'reverse',
126
+ 'shift',
127
+ 'unshift',
128
+ 'slice',
129
+ 'sort',
130
+ 'splice',
131
+ 'includes',
132
+ 'indexOf',
133
+ 'join',
134
+ 'keys',
135
+ 'entries',
136
+ 'values',
137
+ 'forEach',
138
+ 'filter',
139
+ 'flat',
140
+ 'flatMap',
141
+ 'map',
142
+ 'every',
143
+ 'some',
144
+ 'reduce',
145
+ 'reduceRight',
146
+ 'toReversed',
147
+ 'toSorted',
148
+ 'toSpliced',
149
+ 'with',
150
+ 'toLocaleString',
151
+ 'toString',
152
+ ];
153
+ const ARRAY_PROTO_STANDARD_SYMBOL_DESCRIPTIONS = ['Symbol.iterator', 'Symbol.unscopables'];
154
+
155
+ /// `Object.prototype`'s own property names — **read PER CALL from THIS realm's own prototype. They are the
156
+ /// LIVE HALF of the reference set the plain-object test compares against.**
157
+ ///
158
+ /// **⟶ READ PER CALL, NOT ONCE AT LOAD: THE LOAD-TIME CACHE WAS A FAIL-CLOSED DoS.** `C-11` of the gate-4
159
+ /// adversarial pass measured it: the sets stood as module-level `const`s taken at load, so a LATER own
160
+ /// property change to `Array.prototype` (or to `Object.prototype`) left every array address and every plain
161
+ /// `cfg` comparing against a key set the realm no longer has — `arrayClass` and `protoClass` then answered
162
+ /// `'class'`, the walk refused `[]` and `{}` alike, and the refusal was reached at `on`'s own step 1. **THE
163
+ /// SETS ARE FACTS ABOUT THE PROTOTYPES AS THEY ARE AT THIS CALL**, so they are read where they are used;
164
+ /// the reading is unchanged in every other respect (by NAME and by SYMBOL DESCRIPTION, never by a symbol's
165
+ /// identity — `§1.2` row 5, `§1.3` row 13).
166
+ ///
167
+ /// **⟶ AND `C-11` STANDS UNMOVED BY `contract.md §1`'s CLAUSE OF 2026-10-24: THE PER-CALL READ IS KEPT AND
168
+ /// ONLY THE EQUALITY AGAINST IT IS REMOVED** (item `(4)`). The reference set is `referenceSet(...)` below —
169
+ /// the standard list INTERSECTED with this per-call reading — so the equality test cannot be reconstructed
170
+ /// here, a caller-side mutation leaves no stale set behind, and (item `(3)`) it cannot move a verdict either.
171
+ ///
172
+ /// **⟶ AND NO CENSUS IS HANDED TO `new Set(...)` ANY MORE — `contract.md §2.1`'s clause of 2026-10-24 on
173
+ /// `F7-1`, items `(1c)(ii)`, `(2b)`'s rows `1`, `2`, `8` and `11`, and `(10a)` (`S2`).** The static is lawful
174
+ /// and its RESULT'S ITERATION is not: `new Set(census)` consumes the census array through
175
+ /// `Array.prototype[Symbol.iterator]`, so a FORGED iterator emptied or filled the set and a prototype that
176
+ /// owns nothing then passed the carrying test (`Object.create(Object.create(null))` CROSSED as a plain
177
+ /// object, item `(1f)(ii)`'s first measured state). **THE FORM IS ITEM `(1c)(i)`'S: THE CENSUS ARRAY ITSELF,
178
+ /// KEPT AND READ BY INDEX** — no `Set`, no iterator, no `for … of` over a result.
179
+ ///
180
+ /// **⟶ AND THE READ IS CHARGED ITS OWN LENGTH FROM 2026-10-24** (`contract.md §2.1`'s clause of this date on
181
+ /// `F7-2`, item `(4c)(iii)`: *"one own-NAME census read — `1 + the length of the list it returns`"*, and item
182
+ /// `(4e)`: the allowance is threaded into this reader and it answers the WITH branch's conservative answer
183
+ /// where the spend is refused). `null` is that answer — a census the caller may not pay for is not a census
184
+ /// this reader may compare against, so `isStandardObjectPrototype` answers `false` (the class answer) and the
185
+ /// guard keeps walking instead of exempting a link on a read it could not charge.
186
+ function plainProtoNames(allowance) {
187
+ const names = Object.getOwnPropertyNames(Object.prototype);
188
+ if (!spendGuardRead(allowance, 1 + names.length)) return null;
189
+ return names;
190
+ }
191
+
192
+ /// `Array.prototype`'s own property names and its own symbols' descriptions, **read PER CALL from THIS
193
+ /// realm's own prototype**. **They are the LIVE HALF of the reference set the ARRAY half of the class
194
+ /// decision compares against**, and the comparison is by NAME and by SYMBOL DESCRIPTION — never by a
195
+ /// symbol's identity, because `Symbol.iterator` in another realm is a DIFFERENT symbol value, and a
196
+ /// cross-realm array must be ACCEPTED (`§1.2` row 5, `§1.3` row 13). **See `plainProtoNames` above for why
197
+ /// these are not cached (`C-11`) and for why the per-call read survives the clause of 2026-10-24.**
198
+ /// **And for the reason `plainProtoNames` above spells: the census array is READ BY INDEX and never handed to
199
+ /// `new Set(...)` (`F7-1`, items `(2b)` row `2` and `(10a)`).**
200
+ function arrayProtoNames(allowance) {
201
+ const names = Object.getOwnPropertyNames(Array.prototype);
202
+ if (!spendGuardRead(allowance, 1 + names.length)) return null;
203
+ return names;
204
+ }
205
+
206
+ /// **⟶ AND THIS READ TAKES NO METHOD FROM A MUTABLE PROTOTYPE: `Array.prototype.map` IS GONE FROM IT.**
207
+ /// `contract.md §1`'s clause of 2026-10-24 on `F-RA-3`, item `(3)`, declares a DELETION in the CALLER's realm
208
+ /// admission-preserving — the deleted name leaves the reference set's live half and with it the requirement —
209
+ /// and the as-built read spelled `Object.getOwnPropertySymbols(Array.prototype).map((s) => s.description)`,
210
+ /// **so `delete Array.prototype.map` in this realm made the CENSUS READ ITSELF throw and `arrayClass`'s guarded
211
+ /// `try` turned that `TypeError` into `'class'`: a caller's deletion became a REFUSAL of its own array, the
212
+ /// one direction item `(3)` forbids.** The read is now a plain indexed loop over an ordinary array
213
+ /// (`Object.getOwnPropertySymbols`'s own result, read by index, so no iterator and no method of a live
214
+ /// prototype is consulted), and the census is the same census.
215
+ ///
216
+ /// **⟶ AND THE DESCRIPTION READ IS ITSELF MEMBER-FREE FROM 2026-10-24** (`contract.md §2.1`'s clause of this
217
+ /// date on `F7-1`, item `(2b)`'s rows `3`, `4` and `12`, and `(10a)`): `symbols[i].description` is
218
+ /// `Symbol.prototype.description`'s ACCESSOR taken off a MUTABLE PROTOTYPE, so a caller's getter answered for
219
+ /// every symbol and the ARRAY LIMB'S class was decided by it — the measured state `(1f)(ii)` names at row `(e)`,
220
+ /// where a genuine array on a one-symbol array-shaped prototype CROSSED. **THE FORM IS A SPEC CONVERSION ON A
221
+ /// SYMBOL PRIMITIVE** (`String(sym)`'s `SymbolDescriptiveString`, the same lawful form item `(2b)`'s row `27`
222
+ /// records for `String(number)`), **and the description is spelled back by a local index loop** — the string's
223
+ /// own exotic index reads (`(1c)(v)`) and `+=` (`(1c)(i)`), never `slice`, never a method of a prototype.
224
+ function symbolDescription(symbol) {
225
+ const spelled = String(symbol);
226
+ let description = '';
227
+ for (let i = 7; i < spelled.length - 1; i += 1) description += spelled[i];
228
+ return description;
229
+ }
230
+
231
+ /// **⟶ AND THE RESULT IS AN ARRAY, NOT A `Set`** (`F7-1`, items `(2b)` row `4` and `(10a)`): a `Set`'s
232
+ /// membership is `Set.prototype.has` and its construction consumes its argument through an ITERATOR, and both
233
+ /// are mutable-prototype members by item `(1d)(iv)`. The census is read by index wherever it is compared.
234
+ function arrayProtoSymbols(allowance) {
235
+ const symbols = Object.getOwnPropertySymbols(Array.prototype);
236
+ const descriptions = [];
237
+ for (let i = 0; i < symbols.length; i += 1) appendOwn(descriptions, symbolDescription(symbols[i]));
238
+ // THE OWN-SYMBOL CENSUS READ IS `1 + length` TOO (item `(4c)(iv)`); `null` is the conservative answer.
239
+ if (!spendGuardRead(allowance, 1 + symbols.length)) return null;
240
+ return descriptions;
241
+ }
242
+
243
+ /// **THE REFERENCE SET — `contract.md §1`'s clause of 2026-10-24, item `(4)`: THE STANDARD SET INTERSECTED
244
+ /// WITH THIS REALM'S LIVE CENSUS READ AT THIS CALL.**
245
+ ///
246
+ /// **THE INTERSECTION IS NOT A CONVENIENCE: IT IS ITEM `(3)`'S DECLARED SAFETY IN THE ONE DIRECTION THAT IS
247
+ /// NOT FROZEN.** An ADDED member is not in the standard list, so the intersection cannot see it and the
248
+ /// verdict cannot move (item `(3)`); a DELETED standard member is dropped from the live half, so the
249
+ /// intersection only ever REMOVES a requirement and a deletion can never turn an admission into a refusal —
250
+ /// `C-11`'s fail-closed DoS in the other direction, equally forbidden (item `(4)`'s closing sentence).
251
+ ///
252
+ /// **⟶ AND THE SET IS A LIST — `contract.md §2.1`'s clause of 2026-10-24 on `F7-1`, item `(2b)`'s row `5` and
253
+ /// item `(1c)(vi)`, WHICH SPELLS THE REPLACEMENT: *"A MEMBERSHIP TEST WRITTEN AS A LOCAL LOOP"*.** A `Set`'s
254
+ /// construction consumes an argument through an iterator and its membership is `Set.prototype.has`; both are
255
+ /// mutable-prototype members by item `(1d)(iv)`, and the measured states `(1f)(ii)` names at rows `(c)` and
256
+ /// `(d)` are exactly this membership answering a caller's forged `has`/`add`. The intersection is the same
257
+ /// intersection: a local loop, a spelled `===`, and an own-property append (`appendOwn`, `refusal.mjs`).
258
+ ///
259
+ /// **⟶ AND THE APPEND WAS THE REPORTED SITE OF THE `F8-2` CLASS'S WRITE VECTOR — LANDED 2026-10-25.** The
260
+ /// as-built append was `reference[reference.length] = member`, an INDEX WRITE that performs `[[Set]]`; with an
261
+ /// own getter-only accessor at `Array.prototype[0]` (a mutation a caller owns and `C-11` forbids this package
262
+ /// to freeze away) the FIRST append answered `false` and this strict frame raised the raw host `TypeError`
263
+ /// *"Cannot set property 0 of [object Array] which has only a getter"* — out of `storeCreate` and out of
264
+ /// `write`, before any verdict, with no user code run. **`appendOwn` defines the own property instead, so the
265
+ /// reference set is built by a form no mutable prototype decides**; its members, its order and its length are
266
+ /// the ones the index loop built, and no admission, refusal, spelling or position moves.
267
+ function referenceSet(standardMembers, liveCensus, allowance) {
268
+ // **⟶ AND THE ALLOWANCE IS THREADED IN HERE TOO** (item `(4e)`): a census the caller could not pay for is
269
+ // not a reference set, so the intersection answers `null` and its caller answers its branch's conservative
270
+ // answer. The memberships themselves are spelled `===` comparisons over lists already charged their length
271
+ // (item `(4c)(viii)`: a spelled relational comparison is `0`).
272
+ if (liveCensus === null) return null;
273
+ const reference = [];
274
+ for (let i = 0; i < standardMembers.length; i += 1) {
275
+ const member = standardMembers[i];
276
+ for (let j = 0; j < liveCensus.length; j += 1) {
277
+ if (liveCensus[j] === member) {
278
+ appendOwn(reference, member);
279
+ break;
280
+ }
281
+ }
282
+ }
283
+ return reference;
284
+ }
285
+
286
+ /// **`§1`'s `(1)(b)` AND `(1)(c)` — A PROTOTYPE THAT IS TERMINAL AND CARRIES THE STANDARD `Object.prototype`
287
+ /// MEMBER SET**, which is what `contract.md §1`'s clause of 2026-10-24 calls an *"`Object.prototype`-SHAPED
288
+ /// prototype"* in item `(2)`.
289
+ ///
290
+ /// **(b) THAT PROTOTYPE IS TERMINAL: `[[GetPrototypeOf]](proto)` is `null`** — it stands one link from the
291
+ /// value and ends the chain. **This condition, and no census comparison, is what refuses a CLASS INSTANCE**
292
+ /// (row `14`): a class's prototype's own prototype is an `Object.prototype` and is therefore not `null`.
293
+ /// **(c) THAT PROTOTYPE CARRIES THE STANDARD SET**, by `referenceSet` above: every member of the reference set
294
+ /// is an own member of the prototype, **and any FURTHER own member it carries is IRRELEVANT — it neither
295
+ /// admits nor refuses** (item `(1)(c)`'s own closing words). **No COUNT is compared anywhere here**, which is
296
+ /// the two equality tests the clause removed at `:741`–`:742` and `:779`–`:781`.
297
+ ///
298
+ /// The guarded `try` stands where the shipped ones stood: a prototype whose own reads THROW (a `Proxy` used
299
+ /// as a prototype, a revoked one) answers `false` — the class answer — and nothing escapes this frame.
300
+ /// **⟶ AND EVERY READ IT TAKES IS CHARGED TO THE ONE PER-CALL ALLOWANCE FROM 2026-10-24**
301
+ /// (`contract.md §2.1`'s clause of this date on `F7-2`, items `(4a)`, `(4c)` and `(4e)`): the link's
302
+ /// `getPrototypeOf` read is `1`, the own-name census read it takes is `1 + its length`, and the live
303
+ /// `plainProtoNames` census is the same figure — **the three terms item `(4a)` names as the ones no charge
304
+ /// reached.** Where a spend is refused this predicate answers `false`, i.e. **"not a standard shape"**: the
305
+ /// conservative direction, since the class answer is `'class'` and the render guard keeps walking instead of
306
+ /// exempting a link whose census it could not pay for.
307
+ /// **⟶ AND WHICH PREDICATE THE LINK IS ASKED OF IS THE CALLER'S FROM 2026-11-17 — `D-167`.** The link test is
308
+ /// `linkInstrument`'s answer, **defaulting to `isProxyOf`, so every existing caller is byte-unmoved**; the carrier
309
+ /// sibling below passes `isProxyOfCarrier` instead, because the object whose prototype link is being read THERE is
310
+ /// the package's `cfg` and not a value (the split lives at the call and this is the one place the call has to
311
+ /// reach one link deeper). **ON THE NODE ARM THE TWO ARE THE SAME FUNCTION, so the parameter moves nothing there;
312
+ /// on the WASM arm it is the whole of what makes the carrier gate answer "not a `Proxy`" without reading a member
313
+ /// the API does not declare** — the declaration and its price are at `class-instrument.mjs`'s
314
+ /// `isProxyOfCarrier`.
315
+ function isStandardObjectPrototype(proto, allowance, linkInstrument = isProxyOf) {
316
+ if (proto === null) return false;
317
+ // **⟶ `contract.md §2`'s clause of 2026-10-24 on `F-RA-12`, item `(6)(a)`: A PROTOTYPE LINK THAT IS A
318
+ // `Proxy` — INCLUDING A REVOKED ONE — IS `false`, WITH NO TRAP RUN AND BEFORE ANY CENSUS READ OF IT.** A
319
+ // trap that RETURNS a shape is not answered by the `catch` below (a `catch` cannot un-run a trap that
320
+ // returns), so a LYING `ownKeys`/`getPrototypeOf` handler turned a subclass-shaped prototype into an
321
+ // admission: `Object.create(lyingProxy)` crossed as a plain object. `util.types.isProxy` reads no member
322
+ // and invokes no handler, and a shape the package may not read is not a shape the value carries. **THE
323
+ // GROUND IS `§1`'s OWN** — this guard covers `protoClass`'s whole census path, `arrayClass`'s chain link
324
+ // and `isLanguageStandardPrototype`'s `above` read, so no limb and no conversion test reads a proxy link.
325
+ if (linkInstrument(proto)) return false;
326
+ let names;
327
+ try {
328
+ if (!spendGuardRead(allowance, 1)) return false; // ONE `getPrototypeOf` CALL — item `(4c)(ii)`
329
+ if (Object.getPrototypeOf(proto) !== null) return false; // (b) TERMINAL
330
+ // **⟶ AND THE CENSUS IS KEPT AS AN ARRAY AND COMPARED BY INDEX** (`contract.md §2.1`'s clause of
331
+ // 2026-10-24 on `F7-1`, items `(1c)(ii)`, `(2b)`'s row `6` and `(10a)`): `new Set(...)` consumed the
332
+ // read through `Array.prototype[Symbol.iterator]` and its `has` was `Set.prototype.has`, so a forged
333
+ // iterator or a forged `has` decided the CLASS — `Object.create(Object.create(null))` crossed and
334
+ // `[1]` on a one-symbol array-shaped prototype crossed with it. The read, the reference set and the
335
+ // carrying test below are all local loops on ordinary arrays now.
336
+ names = Object.getOwnPropertyNames(proto); // (c) the value's prototype's own census
337
+ } catch {
338
+ return false;
339
+ }
340
+ // THE OWN-NAME CENSUS READ, CHARGED `1 + the length of the list it returns` (item `(4c)(iii)`).
341
+ if (!spendGuardRead(allowance, 1 + names.length)) return false;
342
+ const reference = referenceSet(OBJECT_PROTO_STANDARD_NAMES, plainProtoNames(allowance), allowance);
343
+ if (reference === null) return false;
344
+ for (let i = 0; i < reference.length; i += 1) {
345
+ const name = reference[i];
346
+ let carried = false;
347
+ for (let j = 0; j < names.length; j += 1) {
348
+ if (names[j] === name) {
349
+ carried = true;
350
+ break;
351
+ }
352
+ }
353
+ if (!carried) return false;
354
+ }
355
+ return true;
356
+ }
357
+
358
+ /// `crossing.md §1.4` item 4: **THE PLAIN-OBJECT TEST**, items (a)–(g) — **STRUCTURAL AND REALM-AGNOSTIC.**
359
+ /// **The prototype half is NOT an identity test against this realm's `Object.prototype`**: the prototype
360
+ /// is `null`, or a prototype whose OWN properties are exactly the plain-object prototype's. **A plain
361
+ /// object from ANY realm (`vm`, a worker, `structuredClone`) is therefore ACCEPTED** — its prototype is
362
+ /// that realm's own `Object.prototype`, whose own names are this realm's own two — **while a CLASS INSTANCE
363
+ /// is refused, because a class's prototype carries its own `constructor`** (`DD-7`, `DD-35`).
364
+ ///
365
+ /// **⟶ AMENDED 2026-10-24 (`DEF-2026-10-24-C`; `contract.md §1`'s clause of that date, items `(1)`, `(3)`,
366
+ /// `(5)`, `(6)`): THE PREDICATE IS `§1`'s OBJECT LIMB, TAKEN STRUCTURALLY — THE VALUE CARRIES A PROTOTYPE,
367
+ /// THAT PROTOTYPE IS TERMINAL, AND THAT PROTOTYPE CARRIES THE STANDARD `Object.prototype` MEMBER SET.**
368
+ /// The block above stands byte-for-byte and is read THROUGH this clause. **THE TWO EQUALITY TESTS THE CLAUSE
369
+ /// REMOVES ARE GONE FROM THIS BODY — `names.length !== plain.size` and `if (!plain.has(name)) return 'class'`
370
+ /// — because a COUNT and a NAME-NOT-IN-THE-SET compared the value's prototype's own census against THIS
371
+ /// realm's live prototype and so REFUSED a lawful foreign-realm plain object the moment either realm's
372
+ /// `Object.prototype` gained one own member.** What stands in their place is `isStandardObjectPrototype`
373
+ /// above: terminality (`(1)(b)`, which is what refuses a class instance and needs no census read at all) and
374
+ /// a CARRYING test against the standard set (`(1)(c)`, in which an EXTRA own member on either realm's
375
+ /// prototype is irrelevant). **A LAWYER'S NOTE ON WHAT DID NOT MOVE: the `'null'` answer and the identity
376
+ /// comparison below STAY.** The `'null'` answer is `§3`'s `p` classification for a prototype-less object —
377
+ /// admitted, and unmoved by this clause — and `proto === Object.prototype ? 'plain' : 'foreign'` LABELS an
378
+ /// admitted value's classification and decides NO admission (`§1`'s item `(5)`); a verdict that turned on it
379
+ /// would be the removed test under another name.
380
+ /// **⟶ AND ITS LINK TEST IS A PARAMETER FROM 2026-11-17 (`D-167`), DEFAULTING TO `isProxyOf`** — the data
381
+ /// question, which is what every existing caller asks. `isPlainObjectCarrier` below — the one carrier-shaped
382
+ /// reader — passes `isProxyOfCarrier`, so the object whose link is read there is classified as the carrier it is
383
+ /// and not as a value. **NO CENSUS, NO TERMINALITY TEST AND NO `'class'` ANSWER MOVES**: only which predicate is
384
+ /// asked of the one link.
385
+ export function protoClass(value, linkInstrument = isProxyOf) {
386
+ const proto = Object.getPrototypeOf(value);
387
+ if (proto === null) return 'null';
388
+ return isStandardObjectPrototype(proto, undefined, linkInstrument)
389
+ ? (proto === Object.prototype ? 'plain' : 'foreign')
390
+ : 'class';
391
+ }
392
+
393
+ /// `crossing.md §1.4` item 4 (c), (d) and item 1: an own ACCESSOR, or an own `Symbol`-keyed property,
394
+ /// REFUSES THE WHOLE VALUE — *"any other answer would DROP A MEMBER SILENTLY"* (`DD-8`).
395
+ ///
396
+ /// **⟶ AND THE SCAN IS A LOCAL INDEX LOOP FROM 2026-10-24** (`contract.md §2.1`'s clause of this date on
397
+ /// `F7-1`, items `(1c)(i)`, `(2b)`'s rows `7` and `16`, and `(10a)`): the as-built read walked
398
+ /// `Object.getOwnPropertyNames(value)` with `for … of`, i.e. through `Array.prototype[Symbol.iterator]`, so a
399
+ /// caller's forged iterator **left row `15`'s accessor untested** while the census still had entries to read.
400
+ /// The census is the same census and the two descriptors read are the same two; only the consumption form
401
+ /// moved.
402
+ export function accessorOrSymbolArm(value) {
403
+ const names = Object.getOwnPropertyNames(value);
404
+ for (let i = 0; i < names.length; i += 1) {
405
+ const descriptor = Object.getOwnPropertyDescriptor(value, names[i]);
406
+ if (descriptor.get || descriptor.set) return { k: 'P' };
407
+ }
408
+ return Object.getOwnPropertySymbols(value).length > 0 ? { k: 'y' } : null;
409
+ }
410
+
411
+ /// **THE ARRAY HALF OF THE CLASS DECISION** — `crossing.md §1.2` row 5, whose two halves are BOTH declared:
412
+ /// *"a cross-realm array IS accepted (it is an `Array`), **a class extending `Array` is not**"*, with
413
+ /// `§1.3`'s `AddressArg` row 13 accepting a cross-realm array and row 11 refusing the array-like class.
414
+ /// **THE DECISION IS STRUCTURAL AND REALM-AGNOSTIC, exactly as `§1.4` item 4 (e) makes the plain-object
415
+ /// test's**: the value's own prototype is `null`, or a prototype whose OWN property names and OWN symbol
416
+ /// descriptions are EXACTLY an array prototype's — **reached without an `instanceof` test and without a
417
+ /// comparison against this realm's `Array.prototype`, so a cross-realm array is admitted while a SUBCLASS
418
+ /// (`class V extends Array {}`, whose prototype carries its own `constructor` and little else) is refused
419
+ /// BY ITS CLASS.** (`JS-2`: `Array.isArray` may not SHORT-CIRCUIT this test — it is a predicate about the
420
+ /// exotic array-ness of the object and says NOTHING about which class the object belongs to.)
421
+ ///
422
+ /// **⟶ AMENDED 2026-10-24 (`DEF-2026-10-24-C`; `contract.md §1`'s clause of that date, item `(2)`): THE
423
+ /// ARRAY LIMB IS `§1`'s THREE CONDITIONS, AND ITS CHAIN HAS ONE MORE LINK THAN THE OBJECT'S — so the test
424
+ /// is stated ON THE CHAIN and never on this realm's `Array.prototype` by identity.** (a) the value carries
425
+ /// a prototype; (b) that prototype carries the standard `Array.prototype` NAME set AND the standard
426
+ /// `Array.prototype` SYMBOL-DESCRIPTION set — compared by description and never by a symbol's identity; and
427
+ /// (c) **that prototype's own prototype is an `Object.prototype`-SHAPED prototype, i.e. one satisfying
428
+ /// `§1`'s `(1)(b)` and `(1)(c)` (`isStandardObjectPrototype` above)**. **The standard chain is therefore
429
+ /// `value → Array.prototype → Object.prototype → null` in EVERY realm**, which is why a `vm` array, a
430
+ /// worker's array and a `structuredClone`d array are admitted by the same rule as this realm's own — and why
431
+ /// a class extending `Array` is refused: its prototype's own prototype is an `Array.prototype` and NOT an
432
+ /// `Object.prototype`-shaped one, so the chain check alone answers `'class'` before any census is compared.
433
+ /// **THE TWO EQUALITY TESTS THE CLAUSE REMOVES ARE GONE — `names.length !== arrayNames.size ||
434
+ /// symbols.length !== arraySymbols.size` and the two `if (!set.has(...)) return 'class'` loops — and the
435
+ /// per-call census reads and the guarded `try` stand exactly where they stood** (item `(5)`). **`Array.isArray`
436
+ /// alone may not stand as the admission test and no `instanceof` test is taken** (`JS-2`, unmoved); the
437
+ /// identity comparison in the final `return` LABELS the `p` classification and decides no admission.
438
+ /// **⟶ AND ITS READS ARE CHARGED TO THE ONE PER-CALL ALLOWANCE WHERE A CALLER CARRIES ONE** (`contract.md
439
+ /// §2.1`'s clause of 2026-10-24 on `F7-2`, item `(4e)`): its `getPrototypeOf` reads, its own-name and
440
+ /// own-symbol census reads and the two live reference censuses are the same figures
441
+ /// `isStandardObjectPrototype` charges. **A REFUSED SPEND ANSWERS `'class'`** — the limb's own class answer,
442
+ /// which is the WITH branch's conservative direction for a class decision — and a caller that carries no
443
+ /// allowance (the walk's own admission test, `isAdmittedArray`, `constraintAddress`) is charged nothing.
444
+ export function arrayClass(value, allowance) {
445
+ const proto = Object.getPrototypeOf(value);
446
+ if (proto === null) return 'null';
447
+ // **⟶ `contract.md §2`'s clause of 2026-10-24 on `F-RA-12`, item `(6)(b)`: THE ARRAY LIMB ANSWERS
448
+ // `'class'` FOR A `Proxy` PROTOTYPE LINK — INCLUDING A REVOKED ONE — BEFORE ITS GUARDED `try` AND
449
+ // THEREFORE BEFORE EVERY CENSUS READ BELOW.** The limb answers `'class'` and not a boolean, so the guard
450
+ // is spelled here as well as in `isStandardObjectPrototype` above; `util.types.isProxy` reads no member,
451
+ // runs no trap and throws for no revoked link.
452
+ if (isProxyOf(proto)) return 'class';
453
+ let names;
454
+ let symbols;
455
+ let above;
456
+ try {
457
+ // `C-11`: the value's prototype's own census is read at THIS call, never from a load-time constant.
458
+ // **⟶ AND IT IS AN ARRAY, READ BY INDEX, WITH A MEMBERSHIP LOOP AND NOT A `Set`** (`contract.md §2.1`'s
459
+ // clause of 2026-10-24 on `F7-1`, items `(1c)(ii)`, `(1c)(vi)`, `(2b)`'s rows `8`, `11` and `12`, and
460
+ // `(10a)`): `new Set(...)` consumed each read through `Array.prototype[Symbol.iterator]` and each
461
+ // comparison was `Set.prototype.has`, so a forged iterator or a forged `has` answered the array limb for
462
+ // the caller — the measured state `(1f)(ii)` row `(c)`'s `[1]`, and row `(e)`'s genuine array.
463
+ names = Object.getOwnPropertyNames(proto);
464
+ // **⟶ AND NO METHOD IS TAKEN FROM A MUTABLE PROTOTYPE HERE EITHER** — the as-built read spelled
465
+ // `.map((symbol) => symbol.description)`, so `delete Array.prototype.map` in the CALLER's realm threw inside
466
+ // this guarded frame and the catch below answered `'class'` for the caller's own lawful array
467
+ // (`contract.md §1`'s clause of 2026-10-24 on `F-RA-3`, item `(3)`: a caller-side deletion cannot turn an
468
+ // admission into a refusal). The loop reads the census by index, and the description is a spec conversion
469
+ // on the symbol primitive (`symbolDescription` above), never `Symbol.prototype.description`; the guarded
470
+ // `try` still stands for a prototype whose own reads THROW (a `Proxy` used as a prototype, a revoked one).
471
+ const ownSymbols = Object.getOwnPropertySymbols(proto);
472
+ symbols = [];
473
+ for (let i = 0; i < ownSymbols.length; i += 1) appendOwn(symbols, symbolDescription(ownSymbols[i]));
474
+ above = Object.getPrototypeOf(proto); // (c) the chain's next link: `Array.prototype → Object.prototype`
475
+ } catch {
476
+ return 'class';
477
+ }
478
+ // THE THREE READS JUST TAKEN, EACH AT ITEM `(4c)`'S OWN FIGURE: two own censuses at `1 + length` and the
479
+ // one `getPrototypeOf` call at `1`. A refused spend answers the limb's own class answer.
480
+ if (!spendGuardRead(allowance, 1 + names.length)) return 'class';
481
+ if (!spendGuardRead(allowance, 1 + symbols.length)) return 'class';
482
+ if (!spendGuardRead(allowance, 1)) return 'class';
483
+ if (!isStandardObjectPrototype(above, allowance)) return 'class';
484
+ const liveNames = arrayProtoNames(allowance);
485
+ if (liveNames === null) return 'class';
486
+ const arrayNames = referenceSet(ARRAY_PROTO_STANDARD_NAMES, liveNames, allowance);
487
+ const liveSymbols = arrayProtoSymbols(allowance);
488
+ if (liveSymbols === null) return 'class';
489
+ const arraySymbols = referenceSet(ARRAY_PROTO_STANDARD_SYMBOL_DESCRIPTIONS, liveSymbols, allowance);
490
+ for (let i = 0; i < arrayNames.length; i += 1) {
491
+ const name = arrayNames[i];
492
+ let carried = false;
493
+ for (let j = 0; j < names.length; j += 1) {
494
+ if (names[j] === name) {
495
+ carried = true;
496
+ break;
497
+ }
498
+ }
499
+ if (!carried) return 'class';
500
+ }
501
+ for (let i = 0; i < arraySymbols.length; i += 1) {
502
+ const description = arraySymbols[i];
503
+ let carried = false;
504
+ for (let j = 0; j < symbols.length; j += 1) {
505
+ if (symbols[j] === description) {
506
+ carried = true;
507
+ break;
508
+ }
509
+ }
510
+ if (!carried) return 'class';
511
+ }
512
+ return proto === Array.prototype ? 'plain' : 'foreign';
513
+ }
514
+
515
+ /// **A GENUINE ARRAY** — `Array.isArray`'s own answer AND the class decision beside it: an exotic
516
+ /// array-like object whose class is a class extending `Array` is NOT a genuine array (`JS-2`).
517
+ export function isAdmittedArray(value) {
518
+ return Array.isArray(value) && arrayClass(value) !== 'class';
519
+ }
520
+
521
+ /// **A PLAIN OBJECT**, in the sense `docs/specs/storeroom-js/surface.md §2.1` takes `cfg` and `§1.3`'s `ListenersArg` row 2 takes an entry:
522
+ /// not `null`, `typeof x === 'object'`, not an `Array`, **not a `Proxy`** (`DD-34`) and not a class
523
+ /// instance or any other prototype-carrying object (`§1.4` item 4 (e), (f), (g)). **A PLAIN OBJECT FROM
524
+ /// ANY REALM IS ACCEPTED** — the (e)-half is structural, never an identity test (`DD-7`, `DD-35`).
525
+ export function isPlainObjectValue(value) {
526
+ if (value === null || typeof value !== 'object') return false;
527
+ if (Array.isArray(value) || isProxyOf(value)) return false;
528
+ return protoClass(value) !== 'class';
529
+ }
530
+
531
+ /// **⟶ THE CARRIER-SHAPED SIBLING — `D-167`, ADDED 2026-11-17. THE SAME PREDICATE WITH THE ONE PREDICATE MOVED:**
532
+ /// the same own-data census (`Array.isArray`, the prototype-link rule below) and **`isProxyOfCarrier` asked of the
533
+ /// value AND of its link**, where `isPlainObjectValue` above asks `isProxyOf` of both.
534
+ ///
535
+ /// **IT EXISTS BECAUSE THE SPLIT CANNOT LIVE INSIDE ITS SIBLING.** `isPlainObjectValue` is SHARED: it classifies
536
+ /// `cfg` (a carrier) at `frame.mjs`'s `encodeConfig` and it classifies values (data) at the verbs' walks, so a
537
+ /// decision taken inside it would move the value crossing with the carrier gate. **THE DECISION IS THEREFORE AT
538
+ /// THE CALL, AND THIS IS THE CALL'S OWN COPY OF IT** — one reader, `frame.mjs`'s `encodeConfig`, and no other.
539
+ ///
540
+ /// **WHAT MOVES AND WHAT DOES NOT, ON EACH ARM:**
541
+ /// * **On the Node arm: NOTHING.** `isProxyOfCarrier` is `types.isProxy` there — precise, handler-free, exact —
542
+ /// so this predicate answers byte-for-byte what its sibling answers, and every Node cell that hands a `Proxy`
543
+ /// a `cfg` keeps its refusal, its form and its message (`NG-JS-*`, `F-RA-12`, `DD-34`).
544
+ /// * **On the WASM arm: THE ONE THING THAT LETS THE ARM CONSTRUCT A STORE.** The sibling's `isProxyOf` is
545
+ /// `structuredClone`, which throws for BOTH a `Proxy` AND any object carrying a function — and `cfg` carries
546
+ /// functions by definition (`cfg.saveCall`, a listener's `listener`, a constraint's `constraint`) — so the
547
+ /// shared predicate refused every `cfg` the arm exists for (`D-166`, measured: `storeCreate(bindings,
548
+ /// { journalLength, listeners: [], saveCall })` answered `AddressMalformed`). **`isProxyOfCarrier` answers
549
+ /// `false` for every value there, and the declaration and its price are stated at that predicate**
550
+ /// (`class-instrument.mjs`): **a `Proxy` at a carrier gate is NOT DETECTED on that arm.**
551
+ ///
552
+ /// **THE CENSUS IS THE SIBLING'S AND IS NOT RE-DERIVED**: `null` and every non-object `false` · an `Array`
553
+ /// `false` · the value's class through the SAME `protoClass` link rule · a class instance or another
554
+ /// prototype-carrying object `false` (`§1.4` item 4 (e)–(g)). **No member is read, no accessor runs and no
555
+ /// `Object.keys` is taken here** — the `cfg` gate's own reads happen after it, by `Object.hasOwn` (`A76`/`JS-5`).
556
+ export function isPlainObjectCarrier(value) {
557
+ if (value === null || typeof value !== 'object') return false;
558
+ if (Array.isArray(value) || isProxyOfCarrier(value)) return false;
559
+ return protoClass(value, isProxyOfCarrier) !== 'class';
560
+ }
561
+
562
+ /// **THE CLASS THAT FAILED, SPELLED FOR THE VERBOSE REJECTION** (`A76`: *"the rejection names the failing
563
+ /// target and the reason"*; `surface.md §2.5` item 5 (b): *"the reason is the CLASS the value HAS — named as
564
+ /// `§1.2`'s or `§1.3`'s own class, never as a class the value could be converted to"*). **IT READS NO
565
+ /// MEMBER THROUGH ANY CHAIN** — `typeof`, `util.types.isProxy`, `Array.isArray`, `getPrototypeOf` and the
566
+ /// two own-key-set predicates alone: no `.constructor`, no `.name`, no `.toString` and no `in`.
567
+ export function classSpelling(value) {
568
+ if (value === null) return 'null';
569
+ if (value === undefined) return 'undefined';
570
+ const kind = typeof value;
571
+ if (kind !== 'object' && kind !== 'function') return `a ${kind}`;
572
+ if (isProxyOf(value)) return 'a Proxy';
573
+ if (Array.isArray(value)) return arrayClass(value) === 'class' ? 'a class extending Array' : 'an Array';
574
+ if (kind === 'function') return 'a function';
575
+ return protoClass(value) === 'class'
576
+ ? 'a class instance or another prototype-carrying non-plain object'
577
+ : 'a plain object';
578
+ }
579
+
580
+ /// **THE FAILING TARGET, RENDERED AS THE STORE'S GENERATOR RENDERS IT** — `surface.md §2.5` item 5 (a),
581
+ /// verbatim: *"a non-segment value PRINTED AS ITS OWN VALUE, SINGLE-QUOTED (`10n` for a `bigint`, `Symbol()`
582
+ /// for a symbol) where the failure is about a value and not about a segment — because the store's generator's
583
+ /// own rule prints a non-segment argument that way, and this unit may not invent a second rendering of a
584
+ /// target the store already renders"*. **THE GENERATOR APPLIES THE QUOTING ITSELF** (it spells the subject
585
+ /// `'<subject>'`), so the BARE rendering is what is handed to it.
586
+ ///
587
+ /// **AND THE RENDERING IS GUARDED, WHICH IS `A76`'S OWN INSTRUCTION:** *"a throwing `valueOf`/
588
+ /// `Symbol.toPrimitive`/`Proxy` trap must be caught and answered as the declared refusal (catch, then
589
+ /// classify — never propagate the host error)"*. A rendering that throws answers the CLASS spelling instead
590
+ /// — **the class half of the reason is mandatory (`§2.5` item 5 (b)), so the rejection still carries it** —
591
+ /// and nothing escapes this frame either way.
592
+ export function targetSpelling(value) {
593
+ try {
594
+ // **`§2.5` item 5 (a)'s OWN TWO EXAMPLES, RENDERED EXACTLY:** *"`10n` for a `bigint`, `Symbol()` for a
595
+ // symbol"* — a `bigint` is printed with the `n` its own JS spelling carries (which
596
+ // `BigInt.prototype.toString` drops) and a `symbol` is printed `Symbol()`, while every other target class
597
+ // is printed as its own value.
598
+ if (typeof value === 'bigint') return `${value}n`;
599
+ // **⟶ AND A `Proxy` IS NEVER COERCED, BY THIS RENDERER EITHER (`C-1`'s third half, 2026-10-11).** The
600
+ // renderer is reached on the refusal path of a value the walk has ALREADY refused as `AddressArg` row 12
601
+ // — and `String(value)` on a `Proxy` invokes its `get` trap for `Symbol.toPrimitive` and for `toString`,
602
+ // **so the walk's own refusal message RAN THE TRAPS the walk exists to avoid running.** `classSpelling`
603
+ // reads the class with `util.types.isProxy` alone, invoking nothing, so the target half is still the
604
+ // class the value HAS — no trap runs on this path either, and the same refusal is reachable `on` and
605
+ // `read` alike.
606
+ // **⟶ AMENDED 2026-10-24 (`contract.md §2.1`'s clause of this date on `F5-3`, items `(3a)`–`(3d)`; the owed
607
+ // byte is `implementation-plan.md §2` step `4`'s arm `(ix)`): THE GUARD READS "OR CALLABLE".** The block
608
+ // above stands byte-for-byte and is read THROUGH this clause; its universal is what the one test below now
609
+ // makes true. **THE STATE IT CLOSES:** the shipped test guarded a `Proxy` only when `typeof value ===
610
+ // 'object'`, so a CALLABLE `Proxy` — `typeof 'function'` — fell past it to `String(value)`, whose
611
+ // `ToPrimitive` read `Symbol.toPrimitive` and then `toString` THROUGH THE `get` TRAP at every carrier slot
612
+ // that renders its argument. **THE FORM IS THE SIBLING ARM'S OWN** (`valueTargetSpelling`'s test
613
+ // below): object **or** function, then `types.isProxy`, then the class spelling — the `Proxy` class is ONE
614
+ // class and the renderer's `typeof` split is not a fact about it. Nothing else at this renderer moves: the
615
+ // `bigint` limb, `String(value)`, the `try` and the `catch` all stand, and no identity is compared and no
616
+ // prototype is frozen (`C-11` is untouched).
617
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null && isProxyOf(value)) {
618
+ return classSpelling(value);
619
+ }
620
+ return String(value);
621
+ } catch {
622
+ return classSpelling(value);
623
+ }
624
+ }
625
+
626
+ // ---------------------------------------------------------------------------------------------
627
+ // `A76`'S VERBOSE REJECTION AT A **VALUE** POSITION — `surface.md §2.5` item 6 (a)–(d), read with
628
+ // the `CF-3` authority split that same section declares
629
+ // ---------------------------------------------------------------------------------------------
630
+ //
631
+ // **THE FINDING THIS BLOCK CLOSES, NAMED AS THE SET MEASURED IT** (`archive/gate5/storeroom-js-greens-run.md`
632
+ // §3, FINDING 1; `JSG-04.1.v` · `JSG-04.2.v` · `JSG-04.4.v`): every class the WALK refuses at a VALUE
633
+ // position answered ONE byte-identical message — the store's generic `ValueNotAdmitted` clause at the
634
+ // WRITE ADDRESS's own spelling — so **the reason's class half was absent at every value position**
635
+ // (`§2.5` item 6 (b) makes it MANDATORY), **the position half was absent where the contract declares one**
636
+ // (item 6 (b): *"the ARGUMENT POSITION for a verb's arguments, and the MEMBER POSITION for a member inside a
637
+ // value the walk reached"*), **and PART ONE's target was the wrong datum**: the failure is about a VALUE,
638
+ // and item 6 (a) declares that *"a non-segment value [is] PRINTED AS ITS OWN VALUE, SINGLE-QUOTED (`10n` for a
639
+ // `bigint`, `Symbol()` for a symbol) where the failure is about a value and not about a segment"*.
640
+ //
641
+ // **THE TWO PARTS OF THE COMPOSITE, AND WHOSE BYTES EACH IS** (`CF-3`, the bounded correction pass that
642
+ // closed this implementer's own contract finding, `surface.md §2.5` item 6's closing clause):
643
+ // 1. **PART ONE IS THE STORE'S GENERATOR'S OWN, VERBATIM** — `boundaryReject` reaches the generator through
644
+ // the addon's `errorMessage` and hands it the failing target in the generator's own `<SEGMENT>` slot, so
645
+ // the target half is the store's bytes and never this file's (item 2; item 6 (d)).
646
+ // 2. **PART TWO IS THE BOUNDARY'S OWN AND IS APPENDED** — the class that failed, and the position where the
647
+ // contract declares one. **IT IS APPENDED AND NOT EMBEDDED, because the generator reachable from JS
648
+ // fills two slots and two only** — `errorMessage(code, subject)`'s `segment` and `path`
649
+ // (`bindings/js/src/facade.rs`) — **which is exactly the `CF-3` split this item's own closing clause
650
+ // declares.** The status is a member of the store's closed set and is carried, never minted (`DD-40`).
651
+ //
652
+ // **AND NOTHING ON THIS PATH COERCES** (`A76`'s second part, verbatim: *"do not attempt to fix"*; `§1.8`): the
653
+ // value's own class is READ, the class that failed is NAMED, and the value is REFUSED — never converted,
654
+ // substituted, defaulted or truncated. The rendering of the target is the one guarded read `targetSpelling`
655
+ // already declares (`JS-1`: catch, then classify — never propagate the host error).
656
+
657
+ /// **THE POSITION A VALUE OCCUPIES** — `surface.md §2.5` item 6 (b): *"the ARGUMENT POSITION for a verb's
658
+ /// arguments, and the MEMBER POSITION for a member inside a value the walk reached"*. `write` is the ONE
659
+ /// verb whose argument is a VALUE (`surface.md §2.2`), so the argument position is `write`'s own `value`
660
+ /// slot; a member the walk reached is named by its PATH from that argument, spelled with `§2.5` item 6 (a)'s
661
+ /// own segment spellings — **a string key SINGLE-QUOTED (`'a'`) and an integer index BARE (`0`), JOINED BY
662
+ /// `/`**, which is the spelling the item declares for a whole address.
663
+ export const VALUE_ARGUMENT_POSITION = "the write's value argument";
664
+
665
+ /// **⟶ AMENDED 2026-10-24 (`contract.md §2.1`'s clause of this date on `F5-4`, items `(4a)`–`(4e)`; the owed
666
+ /// byte is `implementation-plan.md §2` step `4`'s arm `(x)`): THE POSITION SPELLING INVOKES NOTHING TAKEN FROM A
667
+ /// MUTABLE PROTOTYPE.** The block above stands byte-for-byte and is read THROUGH this clause; **the three
668
+ /// segment renderings, the `/` separator, the empty key's `''` and the `member … of …` wrapper are UNMOVED.**
669
+ /// **THE STATE THIS CLOSES:** the shipped limb built the segment list with `path.map(...)` and joined it with
670
+ /// `.join('/')` — `Array.prototype.map` and `Array.prototype.join` taken from a MUTABLE PROTOTYPE — so a
671
+ /// caller's override RAN ON EVERY MEMBER-POSITION REFUSAL and its return value became the POSITION, which is
672
+ /// the package's own diagnostic datum and not a rendering of the value at all (`LIVE-F18`'s second count; the
673
+ /// file's own prohibition restated at `:1136`–`:1137` for `Object.prototype.hasOwnProperty`).
674
+ ///
675
+ /// **THE FORM IS A LOCAL INDEX LOOP AND A LOCAL JOIN — `+=` INTO A `let` STRING.** No `map`, no `join`, no
676
+ /// `forEach`, no `reduce`, and no array or string METHOD taken from a prototype: the same form `Object.hasOwn`
677
+ /// already takes over `hasOwnProperty` at the walk.
678
+ function valuePosition(path) {
679
+ if (path.length === 0) return VALUE_ARGUMENT_POSITION;
680
+ let spelled = '';
681
+ for (let i = 0; i < path.length; i += 1) {
682
+ const segment = path[i];
683
+ let rendered;
684
+ if (typeof segment === 'number') {
685
+ rendered = String(segment);
686
+ } else if (hasLoneSurrogate(segment)) {
687
+ // **A KEY THE MESSAGE MAY NOT CARRY IS NAMED BY ITS CLASS.** A member KEY holding a lone surrogate is
688
+ // the one position this pass refuses whose own spelling cannot cross into the message at all: the
689
+ // code unit has no `String` form a Rust `String` can carry, so the alternatives are a REPAIR (`§1.8`
690
+ // forbids it, `A76`: *"do not attempt to fix"*) or a message that is not a string. **The position is
691
+ // therefore spelled `'<key: a string carrying a lone surrogate>'`, which names the class the key HAS
692
+ // and no byte of it** — the same reading `boundaryReject`'s target half takes at the segment position.
693
+ rendered = "'<key: a string carrying a lone surrogate>'";
694
+ } else {
695
+ rendered = `'${segment}'`;
696
+ }
697
+ spelled += i === 0 ? rendered : `/${rendered}`;
698
+ }
699
+ return `member ${spelled} of ${VALUE_ARGUMENT_POSITION}`;
700
+ }
701
+
702
+ /// **A CONVERSION MEMBER ON THE REFUSED VALUE** — `Symbol.toPrimitive`, `toString` or `valueOf`, OWN on the
703
+ /// value **or reached through a prototype the value supplies** — **read WITHOUT invoking any of them**
704
+ /// (`getOwnPropertyDescriptor` reads a descriptor and never calls a getter, so no user code runs here either).
705
+ ///
706
+ /// **⟶ `contract.md §2.1`'s clause of 2026-10-24 (`docs/defects.md` · `DEF-2026-10-24-D`), items `(1)` and
707
+ /// `(4)`, ARE ITS AUTHORITY: `String(value)` INVOKES THE REFUSED VALUE'S CONVERSION MEMBER, AND A GUARDED
708
+ /// `catch` CANNOT UN-RUN A TRAP THAT RETURNS.** Item `(4)` re-derives **row `3`'s arm and row `8`'s DEPTH
709
+ /// arm conditionally**: each keeps the refused value's own spelling *"read WITHOUT invoking an own
710
+ /// `Symbol.toPrimitive`, `toString` or `valueOf` member of the refused value"*, and **where the refused value
711
+ /// carries such a member the arm answers the CLASS SPELLING — `'a function'` at row `3`, `'a value over the
712
+ /// walk ceiling'` at row `8`'s depth arm**. Item `(1)` states the rule generally (*"NO USER CODE RUNS ON A
713
+ /// REFUSAL PATH"*) and **says which members it means: *"whether that member is OWN on the value or reached
714
+ /// through a prototype the value supplies (a class's own `toString` method is reached exactly that way)"* —
715
+ /// so the own-descriptor read this test was filed as is ONE HALF of item `(1)`, and the chain is the
716
+ /// other.** A value whose `toString` stands on a custom prototype or on a class's own prototype runs that
717
+ /// trap through `String(value)` exactly as an own member does, and a guarded `catch` is as unable to un-run
718
+ /// it.
719
+ ///
720
+ /// **THOSE TWO ARE THE ONLY ARMS THIS TEST CAN REACH WITH AN OBJECT OR A FUNCTION.** Every other rendering
721
+ /// arm carries a primitive (`null` · `undefined` · a `string` · a `boolean`-free `number` · a `bigint` · a
722
+ /// `symbol`) or the class spelling's own string, the `Proxy` arm answers `classSpelling` before this test is
723
+ /// consulted (**a `Proxy`'s descriptor read would run its `getOwnPropertyDescriptor` trap, which is why the
724
+ /// guard stands ABOVE this call**), and the six arms item `(2)` re-derives answer their row's class spelling
725
+ /// without rendering the value at all (`fault.subject`).
726
+ ///
727
+ /// **⟶ AND THE CHAIN WALK STOPS AT THE LANGUAGE'S OWN PROTOTYPES, WHICH IS WHAT KEEPS THE TWO SANCTIONED
728
+ /// RENDERINGS OF ITEM `(4)`'s WITHOUT BRANCH.** An ordinary `{}` reaching `Object.prototype.toString`, an
729
+ /// array reaching `Array.prototype.toString` and a function reaching the standard `Function.prototype.toString`
730
+ /// machinery supply **no member the caller wrote**, so `'[object Object]'`, `'1,2'` and a function's own
731
+ /// source text stay the subject at the BASE of both conditional arms — item `(4)`'s own words for row `3` are
732
+ /// *"read through the standard `Function.prototype.toString` machinery (`String(fn)`'s answer for a function
733
+ /// that carries no conversion member of its own)"*, and a fix that answered the class spelling for an
734
+ /// ordinary value would be an OVER-REFUSAL the law does not declare. **The stop is STRUCTURAL, from the link
735
+ /// and from nothing else** (`isLanguageStandardPrototype` below), so a foreign realm's `Object.prototype`,
736
+ /// `Array.prototype` and `Function.prototype` are recognised on the same terms as this realm's, and a class's
737
+ /// own `toString` — one link above a class's prototype, which is not standard-shaped — is still found.
738
+ const CONVERSION_MEMBER_KEYS = [Symbol.toPrimitive, 'toString', 'valueOf'];
739
+
740
+ /// **ONE LINK'S OWN CONVERSION MEMBER, ASKED BY DESCRIPTOR AND NOTHING ELSE.** No getter is invoked (a
741
+ /// descriptor read does not call one), no `hasOwnProperty` is taken from a mutable prototype, no `Reflect.get`
742
+ /// is spelled on an accessor, and neither `in` nor `for…in` is used (each would reach the CHAIN, which this
743
+ /// walk takes itself so that every link can be classified before it is asked).
744
+ /// **⟶ AND THE KEY LIST IS CONSUMED BY INDEX, NOT THROUGH THE ITERATOR PROTOCOL** (`contract.md §2.1`'s
745
+ /// clause of 2026-10-24 on `F7-1`, items `(1c)(i)`, `(2b)`'s row `33` and `(10b)`): the array of well-known
746
+ /// symbol VALUES is lawful (`(1d)(iii)` — a value read off the `Symbol` binding is not a prototype member),
747
+ /// but `for … of` over it takes `Array.prototype[Symbol.iterator]`, and a caller's forged iterator could stop
748
+ /// the search before the caller's own `toString` was asked.
749
+ /// **⟶ AND EACH OF THE THREE DESCRIPTOR READS IS CHARGED `1`** (`contract.md §2.1`'s clause of 2026-10-24 on
750
+ /// `F7-2`, item `(4c)(i)`, and item `(4e)`'s threading): where the spend is refused the answer is `true` —
751
+ /// "a conversion member stands here" — which is the WITH branch's conservative answer (the class spelling),
752
+ /// so an unpayable read never renders a value.
753
+ function ownsConversionMember(link, allowance) {
754
+ for (let i = 0; i < CONVERSION_MEMBER_KEYS.length; i += 1) {
755
+ if (!spendGuardRead(allowance, 1)) return true;
756
+ if (Object.getOwnPropertyDescriptor(link, CONVERSION_MEMBER_KEYS[i]) !== undefined) return true;
757
+ }
758
+ return false;
759
+ }
760
+
761
+ /// **A PROTOTYPE THE LANGUAGE ITSELF SUPPLIES**, recognised STRUCTURALLY so that no realm's identity and no
762
+ /// prototype census equality is compared: an `Object.prototype`-shaped prototype (`§1`'s `(1)(b)` and
763
+ /// `(1)(c)` — `isStandardObjectPrototype` above), an exotic array standing one link above such a prototype
764
+ /// (any realm's `Array.prototype` IS an array, and `§1`'s `(2)` states its chain), or a callable standing one
765
+ /// link above such a prototype (any realm's `Function.prototype` IS a function). **Its own conversion members
766
+ /// are ECMAScript's machinery and not the caller's code**, so the walk above it STOPS there.
767
+ /// **⟶ AND BOTH ITS SHAPE JUDGEMENTS AND ITS ONE `getPrototypeOf` READ ARE CHARGED TO THE ONE ALLOWANCE**
768
+ /// (`contract.md §2.1`'s clause of 2026-10-24 on `F7-2`, item `(4e)`): every read that decides whether the
769
+ /// walk STOPS here is a read of the budget, so no exemption is granted on reads the caller could not pay for.
770
+ /// Where the spend is refused the answer is `false` — **NOT exempted** — which keeps the conversion search
771
+ /// going (the conservative direction: the WITH branch, the class spelling).
772
+ function isLanguageStandardPrototype(link, allowance) {
773
+ if (isStandardObjectPrototype(link, allowance)) return true;
774
+ if (!Array.isArray(link) && typeof link !== 'function') return false;
775
+ if (!spendGuardRead(allowance, 1)) return false; // ONE `getPrototypeOf` CALL — item `(4c)(ii)`
776
+ const above = Object.getPrototypeOf(link);
777
+ return above !== null && isStandardObjectPrototype(above, allowance);
778
+ }
779
+
780
+ /// **THE VALUE'S CONVERSION MEMBER, ANYWHERE THE CALLER SUPPLIED IT** — own on the value, or owned by any
781
+ /// prototype its chain reaches before the language's own. **A `Proxy` LINK IS NOT ASKED ANYTHING**: a
782
+ /// descriptor read on one runs its `getOwnPropertyDescriptor` trap, so a chain carrying one answers `true`,
783
+ /// which costs the arm its class spelling and runs no handler (`C-1`'s form, at this limb).
784
+ ///
785
+ /// **ITS NAME MOVES WITH THE LAW** — the shipped `carriesOwnConversionMember` read own descriptors only, and
786
+ /// that read is the first test below, not the whole of it.
787
+ ///
788
+ /// **⟶ AND `contract.md §2.1`'s clause of 2026-10-24 ON `F-RA-13`, ITEM `(1a)`, ADDS ONE KEY TO THE LINK
789
+ /// WALK: AN **ADDED** `Symbol.toPrimitive` ON A SHAPE-STANDARD PROTOTYPE IS A CONVERSION PATH THE ARM MAY NOT
790
+ /// TAKE, AND IT IS SEPARATED FROM AN INTRINSIC BY ONE OWN-DESCRIPTOR READ OF THAT KEY PER LINK, TAKEN BEFORE
791
+ /// THE EXEMPTION STOPS THE WALK.** The exemption's carrying test asks NAMES only and no realm's
792
+ /// `Object.prototype`, `Array.prototype` or `Function.prototype` carries an own `Symbol.toPrimitive`, so an
793
+ /// ADDED one left the shape test TRUE, the stop at the language's own prototype exempted the link, and
794
+ /// `String(value)` reached it — ToPrimitive's `@@toPrimitive` lookup being a `[[Get]]` that traverses the
795
+ /// chain. **THIS IS NOT THE REJECTED THREE-KEY ORDERING SWAP** (that clause's item `(6)`): the swap asks all
796
+ /// three keys of every shape-standard link and would withdraw `'[object Object]'`, `'1,2'` and a function's
797
+ /// source text; THIS ASKS ONE KEY and answers "does not carry" for every intrinsic prototype, so item `(2)`'s
798
+ /// three sanctioned renderings stand. **THE WALK CONTINUES PAST THE STOP FOR THIS KEY ALONE** — the
799
+ /// rendering traverses the WHOLE chain for `@@toPrimitive`, so a member added to a link ABOVE a
800
+ /// language-standard one is reached by the rendering just the same — while the `toString`/`valueOf` search
801
+ /// still ends at the language's own machinery, which is item `(7)`'s reading of *"own"* for the one key.
802
+ ///
803
+ /// **⟶ AMENDED 2026-10-24 (`contract.md §2.1`'s clause of this date on `F6-1`, items `(1a)`, `(1c)`, `(1d)`
804
+ /// and `(1f)`): EVERY LINK THIS WALK ENTERS IS CHARGED TO THE ONE PER-CALL POSITION BUDGET.** The block above
805
+ /// stands byte-for-byte and is read THROUGH this clause; **every descriptor read, the shape test, the
806
+ /// exemption's stop, the `Proxy` answer and the guarded `catch` stand unmoved.** The shipped walk was
807
+ /// one-argument and walked its chain link by link to `null` WITH NO CHARGE ANYWHERE, so an element set
808
+ /// multiplying chain traversals re-scaled the very cost the per-call budget was ruled to close (item `(1b)`).
809
+ /// **THE SPEND IS ONE POSITION PER LINK, TAKEN ON ENTRY AND BEFORE THE FIRST READ OF THAT LINK** — through
810
+ /// `spendGuardPosition` below, the one figure `NODE_CEILING` and NO SECOND CEILING — and where the spend is
811
+ /// refused this reader answers `true`, i.e. **"caller code is reachable"**, so the arm takes its class
812
+ /// spelling and nothing is rendered (the WITH branch's conservative answer, un-re-deciding the guard's one
813
+ /// conjunction). **THE ALLOWANCE IS THE CALLER'S AND IS NEVER OPENED HERE:** it is the fresh per-call `budget`
814
+ /// `renderGuardTrips` creates, threaded in by that entry, so no census, chain length or memo is captured and
815
+ /// `C-11` is untouched.
816
+ ///
817
+ /// **⟶ AND EVERY READ THIS WALK TAKES IS CHARGED THE SAME WAY FROM 2026-10-24** (`contract.md §2.1`'s clause
818
+ /// of this date on `F7-2`, items `(4c)` and `(4e)`): one link entered is `1` (already charged on entry), its
819
+ /// `@@toPrimitive` descriptor read is `1`, each descriptor read of `ownsConversionMember` is `1`, every
820
+ /// `getPrototypeOf` call — the value's own and the loop's — is `1`, and the shape judgement's census reads are
821
+ /// `1 + length`. Where a spend is refused every branch answers `true`, **"caller code is reachable"**, which
822
+ /// is the WITH branch's conservative answer and the arm's class spelling.
823
+ function carriesConversionMember(value, allowance) {
824
+ if (value === null || (typeof value !== 'object' && typeof value !== 'function')) return false;
825
+ try {
826
+ if (isProxyOf(value)) return true;
827
+ if (ownsConversionMember(value, allowance)) return true;
828
+ if (!spendGuardRead(allowance, 1)) return true; // the `getPrototypeOf` read below — item `(4c)(ii)`
829
+ let link = Object.getPrototypeOf(value);
830
+ let aboveTheExemption = false;
831
+ while (link !== null) {
832
+ // ONE POSITION PER LINK ENTERED (item `(1c)`), charged BEFORE the read that reached the link, so no
833
+ // chain can be entered unpaid and exhaustion answers "caller code is reachable".
834
+ if (!spendGuardPosition(allowance, 1)) return true;
835
+ if (isProxyOf(link)) return true;
836
+ // ITEM `(1a)`'S READ — ONE KEY, OWN, BY DESCRIPTOR (so no getter is called), BEFORE THE STOP.
837
+ if (!spendGuardRead(allowance, 1)) return true; // ONE descriptor read — item `(4c)(i)`
838
+ if (Object.getOwnPropertyDescriptor(link, Symbol.toPrimitive) !== undefined) return true;
839
+ if (!aboveTheExemption) {
840
+ if (isLanguageStandardPrototype(link, allowance)) {
841
+ // the language's own machinery: the `toString`/`valueOf` search ends here, the `@@toPrimitive`
842
+ // read above does not
843
+ aboveTheExemption = true;
844
+ } else if (ownsConversionMember(link, allowance)) {
845
+ return true;
846
+ }
847
+ }
848
+ if (!spendGuardRead(allowance, 1)) return true; // the loop's `getPrototypeOf` — item `(4c)(ii)`
849
+ link = Object.getPrototypeOf(link);
850
+ }
851
+ return false;
852
+ } catch {
853
+ // **A CHAIN THAT CANNOT BE READ ANSWERS `true`** — the arm takes its class spelling, the rendering is not
854
+ // attempted, and the guarded `catch` that stands beside this call in `valueTargetSpelling` is not needed.
855
+ return true;
856
+ }
857
+ }
858
+
859
+ /// **⟶ `contract.md §2.1`'s clause of 2026-10-24 ON `F-RA-13`, ITEM `(1b)`: AN OWN OR ADDED
860
+ /// `Symbol.toStringTag` MEMBER IS THE RENDER GUARD'S SECOND TEST.** `Object.prototype.toString` reads
861
+ /// `@@toStringTag` off the refused value — a `[[Get]]` that traverses the chain — so an own `@@toStringTag`
862
+ /// ACCESSOR is INVOKED at row `8`'s depth arm (a value the walk refused on ENTRY, above the shape arm that
863
+ /// would have refused an own accessor) and an ADDED one on a shape-standard prototype is reached the same
864
+ /// way. **THE READ IS TAKEN FOR THE KEY AND NOT MERELY FOR THE ACCESSOR BIT, DELIBERATELY**: a DATA
865
+ /// `@@toStringTag` member would move the SUBJECT (`String({ [Symbol.toStringTag]: 'X' })` is `'[object X]'`),
866
+ /// and a subject that depends on a caller's data is not the declared form — the accessor case is the no-run
867
+ /// case and the data case is the determinism case, and ONE descriptor read answers both. **NO ADMISSION
868
+ /// MOVES**: a value carrying an own `Symbol`-keyed member is refused at its own position as row `5` already,
869
+ /// and at row `8`'s depth arm it is refused as row `8` regardless. **NO REALM'S INTRINSIC PROTOTYPE CARRIES
870
+ /// AN OWN `@@toStringTag`**, so the read answers "absent" for every intrinsic chain and item `(2)`'s
871
+ /// renderings stand.
872
+ ///
873
+ /// **⟶ AND THIS WALK IS CHARGED THE SAME WAY** (`contract.md §2.1`'s clause of 2026-10-24 on `F6-1`, items
874
+ /// `(1c)`, `(1d)` and `(1f)`): **ONE POSITION PER LINK ENTERED, SPENT ON ENTRY AND BEFORE THE FIRST READ OF
875
+ /// THAT LINK**, from the SAME per-call allowance `carriesConversionMember` above spends — so the two walks an
876
+ /// element costs are both paid from the one figure, and where a spend is refused this reader answers `true`
877
+ /// (the WITH branch, the class spelling). The descriptor reads, the `Proxy` answer and the guarded `catch`
878
+ /// stand unmoved.
879
+ function carriesTagMember(value, allowance) {
880
+ if (value === null || (typeof value !== 'object' && typeof value !== 'function')) return false;
881
+ try {
882
+ if (isProxyOf(value)) return true; // a descriptor read on a `Proxy` would run a trap
883
+ // **⟶ AND EVERY READ IS CHARGED, AS THE SIBLING WALK'S ARE** (`contract.md §2.1`'s clause of 2026-10-24 on
884
+ // `F7-2`, items `(4c)` and `(4e)`): each `@@toStringTag` descriptor read is `1` and each `getPrototypeOf`
885
+ // call is `1`; a refused spend answers `true` (the WITH branch, the class spelling).
886
+ if (!spendGuardRead(allowance, 1)) return true; // ONE descriptor read — item `(4c)(i)`
887
+ if (Object.getOwnPropertyDescriptor(value, Symbol.toStringTag) !== undefined) return true;
888
+ if (!spendGuardRead(allowance, 1)) return true; // the value's `getPrototypeOf` — item `(4c)(ii)`
889
+ let link = Object.getPrototypeOf(value);
890
+ while (link !== null) {
891
+ // ONE POSITION PER LINK ENTERED (item `(1c)`), before the read that reached the link.
892
+ if (!spendGuardPosition(allowance, 1)) return true;
893
+ if (isProxyOf(link)) return true;
894
+ if (!spendGuardRead(allowance, 1)) return true; // ONE descriptor read — item `(4c)(i)`
895
+ if (Object.getOwnPropertyDescriptor(link, Symbol.toStringTag) !== undefined) return true;
896
+ if (!spendGuardRead(allowance, 1)) return true; // the loop's `getPrototypeOf` — item `(4c)(ii)`
897
+ link = Object.getPrototypeOf(link);
898
+ }
899
+ return false;
900
+ } catch {
901
+ return true;
902
+ }
903
+ }
904
+
905
+ /// **⟶ `contract.md §2.1`'s clause of 2026-10-24 ON `F-RA-13`, ITEM `(1c)`: THE ARRAY-ELEMENT LIMB.** At row
906
+ /// `8`'s DEPTH arm the refused value may be an ARRAY, and `Array.prototype.toString` calls `join`, which takes
907
+ /// each element by `[[Get]]` and CONVERTS it — **so the elements' conversion members run, and the walk never
908
+ /// classified those elements, the element loop lying BELOW the arm.** **EVERY OWN INDEX IS READ BY
909
+ /// DESCRIPTOR**, so an own ACCESSOR at an index answers the class spelling and ITS GETTER NEVER RUNS, and
910
+ /// **EVERY DATA ELEMENT IS SUBJECTED TO THE SAME RENDER GUARD** the refused value itself is put to — an
911
+ /// element's `ToString` is a rendering as the value's `String` is, so one guard governs both and a test that
912
+ /// asked only `carriesConversionMember` would leave an added `Symbol.toPrimitive` on a standard prototype
913
+ /// running for an OBJECT element. **WHERE EVERY ELEMENT IS A PRIMITIVE** — or an object whose conversion and
914
+ /// tag members sit only on an intrinsic prototype — no guard is tripped and the sanctioned `'1,2'` renders.
915
+ /// **⟶ AMENDED 2026-10-24 (`contract.md §2.1`'s clause of that date on `F-RA-20`, items `(b)`, `(c)` and
916
+ /// `(d)`): THE REPEAT TEST IS THE CURRENT PATH AND NOT A VISITED SET.** The block above stands byte-for-byte
917
+ /// and is read THROUGH this clause; **the descriptor reads, the accessor answer, the element guard and the
918
+ /// `try` all stand unmoved.** The second parameter is a PATH — the list of arrays the walk is CURRENTLY
919
+ /// reading, extended by `[...path, value]` (the file's own idiom at the ancestor stack's `[...ancestors,
920
+ /// value]`) — so `seen.has` becomes a membership test on that path and `seen.add` becomes the append. **A
921
+ /// CYCLE STILL TRIPS** — a self-containing array is ON the path when its own element is read, so the
922
+ /// membership test answers at the repeat and the arm reaches its class spelling DETERMINISTICALLY rather
923
+ /// than through a stack-overflow `catch` — **while an ALIAS DOES NOT**: a sub-value the same parent holds
924
+ /// twice is on no path when either occurrence is read, and rendering it twice runs the same code twice and
925
+ /// reaches no member the first read did not (item `(b)`: an alias is neither a cycle nor caller code, and
926
+ /// `§4`'s clause on `F-RA-4` already declares the walk's *"ancestor stack and never a visited set"*).
927
+ ///
928
+ /// **⟶ AMENDED 2026-10-24 (`contract.md §2.1`'s clause of this date on `F5-1` and `F5-2`, items `(1b)`, `(1c)`,
929
+ /// `(1d)`, `(1f)` and `(2)`; the owed byte is `implementation-plan.md §2` step `4`'s arm `(viii)`): THE GUARD'S
930
+ /// WORK IS BOUNDED PER CALL.** The block above stands byte-for-byte and is read THROUGH this clause; **the
931
+ /// descriptor reads, the accessor answer, the `Proxy` answer, the non-array answer, the hole's `continue` and the
932
+ /// guarded `catch` all stand unmoved.** **THE COST IT CLOSES, WITH BOTH WITNESSES:** the path test alone walks a
933
+ /// shared sub-value ONCE PER POSITION IT OCCUPIES, so `let v = [1]; for (i < 40) v = [v, v];` costs `~2^40`
934
+ /// visits (measured at this tree: depth `16` = `174` ms, depth `20` = `2,578` ms, depth `24` = `40,945` ms, and
935
+ /// depth `40` did not answer inside `7` seconds); and the element limb scanned the WHOLE `length`, so
936
+ /// `new Array(4294967295)` cost `~4.29×10^9` descriptor reads (also killed at `7` seconds). **Neither ceiling of
937
+ /// `§4` counted either, because the refused subtree is never walked.**
938
+ ///
939
+ /// **THE THREE LIMBS, EACH AS ITEM `(1b)` STATES IT:**
940
+ /// (i) **THE TRIP IS THE PATH TEST, TAKEN FIRST** — an ancestor on the current path trips (a cycle), a value
941
+ /// off it does not (an alias).
942
+ /// (ii) **THE COST IS A PER-CALL MEMO CONSULTED ONLY AFTER THE PATH TEST** — a repeat answers `false` (the
943
+ /// answer its first occurrence gave, which is the only answer a still-scanning frame can have produced)
944
+ /// and ITS OWN POSITION COUNT IS CHARGED, so an aliased DAG is counted per position and the memo cannot
945
+ /// be used to evade the budget. **The memo is a COST device and never a trip decision** (item `(1b)`).
946
+ /// (iii) **A PER-CALL POSITION BUDGET OF `NODE_CEILING` — `1,000,000` — AND THE CLASS SPELLING WHEN IT IS
947
+ /// SPENT** (item `(1d)`: the crossing's own figure, no third ceiling minted). Positions are counted `§8`
948
+ /// row `8`'s way — one per position the walk would visit, an alias counted per position — and **the
949
+ /// element limb's descriptor reads spend the SAME budget**, so no `length` the walk would never have
950
+ /// walked is ever scanned (item `(2)(b)`). **ON EXHAUSTION THE GUARD ANSWERS "CALLER CODE IS REACHABLE"**
951
+ /// — the WITH branch — so the arm answers its class spelling and renders nothing.
952
+ ///
953
+ /// **A HOLE IS NOT A TRIP AND IS NOT MADE ONE** (item `(1f)`): `'1,,3'`'s declared rendering survives because a
954
+ /// missing descriptor still `continue`s; only the budget bounds the sparse limb. **AND THE BUDGET IS FRESH PER
955
+ /// CALL** — created at `renderGuardTrips`'s own entry, never per element and never module-level, so no census is
956
+ /// cached across calls and `C-11`'s no-frozen-prototype-fact rule is untouched.
957
+ ///
958
+ /// **⟶ AND NOTHING THIS LIMB DOES IS TAKEN FROM A MUTABLE PROTOTYPE** (`contract.md §2.1`'s clause of
959
+ /// 2026-10-24 on `F7-1`, items `(1c)`, `(2b)`'s rows `18`, `24` and `26`, and `(10b)`: *"`Array.prototype.includes
960
+ /// = () => false` currently misses a **cycle** and the walk dies in a raw host `RangeError`"*). **Three sites,
961
+ /// one class:**
962
+ /// * **THE PATH TEST IS A LOCAL LOOP** (`(1c)(vi)`'s spelled `===`), not `path.includes(value)` — a forged
963
+ /// `includes` answering `false` un-detected the cycle, the recursion re-entered the ancestor and the host
964
+ /// stopped the process instead of the arm answering its class spelling;
965
+ /// * **THE PATH EXTENSION IS A LOCAL INDEX LOOP**, not `[...path, value]` — an array spread consumes the
966
+ /// path through `Array.prototype[Symbol.iterator]`;
967
+ /// * **THE MEMO IS A PAIR LIST READ BY INDEX**, not a `Map` — `Map.prototype.get` was the repeat's whole
968
+ /// cost decision (item `(2b)`'s rows `23` and `24`; the measured states are the battery's row `(d)`).
969
+ function arrayElementsReachCallerCode(value, path, allowance) {
970
+ if (value === null || typeof value !== 'object') return false;
971
+ try {
972
+ if (isProxyOf(value)) return true;
973
+ if (!Array.isArray(value)) return false;
974
+ // AN ANCESTOR ON THE CURRENT PATH IS A CYCLE, NOT AN ALIAS — asked by a local loop over the datum's own
975
+ // indices, never by `Array.prototype.includes`.
976
+ //
977
+ // **⟶ AND THE SCAN IS CHARGED `1` PER ENTRY THE PATH CARRIES, BEFORE IT IS TAKEN** (`contract.md §2.1`'s
978
+ // clause of 2026-10-24 on `F8-3`, items `(3c)`'s term `(ix)` and `(3d)`): the path test performs one spelled
979
+ // `===` per entry and it is CALLER-SCALED — a shared sub-value walks it once per position it occupies — so
980
+ // an uncharged scan was a caller-set price for a sanctioned rendering. **The spend answers "caller code is
981
+ // reachable" where it is refused**, exactly as the limb's other spends do (`:1618` · `:1638`).
982
+ if (!spendGuardRead(allowance, path.length)) return true;
983
+ let onPath = false;
984
+ for (let i = 0; i < path.length; i += 1) {
985
+ if (path[i] === value) {
986
+ onPath = true;
987
+ break;
988
+ }
989
+ }
990
+ if (onPath) return true;
991
+ // (iii) THE ARRAY'S OWN POSITION, SPENT BEFORE ANY READ.
992
+ if (!spendGuardPosition(allowance, 1)) return true;
993
+ // (ii) THE MEMO, CONSULTED ONLY AFTER THE PATH TEST, AND THE REPEAT'S OWN COUNT IS CHARGED.
994
+ //
995
+ // **⟶ AND THE CONSULTATION IS CHARGED `1 + memo.length`, BEFORE ITS SCAN** (`contract.md §2.1`'s clause of
996
+ // 2026-10-24 on `F8-3`, items `(3c)`'s term `(viii)` and `(3d)`): the scan performs one spelled `===` per
997
+ // RECORDED ENTRY and `memo` grows by one entry per DISTINCT leaf, so `~125,000` distinct leaves were
998
+ // `1 + 2 + … + 125,000 ≈ 7.8×10⁹` UNCHARGED identity comparisons inside ONE `1,000,000`-unit call — the
999
+ // guard was bounded in positions and unbounded in reads. **CHARGED, the budget exhausts near the `1,400`th
1000
+ // distinct leaf and the arm answers its class spelling without taking the scan; `NODE_CEILING` stays the
1001
+ // ONE per-call figure, created once per `renderGuardTrips` call, and no second ceiling is minted.**
1002
+ const memo = allowance.memo;
1003
+ if (!spendGuardRead(allowance, 1 + memo.length)) return true;
1004
+ let recorded = null;
1005
+ for (let i = 0; i < memo.length; i += 1) {
1006
+ if (memo[i].value === value) {
1007
+ recorded = memo[i];
1008
+ break;
1009
+ }
1010
+ }
1011
+ if (recorded !== null) {
1012
+ if (!spendGuardPosition(allowance, recorded.positions)) return true;
1013
+ return recorded.answer;
1014
+ }
1015
+ const positionsBefore = allowance.positions;
1016
+ // **⟶ AND THE COPY IS THE PATH'S SECOND CHARGED LIMB: `1` PER ENTRY IT CARRIES** (`contract.md §2.1`'s
1017
+ // clause of 2026-10-24 on `F8-3`, items `(3c)`'s term `(ix)` and `(3d)`): `extendedPath` copies one entry per
1018
+ // path entry and that loop was charged nothing. **BOTH limbs are charged** — charging only the copy would
1019
+ // leave the caller-scaled TEST at `0`, which is the loop the finding measures.
1020
+ if (!spendGuardRead(allowance, path.length)) return true;
1021
+ const next = extendedPath(path, value);
1022
+ const length = value.length; // an exotic array's own data property: no getter is reached here
1023
+ for (let i = 0; i < length; i += 1) {
1024
+ // THE DESCRIPTOR READ THIS LIMB PERFORMS IS ONE POSITION OF THE ONE BUDGET (item `(2)(b)`), so a
1025
+ // `length` no walk would have walked spends itself out instead of being scanned.
1026
+ if (!spendGuardPosition(allowance, 1)) return true;
1027
+ const descriptor = Object.getOwnPropertyDescriptor(value, i);
1028
+ if (descriptor === undefined) continue; // a hole: `join` converts nothing there
1029
+ if (descriptor.get !== undefined || descriptor.set !== undefined) return true;
1030
+ if (renderGuardTrips(descriptor.value, next, allowance)) return true;
1031
+ }
1032
+ appendOwn(memo, { value, answer: false, positions: positionsBefore - allowance.positions });
1033
+ return false;
1034
+ } catch {
1035
+ return true;
1036
+ }
1037
+ }
1038
+
1039
+ /// **ONE MORE SEGMENT ON A PATH, BUILT BY A LOCAL INDEX LOOP** — items `(1c)(i)` and `(1c)(v)`: the copy reads
1040
+ /// the path's own indices and writes the extension's own index, so no array spread and no iterator is reached.
1041
+ export function extendedPath(path, segment) {
1042
+ const next = [];
1043
+ for (let i = 0; i < path.length; i += 1) appendOwn(next, path[i]);
1044
+ appendOwn(next, segment);
1045
+ return next;
1046
+ }
1047
+
1048
+ /// **ONE SPEND AGAINST THE PER-CALL POSITION BUDGET** — answers `true` where the spend is covered and `false`
1049
+ /// where it would overdraw, so the caller that receives `false` answers "caller code is reachable" and the arm
1050
+ /// takes its class spelling (item `(1d)`). **THE FIGURE IS `NODE_CEILING` AND NO SECOND CONSTANT IS MINTED**
1051
+ /// (`contract.md §2.1`'s clause of 2026-10-24 on `F5-1`, item `(1d)`); the allowance itself is created once per
1052
+ /// call of `renderGuardTrips` below.
1053
+ function spendGuardPosition(allowance, positions) {
1054
+ if (positions > allowance.positions) {
1055
+ allowance.positions = 0;
1056
+ return false;
1057
+ }
1058
+ allowance.positions -= positions;
1059
+ return true;
1060
+ }
1061
+
1062
+ /// **⟶ ONE READ SPENT AGAINST THE SAME ONE PER-CALL ALLOWANCE — `contract.md §2.1`'s clause of 2026-10-24 on
1063
+ /// `F7-2`, items `(4c)`, `(4e)` and `(10e)`, item `(4c)`'s unit being EXHAUSTIVE**, AND RE-DERIVED TO ITS
1064
+ /// **ELEVEN** TERMS BY THIS SECTION'S CLAUSE OF `2026-10-24` ON `F8-3`, ITEM `(3c)` (arm `(xvii)` widened,
1065
+ /// cell `JC-TC-67`), EACH WITH THE SITE THAT TAKES IT: **(i)** one `Object.getOwnPropertyDescriptor` call is
1066
+ /// `1`; **(ii)** one `Object.getPrototypeOf` call is `1`; **(iii)** an own-NAME census read is
1067
+ /// `1 + the length of the list it returns`; **(iv)** an own-SYMBOL census read is `1 + the length of the list
1068
+ /// it returns`; **(v)** an element index read is `1`, charged where it is taken through `spendGuardPosition`;
1069
+ /// **(vi)** a link entered is `1`, charged by the chain loops' own spends; **(vii)** a memo HIT is the
1070
+ /// repeat's recorded count; **(viii) a MEMO CONSULTATION is `1 + memo.length`** — charged before its scan at
1071
+ /// `arrayElementsReachCallerCode`, because the scan performs one spelled `===` per recorded entry and the memo
1072
+ /// grows by one entry per distinct leaf; **(ix) THE PATH IS `1` PER ENTRY IT CARRIES, CHARGED AT BOTH LIMBS —
1073
+ /// THE TEST'S SCAN AND THE COPY** (`extendedPath`'s call site), the scan being charged because it is the
1074
+ /// caller-scaled loop the finding measures; **(x)** an allocation and a `typeof` are `0`; and **(xi) AN
1075
+ /// IDENTITY COMPARE AND A SPELLED RELATIONAL COMPARISON ARE `0` ONLY WHERE THEY ARE NOT ONE OF TERMS `(viii)`
1076
+ /// AND `(ix)`.** **NO SECOND FIGURE IS MINTED** — `NODE_CEILING` (`1,000,000`) stays the one per-call
1077
+ /// budget, created once per `renderGuardTrips` call — and **exhaustion is NOT a trip decision**: a caller that
1078
+ /// receives `false` answers the WITH branch's conservative answer (item `(1d)`), exactly as
1079
+ /// `spendGuardPosition` already rules. **A CALLER THAT CARRIES NO ALLOWANCE IS THE WALK, WHICH COUNTS NODES**
1080
+ /// (`encodeValue`'s own ceiling), so the charge is skipped there and no admission moves.
1081
+ function spendGuardRead(allowance, reads) {
1082
+ if (allowance === null || allowance === undefined) return true;
1083
+ return spendGuardPosition(allowance, reads);
1084
+ }
1085
+
1086
+ // ⟶ CARVED UP 2026-10-24 (`D-2`/`D-33`): `NODE_CEILING` is the walk's own in the file of record
1087
+ // (`index.mjs:1945`) and stands here because `renderGuardTrips` reads it while the walk's encoders read this part's
1088
+ // predicates — the one class-decision ↔ walk edge the re-issued DAG does not carry. Value and readers unchanged.
1089
+ export const NODE_CEILING = 1_000_000;
1090
+
1091
+ /// **THE RENDER GUARD'S THREE TESTS, AS `contract.md §2.1`'s clause of 2026-10-24 ON `F-RA-13`, ITEM `(6)`,
1092
+ /// STATES THEM: the WITH branch is taken where they do not all answer "no caller code"** — `(1a)`'s
1093
+ /// `Symbol.toPrimitive` descriptor read (inside `carriesConversionMember` above), `(1b)`'s
1094
+ /// `Symbol.toStringTag` descriptor read, and `(1c)`'s element reads. Every one of the three is a READ of a
1095
+ /// descriptor or a per-call walk, so `C-11`'s no-frozen-prototype-fact rule is untouched: no identity is
1096
+ /// captured, no census is cached and no intrinsic is compared.
1097
+ ///
1098
+ /// **⟶ AND ITS ENTRY IS WHERE THE ONE ALLOWANCE IS OPENED** (`contract.md §2.1`'s clause of 2026-10-24 on
1099
+ /// `F5-1`, item `(1b)(iii)`): a FRESH `NODE_CEILING` position budget and a FRESH empty memo per call — the
1100
+ /// carrier slot reaches that entry through the guard call below, and the value arm through
1101
+ /// `valueTargetSpelling` — so no allowance is shared between calls and none stands at module level. **An
1102
+ /// `allowance` is threaded in only by the recursion inside `arrayElementsReachCallerCode`, which passes its
1103
+ /// own call's allowance down.**
1104
+ ///
1105
+ /// **⟶ AND FROM 2026-10-24 THE SAME `budget` IS HANDED TO ALL THREE TEST CALLS, THE TWO CHAIN WALKS
1106
+ /// INCLUDED** (`contract.md §2.1`'s clause of this date on `F6-1`, items `(1c)` and `(1d)`): every read the
1107
+ /// guard performs is charged to the one per-call allowance — the array's own position, each index the element
1108
+ /// limb reads, and every link each chain walk enters, per element and for the refused value itself — so no
1109
+ /// call site is left uncharged and no chain can be entered unpaid. **THE FIGURE STAYS `NODE_CEILING` AND NO
1110
+ /// SECOND CEILING IS MINTED**, the allowance stays fresh per call, and exhaustion answers "caller code is
1111
+ /// reachable" at each limb (the WITH branch, the class spelling).
1112
+ function renderGuardTrips(value, path = [], allowance = null) {
1113
+ // **⟶ AND THE MEMO IS A PAIR LIST, NOT A `Map`** (`contract.md §2.1`'s clause of 2026-10-24 on `F7-1`,
1114
+ // items `(2b)`'s rows `23` and `24` and `(10c)`): `Map.prototype.get`/`set` are mutable-prototype members
1115
+ // by item `(1d)(iv)`, and the battery's row `(d)` measures the two answers they gave — a forged `get`
1116
+ // answering a recorded "no caller code" and a no-op `set` — each of which decided a rendered subject.
1117
+ const budget = allowance === null ? { positions: NODE_CEILING, memo: [] } : allowance;
1118
+ return carriesConversionMember(value, budget)
1119
+ || carriesTagMember(value, budget)
1120
+ || arrayElementsReachCallerCode(value, path, budget);
1121
+ }
1122
+
1123
+ /// **THE FAILING TARGET AT A VALUE POSITION, RENDERED AS THE STORE'S GENERATOR RENDERS IT** —
1124
+ /// `surface.md §2.5` item 6 (a). **ITS ONE EXAMPLE THAT DIFFERS FROM A CARRIER'S TARGET IS THE SYMBOL**: a
1125
+ /// symbol's own value carries the caller's DESCRIPTION, and the item's own example prints the CLASS's
1126
+ /// canonical token `Symbol()`, which is the spelling this arm carries. Every other target is printed as its
1127
+ /// own value, guarded exactly as `targetSpelling` guards its read.
1128
+ ///
1129
+ /// **⟶ AMENDED 2026-10-24 (`DEF-2026-10-24-D`; `contract.md §2.1`'s clause of that date, items `(1)`,
1130
+ /// `(4)` and `(6)`): `String(value)` IS WITHDRAWN AS A SUBJECT SOURCE AT EVERY ARM WHOSE SUBJECT IS THE
1131
+ /// REFUSED VALUE'S OWN RENDERING AND THE VALUE CARRIES A CONVERSION MEMBER.** The block above stands
1132
+ /// byte-for-byte and is read THROUGH this clause; **its four named substitutions are UNMOVED** — a
1133
+ /// `bigint`'s `` n ``, a `symbol`'s `Symbol()`, a `Proxy`'s class spelling and a lone-surrogate string's class
1134
+ /// spelling — and item `(6)` reads them byte-identical. **WHAT MOVES IS ONE TEST, INSERTED AFTER THE PROXY
1135
+ /// GUARD AND BEFORE `String(value)`:** a `Symbol.toPrimitive`/`toString`/`valueOf` member the refused value
1136
+ /// carries answers the ROW'S OWN CLASS SPELLING, which the walk hands in as `rowClass` (`fault.found`), and no
1137
+ /// conversion member is invoked. **THE GUARDED `catch` BELOW STANDS AS THE FALLBACK FOR A RENDERING THAT
1138
+ /// THROWS** (item `(4)`'s closing sentence, and item `(5)` item `(e)`'s list of its answers). **AND THE
1139
+ /// MEMBER IS SOUGHT WHERE ITEM `(1)` SAYS IT STANDS — *"whether that member is OWN on the value or reached
1140
+ /// through a prototype the value supplies"* — so `carriesConversionMember` above walks the chain and stops at
1141
+ /// the language's own prototypes**, which is what keeps this arm's WITHOUT branch (`'[object Object]'`, a
1142
+ /// function's source text, `'1,2'`) reachable for a value whose only conversion member is
1143
+ /// `Object.prototype.toString` or the standard `Function.prototype.toString` machinery.
1144
+ export function valueTargetSpelling(value, rowClass) {
1145
+ try {
1146
+ if (typeof value === 'bigint') return `${value}n`;
1147
+ if (typeof value === 'symbol') return 'Symbol()';
1148
+ // **⟶ AND A PROXY IS NEVER COERCED HERE EITHER — `C-1`'s THIRD HALF, CLOSED AT THIS ARM 2026-10-23 BY
1149
+ // THE GATE-4 ADVERSARIAL BATTERY (`json-crossing-gate4-adversarial.test.mjs`'s `ADV-03`/`ADV-05`/`ADV-06`).**
1150
+ // The `targetSpelling` guard stood at the CARRIER arm; this VALUE arm lacked it, so a refused `Proxy`
1151
+ // reached `String(value)` and its `Symbol.toPrimitive`/`toString` GET TRAP RAN — the very trap the walk's
1152
+ // `util.types.isProxy` refusal exists to avoid — even though a throwing trap was caught by the `catch`
1153
+ // below. **THE CLASS IS READ WITH `util.types.isProxy` ALONE AND NO TRAP RUNS**, exactly as
1154
+ // `targetSpelling` does at its own arm.
1155
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null && isProxyOf(value)) {
1156
+ return classSpelling(value);
1157
+ }
1158
+ // **AND A TARGET THE MESSAGE MAY NOT CARRY IS NAMED AS ITS OWN CLASS RATHER THAN AS ITS BYTES**: a string
1159
+ // carrying a LONE SURROGATE is the one value this pass refuses whose code unit has no `String` form at
1160
+ // all, so printing it would REQUIRE the repair `§1.8` forbids (`A76`: *"do not attempt to fix"*). **The
1161
+ // class half is mandatory (item 6 (b)); the byte half is the one datum no clause requires here.**
1162
+ if (typeof value === 'string' && hasLoneSurrogate(value)) return 'a string carrying a lone surrogate';
1163
+ // **`§2.1`'s clause of 2026-10-24, item `(4)` — NO CONVERSION MEMBER OF THE REFUSED VALUE IS INVOKED.**
1164
+ // Where the value carries one — OWN, or reached through a prototype it supplies (item `(1)`'s own
1165
+ // parenthesis) — the arm answers the row's own class spelling (`'a function'` at row `3`, `'a value over
1166
+ // the walk ceiling'` at row `8`'s depth arm), which is the string the walk recorded as the class — so
1167
+ // `String(value)` below never runs for such a value and the trap is not merely caught, it is not reached.
1168
+ // **⟶ AND THE TEST IS THE RENDER GUARD'S THREE TESTS, NOT ONE OF THEM** (`contract.md §2.1`'s clause of
1169
+ // 2026-10-24 on `F-RA-13`, item `(6)`): item `(1a)`'s added-`Symbol.toPrimitive` read, item `(1b)`'s
1170
+ // `Symbol.toStringTag` descriptor read and item `(1c)`'s array-element reads each answer "caller code is
1171
+ // reachable" here, and where any does, this arm answers the row's class spelling and renders nothing.
1172
+ // **⟶ AND WHERE NO ROW CLASS IS SUPPLIED THE ANSWER IS THE VALUE'S OWN CLASS SPELLING**
1173
+ // (`contract.md §2.1`'s clause of 2026-10-24 on `F-RA-18`, items `(c)` and `(e)`): **AT A CARRIER POSITION
1174
+ // THE SUBJECT IS THAT POSITION'S OWN DECLARED DESCRIPTOR, NEVER `undefined`.** The VALUE arm hands the
1175
+ // row's own class in from the walk's record (`:1381`), and the ONE-ARGUMENT carrier call at `:2334`
1176
+ // supplies none because a CARRIER refusal declares no row class — `§2`'s seventeen rows are the WALK's —
1177
+ // so an address carrying a conversion or tag member rendered the eleven characters `'undefined'` where
1178
+ // the caller's own rendering stood. **The fallback is `classSpelling(value)`, exactly the byte the
1179
+ // guarded `catch` below already answers for a rendering that throws**, so this arm has ONE fallback rather
1180
+ // than two and no call site can print garbage. Nothing else moves: the two substitutions above, the Proxy
1181
+ // guard, `String(value)` below, the `catch` and the value arm's two-argument call all stand unmoved.
1182
+ if (renderGuardTrips(value)) return rowClass === undefined ? classSpelling(value) : rowClass;
1183
+ return String(value);
1184
+ } catch {
1185
+ // The rendering THREW (a `valueOf`/`Symbol.toPrimitive`/`Proxy` trap): the CLASS spelling is the
1186
+ // declared fallback, because the reason's class half is mandatory (item 6 (b)) and nothing escapes.
1187
+ return classSpelling(value);
1188
+ }
1189
+ }
1190
+
1191
+ /// **A REFUSAL THE WALK PRODUCED AT A VALUE POSITION, ANSWERED IN THE ONE FORM — VERBOSELY.** `§1.8`'s dated
1192
+ /// clause 1: *"AT A VALUE POSITION — a member of a value the WALK meets, or the written value itself — the
1193
+ /// class is `NonPlainCollection` and the code is that class's own `ValueNotAdmitted` … PRODUCED AT THE
1194
+ /// WALK"*. The status is the store's own member token and is never minted here (`DD-40`); PART ONE is the
1195
+ /// store's generator's bytes at the failing target's own spelling; PART TWO — the class that failed and the
1196
+ /// position the contract declares for it — is appended (`CF-3`). `write` is this helper's ONE caller, and it
1197
+ /// calls it at the ONE site where the store answered `ValueNotAdmitted` for a value the walk had refused.
1198
+ ///
1199
+ /// **⟶ AMENDED 2026-10-23 (THE GATE-3 PROOFREADING PASS, `role_proofreader`; `RCA-8(g)`): THE CODE IS
1200
+ /// `ValueRefusedAtBoundary` AND IT IS ANSWERED BEFORE ANY STORE VERB IS CALLED.** The block above stands
1201
+ /// byte-for-byte and is read THROUGH this clause, on exactly two of its terms: *"the code is that class's own
1202
+ /// `ValueNotAdmitted`"* is read as the boundary refusal's status **`ValueRefusedAtBoundary`** — the store's
1203
+ /// rank-`17` member, minted by the store's closed set (`docs/specs/storeroom-native/contract.md` `§8.1`, its
1204
+ /// amendment of 2026-10-23) and SELECTED by the package, which mints neither the status nor its code — and
1205
+ /// *"it calls it at the ONE site where the store answered `ValueNotAdmitted` for a value the walk had
1206
+ /// refused"* is read as **the PRE-VERB site**: `write` checks the walk's recorded fault — the statement
1207
+ /// `if (fault.found !== null) valueReject(fault);` — and this helper throws THERE, ahead of the entry call
1208
+ /// `entryOf().write.call(this, …)`, so THE STORE ANSWERS NOTHING HERE AND NEVER RECEIVES THE REFUSED TREE.
1209
+ /// **THE TWO SITES' POSITIONS IN THIS FILE: the fault check at `:2439` and the entry call at `:2454`** —
1210
+ /// `:2391` and `:2406` are where the gate-4 audit read them, the difference being this pass's own inserted
1211
+ /// comment lines and nothing else. PART ONE (the store generator's bytes at the failing target's own spelling),
1212
+ /// PART TWO (class and position appended, `CF-3`) and `DD-40` stand unmoved.
1213
+ /// `[A2 docs/decisions.md · `A148` (Q3); docs/specs/storeroom-native/contract.md §8.1 — its 2026-10-23
1214
+ /// amendment, rank `17`, *"the store never receives those values on the JavaScript route"*; A1
1215
+ /// bindings/js/index.mjs:2439 · :2454 | requirement]`
1216
+ /// **⟶ AMENDED 2026-10-24 (`DEF-2026-10-24-D`; `contract.md §2.1`'s clause of that date, items `(1)`–`(3)`
1217
+ /// and `(7)`): THE SUBJECT IS THE WALK'S OWN RECORD WHEN THE ARM DECLARED ONE, AND THE REFUSED VALUE IS NOT
1218
+ /// RENDERED AT THE SIX ARMS THAT CLAUSE RE-DERIVES.** The block above stands byte-for-byte and is read THROUGH
1219
+ /// this clause; **PART ONE's fixed bytes, the generator's single quoting, PART TWO and the status are
1220
+ /// unmoved.** **`fault.subject` IS THE WALK'S DECLARED SUBJECT AND IS `null` AT EVERY ARM THAT RENDERS ITS
1221
+ /// TARGET**: where the walk set it — rows `5`, `11`, `13`, `14`, `15` and `16`, item `(2)` — PART ONE opens on
1222
+ /// the CLASS SPELLING that row's own row carries, so at those six arms the subject and PART TWO's class are the
1223
+ /// SAME STRING and the message names the row's class twice (item `(3)`: the declared form, and not a defect).
1224
+ /// **THE TARGETS THE WALK HANDS (`fault.value`) ARE UNMOVED AT ALL SIX — the containing value at rows `5` and
1225
+ /// `15`, the repeated ancestor at `11`, the instance at `13` and `14`, the array at `16` — only the RENDERING
1226
+ /// of them is withdrawn** (item `(2)`), and `valueTargetSpelling` is the rendering for every other arm.
1227
+ export function valueReject(fault) {
1228
+ boundaryReject(
1229
+ 'ValueRefusedAtBoundary', // A148 Q3's rank-17 member, carried and never minted (`DD-40`)
1230
+ fault.subject === null ? valueTargetSpelling(fault.value, fault.found) : fault.subject,
1231
+ `the value at ${valuePosition(fault.path)} is ${fault.found}`,
1232
+ );
1233
+ }
1234
+
1235
+ /// **THE CLASS THE SHAPE ARMS REFUSE** — `§1.4` items 1 and 4 (c): an own `Symbol`-keyed member and an own
1236
+ /// accessor each refuse the WHOLE value (*"any other answer would DROP A MEMBER SILENTLY"*, `DD-8`), so the
1237
+ /// value's own class is the admitted one it holds and the reason names the arm's own class instead.
1238
+ export function shapeArmClass(refusal) {
1239
+ return refusal.k === 'y'
1240
+ ? 'a value carrying a Symbol-keyed own member'
1241
+ : 'a value carrying an own accessor member';
1242
+ }
1243
+
1244
+ /// **ONE `listeners[]` ELEMENT IS LAWFUL WHERE THE STORE'S OWN ADMISSION AND THE BOUNDARY'S OWN WALK AGREE
1245
+ /// ON IT — ADDED 2026-10-17, SO THE SEEDING PREDICATE AND `listen`'S PUSH CONDITION CANNOT DISAGREE ABOUT
1246
+ /// WHAT A LAWFUL ELEMENT IS** (`docs/specs/storeroom-js/surface.md §2.4` item 7 (a) item 3's *"ADMIT-OR-REFUSE COMES THIRD, and every element
1247
+ /// read … is reached ONLY for a value the first step has admitted"*, read with `§1.4`'s walk and the store's
1248
+ /// own `src/args.rs`, which admits exactly the elements whose every segment `Segment::is_in_domain` holds
1249
+ /// and whose handle token is not blank). **THE FOUR TESTS ARE THE ONES `encodeListeners` AND
1250
+ /// `constraintAddress` ALREADY TAKE, AND NOT ONE OF THEM IS NEW**: the entry is a plain object (a `Proxy`,
1251
+ /// an `Array` and a prototype-carrying object refused before a member is read — `§1.4` item 4 (e)–(g),
1252
+ /// `DD-34`/`DD-35`); `address` and `handle` are OWN members (`Object.hasOwn` and never `in`, `JS-5`); the
1253
+ /// handle is a non-empty string (`§0.4` clause 3 / `PAR-13`); and the address is an admitted array whose
1254
+ /// every segment is a string without a lone surrogate or a non-negative SAFE integer — the two classes
1255
+ /// `encodeSegment` pushes and `Segment::is_in_domain` admits, so the elements the store ADOPTS and the
1256
+ /// elements this predicate ACCEPTS are one set and the mirror holds one entry per store entry.
1257
+ export function inDomainAddress(address) {
1258
+ if (isProxyOf(address) || !Array.isArray(address) || arrayClass(address) === 'class') return false;
1259
+ for (let i = 0; i < address.length; i += 1) {
1260
+ if (!(i in address)) return false; // a hole is `AddressArg` row 14's own outside shape (`DD-8`)
1261
+ const segment = address[i];
1262
+ if (typeof segment === 'string') {
1263
+ if (hasLoneSurrogate(segment)) return false; // the class the walk refuses before any verb (`C-4`)
1264
+ } else if (!(typeof segment === 'number' && Number.isInteger(segment) && segment >= 0
1265
+ && Number.isSafeInteger(segment))) {
1266
+ return false; // and every other class is `§1.5`'s own outside set
1267
+ }
1268
+ }
1269
+ return true;
1270
+ }
1271
+
1272
+ /// **AND THE SEEDING PREDICATE IS THAT ONE PREDICATE** — the entry's own four tests, taken together.
1273
+ export function isLawfulListenerElement(entry) {
1274
+ if (!isPlainObjectCarrier(entry) || !Object.hasOwn(entry, 'address') || !Object.hasOwn(entry, 'handle')) return false;
1275
+ if (typeof entry.handle !== 'string' || entry.handle === '') return false;
1276
+ return inDomainAddress(entry.address);
1277
+ }
1278
+