@auspicion/provident-storeroom-js-wasm 0.0.0-stage → 2.0.1
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.
- package/BUILD-INFO.txt +3 -0
- package/LICENSE +662 -0
- package/README.md +425 -2
- package/index.d.ts +2067 -0
- package/index.mjs +132 -0
- package/package.json +40 -4
- package/src/constraint-kernel.mjs +4 -0
- package/src/entry/addon-slot.mjs +484 -0
- package/src/entry/artefact-node.mjs +327 -0
- package/src/entry/artefact.mjs +57 -0
- package/src/entry/carrier.mjs +1011 -0
- package/src/entry/class-decision.mjs +1278 -0
- package/src/entry/class-instrument.mjs +186 -0
- package/src/entry/constraints.mjs +3953 -0
- package/src/entry/delivery.mjs +1697 -0
- package/src/entry/frame.mjs +616 -0
- package/src/entry/instance.mjs +2312 -0
- package/src/entry/kernel-attempt.mjs +1392 -0
- package/src/entry/kernel-commit.mjs +384 -0
- package/src/entry/kernel-foundations.mjs +1565 -0
- package/src/entry/kernel-loader.mjs +53 -0
- package/src/entry/kernel-registration.mjs +1377 -0
- package/src/entry/kernel-terminal.mjs +593 -0
- package/src/entry/refusal.mjs +216 -0
- package/src/entry/state.mjs +1484 -0
- package/storeroom_js_binding.d.ts +350 -0
- package/storeroom_js_binding.js +813 -0
- package/storeroom_js_binding_bg.wasm +0 -0
- package/storeroom_js_binding_bg.wasm.d.ts +28 -0
|
@@ -0,0 +1,1011 @@
|
|
|
1
|
+
// `D-2` (`docs/L1/entry-subdivision.md` §1 part `6a`, `D-33`'s seam at `L2799`) — 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
|
+
import { isProxyOf } from './class-instrument.mjs';
|
|
12
|
+
import { boundaryReject } from './addon-slot.mjs';
|
|
13
|
+
import { appendOwn } from './refusal.mjs';
|
|
14
|
+
import { NODE_CEILING, VALUE_ARGUMENT_POSITION, accessorOrSymbolArm, arrayClass, classSpelling, extendedPath, hasLoneSurrogate, protoClass, shapeArmClass, targetSpelling } from './class-decision.mjs';
|
|
15
|
+
|
|
16
|
+
// ---------------------------------------------------------------------------------------------
|
|
17
|
+
// THE CROSSING MODEL, ENCODED FOR THE CORE — `bindings/js/src/facade.rs` states the protocol, and this
|
|
18
|
+
// section is its only producer. **The class decisions are TAKEN HERE: an IN-DOMAIN value is carried as
|
|
19
|
+
// data and every other rule of `crossing.md §1.4` over it is the core's (`package.md §4.5` item 3 (c)),
|
|
20
|
+
// while a value the WALK refuses is ANSWERED HERE, in the one form, verbosely** (`§1.8`'s dated clause 1).
|
|
21
|
+
// ---------------------------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
/// **`A76`'S CLASS ORDER, SHIPPED SO IT IS VISIBLE AS AN ORDER: the CLASS decision, then the SHAPE
|
|
24
|
+
/// decision, then admission — and NEVER a coercion between them.** Every arm below CLASSIFIES the value it
|
|
25
|
+
/// was handed; not one of them converts it, defaults it or substitutes for it:
|
|
26
|
+
/// 1. `null` and `undefined` are their own outside classes (`§1.2` rows 6–7);
|
|
27
|
+
/// 2. the primitives are read by `typeof` — **the `string`, `boolean` and `bigint` classes are decided
|
|
28
|
+
/// BEFORE the numeric arm**, so `10n` is a `BigInt` and is NEVER carried through the number arm
|
|
29
|
+
/// (`JS-6`): `typeof 10n === 'bigint'`, and no `Number(...)` is spelled anywhere on this path;
|
|
30
|
+
/// 3. `function` and `symbol` are their own outside classes (rows 8–9);
|
|
31
|
+
/// 4. a `Proxy` is refused BEFORE any trap can run (`§1.4` item 4 (g), `DD-34`) — **`util.types.isProxy`
|
|
32
|
+
/// reads no member and invokes no handler, which is why a throwing trap cannot raise a host error out
|
|
33
|
+
/// of this frame** (`JS-1`: *"catch, then classify — never propagate the host error"*; there is
|
|
34
|
+
/// nothing to catch because nothing is invoked);
|
|
35
|
+
/// 5. an ancestor is the cycle class (`§1.4` item 6);
|
|
36
|
+
/// 6. **the ARRAY CLASS is decided before the array SHAPE**: a genuine array (any realm) is walked, and a
|
|
37
|
+
/// class extending `Array` is refused as `NonPlainCollection` (`JS-2` — `Array.isArray` does not
|
|
38
|
+
/// short-circuit `arrayClass`, which is what makes `class V extends Array {}` refused as a VALUE);
|
|
39
|
+
/// 7. otherwise the plain-object test decides, and a prototype-carrying object is refused (§1.4 (f)).
|
|
40
|
+
///
|
|
41
|
+
/// The `JsValue` model of `crossing.md §1.2`, encoded member for member. **The walk reads each member ONCE
|
|
42
|
+
/// and carries its OWN ancestor stack — never a `WeakSet` of visited objects, which would refuse an
|
|
43
|
+
/// acyclic DIAMOND** (`§1.4` item 6, `DD-11`).
|
|
44
|
+
///
|
|
45
|
+
/// **THE DEPTH CEILING IS THE CORE'S DECLARATION AND THE ENCODER IS BOUNDED BESIDE IT** (`§1.4` item 5,
|
|
46
|
+
/// `DD-10`): the encoder's own nesting bound is `65` — one PAST the declared `64` — so the value the
|
|
47
|
+
/// declared ceiling refuses (`65`) is still encoded, handed to the core, and refused THERE with the store's
|
|
48
|
+
/// own `ValueNotAdmitted` and the store's own generated message (`§2.5` item 6 (d): *"for a failure the store
|
|
49
|
+
/// itself produces, `message` is the store's generated string verbatim"*), **while the arm `§1.4` item 5's
|
|
50
|
+
/// dated table assigns to THIS BOUNDARY — `66` and beyond, *"carrying the store's outside class
|
|
51
|
+
/// `Cyclic`"* — is refused HERE, verbosely, with the same code and no second rule.** `ENCODER_CEILING` is
|
|
52
|
+
/// therefore `65` and the arm's own site is the first `if` below.
|
|
53
|
+
///
|
|
54
|
+
/// **⟶ AMENDED 2026-10-23 (`A149`; `RCA-8(g)`): THE OPERATIVE ADMISSION CEILING IS THE STORE'S PERSISTENT
|
|
55
|
+
/// `126` — NOT THE CORE'S DECLARATION, AND NEITHER THE `64` NOR THE `65` THIS BLOCK PRINTS.** The block
|
|
56
|
+
/// above stands byte-for-byte and is read THROUGH this clause: its `64`/`65`/`66` figures are the retired
|
|
57
|
+
/// era's, and its sentence *"`ENCODER_CEILING` is therefore `65`"* is read as **`126`**. **WHAT IS OPERATIVE
|
|
58
|
+
/// FROM THIS DATE: depth `126` is the highest ADMITTED value ON BOTH ROUTES, because the root enters at
|
|
59
|
+
/// `0`; `127` and beyond is the depth class — refused HERE, at this walk, BEFORE ANY STORE VERB, as `a value
|
|
60
|
+
/// over the walk ceiling` with the status `ValueRefusedAtBoundary` and the refused value's own `127`-segment
|
|
61
|
+
/// position; and the crate's `128` remains the CRATE-SIDE CONVERSION's OWN bound (`bindings/js/src/
|
|
62
|
+
/// crossing.rs`'s `depth > 128`, untouched by this clause), never the crossing's admission bound.** **THE
|
|
63
|
+
/// GROUND, AS MEASURED (`A149`): depths `125`/`126` commit and reopen intact, while `127`/`128` were ADMITTED
|
|
64
|
+
/// and round-tripped IN MEMORY but their commit threw `FileCommitFailed`, the store file stayed `0` bytes and
|
|
65
|
+
/// a fresh boot answered `AddressNotFound` — cause `serde_json::from_str` at `src/json.rs:83` with its
|
|
66
|
+
/// recursion limit `128`, plus the register root, plus the commit's re-load of the image it wrote
|
|
67
|
+
/// (`src/store.rs:1283`–`:1292`) — so a value the file tier cannot commit is never admitted in the first
|
|
68
|
+
/// place.** **`NODE_CEILING` IS UNMOVED AT `1,000,000`** (`A149` (3)): the walk counts its root as its first
|
|
69
|
+
/// node, so the admitted node range is `0…999,999` and a dense `1,000,000`-element top-level array is
|
|
70
|
+
/// `1,000,001` nodes and is refused as the same class. **THE ARM'S OWN SITE IS STILL THE FIRST `if` BELOW,
|
|
71
|
+
/// and no other behaviour of this file moves.**
|
|
72
|
+
/// `[A2 docs/decisions.md · `A149`; docs/specs/storeroom-json-crossing/contract.md §4 — its 2026-10-23
|
|
73
|
+
/// clause | the operative ceiling and the refusal's place; A1 bindings/js/index.mjs | `ENCODER_CEILING`,
|
|
74
|
+
/// cited by symbol | numeric claim]`
|
|
75
|
+
///
|
|
76
|
+
/// **⟶ RECONCILED 2026-10-24 (`DEF-2026-10-24-A`; `RCA-8(g)`): THE CLAUSE ABOVE CARRIES A `2026-10-23` MARKER
|
|
77
|
+
/// FOR A `2026-10-24` LANDING, AND NOTHING ELSE OF IT MOVES.** The clause above stands byte-for-byte and is
|
|
78
|
+
/// read THROUGH this one: its `126` on both routes, its `127`-and-beyond refusal with the
|
|
79
|
+
/// `ValueRefusedAtBoundary` status, its node range `0…999,999` and every authority tag it carries are unmoved.
|
|
80
|
+
/// **THE DATE ALONE IS RECONCILED: the landing that clause records is `2026-10-24`, one day after its
|
|
81
|
+
/// marker** — the source edit `bindings/js/index.mjs`'s `const ENCODER_CEILING = 126` landed
|
|
82
|
+
/// `2026-10-24 19:09:06`, and the native addon the live battery drove was built `19:09:49` and restaged
|
|
83
|
+
/// `19:09:51` (`docs/specs/storeroom-json-crossing-live-report.md §11`) — **and the marker stands as filed,
|
|
84
|
+
/// because `A149`, the `docs/next-steps.md` `N8` delta and the review record already cite it; re-pointing it
|
|
85
|
+
/// would break resolving citations rather than repair anything.** No behaviour byte of this file moved.
|
|
86
|
+
/// `[A2 docs/decisions.md · `A149`; docs/defects.md · `DEF-2026-10-24-A` | the marker's resolution of record;
|
|
87
|
+
/// A2 docs/specs/storeroom-json-crossing-live-report.md §11 | the landing's own timestamps | cross-reference]`
|
|
88
|
+
///
|
|
89
|
+
/// **⟶ AND ONE SENTENCE OF THE `2026-10-23` CLAUSE ABOVE IS NOW FALSE AT THE BYTES — CORRECTED BESIDE IT RATHER
|
|
90
|
+
/// THAN REWRITTEN, 2026-10-25 (`RCA-8(g)`).** Its phrase *"the crate's `128` remains the CRATE-SIDE
|
|
91
|
+
/// CONVERSION's OWN bound (`bindings/js/src/crossing.rs`'s `depth > 128`, untouched by this clause)"* **names a
|
|
92
|
+
/// guard that no longer reads `128`.** The conversion's guard is **`if depth > 126 || visited > 1_000_000`**
|
|
93
|
+
/// (`bindings/js/src/crossing.rs:696`, measured on this tree), so **the conversion's admitted bound and this
|
|
94
|
+
/// part's `ENCODER_CEILING` are ONE FIGURE — `126` — and not two.** `128` is what that guard read until
|
|
95
|
+
/// 2026-10-25, and it was the bound that ADMITTED a depth the `file` tier's commit then could not write; the
|
|
96
|
+
/// guard moved when the three acts (admitted · committed · re-booted) were measured together (`crossing.rs:691`
|
|
97
|
+
/// –`:702`'s own dated clause; `tests/unit/binding-crossing/crossing_values.rs`'s `ceiling_depth_126_is_admitted`
|
|
98
|
+
/// cell). **Nothing else of the clause above moves:** its `126` on both routes, its `127`-and-beyond refusal, its
|
|
99
|
+
/// `ValueRefusedAtBoundary` status and its node ceiling are exactly as it prints them, and no behaviour byte of
|
|
100
|
+
/// this file is touched by this clause.
|
|
101
|
+
/// `[A2 docs/decisions.md · `A149`; A1 bindings/js/src/crossing.rs:696 | the conversion's own guard, read at its
|
|
102
|
+
/// bytes | numeric claim]`
|
|
103
|
+
const ENCODER_CEILING = 126;
|
|
104
|
+
|
|
105
|
+
// ⟶ CARVED UP 2026-10-24 (`D-2`/`D-33`): `NODE_CEILING` now stands with the guard machinery in the
|
|
106
|
+
// class-decision part — see that part's marker. `ENCODER_CEILING` is unmoved and is this part's own.
|
|
107
|
+
|
|
108
|
+
/// **THE WALK'S FIRST VALUE FAULT, RECORDED — AND THE CORE'S OWN MARKER FOR THAT ARM RETURNED.**
|
|
109
|
+
///
|
|
110
|
+
/// **WHY THE FAULT IS RECORDED AND NOT ANSWERED HERE, AND IT IS A DECLARED REASON RATHER THAN A
|
|
111
|
+
/// CONVENIENCE:** the crossing's own refusal ORDER is the STORE's (`DD-46`: *"the package passes every
|
|
112
|
+
/// argument position through as supplied and performs NO arity check of its own"*; `write-and-read.md §3.4`
|
|
113
|
+
/// `F-1`), so `write(instance, ['x'])` — the `tier` position ABSENT and the `value` position ABSENT with it —
|
|
114
|
+
/// answers the carrier row's own `AddressMalformed` and NOT the value's `ValueNotAdmitted`. **An answer
|
|
115
|
+
/// rendered at the walk before the carrier positions had been converted would REORDER two declared answers**,
|
|
116
|
+
/// and `JSG-05.7`/`JSG-10.2` drive exactly that state. The walk therefore CLASSIFIES, RECORDS the first fault
|
|
117
|
+
/// it meets and hands the core the marker the shipped encoder handed it; **`write` then renders the verbose
|
|
118
|
+
/// message from the record at the ONE site where the store answered `ValueNotAdmitted` for a value the walk
|
|
119
|
+
/// refused** (`§1.8`'s dated clause 1: the value-position refusal is *"PRODUCED AT THE WALK"*, and `CF-3`
|
|
120
|
+
/// clause 1 is its message's route). Nothing here coerces, and nothing here repairs.
|
|
121
|
+
///
|
|
122
|
+
/// **⟶ AND THE RECORD CARRIES THE ARM'S OWN PART ONE SUBJECT WHERE THE ARM DECLARES ONE —
|
|
123
|
+
/// `contract.md §2.1`'s clause of 2026-10-24, item `(2)` (`DEF-2026-10-24-D`).** `subject` is `null` at every
|
|
124
|
+
/// arm whose PART ONE is the failing target's own rendering — the walk then leaves the rendering to
|
|
125
|
+
/// `valueTargetSpelling` at answer time, exactly as it always did — and it is the ROW'S CLASS SPELLING at the
|
|
126
|
+
/// six arms item `(2)` re-derives in place (rows `5`, `11`, `13`, `14`, `15`, `16`), where **the refused value
|
|
127
|
+
/// is NOT rendered and no member, element join or empty spelling can reach the message** (item `(3)`). **The
|
|
128
|
+
/// TARGET the walk hands in `value` is unmoved at those six too** — the target and its rendering are two
|
|
129
|
+
/// different facts and only the second is withdrawn (item `(2)`).
|
|
130
|
+
function refusedValue(fault, value, failedClass, path, marker, subject = null) {
|
|
131
|
+
if (fault.found === null) {
|
|
132
|
+
fault.found = failedClass;
|
|
133
|
+
fault.value = value;
|
|
134
|
+
fault.path = path;
|
|
135
|
+
fault.subject = subject;
|
|
136
|
+
}
|
|
137
|
+
return marker;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// **ONE OF THE SIX ARMS WHOSE PART ONE SUBJECT IS THE ROW'S OWN CLASS SPELLING** — the same record as
|
|
141
|
+
/// `refusedValue` above with the row's class handed to it as the subject, so the arm states in one word that
|
|
142
|
+
/// it renders nothing (`contract.md §2.1`'s clause of 2026-10-24, items `(2)` and `(3)`). **THE CLASS AND THE
|
|
143
|
+
/// SUBJECT ARE THE SAME STRING AT THESE SIX, AND THAT IS THE DECLARED FORM** — e.g.
|
|
144
|
+
/// `'a sparse array' is not a value …, the value at the write's value argument is a sparse array`.
|
|
145
|
+
function refusedAsClass(fault, value, failedClass, path, marker) {
|
|
146
|
+
return refusedValue(fault, value, failedClass, path, marker, failedClass);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/// **A CANONICAL ARRAY INDEX, AS `§2` ROW `17`'S PREDICATE SPELLS IT** — `String(i)` for an integer `i` with
|
|
150
|
+
/// `0 ≤ i ≤ length − 1`, and nothing else (`contract.md §2`'s clause of 2026-10-24 on `F-RA-5`, item `(3)`).
|
|
151
|
+
/// **THE `String(i) === key` HALF IS THE POINT AND NOT A FORMALITY**: `'01'`, `'1.0'`, `'1e0'`, `'-0'`, `' 1'`
|
|
152
|
+
/// and `'0x1'` all convert to a number INSIDE the range, and none of them is the canonical spelling of the
|
|
153
|
+
/// index it would otherwise be taken for — so the key's own spelling is compared with the index's. No member
|
|
154
|
+
/// is read, no user code runs, and `length` is the exotic array's own data property (the value is a genuine
|
|
155
|
+
/// array by the time this test is taken).
|
|
156
|
+
function isCanonicalArrayIndex(key, length) {
|
|
157
|
+
const index = Number(key);
|
|
158
|
+
if (!Number.isInteger(index) || index < 0 || index > length - 1) return false;
|
|
159
|
+
return String(index) === key;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function encodeValue(value, ancestors, depth, path, fault) {
|
|
163
|
+
// **THE WALK STOPS AT ITS FIRST FAULT** — the refusal is recorded once and the remaining members are not
|
|
164
|
+
// read, so a refused tree costs the members already visited and no more.
|
|
165
|
+
if (fault.found !== null) return { k: 'c' };
|
|
166
|
+
// **THE NODE CEILING IS THE CRATE'S `1,000,000`, COUNTED ON THIS ONE WALK** (`contract.md §4`; `A148` Q6).
|
|
167
|
+
// The crate's conversion counts the root as its first node; the `1,000,001`st node is row `8`'s class at
|
|
168
|
+
// the root `value` position.
|
|
169
|
+
// **⟶ AMENDED 2026-10-23 (THE GATE-3 PROOFREADING PASS, `role_proofreader`; `RCA-8(g)`): THE CITE ABOVE IS
|
|
170
|
+
// RE-SPELLED, BECAUSE `A148` CARRIES NO `Q6`.** The comment above stands byte-for-byte and is read THROUGH
|
|
171
|
+
// this clause; the ceiling and both counting conventions are unmoved. **`docs/decisions.md` · `A148` records
|
|
172
|
+
// `Q1`–`Q5` and TWO follow-ups — there is no `Q6`** — so `A148` Q6 is read as the gate-1 record's own THIRD
|
|
173
|
+
// `Follow-up` row: *"Crate `128` governs"* → *"Depth `128` and nodes `1,000,000`"*
|
|
174
|
+
// (`docs/specs/storeroom-json-crossing-proposal-review.md §4`'s answers cell, `§4.1`, the last of its three
|
|
175
|
+
// `Follow-up` rows). The same re-spelling is already carried at `contract.md §4` and
|
|
176
|
+
// `parameter-semantics.md §4`; this site follows their form.
|
|
177
|
+
// `[A2 docs/decisions.md · `A148` (its two follow-ups); docs/specs/storeroom-json-crossing-proposal-review.md
|
|
178
|
+
// §4.1 — its third `Follow-up` row | cross-reference]`
|
|
179
|
+
fault.nodes += 1;
|
|
180
|
+
if (fault.nodes > NODE_CEILING) {
|
|
181
|
+
return refusedValue(fault, 'a value over the walk ceiling', 'a value over the walk ceiling', [], { k: 'c' });
|
|
182
|
+
}
|
|
183
|
+
// **EVERY REFUSAL BELOW IS THE WALK'S OWN** (`§1.8`'s dated clause 1; `A76`: *"Test JS data for compliance
|
|
184
|
+
// with permitted shape before admitting and do not attempt to fix. reject with verbose error to client"*):
|
|
185
|
+
// the failing target's own spelling is PART ONE (the store's generator's bytes), the class that failed and
|
|
186
|
+
// the position it holds are PART TWO, appended — and the status is the store's own `ValueNotAdmitted`
|
|
187
|
+
// (`§1.2`'s outside rows 6–13). **NOTHING IS REPAIRED**: no member is dropped, no class is substituted, no
|
|
188
|
+
// value is converted (`A76`'s second part; `§1.8`).
|
|
189
|
+
// `§1.4` item 5's dated two-arm table: *"`66` and beyond REFUSED by the boundary's own encoder carrying the
|
|
190
|
+
// store's outside class `Cyclic`"* — the encoder's bound is one PAST the declared `64`, so `65` is still
|
|
191
|
+
// encoded and refused by the conversion core's own bound, whose message is the store's own (item 6 (d)).
|
|
192
|
+
// **⟶ AMENDED 2026-10-23 (`A149`; `RCA-8(g)`): THIS NARRATION'S `64`/`65`/`66` TWO-ARM SPLIT IS THE
|
|
193
|
+
// RETIRED ERA'S AND IS READ THROUGH THIS CLAUSE.** The three lines above stand byte-for-byte; their `64`
|
|
194
|
+
// and `65` are read as the operative `126` and the `127` it refuses, and the arm that was "still encoded and
|
|
195
|
+
// refused by the conversion core's own bound" no longer exists on this route. **WHAT IS OPERATIVE: depth
|
|
196
|
+
// `126` is the highest admitted value ON BOTH ROUTES, so `127` and beyond is refused HERE, at the walk,
|
|
197
|
+
// BEFORE ANY STORE VERB, as `a value over the walk ceiling` with the status `ValueRefusedAtBoundary` at the
|
|
198
|
+
// refused value's own `127`-segment position; the crate's `128` is the CRATE-SIDE CONVERSION's bound ONLY
|
|
199
|
+
// (`bindings/js/src/crossing.rs`'s `depth > 128`, untouched).** **THE GROUND, AS MEASURED (`A149`):
|
|
200
|
+
// `125`/`126` commit and reopen; `127`/`128` threw `FileCommitFailed` with a `0`-byte store file and a
|
|
201
|
+
// fresh boot answering `AddressNotFound`, from `serde_json::from_str` at `src/json.rs:83` (recursion limit
|
|
202
|
+
// `128`), the register root and the commit's re-load of the image it wrote (`src/store.rs:1283`–`:1292`).**
|
|
203
|
+
// The node ceiling above (`1,000,000`, root counted) is unmoved.
|
|
204
|
+
// `[A2 docs/decisions.md · `A149`; docs/specs/storeroom-json-crossing/contract.md §4 — its 2026-10-23
|
|
205
|
+
// clause; A1 bindings/js/src/crossing.rs | the conversion's own guard, cited by symbol | numeric claim]`
|
|
206
|
+
// **⟶ RECONCILED 2026-10-24 (`DEF-2026-10-24-A`; `RCA-8(g)`): THIS CLAUSE'S `2026-10-23` MARKER DENOTES A
|
|
207
|
+
// `2026-10-24` LANDING, AND NOTHING ELSE OF IT MOVES.** The clause above stands byte-for-byte and is read
|
|
208
|
+
// THROUGH this one: its reading of the retired figures (`64` read `126`, `65` read `127`), its one-arm
|
|
209
|
+
// re-derivation, the retired core-bound arm it closes and the unmoved node ceiling are all unmoved.
|
|
210
|
+
// **THE DATE ALONE IS RECONCILED: the landing it records is `2026-10-24`, one day after its marker** — the
|
|
211
|
+
// source edit landed `2026-10-24 19:09:06`, and the native addon the live battery drove was built `19:09:49`
|
|
212
|
+
// and restaged `19:09:51` (`docs/specs/storeroom-json-crossing-live-report.md §11`) — **and the marker stands
|
|
213
|
+
// as filed, because `A149` and the review record already cite it; re-pointing it would break resolving
|
|
214
|
+
// citations rather than repair anything.** No behaviour byte of this file moved.
|
|
215
|
+
// `[A2 docs/decisions.md · `A149`; docs/defects.md · `DEF-2026-10-24-A` | the marker's resolution of record;
|
|
216
|
+
// A2 docs/specs/storeroom-json-crossing-live-report.md §11 | the landing's own timestamps | cross-reference]`
|
|
217
|
+
// **⟶ AND THE SAME ONE SENTENCE IS FALSE HERE AS AT `ENCODER_CEILING`'S BLOCK ABOVE — CORRECTED BESIDE IT,
|
|
218
|
+
// 2026-10-25 (`RCA-8(g)`).** This narration's *"the crate's `128` is the CRATE-SIDE CONVERSION's bound ONLY
|
|
219
|
+
// (`bindings/js/src/crossing.rs`'s `depth > 128`, untouched)"* names a guard that reads **`depth > 126`** on
|
|
220
|
+
// this tree (`crossing.rs:696`), so **there is no longer a second, larger bound behind the walk's: the
|
|
221
|
+
// conversion admits exactly what this part admits, `126`, and refuses `127` at the same figure.** The retired
|
|
222
|
+
// `128` is named here once and is not re-spelled anywhere else in this file. **Every other reading of the
|
|
223
|
+
// clause above stands**: the operative `126` on both routes, the `127`-and-beyond refusal at the walk before
|
|
224
|
+
// any store verb, the `ValueRefusedAtBoundary` status at the refused value's own `127`-segment position, and
|
|
225
|
+
// the unmoved `1,000,000` node ceiling.
|
|
226
|
+
// `[A2 docs/decisions.md · `A149`; A1 bindings/js/src/crossing.rs:696 | the conversion's own guard, read at its
|
|
227
|
+
// bytes | numeric claim]`
|
|
228
|
+
if (depth > ENCODER_CEILING) {
|
|
229
|
+
return refusedValue(fault, value, 'a value over the walk ceiling', path, { k: 'c' });
|
|
230
|
+
}
|
|
231
|
+
if (value === null) return refusedValue(fault, value, 'null', path, { k: 'z' }); // `§1.2` row 6, any depth
|
|
232
|
+
const kind = typeof value;
|
|
233
|
+
if (kind === 'undefined') return refusedValue(fault, value, 'undefined', path, { k: 'u' }); // row 7
|
|
234
|
+
if (kind === 'string') {
|
|
235
|
+
// `§1.2` row 1's dated clause: a LONE SURROGATE is refused at the package's own walk — the class has no
|
|
236
|
+
// Rust spelling at all — and it is never silently replaced, dropped or normalized.
|
|
237
|
+
if (hasLoneSurrogate(value)) {
|
|
238
|
+
return refusedValue(fault, value, 'a string carrying a lone surrogate', path, { k: 'c' });
|
|
239
|
+
}
|
|
240
|
+
return value;
|
|
241
|
+
}
|
|
242
|
+
if (kind === 'boolean') return value;
|
|
243
|
+
// THE CLASS TEST PRECEDES THE NUMERIC ARM (`JS-6`): `bigint` is refused here, as its own outside class,
|
|
244
|
+
// and is NEVER converted through the numeric arm (`Number(10n)` is the shipped `JS-6` substitution).
|
|
245
|
+
if (kind === 'bigint') {
|
|
246
|
+
// **⟶ AND THE SPELLING IS A SPEC CONVERSION ON THE PRIMITIVE, NOT `BigInt.prototype.toString`**
|
|
247
|
+
// (`contract.md §2.1`'s clause of 2026-10-24 on `F7-1`, items `(1c)`, `(2b)`'s row `37` and `(10c)`): the
|
|
248
|
+
// as-built `value.toString()` was a method taken off a MUTABLE PROTOTYPE, and the battery's row `(i)`
|
|
249
|
+
// measures the answer it gave — a caller's `BigInt.prototype.toString` returned a marker that crossed as
|
|
250
|
+
// the carrier's own value. `String(10n)` is `'10'` — the language's `ToString` for a BigInt appends NO
|
|
251
|
+
// suffix — and the `'10n'` spelling the contract's row `6` subject carries is `valueTargetSpelling`'s own
|
|
252
|
+
// `` `${value}n` `` substitution and a DIFFERENT BYTE from the conversion named here; the conversion reads
|
|
253
|
+
// no member. No second figure and no second rendering is minted.
|
|
254
|
+
return refusedValue(fault, value, 'a bigint', path, { k: 'g', v: String(value) });
|
|
255
|
+
}
|
|
256
|
+
if (kind === 'number') {
|
|
257
|
+
if (!Number.isFinite(value)) {
|
|
258
|
+
return refusedValue(fault, value, 'a non-finite number', path, { k: 'F', v: value }); // `§1.2` row 11
|
|
259
|
+
}
|
|
260
|
+
// `-0` DOES NOT CROSS AS A SIGN (`A140`; `contract.md §4`).
|
|
261
|
+
return Object.is(value, -0) ? 0 : value;
|
|
262
|
+
}
|
|
263
|
+
if (kind === 'function') return refusedValue(fault, value, 'a function', path, { k: 'f' }); // row 8
|
|
264
|
+
if (kind === 'symbol') return refusedValue(fault, value, 'a symbol', path, { k: 'y' }); // row 9
|
|
265
|
+
// `§1.4` item 4 (g), `DD-34` — and NO trap is invoked: `util.types.isProxy` reads no member.
|
|
266
|
+
if (isProxyOf(value)) return refusedValue(fault, value, 'a Proxy', path, { k: 'P' });
|
|
267
|
+
// `§1.4` item 6: the ancestor stack, never a `WeakSet` — which is what ADMITS an acyclic diamond.
|
|
268
|
+
// **⟶ AND THE STACK IS READ BY INDEX, NOT BY `Array.prototype.includes`** (`contract.md §2.1`'s clause of
|
|
269
|
+
// 2026-10-24 on `F7-1`, items `(1c)(vi)`, `(2b)`'s rows `18` and `29`, and `(10b)`): the as-built membership
|
|
270
|
+
// was a member of a mutable prototype, and the battery's row `(b)` measures both of its forgeries — an
|
|
271
|
+
// `includes` answering `true` refused an ACYCLIC value at the root and one answering `false` missed the
|
|
272
|
+
// CYCLE, so the walk re-entered the ancestor and the host stopped it. **THE MEMBERSHIP IS A LOCAL LOOP AND
|
|
273
|
+
// THE STACK'S EXTENSION IS A LOCAL INDEX LOOP** — no method and no iterator of a mutable prototype decides
|
|
274
|
+
// row `11`.
|
|
275
|
+
let onAncestorPath = false;
|
|
276
|
+
for (let i = 0; i < ancestors.length; i += 1) {
|
|
277
|
+
if (ancestors[i] === value) {
|
|
278
|
+
onAncestorPath = true;
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (onAncestorPath) {
|
|
283
|
+
// ⟶ `contract.md §2.1`'s clause of 2026-10-24, item `(2)`: row `11`'s subject is its own CLASS SPELLING
|
|
284
|
+
// — the repeated ancestor is NOT rendered (`DEF-2026-10-24-D`).
|
|
285
|
+
return refusedAsClass(fault, value, 'a value that contains itself', path, { k: 'c' }); // `§1.2` row 12
|
|
286
|
+
}
|
|
287
|
+
const next = extendedPath(ancestors, value);
|
|
288
|
+
if (Array.isArray(value)) {
|
|
289
|
+
// **THE CLASS DECISION COMES FIRST, ON THE VALUE AS IT IS** (`A76`, `JS-2`): `Array.isArray` is TRUE
|
|
290
|
+
// for a class extending `Array`, so it may not stand alone as the admission test. **A class extending
|
|
291
|
+
// `Array` is refused under ITS OWN declared class — `§1.2` row 5's `ValueNotAdmitted`
|
|
292
|
+
// (`NonPlainCollection`) — and NEVER through the array shape test.**
|
|
293
|
+
if (arrayClass(value) === 'class') {
|
|
294
|
+
// ⟶ `contract.md §2.1`'s clause of 2026-10-24, item `(2)`: row `13`'s subject is its own CLASS SPELLING
|
|
295
|
+
// — the instance is NOT rendered, so the empty subject this arm once answered is retired.
|
|
296
|
+
return refusedAsClass(fault, value, 'a class extending Array', path, { k: 'P' });
|
|
297
|
+
}
|
|
298
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
299
|
+
// `§1.4` item 2: a hole refuses the WHOLE value (`DD-8`), and its class is the array's own hole arm.
|
|
300
|
+
// ⟶ `contract.md §2.1`'s clause of 2026-10-24, item `(2)`: row `16`'s subject is its own CLASS SPELLING
|
|
301
|
+
// — the array is NOT rendered, so `'1,,3'` is retired.
|
|
302
|
+
// **⟶ AND `contract.md §2`'s clause of 2026-10-24 on `F-RA-11` RE-DERIVES THE HOLE ITSELF: A HOLE IS AN
|
|
303
|
+
// INDEX BELOW `length` WITH NO **OWN** PROPERTY** (its item `(1)`), so the test is `Object.hasOwn` and
|
|
304
|
+
// NOT `in`. `in` is `[[HasProperty]]`, which walks the prototype chain, so
|
|
305
|
+
// `Array.prototype[0] = 'x'; const a = new Array(2); a[1] = 'y'` passed this scan and the crossing
|
|
306
|
+
// admitted `['x', 'y']` — **an element REPLACED at the boundary, one the caller's array never owned** —
|
|
307
|
+
// while an inherited ACCESSOR at an index was then READ by the element loop's `[[Get]]`, running caller
|
|
308
|
+
// code on an admission path (its items `(3)`, `(4)` and `(5)`). **`Object.hasOwn` and never
|
|
309
|
+
// `Object.prototype.hasOwnProperty`, which is a method taken from a mutable prototype** (item `(6)`,
|
|
310
|
+
// the file's own idiom at `:2144` · `:2179` · `:2261` and the rule stated at `:2240`). **A
|
|
311
|
+
// prototype-carried index is therefore never read** — the element loop below reaches only indices this
|
|
312
|
+
// scan has proved OWN — and an OWN accessor at an index is refused as row `15` three lines below.
|
|
313
|
+
if (!Object.hasOwn(value, i)) return refusedAsClass(fault, value, 'a sparse array', path, { k: 'H' });
|
|
314
|
+
}
|
|
315
|
+
const refusal = accessorOrSymbolArm(value);
|
|
316
|
+
// ⟶ `contract.md §2.1`'s clause of 2026-10-24, item `(2)`: rows `5`/`15`'s subject is the CLASS SPELLING —
|
|
317
|
+
// the containing ARRAY is NOT rendered, so the empty subject an empty array answered is retired.
|
|
318
|
+
if (refusal !== null) return refusedAsClass(fault, value, shapeArmClass(refusal), path, refusal);
|
|
319
|
+
// **⟶ ROW `17` — `an array carrying a non-index own member` — IS DECIDED HERE AND NOWHERE ELSE**
|
|
320
|
+
// (`contract.md §2`'s clause of 2026-10-24 on the gate-11 finding `F-RA-5`, items `(3)`, `(5)`, `(6)` and
|
|
321
|
+
// `(8)`). The as-built walk read an array BY INDEX ALONE, so `const a = [1]; a.foo = 3` crossed as `[1]`
|
|
322
|
+
// and **the member was DROPPED SILENTLY** — the one answer `§2`'s own ground (*"None is coerced, repaired,
|
|
323
|
+
// dropped, or replaced"*) forbids, and the answer rows `15` and `5` had already refused twice for a member
|
|
324
|
+
// with no JSON spelling. **THE PREDICATE IS ITEM `(3)`'S, EXACTLY: every string in `Object.keys(value)` is
|
|
325
|
+
// a canonical index in `0…length − 1`** — own ENUMERABLE string keys only, so `length` itself (an own
|
|
326
|
+
// non-enumerable data member) is not a member of this test and an own NON-ENUMERABLE member other than it
|
|
327
|
+
// is outside the tree by the rule that puts an object's non-enumerable members outside it, while an
|
|
328
|
+
// element whose own index property happens to be non-enumerable is still carried, because the element walk
|
|
329
|
+
// below reads by INDEX. **THE POSITION IS THE ARRAY'S OWN** (item `(5)`) and **THE SUBJECT IS THE ROW'S
|
|
330
|
+
// CLASS SPELLING**, so the message names the class twice and the extra member is never reached.
|
|
331
|
+
// **THE ORDER IS ITEM `(6)`'S**: row `13` above, then row `16`, then rows `15`/`5`, then THIS ROW, then
|
|
332
|
+
// the element walk — so a subclass, a sparse array and a Symbol-carrying array each keep answering their
|
|
333
|
+
// own row, and a refused element costs no visit because this test precedes the loop. **AND A
|
|
334
|
+
// `Proxy`-SHAPED PROTOTYPE IS NO LONGER PART OF THAT LIST**, because `contract.md §2`'s clause of
|
|
335
|
+
// 2026-10-24 on `F-RA-12` item `(4)` declares this comment's old half false for a LYING trap: a `Proxy`
|
|
336
|
+
// prototype link is answered as `'class'` with no trap run, so such a value answers row `13` above and
|
|
337
|
+
// never reaches here. **THE MEMBER IS NEVER CARRIED**: the row refuses its PRESENCE, not its value
|
|
338
|
+
// (item `(3)`'s last sentence).
|
|
339
|
+
// **⟶ AND THE KEY CENSUS IS CONSUMED BY INDEX, NOT THROUGH THE ITERATION PROTOCOL** (`contract.md §2.1`'s
|
|
340
|
+
// clause of 2026-10-24 on `F7-1`, items `(1c)(ii)`, `(2b)`'s row `17` and `(10b)`: *"`Object.keys`'s
|
|
341
|
+
// iteration is row `17`'s **only** gate"*) — `Object.keys`'s CALL is lawful and its result's `for … of` is
|
|
342
|
+
// not, so a caller's forged iterator decided whether row `17` saw the non-index member at all.
|
|
343
|
+
const indexKeys = Object.keys(value);
|
|
344
|
+
for (let at = 0; at < indexKeys.length; at += 1) {
|
|
345
|
+
if (!isCanonicalArrayIndex(indexKeys[at], value.length)) {
|
|
346
|
+
return refusedAsClass(fault, value, 'an array carrying a non-index own member', path, { k: 'c' });
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const members = [];
|
|
350
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
351
|
+
// **AN ARRAY MEMBER'S INDEX IS A DECLARED POSITION** (`§2.5` item 6 (b): *"the MEMBER POSITION for a
|
|
352
|
+
// member inside a value the walk reached"*), and it is carried BARE, as item 6 (a) spells an integer
|
|
353
|
+
// segment. Every index is present and is a data property by the two rules above, so the read below is
|
|
354
|
+
// the read `for … of` performed.
|
|
355
|
+
appendOwn(members, encodeValue(value[i], next, depth + 1, extendedPath(path, i), fault));
|
|
356
|
+
if (fault.found !== null) break;
|
|
357
|
+
}
|
|
358
|
+
return members;
|
|
359
|
+
}
|
|
360
|
+
const proto = protoClass(value);
|
|
361
|
+
// `§1.4` item 4 (f): a prototype-carrying object is REFUSED — never read through its chain (`JS-5`).
|
|
362
|
+
// ⟶ `contract.md §2.1`'s clause of 2026-10-24, item `(2)`: row `14`'s subject is its own CLASS SPELLING —
|
|
363
|
+
// the value is NOT rendered and its class's own `toString` is not reached.
|
|
364
|
+
if (proto === 'class') return refusedAsClass(fault, value, classSpelling(value), path, { k: 'P' });
|
|
365
|
+
// ⟶ `contract.md §2.1`'s clause of 2026-10-24, item `(2)`: rows `5`/`15`'s subject is the CLASS SPELLING —
|
|
366
|
+
// the containing OBJECT is NOT rendered, so `'[object Object]'` is retired.
|
|
367
|
+
const refusal = accessorOrSymbolArm(value);
|
|
368
|
+
if (refusal !== null) return refusedAsClass(fault, value, shapeArmClass(refusal), path, refusal);
|
|
369
|
+
const members = [];
|
|
370
|
+
// **⟶ AND OBJECT KEYS' ITERATION IS A LOCAL INDEX LOOP** (`contract.md §2.1`'s clause of 2026-10-24 on
|
|
371
|
+
// `F7-1`, items `(1c)(ii)` and `(2b)`'s row `17`): `Object.keys` is an `Object` static and lawful; consuming
|
|
372
|
+
// its result with `for … of` is `Array.prototype[Symbol.iterator]` and is not.
|
|
373
|
+
const memberNames = Object.keys(value);
|
|
374
|
+
for (let at = 0; at < memberNames.length; at += 1) {
|
|
375
|
+
const name = memberNames[at];
|
|
376
|
+
// `§1.2` row 7 / `§1.4` item 3: an `{a: undefined}` member is SEEN and REFUSED, and **the key is NEVER
|
|
377
|
+
// dropped** — the member is walked, its own position is carried, and the walk records the fault THERE.
|
|
378
|
+
// **THE READ IS AN OWN-PROPERTY READ** (`A76`, `JS-5`): `Object.keys` yields the OWN enumerable string
|
|
379
|
+
// keys — the keys the walk takes, `§1.4` item 4 (b) — and the member read is that key's own value.
|
|
380
|
+
//
|
|
381
|
+
// **⟶ AND THE LONE SURROGATE IS APPLIED AT THIS KEY POSITION TOO — `C-4`, THE MEMBER-KEY HALF
|
|
382
|
+
// (2026-10-11).** A KEY of a walked value is a JS `string` exactly as a value is, so `§1.2` row 1's
|
|
383
|
+
// dated clause reaches it: the class has no Rust spelling, **and the facade's string path ended in
|
|
384
|
+
// `String::from_utf8_lossy`, so a key holding `\uD800` was silently REPAIRED to U+FFFD on the way in —
|
|
385
|
+
// a member KEY silently renamed under a write the caller spelled at another name.** The class is
|
|
386
|
+
// refused here as the VALUE position refuses it, and the KEY IS STILL NEVER DROPPED: the whole value is
|
|
387
|
+
// refused, verbosely, at the member's own position (`§1.4` item 3's own answer to a dropped member).
|
|
388
|
+
if (hasLoneSurrogate(name)) {
|
|
389
|
+
// **THE TARGET IS THE MEMBER POSITION'S OWN NAME AND NOT THE KEY**, for the reason `encodeSegment`
|
|
390
|
+
// carries at the same class: the unpaired code unit has no `String` spelling and the only alternative
|
|
391
|
+
// is a REPAIR of it, which `§1.8` forbids — so the failing target is named by the VALUE argument the
|
|
392
|
+
// member was reached under, and the member's own POSITION (the key path, whose spelling
|
|
393
|
+
// `valuePosition` takes from the same key) carries the rest.
|
|
394
|
+
return refusedValue(fault, VALUE_ARGUMENT_POSITION, 'a string carrying a lone surrogate', extendedPath(path, name), { k: 'c' });
|
|
395
|
+
}
|
|
396
|
+
appendOwn(members, [name, encodeValue(value[name], next, depth + 1, extendedPath(path, name), fault)]);
|
|
397
|
+
if (fault.found !== null) break;
|
|
398
|
+
}
|
|
399
|
+
// **THE BARE PLAIN OBJECT** (`contract.md §3`, `§5`; `A148` Q4): the members are data and the shape is
|
|
400
|
+
// the object's own, so no `k`, no `m`, no `p`, no `acc` and no `proxy` is carried.
|
|
401
|
+
// **⟶ AND THE MEMBERS ARE DEFINED OWN DATA PROPERTIES BY A LOCAL LOOP, NOT BY `Object.fromEntries`**
|
|
402
|
+
// (`contract.md §2.1`'s clause of 2026-10-24 on `F7-1`, items `(1c)(ii)` and `(2b)`'s row `20`): the CALL is
|
|
403
|
+
// lawful and its ARGUMENT'S ITERATION is not — `fromEntries` consumed the members through
|
|
404
|
+
// `Array.prototype[Symbol.iterator]`, so a forged iterator could drop or reorder a crossed member. **The
|
|
405
|
+
// defined form is the one `Object.fromEntries` took all along** — an own data property per member, per the
|
|
406
|
+
// gate-4 `ADV-12` rule that a member genuinely named `__proto__` must stay a member and not become the
|
|
407
|
+
// returned object's prototype (`Object.defineProperty` defines; `[[Set]]` would not).
|
|
408
|
+
//
|
|
409
|
+
// **⟶ AND THE NODE IS A `null`-PROTOTYPE NODE FROM 2026-10-25 — THE CROSSING'S FORM AND NOT ONE OF ITS
|
|
410
|
+
// DECISIONS** (`RCA-8(g)`; the architect's ruling, verbatim: *"Cast into JSON in the JS side of the
|
|
411
|
+
// interface."*). **Everything above this line CLASSIFIES; this line SHAPES what crosses, and the two are
|
|
412
|
+
// different facts.** **THE DEFECT IT CLOSES, AS MEASURED:** a `{}` carries this realm's `Object.prototype`,
|
|
413
|
+
// and `codec.rs`'s `value_of` TAKES the value it is handed as JSON — its `serde-json` cast walks the
|
|
414
|
+
// property-NAME enumeration the runtime offers, **WHICH INCLUDES THE PROTOTYPE CHAIN** — so with an
|
|
415
|
+
// enumerable `Object.prototype.injected` a lawful `write(['v'], 'mem', { a: 1 })` read back
|
|
416
|
+
// `{"a":1,"injected":"P"}`, and the same member appeared at EVERY NESTING DEPTH
|
|
417
|
+
// (`{"a":1,"b":{"c":2,"injected":"P"},"d":[{"e":3,"injected":"P"}]}`), each node's prototype being the one
|
|
418
|
+
// thing this crossing left a caller's realm to decide. **A member the walk never admitted crossed into Rust
|
|
419
|
+
// and the store's record carried it.** **`Object.create(null)` CARRIES NO PROTOTYPE AT ALL, SO THE CAST HAS
|
|
420
|
+
// NOTHING BEYOND THE OWN MEMBERS THIS LOOP DEFINED** — the members, their names, their ORDER, the class
|
|
421
|
+
// decisions above, both ceilings and both refusal codes are unmoved, and **`codec.rs` KEEPS ITS SIMPLE CAST
|
|
422
|
+
// AND IS NOT TOUCHED**: the ruling put the form on this side of the boundary.
|
|
423
|
+
// **THE CLASS IS THE CONTRACT'S AND IS NOT RE-DECIDED HERE:** a `null`-prototype object is an ADMITTED value
|
|
424
|
+
// — `contract.md §1`'s clause of 2026-10-24, item `(1)`'s own parenthesis: *"A `null`-prototype object is not
|
|
425
|
+
// this limb; it carries no prototype at all, and it is admitted through `§3`'s `p` classification `null`"* —
|
|
426
|
+
// which is what `protoClass`'s `'null'` answer already meant at this walk (`class-decision.mjs`), so a
|
|
427
|
+
// caller's `Object.create(null)` value was admitted before this clause and is admitted after it. **NO MEMBER
|
|
428
|
+
// IS ADDED, DROPPED OR REORDERED**: the own data properties below are the ones `Object.fromEntries`'s defined
|
|
429
|
+
// form has always written, and the object's prototype is not a member.
|
|
430
|
+
// `[A2 docs/specs/storeroom-json-crossing/contract.md §1 — its 2026-10-24 clause, item `(1)`; A1
|
|
431
|
+
// bindings/js/src/codec.rs · `value_of` | the cast that reads the chain, named and left in its own module |
|
|
432
|
+
// requirement]`
|
|
433
|
+
const plain = Object.create(null);
|
|
434
|
+
for (let at = 0; at < members.length; at += 1) {
|
|
435
|
+
Object.defineProperty(plain, members[at][0], {
|
|
436
|
+
value: members[at][1],
|
|
437
|
+
writable: true,
|
|
438
|
+
enumerable: true,
|
|
439
|
+
configurable: true,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
return plain;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/// `crossing.md §1.3`'s `Segment`: a string or a non-negative integer is admitted, and EVERY outside class
|
|
446
|
+
/// is carried as its own variant so the STORE produces the code (`DD-1`) — the package mints none.
|
|
447
|
+
///
|
|
448
|
+
/// **`A76` AT THIS SITE: THE CLASS IS DECIDED FIRST AND NOTHING IS RESHAPED.** The declared rows (a
|
|
449
|
+
/// `null`, an `undefined`, a boolean, an object, a nested array, a function) are carried as their own
|
|
450
|
+
/// variants, so the store generates its own `AddressMalformed` at the failing target's address. **A
|
|
451
|
+
/// `symbol` and a `bigint` have NO carrier row at all** — and folding either into the `object` marker would
|
|
452
|
+
/// report a class that is not the one the caller spelled — so those two are REFUSED AT THE BOUNDARY,
|
|
453
|
+
/// verbosely, naming the class and the POSITION the segment holds. **`JS-1`'s demand is met by
|
|
454
|
+
/// CONSTRUCTION, not by a `catch`: no `String(segment)`/`Number(segment)` is spelled here, so no `valueOf`,
|
|
455
|
+
/// no `Symbol.toPrimitive` and no trap is ever invoked, and the class is read with `typeof` alone.**
|
|
456
|
+
///
|
|
457
|
+
/// **⟶ AND TWO MORE CLASSES ARE DECIDED AT THIS POSITION, ADDED 2026-10-11 BY THIS HOST-FIX PASS — `C-4`
|
|
458
|
+
/// AND `C-12` OF THE GATE-4 ADVERSARIAL PASS:**
|
|
459
|
+
/// * **THE LONE SURROGATE (`C-4`).** `crossing.md §1.2` row 1's dated clause and `§1.4` item 9 make the class
|
|
460
|
+
/// BOUNDARY-ONLY and refuse it *"AT THE PACKAGE'S OWN WALK, BEFORE ANY VERB IS CALLED"*, *"never silently
|
|
461
|
+
/// replaced, never silently dropped and never normalized into a replacement character"* — **and the class
|
|
462
|
+
/// is a property of a JS `string`, which a SEGMENT is.** The as-built walk never called
|
|
463
|
+
/// `hasLoneSurrogate` here, so `on(['\uD800'], f)` was admitted, `facade.rs`'s string path repaired the
|
|
464
|
+
/// code unit to U+FFFD on the way in, and **a listener fired at an address the caller never spelled.**
|
|
465
|
+
/// **THE CLASS IS NOW APPLIED HERE EXACTLY AS THE VALUE POSITION APPLIES IT**, with the answer the same
|
|
466
|
+
/// dated clause declares.
|
|
467
|
+
/// * **AN INTEGRAL SEGMENT ABOVE THE CARRIER'S OWN RANGE (`C-12`).** `AddressArg` row 3 admits *"a `number`
|
|
468
|
+
/// that is integral, `>= 0` and exact as an `f64`"* — and the carrier that row's own spelling reaches is
|
|
469
|
+
/// `JsSegment::Index(u64)` (`package.md §4.5` item 2's `JsSegment` row; `crossing.rs`'s
|
|
470
|
+
/// `JsSegment::Index(i) => Segment::Index(*i)`), **so a JS `number` above `u64::MAX` has NO EXACT SPELLING
|
|
471
|
+
/// IN THE CARRIER AT ALL.** The facade read it with `n as u64`, a SATURATING cast in Rust: `2**64` and
|
|
472
|
+
/// `1e30` both arrived as `u64::MAX`, so **two distinct admissible addresses became ONE store address and
|
|
473
|
+
/// shared one handle.** **THE RANGE IS CHECKED BEFORE THE CAST AND THE OUT-OF-RANGE INTEGRAL SEGMENT IS
|
|
474
|
+
/// REFUSED `AddressMalformed` — `AddressArg` row 8's own code for a number outside the segment domain,
|
|
475
|
+
/// carried and never minted (`DD-40`) — because a silent saturation is a repair (`A76`: *"do not attempt
|
|
476
|
+
/// to fix"*; `§1.8`). `Number.MAX_SAFE_INTEGER` is the boundary carried here: it is the largest integral
|
|
477
|
+
/// `number` a JS consumer can hold and compare EXACTLY, and every `number` at or below it is exact in the
|
|
478
|
+
/// carrier's `u64` as well.**
|
|
479
|
+
function encodeSegment(segment, position, argumentPosition) {
|
|
480
|
+
const kind = typeof segment;
|
|
481
|
+
if (kind === 'string') {
|
|
482
|
+
// `§1.2` row 1's dated clause at the SEGMENT position (`C-4`): the class is refused at the package's
|
|
483
|
+
// own walk and never repaired on the way in.
|
|
484
|
+
if (hasLoneSurrogate(segment)) {
|
|
485
|
+
boundaryReject(
|
|
486
|
+
'ValueNotAdmitted', // row 1's dated clause's own answer, carried and never minted (`DD-40`)
|
|
487
|
+
// **THE TARGET IS THE POSITION'S OWN NAME, NOT THE STRING, FOR THE REASON THIS CLASS EXISTS**: the
|
|
488
|
+
// unpaired code unit cannot cross into the generator's own message either — it has no `String`
|
|
489
|
+
// spelling, and the only alternative is a REPAIR of it, which `§1.8` forbids — so the failing TARGET
|
|
490
|
+
// is named `'address'` (as this file already names it for the other class refused at this position)
|
|
491
|
+
// and the failing segment is named by its INDEX and the ARGUMENT POSITION beside it. **The class is
|
|
492
|
+
// what item 5 (b) makes mandatory; the value that failed is the one datum no clause requires here.**
|
|
493
|
+
'address',
|
|
494
|
+
argumentPosition === undefined
|
|
495
|
+
? `the address holds a string carrying a lone surrogate at position ${position}, and a segment is a string or a non-negative integer`
|
|
496
|
+
: `the address holds a string carrying a lone surrogate at position ${position} of the ${argumentPosition}, and a segment is a string or a non-negative integer`,
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
return segment;
|
|
500
|
+
}
|
|
501
|
+
if (kind === 'number') {
|
|
502
|
+
// `C-12`: the class decision then the RANGE, both before the carrier's cast and never by it.
|
|
503
|
+
if (Number.isInteger(segment) && segment >= 0 && !Number.isSafeInteger(segment)) {
|
|
504
|
+
boundaryReject(
|
|
505
|
+
'AddressMalformed', // `AddressArg` row 8's own declared code, carried and never minted (`DD-40`)
|
|
506
|
+
'address',
|
|
507
|
+
argumentPosition === undefined
|
|
508
|
+
? `the address holds an integral segment ${segment} at position ${position} above the carrier's own range, and a segment is a string or a non-negative integer a \`u64\` can carry exactly`
|
|
509
|
+
: `the address holds an integral segment ${segment} at position ${position} of the ${argumentPosition} above the carrier's own range, and a segment is a string or a non-negative integer a \`u64\` can carry exactly`,
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
return segment;
|
|
513
|
+
}
|
|
514
|
+
if (kind === 'boolean') return segment;
|
|
515
|
+
if (segment === null) return { bad: 'null' };
|
|
516
|
+
if (kind === 'undefined') return { bad: 'undefined' };
|
|
517
|
+
if (kind === 'function') return { bad: 'function' };
|
|
518
|
+
if (kind === 'symbol' || kind === 'bigint') {
|
|
519
|
+
// **THE ARGUMENT POSITION IS APPENDED WHERE THE CALLING SITE DECLARES ONE** (`surface.md §2.5` item 5
|
|
520
|
+
// (b): *"the ARGUMENT POSITION for a verb's arguments"* — `parameter-semantics.md §2.17`'s dated clause,
|
|
521
|
+
// position `1` of `2` at `on`). **WHERE NO SITE IS PASSED, NOTHING MOVES**: the clause this arm already
|
|
522
|
+
// stood on, byte-for-byte, is its default, and no verb but `on` declares a position here.
|
|
523
|
+
boundaryReject(
|
|
524
|
+
'AddressMalformed', // `AddressArg` rows 7–10's own declared code, carried and never minted
|
|
525
|
+
'address',
|
|
526
|
+
argumentPosition === undefined
|
|
527
|
+
? `the address holds ${classSpelling(segment)} at position ${position}, and a segment is a string or a non-negative integer`
|
|
528
|
+
: `the address holds ${classSpelling(segment)} at position ${position} of the ${argumentPosition}, and a segment is a string or a non-negative integer`,
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
if (Array.isArray(segment)) return { bad: 'array' };
|
|
532
|
+
return { bad: 'object' };
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/// **A SEGMENT'S OWN CLASS OUTSIDE `PAR-JS-5`'s DOMAIN, DECIDED AT THE PACKAGE'S OWN BOUNDARY AND REFUSED
|
|
536
|
+
/// `AddressMalformed` — THE OUTSIDE-VALUE CLASSIFICATION, TAKEN **BEFORE** THE STORE IS REACHED AND SO
|
|
537
|
+
/// BEFORE ANY ABSENT-KEY LOOKUP** (`parameter-semantics.md §2.5` line `357`: *"**The declared answer for EACH
|
|
538
|
+
/// outside value** — **`AddressMalformed` for every one of them, with the store's generated message**"*,
|
|
539
|
+
/// the fourteen carrier-variant rows `crossing.md §1.3` names — *"an array holding a negative integer · an
|
|
540
|
+
/// array holding a non-integer number · an array holding `null`/`undefined`/a boolean/an object/a nested
|
|
541
|
+
/// array/a function"*).
|
|
542
|
+
///
|
|
543
|
+
/// **WHY THE DECISION STANDS HERE AND NOT AT THE STORE: a well-formed address no node holds is the store's
|
|
544
|
+
/// own `AddressNotFound` (`a127-surface.test.mjs`'s F1 arm asserts that code at the ABSENT position), while
|
|
545
|
+
/// a node HELD and a segment outside the domain must answer `AddressMalformed` — so the CLASS must be
|
|
546
|
+
/// decided before the lookup rather than after it. The store's own walk decides it at `write` · `delete` ·
|
|
547
|
+
/// `listen` (`src/args.rs`, `src/store.rs`); at the READER the carrier reaches the walk FIRST, which returns
|
|
548
|
+
/// `AddressNotFound` for a held key. **The class is decided ONCE, at `encodeAddress`, for every verb alike**,
|
|
549
|
+
/// so no verb's address position can answer a lookup's code for a class the row refuses.
|
|
550
|
+
///
|
|
551
|
+
/// **THE MESSAGE IS THE STORE'S GENERATED ONE AND NEVER AN AUTHORED ONE** (`boundaryReject` reaches the
|
|
552
|
+
/// addon's `errorMessage`, `docs/specs/storeroom-js/surface.md §2.5` item 2): the SUBJECT is the failing segment's own spelling as the store's
|
|
553
|
+
/// generator renders it (`src/value.rs`'s `Segment::spelling`), and *"the integer `-1`"*, *"a shapeless
|
|
554
|
+
/// value"*, *"a boolean"*, *"an array"* and *"a Proxy"* are that rendering carried here, not invented.
|
|
555
|
+
/// **NOTHING IS COERCED** (`A76`/`JS-1`): the class is read with `typeof`, `Number.isInteger` and
|
|
556
|
+
/// `Array.isArray` alone — no `String(segment)`, no `Number(segment)`, no `valueOf` and no trap — so a
|
|
557
|
+
/// segment that is a `Proxy` is refused by `util.types.isProxy` and NO TRAP RUNS (`surface.md §2.4` item 7
|
|
558
|
+
/// (a) item 1; `crossing.md §1.4` item 4; `C-1`).
|
|
559
|
+
/// **THE CONTAINER IS NOW A PREFIX ARGUMENT AND NOT A SPELLED STRING, 2026-10-17** (`§2.5` item 5 (a)–(b)):
|
|
560
|
+
/// the segments the failing one stood in are handed to `boundaryReject`, which passes the store's own
|
|
561
|
+
/// `dotted_address` spelling of them into the generator's `<container>` slot, so **the container is stated
|
|
562
|
+
/// ONCE and by the store's generator** — and PART TWO carries the reason's class-and-position half ALONE,
|
|
563
|
+
/// which is the half `§2.5` item 5 (b) declares the boundary's own (*"the ARGUMENT POSITION … is carried
|
|
564
|
+
/// INSIDE the generated message's own text"*) and is never a second container claim.
|
|
565
|
+
function refuseOutsideSegment(segment, position, prefix, addressArgumentPosition) {
|
|
566
|
+
const kind = typeof segment;
|
|
567
|
+
let subject;
|
|
568
|
+
if (segment === null) subject = 'a shapeless value';
|
|
569
|
+
else if (kind === 'undefined') subject = 'an absent value';
|
|
570
|
+
else if (kind === 'boolean') subject = 'a boolean';
|
|
571
|
+
else if (kind === 'number') subject = Number.isInteger(segment) ? `the integer ${segment}` : `the number ${segment}`;
|
|
572
|
+
else if (kind === 'function') subject = 'a function';
|
|
573
|
+
else if (kind === 'symbol' || kind === 'bigint') subject = classSpelling(segment);
|
|
574
|
+
else if (Array.isArray(segment)) subject = 'an array';
|
|
575
|
+
else subject = 'an object'; // a `Proxy` over an array included: its class is `an object` to the carrier
|
|
576
|
+
boundaryReject(
|
|
577
|
+
'AddressMalformed', // `PAR-JS-5`'s own declared answer for every one of the fourteen rows, carried (`DD-40`)
|
|
578
|
+
subject,
|
|
579
|
+
addressArgumentPosition === undefined
|
|
580
|
+
? `the address holds ${subject} at position ${position}, and a segment is a string or a non-negative integer`
|
|
581
|
+
: `the address holds ${subject} at position ${position} of the ${addressArgumentPosition}, and a segment is a string or a non-negative integer`,
|
|
582
|
+
prefix,
|
|
583
|
+
);
|
|
584
|
+
return { bad: 'object' }; // `boundaryReject` throws; this is unreachable and is not a second path
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/// **`AddressArg` ROWS 5–6'S OUTSIDE SHAPE, DECIDED ON THE VALUE AS IT IS AND BEFORE ANY READ** (`A76`'s
|
|
588
|
+
/// class-first order; `C-1`): everything that is neither an `Array` nor a `Proxy` is rows 5–6's outside
|
|
589
|
+
/// value at the ADDRESS position — **and a `Proxy` is NOT this arm**: its own refusal stands above, where the
|
|
590
|
+
/// class decision is taken on `util.types.isProxy` before any `.length` read and before any element
|
|
591
|
+
/// (`surface.md §2.4` item 7 (a) item 1; `crossing.md` `AddressArg` row 12; `DD-34`), so no trap is run by
|
|
592
|
+
/// THIS predicate either.
|
|
593
|
+
function isOutsideAddressValue(value) {
|
|
594
|
+
if (value === undefined || value === null) return true; // row 5's two named classes, on the value as it is
|
|
595
|
+
if (isProxyOf(value)) return false; // row 12's own arm, decided above, with no trap run
|
|
596
|
+
if (Array.isArray(value)) return false; // rows 1–3, 13, 14 — the ordinary array arm and its own tests
|
|
597
|
+
return true; // rows 5–6: a string, a number, a boolean, an object, a function, a symbol, a bigint
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/// **THE VALUE-SHAPE ARM OF `AddressArg` ROWS 5–6 — A NON-ARRAY OUTSIDE VALUE AT AN ADDRESS POSITION,
|
|
601
|
+
/// REFUSED AT THE BOUNDARY WITH ITS OWN RENDERING AND THE ARGUMENT POSITION IT STANDS AT** (`surface.md`
|
|
602
|
+
/// §2.5 item 5 (a)–(b); the `CF-3` authority split).
|
|
603
|
+
///
|
|
604
|
+
/// **THE DEFECT IT CLOSES, NAMED AS THE SUPERVISOR'S OWN RECORD NAMES IT** (`archive/reviews/
|
|
605
|
+
/// 2026-10-16-constraints-publication-gate1.md` §57, finding `2`): at EVERY address position — `listen`,
|
|
606
|
+
/// `read`, `write`, `delete`, `readLiteral` — a NON-ARRAY outside value (`'a.b'`, `7`, `null`, `undefined`)
|
|
607
|
+
/// answered the store's GENERIC line *"the address argument is not a legal address segment in `''` …"*,
|
|
608
|
+
/// **carrying the class half and NEITHER the failing TARGET NOR the argument POSITION** — while `§2.5` item 5
|
|
609
|
+
/// (a) makes the failing target mandatory and item 5 (b) makes the ARGUMENT POSITION mandatory where the
|
|
610
|
+
/// contract declares one (and a verb's argument position is the one place it does). **IT WAS HIDDEN UNTIL
|
|
611
|
+
/// NOW because the older `register` subject carried both at a HANDLE position — a VALUE position, where a
|
|
612
|
+
/// non-segment value is printed as its own value — and once the subject moved to an ADDRESS position the gap
|
|
613
|
+
/// became visible.**
|
|
614
|
+
///
|
|
615
|
+
/// **WHAT IS DECLARED, AND WHAT THIS SITE THEREFORE DOES:**
|
|
616
|
+
/// * **THE TARGET IS THE VALUE'S OWN RENDERING** (item 5 (a): *"a non-segment value PRINTED AS ITS OWN
|
|
617
|
+
/// VALUE … where the failure is about a value and not about a segment"*), in the spelling the store's own
|
|
618
|
+
/// generator and this package already give that value at every other site: `the number 7` · `the string
|
|
619
|
+
/// 'a.b'` · `null` · `undefined` — **and a class whose own value cannot be printed (a `bool` · a
|
|
620
|
+
/// `function` · an `object` · a `Proxy`) is rendered by the store's own class spelling for it**, exactly
|
|
621
|
+
/// as `refuseOutsideSegment` renders the same classes at a SEGMENT position.
|
|
622
|
+
/// * **THE POSITION IS THE ARGUMENT POSITION** the verb's own signature declares (item 5 (b): *"the
|
|
623
|
+
/// ARGUMENT POSITION for a verb's arguments"*) — `first argument` at all five verbs, whose `address` is
|
|
624
|
+
/// the first position of each (`surface.md` §2.4 item 9 (f)'s table).
|
|
625
|
+
/// * **AND THE CONTAINER IS THE ARGUMENT ITSELF AND NEVER THE EMPTY REGISTER.** **THE ONE DECISION THE
|
|
626
|
+
/// CLAUSE DOES NOT PIN, STATED RATHER THAN GUESSED:** the store's `AddressMalformed` template always
|
|
627
|
+
/// prints a container (`src/error.rs`, *"… in '{container}', …"*), and the store's own trigger for this
|
|
628
|
+
/// state supplies the empty string (`malformed_address_argument`, whose rendering *"… in '', …"* names
|
|
629
|
+
/// THE REGISTER). **THAT CONTAINER IS FALSE HERE** — a whole-address SHAPE failure is found in no
|
|
630
|
+
/// container at all, the address argument never having resolved against the register — so the truthfully
|
|
631
|
+
/// filled slot is the failing ARGUMENT's own name, `address`, which is the same reading the store's own
|
|
632
|
+
/// `ConstraintListInvalid` row takes where the container is a KEY and not an address (`'constraints'`;
|
|
633
|
+
/// `docs/specs/storeroom-native/contract.md` §8.2's row and its `<CONTAINERSEGMENT>` degenerate arm).
|
|
634
|
+
/// **NO CLAUSE FIXES THIS WORDING: the clause fixes the TARGET, the CLASS and the POSITION, and the
|
|
635
|
+
/// container is this site's own truth claim.** **PART TWO then carries the reason's class half and the
|
|
636
|
+
/// position, appended after a separator, exactly as `boundaryReject` appends it at every other site.**
|
|
637
|
+
function refuseOutsideAddressValue(address, addressArgumentPosition) {
|
|
638
|
+
const kind = typeof address;
|
|
639
|
+
let subject;
|
|
640
|
+
if (address === null) subject = 'null';
|
|
641
|
+
else if (kind === 'undefined') subject = 'undefined';
|
|
642
|
+
else if (kind === 'number') subject = `the number ${address}`;
|
|
643
|
+
else if (kind === 'string') subject = `the string '${address}'`;
|
|
644
|
+
else if (kind === 'boolean') subject = 'a boolean';
|
|
645
|
+
else if (kind === 'function') subject = 'a function';
|
|
646
|
+
else if (kind === 'symbol' || kind === 'bigint') subject = classSpelling(address);
|
|
647
|
+
else subject = 'an object'; // a `Proxy` over a plain object included: its class is `an object` to the carrier
|
|
648
|
+
// **THE CONTAINER SLOT CARRIES THE ARGUMENT'S OWN NAME AND NOT `''`** — see this site's own clause above.
|
|
649
|
+
boundaryReject(
|
|
650
|
+
'AddressMalformed', // `AddressArg` rows 5–6's own declared code, carried and never minted (`DD-40`)
|
|
651
|
+
subject,
|
|
652
|
+
`the address position holds ${subject} at the ${addressArgumentPosition}, and an address is an array of segments`,
|
|
653
|
+
['address'],
|
|
654
|
+
);
|
|
655
|
+
return { k: 'A' }; // `boundaryReject` throws; this is unreachable and is not a second path
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/// `crossing.md §1.3`'s `AddressArg` table, rows 1–14.
|
|
659
|
+
///
|
|
660
|
+
/// **⟶ AND ONE OPTIONAL PARAMETER, ADDED 2026-10-11 BY THE `Q3` PASS, SO `on` CAN OBEY `A81` WITHOUT A
|
|
661
|
+
/// SECOND REFUSAL FORM AND WITHOUT A SECOND ENCODER.** `addressArgumentPosition` is the ARGUMENT POSITION
|
|
662
|
+
/// `parameter-semantics.md §2.17`'s dated clause declares at a site that declares one — `on`'s `address` is
|
|
663
|
+
/// `1` of `2` — and it is threaded into the SEGMENT arm alone, which is the one arm of this table that
|
|
664
|
+
/// refuses at the BOUNDARY rather than carrying its class to the store. **EVERY OTHER CALLER PASSES
|
|
665
|
+
/// NOTHING AND EVERY BYTE OF EVERY OTHER ARM IS UNMOVED**, so no verb's answer and no other site's message
|
|
666
|
+
/// changes: the parameter is additive and its absence is the as-filed reading.
|
|
667
|
+
///
|
|
668
|
+
/// **⟶ AND FROM 2026-10-17 A SECOND, SEPARATE POSITION PARAMETER GOVERNS `AddressArg` ROWS 5–6**
|
|
669
|
+
/// (`§2.5` item 5 (a)–(b); see `refuseOutsideAddressValue` above): a NON-ARRAY outside value — a supplied
|
|
670
|
+
/// `undefined`, a `null`, a string, a number, a boolean, an object, a function — is refused at the boundary
|
|
671
|
+
/// at EVERY verb that declares an argument position, verbosely, carrying its own rendering and that position.
|
|
672
|
+
///
|
|
673
|
+
/// **WHY IT IS A SEPARATE PARAMETER AND NOT THE SAME ONE, STATED SO THE BLAST RADIUS IS EXACTLY ONE ARM:**
|
|
674
|
+
/// `addressArgumentPosition` is the SEGMENT arm's (`rows 7–10`, and the `Proxy` and out-of-range arms) and it
|
|
675
|
+
/// is passed by `listen` ALONE, so the segment arm's bytes at the other four verbs are UNMOVED — **THE
|
|
676
|
+
/// INSTRUCTION IS THAT NO MESSAGE ALREADY CORRECT MOVES, and the supervisor's defect is the NON-ARRAY arm
|
|
677
|
+
/// only.** `addressValuePosition` reaches the arms THIS PASS REPAIRS, and nothing else.
|
|
678
|
+
/// **WHERE NO VALUE POSITION IS PASSED — the construction's `listeners[]` walk, which calls this encoder with
|
|
679
|
+
/// one argument — EVERY BYTE IS UNMOVED and the store answers the construction itself** (`PAR-JS-21`; the
|
|
680
|
+
/// construction's own answer is the store's, and no argument position is declared at that site).
|
|
681
|
+
export function encodeAddress(address, addressArgumentPosition, addressValuePosition) {
|
|
682
|
+
// `crossing.md §1.3`'s absent-versus-`undefined` rule, rule 1: an argument position the call supplied no
|
|
683
|
+
// value for is ABSENT, and `undefined` at a supplied position folds to that SAME state. `AddressArg` rows
|
|
684
|
+
// 4 and 5 answer the one code, so no declared answer moves by the fold.
|
|
685
|
+
//
|
|
686
|
+
// **⟶ AND AT A SITE THAT DECLARES AN ARGUMENT POSITION, ROWS 5 AND 6 ARE ANSWERED HERE AND VERBOSELY**
|
|
687
|
+
// (`§2.5` item 5 (a)–(b); `refuseOutsideAddressValue`): a supplied `undefined`, a `null` and every
|
|
688
|
+
// non-array carry their OWN RENDERING and the POSITION instead of the store's generic argument-shaped line.
|
|
689
|
+
// **THE ARITY-ABSENT CALL IS NOT THIS ARM AND CHANGES NOTHING**: `undefined` reaches this encoder only
|
|
690
|
+
// from a call that SUPPLIED it (every caller passes `[encodeAddress(address)]` under its own `n >= 1`
|
|
691
|
+
// test), while the NO-ARGUMENT call reaches the store as its own carrier and answers there — which is
|
|
692
|
+
// `CF-3`'s part 5 unmoved (*"an absent CARRIER argument … crosses to the store as its own carrier value"*).
|
|
693
|
+
if (addressValuePosition !== undefined && isOutsideAddressValue(address)) {
|
|
694
|
+
refuseOutsideAddressValue(address, addressValuePosition);
|
|
695
|
+
}
|
|
696
|
+
if (address === undefined) return { k: 'A' };
|
|
697
|
+
if (address === null) return { k: 'N' };
|
|
698
|
+
// **`A76`/`JS-2`: THE CLASS DECISION COMES FIRST HERE TOO, ON THE ADDRESS AS IT IS — AND THE `Proxy`
|
|
699
|
+
// REFUSAL IS PART OF THAT DECISION AND NOT BESIDE IT** (`surface.md §2.4` item 7 (a) item 1: *"the `Proxy`
|
|
700
|
+
// refusal is part of that decision, not beside it … BEFORE the shape test, BEFORE `Array.isArray`, BEFORE
|
|
701
|
+
// any `.length` read and BEFORE any element is read"*). **`util.types.isProxy` READS NO MEMBER AND
|
|
702
|
+
// INVOKES NO HANDLER**, which is what makes the class decidable with NO TRAP RUN at both proxies-over-array
|
|
703
|
+
// and proxies-over-object (`crossing.md §1.4` item 4; `DD-34`; `C-1`). **AND `§2.5` item 5 (b) MAKES THE
|
|
704
|
+
// CLASS HALF MANDATORY**: the refusal's message carries `a Proxy` and the POSITION, so the class the value
|
|
705
|
+
// HAS is named rather than the store's own generic object arm; a class extending `Array` — for which
|
|
706
|
+
// `Array.isArray` is TRUE — is refused under its own declared class (`AddressArg` row 11's
|
|
707
|
+
// `AddressMalformed`: *"the shape is not an array"*) rather than ADMITTED because a language predicate made
|
|
708
|
+
// it look like one.
|
|
709
|
+
if (isProxyOf(address)) {
|
|
710
|
+
boundaryReject(
|
|
711
|
+
'AddressMalformed', // row 12's own declared code (`DD-34`), carried and never minted (`DD-40`)
|
|
712
|
+
classSpelling(address), // the class half, mandatory under item 5 (b): `a Proxy`
|
|
713
|
+
addressArgumentPosition === undefined
|
|
714
|
+
? 'the address position holds a Proxy, and a Proxy over an array is refused as AddressArg row 12\'s own class with no trap run'
|
|
715
|
+
: `the address position of the ${addressArgumentPosition} holds a Proxy, and a Proxy over an array is refused as AddressArg row 12's own class with no trap run`,
|
|
716
|
+
);
|
|
717
|
+
}
|
|
718
|
+
if (Array.isArray(address)) {
|
|
719
|
+
if (arrayClass(address) === 'class') return { k: 'C' }; // row 11: a class extending `Array`
|
|
720
|
+
for (let i = 0; i < address.length; i += 1) {
|
|
721
|
+
// **⟶ AND THE HOLE SCAN IS `Object.hasOwn`, NOT `i in address` — `D-35`'s READ HALF, CLOSED
|
|
722
|
+
// 2026-10-26.** `in` is a `[[HasProperty]]` and WALKS THE PROTOTYPE CHAIN, so a caller's own member at
|
|
723
|
+
// `Array.prototype[1]` answered "present" for an index the caller's array does not carry: MEASURED, a
|
|
724
|
+
// one-member array grown to `length 2` under `Array.prototype[1] = 'b'` was read as the DENSE address
|
|
725
|
+
// `['a', 'b']` and answered the store's `AddressNotFound` — a prototype deciding which address was
|
|
726
|
+
// admitted, where row `14` (`DD-8`) declares the sparse refusal `AddressMalformed`. **THE FORM IS THE
|
|
727
|
+
// ONE THE WALK ALREADY TAKES** (`contract.md §2.1` item `(1c)(ii)`: `Object.hasOwn`, a static, and never
|
|
728
|
+
// `in`), and no lawful address moves: a dense array's own indices answer `true` exactly as `in` did.
|
|
729
|
+
if (!Object.hasOwn(address, i)) return { k: 'S' }; // row 14 (`DD-8`)
|
|
730
|
+
}
|
|
731
|
+
const segments = [];
|
|
732
|
+
for (let i = 0; i < address.length; i += 1) {
|
|
733
|
+
const segment = address[i];
|
|
734
|
+
const encoded = encodeSegment(segment, i, addressArgumentPosition);
|
|
735
|
+
// **`PAR-JS-5`: THE FOURTEEN ROWS' CLASS IS DECIDED HERE, BEFORE THE STORE AND BEFORE ANY LOOKUP**
|
|
736
|
+
// — a `{bad: …}` marker, a negative or non-integer number, a boolean, or a `Proxy` over an array.
|
|
737
|
+
const outsideMarker = encoded !== null && typeof encoded === 'object' && typeof encoded.bad === 'string';
|
|
738
|
+
const outsideNumber = typeof segment === 'number' && !(Number.isInteger(segment) && segment >= 0);
|
|
739
|
+
if (outsideMarker || typeof segment === 'boolean' || outsideNumber) {
|
|
740
|
+
// **AND THE PREFIX IS THE SEGMENTS THIS ONE STOOD IN AND NOTHING ELSE** — the container the
|
|
741
|
+
// store's own `malformed_segment` names at its `L-1` arm (the store's walk pushes each in-domain
|
|
742
|
+
// segment into its own container before it tests the next), so the refusal's container is the
|
|
743
|
+
// SAME datum at both layers and not a second spelling of it.
|
|
744
|
+
// **⟶ AND IT IS BUILT BY INDEX, NOT BY `address.slice(0, i)` — `D-35`'s READ HALF, 2026-10-26.**
|
|
745
|
+
// `slice` is `Array.prototype.slice` taken off a mutable prototype on the REFUSAL path: a caller who
|
|
746
|
+
// deleted it turned a declared refusal into a raw host `TypeError` out of a lawful call, which
|
|
747
|
+
// `surface.md §2.5` item 5 (e) files as a FINDING. **The loop starts at the segments already passed
|
|
748
|
+
// the sparse scan above, so it sees no hole** — the prefix is the same segments, in the same order, as
|
|
749
|
+
// a fresh list (`contract.md §2.1` item `(1c)(i)` + item `(1)`(c)).
|
|
750
|
+
const prefix = [];
|
|
751
|
+
for (let at = 0; at < i; at += 1) appendOwn(prefix, address[at]);
|
|
752
|
+
refuseOutsideSegment(segment, i, prefix, addressArgumentPosition);
|
|
753
|
+
}
|
|
754
|
+
// **⟶ AND THE CARRIER'S SEGMENT LIST IS EXTENDED BY INDEX TOO** (`contract.md §2.1`'s clause of
|
|
755
|
+
// 2026-10-24 on `F7-1`, item `(1b)`, and the battery's row `(g)`): the as-built `segments.push` was
|
|
756
|
+
// `Array.prototype.push` taken off a MUTABLE PROTOTYPE on the ADMISSION path, so a caller's no-op `push`
|
|
757
|
+
// emptied this list and the whole write crossed to the REGISTER instead of the address the caller
|
|
758
|
+
// spelled — an admitted drive whose crossed member moved. The list, its order and the shape it is
|
|
759
|
+
// handed in are unmoved.
|
|
760
|
+
appendOwn(segments, encoded);
|
|
761
|
+
}
|
|
762
|
+
return { k: 'L', s: segments }; // rows 1–3, 13
|
|
763
|
+
}
|
|
764
|
+
if (typeof address === 'object') return { k: 'C' }; // rows 6 and 11: the shape is not an array's
|
|
765
|
+
return { k: 'D', o: encodeSegment(address, 0) }; // row 6: a non-array's five named classes
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/// `crossing.md §1.3`'s `TierArg` table and `TierSetItem` table.
|
|
769
|
+
///
|
|
770
|
+
/// **A SUPPLIED `undefined` IS PRESENT AT THIS POSITION AND `delete`'s TIER IS REACHED AS A VALUE — THE ONE
|
|
771
|
+
/// CALL THAT FOLDS TO THE ABSENT ROW IS THE CALL THAT SUPPLIED NOTHING THERE.** **⟶ ADJUDICATED 2026-10-16,
|
|
772
|
+
/// AND THIS CLAUSE IS THE OPERATIVE READING OF THE BYTES BELOW** (`parameter-semantics.md §2.6`'s
|
|
773
|
+
/// `PAR-JS-6` row, its `the declared answer for EACH outside value` cell as reconciled the same date, whose
|
|
774
|
+
/// words are *"`a.read(address, undefined)` IS A SUPPLIED VALUE AT THIS POSITION AND TAKES `PAR-JS-6`'s
|
|
775
|
+
/// DECLARED ANSWER — the store's own thrown `{status, message}` with `status` `AddressMalformed` — while the
|
|
776
|
+
/// ONE CALL THAT FOLDS TO THE ABSENT ROW IS `a.read(address)`, WHICH SUPPLIED NOTHING THERE"*; the same
|
|
777
|
+
/// adjudication stands at `acceptance.md §4.1` item `7`, whose *"folds to the ABSENT row"* is read through
|
|
778
|
+
/// that row from that date). **SO `foldsUndefined` IS `false` AT EVERY SUPPLYING SITE — `read` ·
|
|
779
|
+
/// `readLiteral` · `write` · `delete` — and the arity fold that reaches `{ k: 'A' }` is the NO-ARGUMENT CALL
|
|
780
|
+
/// ALONE**, which is exactly what `supplied` carries: `n >= 2` at the readers and the writers, read off the
|
|
781
|
+
/// METHOD's own call arity (`docs/specs/storeroom-js/surface.md §2.12` item 3's one-spelling rule). **THE STORE'S OWN `TierArg::Undefined` ARM
|
|
782
|
+
/// ANSWERS `AddressMalformed` AT ALL FOUR** (`src/args.rs`'s `read_tier_sel` and `write_tier`), so no code is
|
|
783
|
+
/// minted here and the answer is the store's own.
|
|
784
|
+
///
|
|
785
|
+
/// **AND `A76`'S CLASS ORDER IS TAKEN HERE FIRST (`JS-2`'s reach at this carrier):** a `Proxy` is refused
|
|
786
|
+
/// as an OBJECT before any element is read from it — **so a throwing `get` trap cannot be raised, because
|
|
787
|
+
/// nothing reads the proxy** — and a class extending `Array` is refused as an OBJECT (`TierArg` row 6's
|
|
788
|
+
/// `OutOfDomainTier`) rather than admitted as the array spelling row 2 declares for the readers.
|
|
789
|
+
/// **THE SUPPLIED-`undefined`-TIER ARM AT AN ADDRESS POSITION** — `refuseOutsideAddressValue`'s own
|
|
790
|
+
/// shape, taken at the one value that reached neither of the boundary's two segment/address arms
|
|
791
|
+
/// (`DEF-2026-10-17-A`; `surface.md §2.5` item 5 (a)–(b) and its `CF-3` authority split).
|
|
792
|
+
///
|
|
793
|
+
/// **THE TARGET IS THE VALUE'S OWN RENDERING AND IT IS THE STORE'S OWN SPELLING FOR THAT VALUE** (item 5
|
|
794
|
+
/// (a): *"a non-segment value PRINTED AS ITS OWN VALUE"*) — `undefined`, which is the spelling
|
|
795
|
+
/// `refuseOutsideAddressValue` already gives this same value at the whole-address arm, so ONE value has
|
|
796
|
+
/// ONE rendering at both arms and neither is authored here. **THE CONTAINER IS THE ARGUMENT'S OWN NAME**
|
|
797
|
+
/// (`['address']`, handed to `boundaryReject`, whose third slot fills the generator's own `<container>`),
|
|
798
|
+
/// exactly as the whole-address arm does one function above — a WHOLE-ADDRESS refusal is found in no
|
|
799
|
+
/// container, so the truthfully filled slot is the failing ARGUMENT's own name. **PART TWO CARRIES THE
|
|
800
|
+
/// POSITION AND NOT A SECOND CONTAINER CLAIM:** the ARGUMENT POSITION `§2.5` item 5 (b) requires beside the
|
|
801
|
+
/// class, and the class of the value the position refused.
|
|
802
|
+
///
|
|
803
|
+
/// **⟶ AND THE SECOND VALUE THIS ARM SERVES IS A SUPPLIED `null`, WIDENED 2026-10-17 BY THE SAME ONE SITE
|
|
804
|
+
/// (`DEF-2026-10-17-E`).** **THE DEFECT: `read(['a','b','c'], null)` crossed as `{ k: 'N' }` to the store's
|
|
805
|
+
/// `TierArg::Null` arm and rendered the SAME register-shaped sentence
|
|
806
|
+
/// *"the tier argument is not a legal address segment in `''`"* — the empty container and the same wrong
|
|
807
|
+
/// argument the `undefined` half above had already been repaired for, so ONE ROW'S two values carried TWO
|
|
808
|
+
/// renderings while `crossing.md §1.3`'s `TierArg` row 4 declares them ONE answer.** **THE STATUS IS
|
|
809
|
+
/// UNMOVED AND NOT MINTED** (`DD-40`): row 4's own `AddressMalformed`, on every verb. **WHAT MOVES IS THE
|
|
810
|
+
/// RENDERING ALONE, AND IT MOVES ALONG THE PATH ALREADY TAKEN:** this helper is the one branch, and the
|
|
811
|
+
/// value's own runtime spelling is its parameter — so `null` takes the SAME path as `undefined` rather than
|
|
812
|
+
/// a second one, and the two values of row 4 render as one shape with one spelling changed. **THE STORE'S
|
|
813
|
+
/// OWN `TierArg::Null` ARM IS UNTOUCHED** (`src/args.rs`), so a native caller of the same row keeps its
|
|
814
|
+
/// bytes; what is intercepted is the JS boundary's own carrier, which is where `DEF-2026-10-17-A` put the
|
|
815
|
+
/// `undefined` half for the same reason.
|
|
816
|
+
function refuseSuppliedOutsideTier(value, addressArgumentPosition) {
|
|
817
|
+
boundaryReject(
|
|
818
|
+
'AddressMalformed', // `PAR-JS-6`'s and `TierArg` rows 3–4's own declared code for this value, carried (`DD-40`)
|
|
819
|
+
value, // the value's own runtime spelling, as the store renders it and as `refuseOutsideSegment` renders it
|
|
820
|
+
// **THE POSITION HALF IS SPELLED IN THIS SITE'S OWN VOCABULARY because `addressArgumentPosition` is the
|
|
821
|
+
// address's OWN position token (`'first argument'`, the position every one of the five verbs declares
|
|
822
|
+
// for its `address` — `surface.md §2.4` item 9 (f)'s table): the address position was SUPPLIED, and
|
|
823
|
+
// what was supplied BESIDE it is a `tier` position carrying this value. The sentence therefore names
|
|
824
|
+
// the argument that was supplied, the position it stands AT, and the class the supplied value has —
|
|
825
|
+
// which is the whole of what item 5 (b) requires to travel inside the message.**
|
|
826
|
+
addressArgumentPosition === undefined
|
|
827
|
+
? `the address position was supplied, the tier position holds ${value}, and a tier is a token or a set of tokens`
|
|
828
|
+
: `the address position was supplied at the ${addressArgumentPosition}, the tier position holds ${value}, and a tier is a token or a set of tokens`,
|
|
829
|
+
['address'],
|
|
830
|
+
);
|
|
831
|
+
return undefined; // `boundaryReject` throws; this is unreachable and is not a second path
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
export function encodeTier(tier, supplied, foldsUndefined, addressArgumentPosition) {
|
|
835
|
+
if (!supplied) return { k: 'A' };
|
|
836
|
+
if (tier === undefined) {
|
|
837
|
+
if (foldsUndefined) return { k: 'A' };
|
|
838
|
+
// **⟶ AND THE SUPPLIED-`undefined` ARM IS THE FOURTH BRANCH, REFUSED AT THE BOUNDARY 2026-10-17
|
|
839
|
+
// (`DEF-2026-10-17-A`; `surface.md` §2.5 item 5 (a)–(b) and its `CF-3` authority split).**
|
|
840
|
+
//
|
|
841
|
+
// **THE DEFECT, MEASURED ON INSTALLED BYTES AND REPRODUCED AT THIS TREE: this value crossed to the
|
|
842
|
+
// store as `{ k: 'U' }` and the store answered its OWN `malformed_tier_argument()`
|
|
843
|
+
// (`src/args.rs`'s `read_tier_sel` / `read_literal_tier_sel` / `write_tier`), whose generated text is
|
|
844
|
+
// *"the tier argument is not a legal address segment in `''`, segments are strings or non-negative
|
|
845
|
+
// integers"* — AN EMPTY CONTAINER AND A NAMED ARGUMENT THE OFFENDING VALUE IS NOT.** *"`''` for the
|
|
846
|
+
// register"* (`docs/specs/storeroom-native/contract.md` §8.2's `<CONTAINER>`), so that message answers
|
|
847
|
+
// a failure found INSIDE THE REGISTER, while a `read(['a','b','c'], undefined)` on an EMPTY store has
|
|
848
|
+
// resolved against no register node at all.
|
|
849
|
+
//
|
|
850
|
+
// **WHY THIS IS THE MISMATCH THE OTHER THREE BRANCHES ALREADY REPAIR, AND WHY IT IS THE FOURTH:** rows
|
|
851
|
+
// 1–3 of that classification are whole-ADDRESS shapes refused by `refuseOutsideAddressValue`
|
|
852
|
+
// (container `'address'`, position `at the first argument`), and the array's own outside SEGMENTS are
|
|
853
|
+
// refused by `refuseOutsideSegment` (container = the failing segment's PREFIX). **A SUPPLIED
|
|
854
|
+
// `undefined` TIER BESIDE AN ADDRESS THAT IS ITSELF WHOLLY IN DOMAIN — `['a','b','c']`, `['a.b']`,
|
|
855
|
+
// `['a']`, `[]` — REACHED NEITHER ARM** and fell through to the store's register-shaped sentence.
|
|
856
|
+
//
|
|
857
|
+
// **WHAT IS DECLARED HERE, AT THIS ONE SITE:** the ARGUMENT POSITION the verb's own signature declares
|
|
858
|
+
// (item 5 (b): *"the ARGUMENT POSITION for a verb's arguments"*) and a TRUE container — the same
|
|
859
|
+
// reading the whole-address arm takes one function above and the same one the store's own
|
|
860
|
+
// `ConstraintListInvalid` row takes where its container is a KEY and not an address
|
|
861
|
+
// (`constraints`; native `contract.md` §8.2's row and its `<CONTAINERSEGMENT>` degenerate arm).
|
|
862
|
+
// **THE STATUS IS NOT MINTED** (`DD-40`): it stays the store's own `AddressMalformed`, which is the
|
|
863
|
+
// code this row declares — *"`AddressMalformed` when the argument is `null` or `undefined`"*
|
|
864
|
+
// (`parameter-semantics.md` §2.6's `PAR-JS-6` answer cell, as reconciled 2026-10-16) — carried and not
|
|
865
|
+
// re-minted, exactly as `refuseOutsideSegment` carries it.
|
|
866
|
+
//
|
|
867
|
+
// **WHAT DOES NOT MOVE:** the call still SUPPLIES the value at the position and does not fold it to the
|
|
868
|
+
// ABSENT row (`PAR-JS-6`'s reconciliation, unmoved: the ONE call that folds is `a.read(address)`, which
|
|
869
|
+
// supplied nothing); `write`'s required tier answers the same code; and the store's own
|
|
870
|
+
// `TierArg::Undefined` arm is untouched.
|
|
871
|
+
refuseSuppliedOutsideTier('undefined', addressArgumentPosition);
|
|
872
|
+
return { k: 'U' }; // `refuseSuppliedOutsideTier` throws; this is unreachable and is not a second path
|
|
873
|
+
}
|
|
874
|
+
// **⟶ AND THE OTHER VALUE OF ROW 4 TAKES THE SAME BRANCH, ADDED 2026-10-17 (`DEF-2026-10-17-E`).**
|
|
875
|
+
// `crossing.md §1.3`'s `TierArg` row 4 prints ONE answer over TWO values — *"`null` / `undefined` … →
|
|
876
|
+
// `AddressMalformed` on every verb"* — and the dated rule above it keeps `read(i, a, null)` a PRESENT
|
|
877
|
+
// value answering its OWN row (as against row 3's arity fold), so the value must arrive at the same
|
|
878
|
+
// branch the `undefined` half already stands on and must NOT mint a code of its own. **WHAT DOES NOT
|
|
879
|
+
// MOVE:** the store's `TierArg::Null` arm is untouched, `TierSetItem` row 2 stays `OutOfDomainTier` for a
|
|
880
|
+
// `null` INSIDE the array (a different row with a different answer — the two are NOT collapsed), and the
|
|
881
|
+
// ABSENT position still folds above this line at the `!supplied` guard.
|
|
882
|
+
if (tier === null) {
|
|
883
|
+
refuseSuppliedOutsideTier('null', addressArgumentPosition);
|
|
884
|
+
return { k: 'N' }; // `refuseSuppliedOutsideTier` throws; this is unreachable and is not a second path
|
|
885
|
+
}
|
|
886
|
+
if (typeof tier === 'string') return { k: 'T', v: tier };
|
|
887
|
+
if (isProxyOf(tier)) return { k: 'O' }; // row 6: an object, and no trap is invoked
|
|
888
|
+
if (Array.isArray(tier)) {
|
|
889
|
+
if (arrayClass(tier) === 'class') return { k: 'O' }; // row 6: a class extending `Array` is an object
|
|
890
|
+
// **⟶ AND THE TIER SET IS ENCODED BY A LOCAL INDEX LOOP, NOT BY `Array.prototype.map`** (`contract.md §2.1`'s
|
|
891
|
+
// clause of 2026-10-24 on `F8-2`, items `(2a)`, `(2b)` and `(2c)`, and item `(2b)`'s row `61`; arm `(xix)`,
|
|
892
|
+
// cell `JC-TC-65`): `delete Array.prototype.map` threw a RAW HOST `TypeError` out of a LAWFUL store verb, and
|
|
893
|
+
// a forged `map` silently dropped tier items from a verb that then succeeded — a crossed member decided by a
|
|
894
|
+
// prototype. The loop carries one encoded item per item, in the caller's own order.
|
|
895
|
+
const items = [];
|
|
896
|
+
for (let i = 0; i < tier.length; i += 1) appendOwn(items, encodeTierSetItem(tier[i]));
|
|
897
|
+
return { k: 'S', i: items };
|
|
898
|
+
}
|
|
899
|
+
if (typeof tier === 'number') return { k: 'D', v: tier };
|
|
900
|
+
if (typeof tier === 'boolean') return { k: 'B', v: tier };
|
|
901
|
+
if (typeof tier === 'function') return { k: 'F' };
|
|
902
|
+
return { k: 'O' };
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
function encodeTierSetItem(item) {
|
|
906
|
+
if (item === null) return { bad: 'null' };
|
|
907
|
+
if (item === undefined) return { bad: 'undefined' };
|
|
908
|
+
if (typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean') return item;
|
|
909
|
+
if (typeof item === 'function') return { bad: 'function' };
|
|
910
|
+
return { bad: 'object' };
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/// `crossing.md §1.3`'s `OpIdArg` table, `6` rows.
|
|
914
|
+
///
|
|
915
|
+
/// **⟶ `JS-1` AND `JS-6` ARE CLOSED AT THIS SITE — THE `Number(opId)` COERCION IS GONE.** The shipped arm
|
|
916
|
+
/// was `return { k: 'D', v: Number(opId) }`, and it was wrong three ways at once: `Number(Symbol())` threw
|
|
917
|
+
/// a RAW HOST `TypeError` out of this frame (outside `docs/specs/storeroom-js/surface.md §2.5`'s one form), an object with a throwing
|
|
918
|
+
/// `valueOf`/`Symbol.toPrimitive` or a `Proxy` with a throwing trap did the same, and **a `bigint` crossed
|
|
919
|
+
/// the NUMBER ARM and was substituted — `Number(10n)` is `10` — so the caller's `10n` was reported as a
|
|
920
|
+
/// number** (`JS-6`). **THE FIX IS THE ORDER, NOT A `catch`: THE CLASS IS DECIDED FIRST AND NOTHING IS
|
|
921
|
+
/// CONVERTED, so no `valueOf`, no `Symbol.toPrimitive` and no trap is ever invoked and there is no host
|
|
922
|
+
/// error left to catch.**
|
|
923
|
+
///
|
|
924
|
+
/// **THE DECLARED ROWS CROSS TO THE STORE (`OpIdArg` rows 1, 3–6): a `string`, a supplied `undefined`, a
|
|
925
|
+
/// `null`, and a NUMBER — `JS-1`'s *"a number"* row 6 — each carried as its own variant so the store renders
|
|
926
|
+
/// its own generated `AddressMalformed` at the failing target.** **EVERY OTHER CLASS — a `symbol`, a
|
|
927
|
+
/// `bigint`, a `boolean`, an object, an array, a function, a `Proxy`, a class instance — is refused AT THE
|
|
928
|
+
/// BOUNDARY, inside the one form, naming the target and the class** (`A76`: *"an op-id (and every other
|
|
929
|
+
/// argument) whose class is outside the declared domain is refused INSIDE the single failure form"*; the
|
|
930
|
+
/// status is the one the table's rows 3–6 declare, `AddressMalformed`, and it is carried rather than
|
|
931
|
+
/// minted — `DD-40`).
|
|
932
|
+
export function encodeOpId(opId) {
|
|
933
|
+
if (opId === undefined) return { k: 'U' };
|
|
934
|
+
if (opId === null) return { k: 'N' };
|
|
935
|
+
if (typeof opId === 'string') return { k: 's', v: opId };
|
|
936
|
+
// THE DECLARED NUMBER ROW: the number itself crosses — **never `Number(opId)`, which would COERCE every
|
|
937
|
+
// other class into this arm.**
|
|
938
|
+
if (typeof opId === 'number') return { k: 'D', v: opId };
|
|
939
|
+
boundaryReject(
|
|
940
|
+
'AddressMalformed', // `OpIdArg` rows 3–6's own declared code, carried and never minted (`DD-40`)
|
|
941
|
+
targetSpelling(opId), // item 5 (a): the non-segment target printed as its OWN value
|
|
942
|
+
`the rollback's opId is ${classSpelling(opId)}, and an op id is a non-empty string`,
|
|
943
|
+
);
|
|
944
|
+
return { k: 'U' }; // `boundaryReject` throws; this is unreachable and is not a second path
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/// **⟶ `encodeHandle` IS DELETED, NOT REWRITTEN — `U-STOREROOM-HELD-LISTENER-IDENTITY` (`D-GP-SHLI`).**
|
|
948
|
+
/// The three-variant classifier (*"the OPAQUE form alone is the site's, and every outside spelling is
|
|
949
|
+
/// carried as its own variant"*) and its `state.tokens` walk **go whole**, on the architect's ruling that
|
|
950
|
+
/// settles fork (g), VERBATIM: *"This is also irrelevant because tokens is being eliminated and the function
|
|
951
|
+
/// lookup is now a direct map key check."* (`P: docs/pending.md · P-6`; `contract.md §2.8` item 2 item (6);
|
|
952
|
+
/// `identity-and-domain.md §1` item 1).
|
|
953
|
+
///
|
|
954
|
+
/// **WHAT REPLACES IT IS A DIRECT MAP KEY CHECK AT EACH VERB** — `map.has(handle)` / `map.get(handle)` on
|
|
955
|
+
/// the ONE function map keyed by the handle string (`identity-and-domain.md §1` item 4). **THE THREE VARIANTS
|
|
956
|
+
/// AND THEIR TWO DISPOSITIONS SURVIVE AS CONSEQUENCES AND NOT AS A CLASSIFIER**: a NON-STRING is REFUSED by
|
|
957
|
+
/// the class test at `listen`/`register`/`removeListener`; a STRING the map does not carry is `unlisten`'s
|
|
958
|
+
/// NO-OP SUCCESS and `register`'s REFUSAL; and a BLANK STRING stays the store's own refused form.
|
|
959
|
+
///
|
|
960
|
+
/// **THE ONE PREDICATE THE SITES SHARE IS THE DOMAIN TEST ITSELF — A `typeof` READ AND A LENGTH READ AND
|
|
961
|
+
/// NOTHING MORE** (`identity-and-domain.md §2` item 1: *"no object inspection, no `Proxy` trap invocation, no
|
|
962
|
+
/// property read"*).
|
|
963
|
+
export function inDomainHandle(handle) {
|
|
964
|
+
return typeof handle === 'string' && handle !== '';
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/// **THE HANDLE SHAPE THE ADDON IS HANDED FOR A VERB'S HANDLE POSITION** — one spelling, and it is the
|
|
968
|
+
/// handle's own value: `{k:'O', v: handle}` is the `JsHandleArg` carrier's opaque arm, which with the token
|
|
969
|
+
/// gone carries the handle it always was (`P: docs/pending.md · P-6`, the type ruling: *"`JsHandle { token:
|
|
970
|
+
/// String }` collapses to the string it always was"*).
|
|
971
|
+
export function handleWire(handle) {
|
|
972
|
+
return { k: 'O', v: handle };
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/// `crossing.md §1.3`'s `FilePathArg` table: ABSENT is IN DOMAIN, and `undefined` at a PRESENT key is row
|
|
976
|
+
/// 3's `AddressMalformed`.
|
|
977
|
+
export function encodeFilePath(filePath) {
|
|
978
|
+
if (filePath === undefined) return undefined;
|
|
979
|
+
if (filePath === null) return null;
|
|
980
|
+
if (typeof filePath === 'string') return filePath;
|
|
981
|
+
return { bad: typeof filePath };
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/// `crossing.md §1.3`'s `JournalLengthArg` table, `12` rows, with NO coercion (`PAR-JS-4`).
|
|
985
|
+
///
|
|
986
|
+
/// **`A76`/`JS-6` AT THIS CARRIER: A `bigint` CROSSES AS A `bigint`.** The shipped arm wrote the marker
|
|
987
|
+
/// `{ bigint: n.toString() }`, which the facade could only read as an OBJECT — a class folding the caller
|
|
988
|
+
/// never spelled. **The value's own class is handed over as the value itself**, the facade reads it as
|
|
989
|
+
/// `NAPI_BIGINT` (never through the number read), and the store answers row 11's declared
|
|
990
|
+
/// `AddressMalformed` — *"and no coercion of a numeric string, a boolean or a `bigint` is performed"*
|
|
991
|
+
/// (`PAR-JS-3`).
|
|
992
|
+
export function encodeJournalLength(n) {
|
|
993
|
+
if (n === undefined) return undefined;
|
|
994
|
+
if (n === null) return null;
|
|
995
|
+
if (typeof n === 'number' || typeof n === 'string' || typeof n === 'boolean') return n;
|
|
996
|
+
if (typeof n === 'bigint') return n;
|
|
997
|
+
if (typeof n === 'function') return { bad: 'function' };
|
|
998
|
+
return { bad: 'object' };
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/// `crossing.md §1.3`'s `ListenersArg` table: ABSENT answers `AddressMalformed` — *"the ONE absence the
|
|
1002
|
+
/// construction does not admit"* — and a rejected array admits NOTHING.
|
|
1003
|
+
///
|
|
1004
|
+
/// **`A76`/`JS-5` AT THIS CARRIER — THE TWO DEFECTS THE GATE-4 PASS MEASURED ARE BOTH CLOSED HERE:**
|
|
1005
|
+
/// **(1) `'address' in entry` WALKED THE PROTOTYPE CHAIN, so an entry carrying an INHERITED `address` or
|
|
1006
|
+
/// `handle` was read as an entry field** — every member read below is now `Object.hasOwn`'s own-property
|
|
1007
|
+
/// read and nothing else; **(2) an ENTRY that is a prototype-carrying object or a class instance was read
|
|
1008
|
+
/// through the chain at all** — **the entry's CLASS is now decided first** (`isPlainObjectValue`, which
|
|
1009
|
+
/// refuses a `Proxy`, an `Array` and any prototype-carrying object before one member is read) and a
|
|
1010
|
+
/// non-plain entry is REFUSED AT THE BOUNDARY with the class and the POSITION named, inside the one form
|
|
1011
|
+
/// (`ListenersArg` row 2's declared `AddressMalformed`, carried and never minted).
|