provident-storeroom 0.1.3 → 0.3.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.
package/index.mjs CHANGED
@@ -12,15 +12,24 @@
12
12
  // CONSTRUCTS THE CROSSING MODEL, HANDS IT TO THE ADDON'S `storeCreate`/`call` DISPATCH, AND MAPS THE
13
13
  // ADDON'S ANSWER BACK INTO JS VALUES.** **THE STORE'S OWN LOGIC IS THE RUST CORE'S**
14
14
  // (`bindings/js/src/crossing.rs`): the register tree, the anchors, the journal and its compaction, the
15
- // listener home and the prefix test, the file image and its boot, the fifteen-member fail set and its
15
+ // listener home and the prefix test, the file image and its boot, the SIXTEEN-member fail set and its
16
16
  // generated messages are ALL reached through the facade, and NOTHING of them is re-implemented here.
17
17
  //
18
+ // **⟶ RE-SPELLED 2026-10-15 BY THE GATE-4 FINDINGS PASS: THE FAIL SET'S FIGURE ON THE LINE ABOVE — the
19
+ // as-filed *"the fifteen-member fail set"* — IS THE FILING-TIME PRINT AND IS READ THROUGH THIS CLAUSE.
20
+ // THE OPERATIVE READING IS *"the SIXTEEN-member fail set"*, with `ConstraintListInvalid` at rank `16` and
21
+ // `FileCommitFailed` at `15`, so `FileCommitFailed` is NOT the last member from that date
22
+ // (`11 + 2 + 1 + 1 + 1 = 16` ✓).** The set is the store's own and is carried, never minted, here
23
+ // (`docs/specs/storeroom-native/contract.md §8.1`'s dated clause of 2026-10-15, the ONE home of the set's
24
+ // size; `§8.2` for the appended member's generated row; `src/error.rs`'s `CODES`, `[&'static str; 16]`,
25
+ // with `ConstraintListInvalid` last; `bindings/js/index.d.ts`'s `StoreStatus`, the published spelling).
26
+ //
18
27
  // **WHAT STAYS IN JS, AND WHY IT IS NOT STORE LOGIC** (`A75`: *"THE REGISTRY, THE OPAQUE HANDLE AND THE
19
28
  // SINGLE FAILURE FORM STAY IN JS (they are the PACKAGE's surface, `§2.4`)"*):
20
29
  // * **THE PACKAGE'S OWN OPAQUE HANDLE** (`surface.md §2.3` item 2, `DD-14`): a frozen, memberless JS
21
30
  // object whose token is private — the store's token crosses OUT of the addon and is wrapped here.
22
31
  // * **THE PACKAGE'S OWN REGISTRY** (`surface.md §2.4`): the caller's FUNCTION, held per instance and
23
- // reached through the ONE member `storeCreate` returns (`register(handle, listener)`). **The store
32
+ // reached through the member `storeCreate` returns (`register(handle, listener)`) — **⟶ RE-SPELLED 2026-10-16: the `ONE member` figure this line printed is the AS-FILED `surface.md §2.4` item 5 (a) reading, and the instance's OPERATIVE member set is `{ register, on, off, settle }`, FOUR OWN MEMBERS (`surface.md §2.7` item 8 AS AMENDED; `§2.11` clause 7; `docs/decisions.md` `A116` (D1)) — the registry being reached through each of them**. **The store
24
33
  // returns handles and invokes nothing** (`A57`), so the invocation is the package's — performed after
25
34
  // the addon's call has returned, with the triggering ADDRESS as its ONE argument (`PAR-JS-12`).
26
35
  // * **THE SINGLE FAILURE FORM** (`surface.md §2.5`, `DD-12`): the addon THROWS the store's own
@@ -75,6 +84,59 @@ import { types } from 'node:util';
75
84
  const require_ = createRequire(import.meta.url);
76
85
  const ADDON_PATH = join(dirOf(fileURLToPath(import.meta.url)), 'build', 'Release', 'storeroom_js_binding.node');
77
86
 
87
+ /**
88
+ * **THE PASS'S OWN CHECK-OFFS, CARRIED FROM THE KERNEL TO THE TERMINAL ARM'S DELIVERY UNDER A SYMBOL KEY
89
+ * (`docs/decisions.md` · `A117` (D5)–(D6); `surface.md §2.7` item 7's keying of 2026-10-15).**
90
+ *
91
+ * `§2.7` item 7 (a) delivers **THE RESIDUE** — *"the handle set that stands in `CommitRecord.pending` at
92
+ * that instant"* — and item 7's keying of 2026-10-15 fixes what the check-off consumed: *"the check-off
93
+ * consumes the evaluated pair's own delivery of that identity and NEVER that identity's whole owed
94
+ * delivery"*. **So the residue is one term of the arm's delivered set and the pass's own checked-off
95
+ * identities are a second**, and this key is how the kernel's finding reaches this file: the kernel
96
+ * records each identity its check-off took and publishes the list on the record AT ITS PASSING ARM, before
97
+ * it hands that record back to this instance's own `settle` member.
98
+ *
99
+ * **THE KEY IS A SYMBOL ON PURPOSE** (`A117` (D6)): **NO MEMBER IS ADDED** — `CommitRecord` keeps its four
100
+ * members and the record's enumerable shape does not move, so no census of a record's members changes and
101
+ * nothing of the named-shape set is widened. **AND THE ENTRY DOES NOT IMPORT THE KERNEL TO READ IT** — the
102
+ * same well-known symbol is declared on both sides, which is what keeps the entry's zero-dependency rule
103
+ * and `kernel-surface.md §1` item 1's one checkout home intact. **A RECORD CARRYING NO SUCH KEY** — a
104
+ * record this instance adopted from a caller, one from a session without the kernel, and the failing
105
+ * arm's own record — reaches the arm's residue term ALONE and behaves exactly as it behaved before.
106
+ */
107
+ const CHECKED_OFF = Symbol.for('provident-storeroom.checked-off-at-the-terminal-arm');
108
+
109
+ /// **⟶ ADDED 2026-10-15 (`surface.md §2.11` clauses 1–2; `contract.md §7.2` item 2 as amended) — THE PASSING
110
+ /// ARM'S OWN MARK: THE SAME DEVICE AS `CHECKED_OFF` ABOVE, ONE CLAUSE EARLIER.**
111
+ ///
112
+ /// **THE TERMINAL ARM'S OWN ACT IS SCOPED TO THE PASSING ARM ALONE** (clause 1: *"the `file` tier, the
113
+ /// TERMINAL ARM and the PASSING ARM alone"*), **and the seam reaches ONE instant on BOTH arms**: a
114
+ /// `file`-tier write whose pass FAILED arrives at this same delivery with its record in hand, and clause 1
115
+ /// refuses it a save and a store call of its own — *"a failing arm drives no save"*. **THE ARM IS THE
116
+ /// KERNEL'S OWN FACT** (`attempt-lifecycle.md §2.4` item 4), so the KERNEL marks the record it settled on
117
+ /// its passing arm and the entry reads THAT MARK and nothing else — never a residue, never a member a
118
+ /// caller may set, and never a second store call on the failing arm.
119
+ ///
120
+ /// **THE KEY IS A SYMBOL ON PURPOSE, EXACTLY AS `CHECKED_OFF`'s IS** (`A117` (D6)): **NO MEMBER IS ADDED** —
121
+ /// `CommitRecord` keeps its four members, `record.pending` stands exactly as the pass left it, and no
122
+ /// census moves. **THE ENTRY DOES NOT IMPORT THE KERNEL TO READ IT**: the same well-known symbol is
123
+ /// declared on both sides. **A RECORD CARRYING NO SUCH KEY** — a caller's own record, and the failing arm's
124
+ /// own record — performs no save and behaves exactly as it behaved before.
125
+ const SETTLED_ON_THE_PASSING_ARM = Symbol.for('provident-storeroom.settled-on-the-passing-arm');
126
+
127
+ /// **⟶ ADDED 2026-10-15 — THE FAILED SAVE'S OWN MARK, THE SIBLING OF THE KEY ABOVE AND READ BY THE KERNEL'S
128
+ /// OWN CATCH** (`docs/specs/storeroom-js/surface.md §2.11` clause 5; `kernel-surface.md §2.1` items 3–5).
129
+ /// **`§2.11` clause 5's save IS A CONSTRAINT, EVALUATED LAST — SO A SAVE THAT FAILS IS REPORTED BY THE PASS
130
+ /// THAT FAILED AND NOT BY THE PASSING ARM**: the failed save's own log gains the `outcome` entry, the
131
+ /// terminal answer returns that closed record's FINAL log, and the report carries the rollback that
132
+ /// actually happened (`§2.6` item 3). **THE ENTRY MINTS NO TOKEN AND CONVERTS NO FORM**: it tells the
133
+ /// kernel WHICH ARM this is, on the record identity it was handed, by carrying THE VERY THROWABLE it
134
+ /// rethrows — while the store's own two-member form crosses UNCHANGED. **IT IS A SYMBOL KEY ON PURPOSE**
135
+ /// (`A117` (D6)): `CommitRecord` keeps its four members, `record.pending` stands exactly as the pass left
136
+ /// it, and no census moves. **A RECORD CARRYING NO SUCH KEY** — every arm but the failed save — is
137
+ /// untouched by it.
138
+ const SAVE_FAILED_AT_THE_TERMINAL_ARM = Symbol.for('provident-storeroom.save-failed-at-the-terminal-arm');
139
+
78
140
  // ---------------------------------------------------------------------------------------------
79
141
  // THE RESOLUTION RULE — THREE RUNGS, IN ORDER, AND THE CLOSED KEY SET (`docs/specs/storeroom-publish/
80
142
  // resolution.md §2` · `§3`; `docs/specs/storeroom-publish/contract.md §1.1` · `§1.3` · `§1.5`).
@@ -371,14 +433,34 @@ function withAddon() {
371
433
  /// NOTHING on this path coerces the value: no `Number(...)`, no `String(...)`, no `valueOf`, no
372
434
  /// `Symbol.toPrimitive` and no trap is ever invoked, so no host `TypeError` can be raised from this frame
373
435
  /// in the first place.**
374
- function boundaryReject(status, subject, clause) {
436
+ ///
437
+ /// **⟶ AND THE FAILING SEGMENT'S CONTAINER IS HANDED TO THE GENERATOR'S OWN `<container>` SLOT, ADDED
438
+ /// 2026-10-17 (`§2.5` item 5 (a)–(b) AND ITS `CF-3` AUTHORITY SPLIT; `docs/specs/storeroom-native/contract.md`
439
+ /// §8.2's `MessageArgs.container`, *"the container or node the mismatch was found in: `''` for the register,
440
+ /// a dotted path otherwise"*).** **THE DEFECT IT CLOSES, NAMED: the two-slot route filled `segment` and
441
+ /// `path` ALONE, so `container` took its default and PART ONE READ *"the number 1.5 is not a legal address
442
+ /// segment in `''`"* — a FALSE container — while PART TWO appended *"in 'a'"* and the store's own bytes for
443
+ /// that same input are `the number 1.5 is not a legal address segment in 'a'` (`src/store.rs`'s `listen`
444
+ /// arm, whose container is the prefix `['a']`; `src/error.rs`'s `malformed_segment`).** **TWO CONTAINERS
445
+ /// STOOD, ONE OF THEM FALSE; ONE STANDS NOW AND IT IS THE TRUE ONE.** **`container` is the failing
446
+ /// segment's OWN PREFIX — the store's own `dotted_address` spelling of it — and `undefined` at every site
447
+ /// that declares none, where the slot is left at its default and THE GENERATOR'S OWN BYTES ARE UNMOVED**
448
+ /// (the two-argument `errorMessage(code, subject)` call included).
449
+ function boundaryReject(status, subject, clause, container) {
375
450
  const addon_ = withAddon();
376
451
  if (typeof addon_.errorMessage !== 'function') {
377
452
  // An artefact that LOADED but does not carry the generator is not the declared artefact: the state is
378
453
  // the declared absent/failed-addon one, and its message is the generator's own rendering reproduced.
379
454
  fail({ status: 'FilePathUnreachable', message: generatorFilePathUnreachable(ADDON_PATH) });
380
455
  }
381
- fail({ status, message: `${addon_.errorMessage(status, subject)}, ${clause}` });
456
+ // **THE CONTAINER IS THE PREFIX'S OWN DOTTED SPELLING AND NOTHING ELSE** (`src/error.rs`'s
457
+ // `dotted_address`: a key bare, an index bare, joined by `.`) — the same reading the store's own
458
+ // `malformed_segment` triggers take, where the container is the segment the mismatch was found in.
459
+ const where = container === undefined ? undefined : container.map((segment) => String(segment)).join('.');
460
+ const generated = where === undefined
461
+ ? addon_.errorMessage(status, subject)
462
+ : addon_.errorMessage(status, subject, where);
463
+ fail({ status, message: `${generated}, ${clause}` });
382
464
  }
383
465
 
384
466
  // ---------------------------------------------------------------------------------------------
@@ -914,6 +996,129 @@ function encodeSegment(segment, position, argumentPosition) {
914
996
  return { bad: 'object' };
915
997
  }
916
998
 
999
+ /// **A SEGMENT'S OWN CLASS OUTSIDE `PAR-JS-5`'s DOMAIN, DECIDED AT THE PACKAGE'S OWN BOUNDARY AND REFUSED
1000
+ /// `AddressMalformed` — THE OUTSIDE-VALUE CLASSIFICATION, TAKEN **BEFORE** THE STORE IS REACHED AND SO
1001
+ /// BEFORE ANY ABSENT-KEY LOOKUP** (`parameter-semantics.md §2.5` line `357`: *"**The declared answer for EACH
1002
+ /// outside value** — **`AddressMalformed` for every one of them, with the store's generated message**"*,
1003
+ /// the fourteen carrier-variant rows `crossing.md §1.3` names — *"an array holding a negative integer · an
1004
+ /// array holding a non-integer number · an array holding `null`/`undefined`/a boolean/an object/a nested
1005
+ /// array/a function"*).
1006
+ ///
1007
+ /// **WHY THE DECISION STANDS HERE AND NOT AT THE STORE: a well-formed address no node holds is the store's
1008
+ /// own `AddressNotFound` (`a127-surface.test.mjs`'s F1 arm asserts that code at the ABSENT position), while
1009
+ /// a node HELD and a segment outside the domain must answer `AddressMalformed` — so the CLASS must be
1010
+ /// decided before the lookup rather than after it. The store's own walk decides it at `write` · `delete` ·
1011
+ /// `listen` (`src/args.rs`, `src/store.rs`); at the READER the carrier reaches the walk FIRST, which returns
1012
+ /// `AddressNotFound` for a held key. **The class is decided ONCE, at `encodeAddress`, for every verb alike**,
1013
+ /// so no verb's address position can answer a lookup's code for a class the row refuses.
1014
+ ///
1015
+ /// **THE MESSAGE IS THE STORE'S GENERATED ONE AND NEVER AN AUTHORED ONE** (`boundaryReject` reaches the
1016
+ /// addon's `errorMessage`, `§2.5` item 2): the SUBJECT is the failing segment's own spelling as the store's
1017
+ /// generator renders it (`src/value.rs`'s `Segment::spelling`), and *"the integer `-1`"*, *"a shapeless
1018
+ /// value"*, *"a boolean"*, *"an array"* and *"a Proxy"* are that rendering carried here, not invented.
1019
+ /// **NOTHING IS COERCED** (`A76`/`JS-1`): the class is read with `typeof`, `Number.isInteger` and
1020
+ /// `Array.isArray` alone — no `String(segment)`, no `Number(segment)`, no `valueOf` and no trap — so a
1021
+ /// segment that is a `Proxy` is refused by `util.types.isProxy` and NO TRAP RUNS (`surface.md §2.4` item 7
1022
+ /// (a) item 1; `crossing.md §1.4` item 4; `C-1`).
1023
+ /// **THE CONTAINER IS NOW A PREFIX ARGUMENT AND NOT A SPELLED STRING, 2026-10-17** (`§2.5` item 5 (a)–(b)):
1024
+ /// the segments the failing one stood in are handed to `boundaryReject`, which passes the store's own
1025
+ /// `dotted_address` spelling of them into the generator's `<container>` slot, so **the container is stated
1026
+ /// ONCE and by the store's generator** — and PART TWO carries the reason's class-and-position half ALONE,
1027
+ /// which is the half `§2.5` item 5 (b) declares the boundary's own (*"the ARGUMENT POSITION … is carried
1028
+ /// INSIDE the generated message's own text"*) and is never a second container claim.
1029
+ function refuseOutsideSegment(segment, position, prefix, addressArgumentPosition) {
1030
+ const kind = typeof segment;
1031
+ let subject;
1032
+ if (segment === null) subject = 'a shapeless value';
1033
+ else if (kind === 'undefined') subject = 'an absent value';
1034
+ else if (kind === 'boolean') subject = 'a boolean';
1035
+ else if (kind === 'number') subject = Number.isInteger(segment) ? `the integer ${segment}` : `the number ${segment}`;
1036
+ else if (kind === 'function') subject = 'a function';
1037
+ else if (kind === 'symbol' || kind === 'bigint') subject = classSpelling(segment);
1038
+ else if (Array.isArray(segment)) subject = 'an array';
1039
+ else subject = 'an object'; // a `Proxy` over an array included: its class is `an object` to the carrier
1040
+ boundaryReject(
1041
+ 'AddressMalformed', // `PAR-JS-5`'s own declared answer for every one of the fourteen rows, carried (`DD-40`)
1042
+ subject,
1043
+ addressArgumentPosition === undefined
1044
+ ? `the address holds ${subject} at position ${position}, and a segment is a string or a non-negative integer`
1045
+ : `the address holds ${subject} at position ${position} of the ${addressArgumentPosition}, and a segment is a string or a non-negative integer`,
1046
+ prefix,
1047
+ );
1048
+ return { bad: 'object' }; // `boundaryReject` throws; this is unreachable and is not a second path
1049
+ }
1050
+
1051
+ /// **`AddressArg` ROWS 5–6'S OUTSIDE SHAPE, DECIDED ON THE VALUE AS IT IS AND BEFORE ANY READ** (`A76`'s
1052
+ /// class-first order; `C-1`): everything that is neither an `Array` nor a `Proxy` is rows 5–6's outside
1053
+ /// value at the ADDRESS position — **and a `Proxy` is NOT this arm**: its own refusal stands above, where the
1054
+ /// class decision is taken on `util.types.isProxy` before any `.length` read and before any element
1055
+ /// (`surface.md §2.4` item 7 (a) item 1; `crossing.md` `AddressArg` row 12; `DD-34`), so no trap is run by
1056
+ /// THIS predicate either.
1057
+ function isOutsideAddressValue(value) {
1058
+ if (value === undefined || value === null) return true; // row 5's two named classes, on the value as it is
1059
+ if (types.isProxy(value)) return false; // row 12's own arm, decided above, with no trap run
1060
+ if (Array.isArray(value)) return false; // rows 1–3, 13, 14 — the ordinary array arm and its own tests
1061
+ return true; // rows 5–6: a string, a number, a boolean, an object, a function, a symbol, a bigint
1062
+ }
1063
+
1064
+ /// **THE VALUE-SHAPE ARM OF `AddressArg` ROWS 5–6 — A NON-ARRAY OUTSIDE VALUE AT AN ADDRESS POSITION,
1065
+ /// REFUSED AT THE BOUNDARY WITH ITS OWN RENDERING AND THE ARGUMENT POSITION IT STANDS AT** (`surface.md`
1066
+ /// §2.5 item 5 (a)–(b); the `CF-3` authority split).
1067
+ ///
1068
+ /// **THE DEFECT IT CLOSES, NAMED AS THE SUPERVISOR'S OWN RECORD NAMES IT** (`archive/reviews/
1069
+ /// 2026-10-16-constraints-publication-gate1.md` §57, finding `2`): at EVERY address position — `listen`,
1070
+ /// `read`, `write`, `delete`, `readLiteral` — a NON-ARRAY outside value (`'a.b'`, `7`, `null`, `undefined`)
1071
+ /// answered the store's GENERIC line *"the address argument is not a legal address segment in `''` …"*,
1072
+ /// **carrying the class half and NEITHER the failing TARGET NOR the argument POSITION** — while `§2.5` item 5
1073
+ /// (a) makes the failing target mandatory and item 5 (b) makes the ARGUMENT POSITION mandatory where the
1074
+ /// contract declares one (and a verb's argument position is the one place it does). **IT WAS HIDDEN UNTIL
1075
+ /// NOW because the older `register` subject carried both at a HANDLE position — a VALUE position, where a
1076
+ /// non-segment value is printed as its own value — and once the subject moved to an ADDRESS position the gap
1077
+ /// became visible.**
1078
+ ///
1079
+ /// **WHAT IS DECLARED, AND WHAT THIS SITE THEREFORE DOES:**
1080
+ /// * **THE TARGET IS THE VALUE'S OWN RENDERING** (item 5 (a): *"a non-segment value PRINTED AS ITS OWN
1081
+ /// VALUE … where the failure is about a value and not about a segment"*), in the spelling the store's own
1082
+ /// generator and this package already give that value at every other site: `the number 7` · `the string
1083
+ /// 'a.b'` · `null` · `undefined` — **and a class whose own value cannot be printed (a `bool` · a
1084
+ /// `function` · an `object` · a `Proxy`) is rendered by the store's own class spelling for it**, exactly
1085
+ /// as `refuseOutsideSegment` renders the same classes at a SEGMENT position.
1086
+ /// * **THE POSITION IS THE ARGUMENT POSITION** the verb's own signature declares (item 5 (b): *"the
1087
+ /// ARGUMENT POSITION for a verb's arguments"*) — `first argument` at all five verbs, whose `address` is
1088
+ /// the first position of each (`surface.md` §2.4 item 9 (f)'s table).
1089
+ /// * **AND THE CONTAINER IS THE ARGUMENT ITSELF AND NEVER THE EMPTY REGISTER.** **THE ONE DECISION THE
1090
+ /// CLAUSE DOES NOT PIN, STATED RATHER THAN GUESSED:** the store's `AddressMalformed` template always
1091
+ /// prints a container (`src/error.rs`, *"… in '{container}', …"*), and the store's own trigger for this
1092
+ /// state supplies the empty string (`malformed_address_argument`, whose rendering *"… in '', …"* names
1093
+ /// THE REGISTER). **THAT CONTAINER IS FALSE HERE** — a whole-address SHAPE failure is found in no
1094
+ /// container at all, the address argument never having resolved against the register — so the truthfully
1095
+ /// filled slot is the failing ARGUMENT's own name, `address`, which is the same reading the store's own
1096
+ /// `ConstraintListInvalid` row takes where the container is a KEY and not an address (`'constraints'`;
1097
+ /// `docs/specs/storeroom-native/contract.md` §8.2's row and its `<CONTAINERSEGMENT>` degenerate arm).
1098
+ /// **NO CLAUSE FIXES THIS WORDING: the clause fixes the TARGET, the CLASS and the POSITION, and the
1099
+ /// container is this site's own truth claim.** **PART TWO then carries the reason's class half and the
1100
+ /// position, appended after a separator, exactly as `boundaryReject` appends it at every other site.**
1101
+ function refuseOutsideAddressValue(address, addressArgumentPosition) {
1102
+ const kind = typeof address;
1103
+ let subject;
1104
+ if (address === null) subject = 'null';
1105
+ else if (kind === 'undefined') subject = 'undefined';
1106
+ else if (kind === 'number') subject = `the number ${address}`;
1107
+ else if (kind === 'string') subject = `the string '${address}'`;
1108
+ else if (kind === 'boolean') subject = 'a boolean';
1109
+ else if (kind === 'function') subject = 'a function';
1110
+ else if (kind === 'symbol' || kind === 'bigint') subject = classSpelling(address);
1111
+ else subject = 'an object'; // a `Proxy` over a plain object included: its class is `an object` to the carrier
1112
+ // **THE CONTAINER SLOT CARRIES THE ARGUMENT'S OWN NAME AND NOT `''`** — see this site's own clause above.
1113
+ boundaryReject(
1114
+ 'AddressMalformed', // `AddressArg` rows 5–6's own declared code, carried and never minted (`DD-40`)
1115
+ subject,
1116
+ `the address position holds ${subject} at the ${addressArgumentPosition}, and an address is an array of segments`,
1117
+ ['address'],
1118
+ );
1119
+ return { k: 'A' }; // `boundaryReject` throws; this is unreachable and is not a second path
1120
+ }
1121
+
917
1122
  /// `crossing.md §1.3`'s `AddressArg` table, rows 1–14.
918
1123
  ///
919
1124
  /// **⟶ AND ONE OPTIONAL PARAMETER, ADDED 2026-10-11 BY THE `Q3` PASS, SO `on` CAN OBEY `A81` WITHOUT A
@@ -923,27 +1128,80 @@ function encodeSegment(segment, position, argumentPosition) {
923
1128
  /// refuses at the BOUNDARY rather than carrying its class to the store. **EVERY OTHER CALLER PASSES
924
1129
  /// NOTHING AND EVERY BYTE OF EVERY OTHER ARM IS UNMOVED**, so no verb's answer and no other site's message
925
1130
  /// changes: the parameter is additive and its absence is the as-filed reading.
926
- function encodeAddress(address, addressArgumentPosition) {
1131
+ ///
1132
+ /// **⟶ AND FROM 2026-10-17 A SECOND, SEPARATE POSITION PARAMETER GOVERNS `AddressArg` ROWS 5–6**
1133
+ /// (`§2.5` item 5 (a)–(b); see `refuseOutsideAddressValue` above): a NON-ARRAY outside value — a supplied
1134
+ /// `undefined`, a `null`, a string, a number, a boolean, an object, a function — is refused at the boundary
1135
+ /// at EVERY verb that declares an argument position, verbosely, carrying its own rendering and that position.
1136
+ ///
1137
+ /// **WHY IT IS A SEPARATE PARAMETER AND NOT THE SAME ONE, STATED SO THE BLAST RADIUS IS EXACTLY ONE ARM:**
1138
+ /// `addressArgumentPosition` is the SEGMENT arm's (`rows 7–10`, and the `Proxy` and out-of-range arms) and it
1139
+ /// is passed by `listen` ALONE, so the segment arm's bytes at the other four verbs are UNMOVED — **THE
1140
+ /// INSTRUCTION IS THAT NO MESSAGE ALREADY CORRECT MOVES, and the supervisor's defect is the NON-ARRAY arm
1141
+ /// only.** `addressValuePosition` reaches the arms THIS PASS REPAIRS, and nothing else.
1142
+ /// **WHERE NO VALUE POSITION IS PASSED — the construction's `listeners[]` walk, which calls this encoder with
1143
+ /// one argument — EVERY BYTE IS UNMOVED and the store answers the construction itself** (`PAR-JS-21`; the
1144
+ /// construction's own answer is the store's, and no argument position is declared at that site).
1145
+ function encodeAddress(address, addressArgumentPosition, addressValuePosition) {
927
1146
  // `crossing.md §1.3`'s absent-versus-`undefined` rule, rule 1: an argument position the call supplied no
928
1147
  // value for is ABSENT, and `undefined` at a supplied position folds to that SAME state. `AddressArg` rows
929
1148
  // 4 and 5 answer the one code, so no declared answer moves by the fold.
1149
+ //
1150
+ // **⟶ AND AT A SITE THAT DECLARES AN ARGUMENT POSITION, ROWS 5 AND 6 ARE ANSWERED HERE AND VERBOSELY**
1151
+ // (`§2.5` item 5 (a)–(b); `refuseOutsideAddressValue`): a supplied `undefined`, a `null` and every
1152
+ // non-array carry their OWN RENDERING and the POSITION instead of the store's generic argument-shaped line.
1153
+ // **THE ARITY-ABSENT CALL IS NOT THIS ARM AND CHANGES NOTHING**: `undefined` reaches this encoder only
1154
+ // from a call that SUPPLIED it (every caller passes `[encodeAddress(address)]` under its own `n >= 1`
1155
+ // test), while the NO-ARGUMENT call reaches the store as its own carrier and answers there — which is
1156
+ // `CF-3`'s part 5 unmoved (*"an absent CARRIER argument … crosses to the store as its own carrier value"*).
1157
+ if (addressValuePosition !== undefined && isOutsideAddressValue(address)) {
1158
+ refuseOutsideAddressValue(address, addressValuePosition);
1159
+ }
930
1160
  if (address === undefined) return { k: 'A' };
931
1161
  if (address === null) return { k: 'N' };
932
- // **`A76`/`JS-2`: THE CLASS DECISION COMES FIRST HERE TOO, ON THE ADDRESS AS IT IS.** A `Proxy` is
933
- // refused BEFORE the array shape test and before any element is read (row 12, `DD-34`), and a class
934
- // extending `Array` — for which `Array.isArray` is TRUE — is refused under its own declared class
935
- // (`AddressArg` row 11's `AddressMalformed`: *"the shape is not an array"*) rather than ADMITTED as an
936
- // address because a language predicate made it look like one.
937
- if (types.isProxy(address)) return { k: 'X' }; // row 12 (`DD-34`)
1162
+ // **`A76`/`JS-2`: THE CLASS DECISION COMES FIRST HERE TOO, ON THE ADDRESS AS IT IS — AND THE `Proxy`
1163
+ // REFUSAL IS PART OF THAT DECISION AND NOT BESIDE IT** (`surface.md §2.4` item 7 (a) item 1: *"the `Proxy`
1164
+ // refusal is part of that decision, not beside it … BEFORE the shape test, BEFORE `Array.isArray`, BEFORE
1165
+ // any `.length` read and BEFORE any element is read"*). **`util.types.isProxy` READS NO MEMBER AND
1166
+ // INVOKES NO HANDLER**, which is what makes the class decidable with NO TRAP RUN at both proxies-over-array
1167
+ // and proxies-over-object (`crossing.md §1.4` item 4; `DD-34`; `C-1`). **AND `§2.5` item 5 (b) MAKES THE
1168
+ // CLASS HALF MANDATORY**: the refusal's message carries `a Proxy` and the POSITION, so the class the value
1169
+ // HAS is named rather than the store's own generic object arm; a class extending `Array` — for which
1170
+ // `Array.isArray` is TRUE — is refused under its own declared class (`AddressArg` row 11's
1171
+ // `AddressMalformed`: *"the shape is not an array"*) rather than ADMITTED because a language predicate made
1172
+ // it look like one.
1173
+ if (types.isProxy(address)) {
1174
+ boundaryReject(
1175
+ 'AddressMalformed', // row 12's own declared code (`DD-34`), carried and never minted (`DD-40`)
1176
+ classSpelling(address), // the class half, mandatory under item 5 (b): `a Proxy`
1177
+ addressArgumentPosition === undefined
1178
+ ? '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'
1179
+ : `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`,
1180
+ );
1181
+ }
938
1182
  if (Array.isArray(address)) {
939
1183
  if (arrayClass(address) === 'class') return { k: 'C' }; // row 11: a class extending `Array`
940
1184
  for (let i = 0; i < address.length; i += 1) {
941
1185
  if (!(i in address)) return { k: 'S' }; // row 14 (`DD-8`)
942
1186
  }
943
- return {
944
- k: 'L',
945
- s: address.map((segment, position) => encodeSegment(segment, position, addressArgumentPosition)),
946
- }; // rows 1–3, 13
1187
+ const segments = [];
1188
+ for (let i = 0; i < address.length; i += 1) {
1189
+ const segment = address[i];
1190
+ const encoded = encodeSegment(segment, i, addressArgumentPosition);
1191
+ // **`PAR-JS-5`: THE FOURTEEN ROWS' CLASS IS DECIDED HERE, BEFORE THE STORE AND BEFORE ANY LOOKUP**
1192
+ // — a `{bad: …}` marker, a negative or non-integer number, a boolean, or a `Proxy` over an array.
1193
+ const outsideMarker = encoded !== null && typeof encoded === 'object' && typeof encoded.bad === 'string';
1194
+ const outsideNumber = typeof segment === 'number' && !(Number.isInteger(segment) && segment >= 0);
1195
+ if (outsideMarker || typeof segment === 'boolean' || outsideNumber) {
1196
+ // **AND THE PREFIX IS THE SEGMENTS THIS ONE STOOD IN AND NOTHING ELSE** — the container the
1197
+ // store's own `malformed_segment` names at its `L-1` arm (the store's walk pushes each in-domain
1198
+ // segment into its own container before it tests the next), so the refusal's container is the
1199
+ // SAME datum at both layers and not a second spelling of it.
1200
+ refuseOutsideSegment(segment, i, address.slice(0, i), addressArgumentPosition);
1201
+ }
1202
+ segments.push(encoded);
1203
+ }
1204
+ return { k: 'L', s: segments }; // rows 1–3, 13
947
1205
  }
948
1206
  if (typeof address === 'object') return { k: 'C' }; // rows 6 and 11: the shape is not an array's
949
1207
  return { k: 'D', o: encodeSegment(address, 0) }; // row 6: a non-array's five named classes
@@ -951,11 +1209,20 @@ function encodeAddress(address, addressArgumentPosition) {
951
1209
 
952
1210
  /// `crossing.md §1.3`'s `TierArg` table and `TierSetItem` table.
953
1211
  ///
954
- /// **THE TWO READERS AND THE TWO WRITERS ARE READ DIFFERENTLY, AND `§1.3` SAYS SO:** rule 1 reads a VERB's
955
- /// trailing argument BY CALL ARITY and folds a supplied `undefined` to the ABSENT row **for `read` ·
956
- /// `readLiteral` and `write`** — which is why `read(i, a, undefined)` answers the value while `read(i, a,
957
- /// null)` answers row 4 — **while `delete`'s `tier` is reached as a VALUE, and its own `null`/`undefined`
958
- /// row is row 4's `AddressMalformed`.**
1212
+ /// **A SUPPLIED `undefined` IS PRESENT AT THIS POSITION AND `delete`'s TIER IS REACHED AS A VALUE — THE ONE
1213
+ /// CALL THAT FOLDS TO THE ABSENT ROW IS THE CALL THAT SUPPLIED NOTHING THERE.** **⟶ ADJUDICATED 2026-10-16,
1214
+ /// AND THIS CLAUSE IS THE OPERATIVE READING OF THE BYTES BELOW** (`parameter-semantics.md §2.6`'s
1215
+ /// `PAR-JS-6` row, its `the declared answer for EACH outside value` cell as reconciled the same date, whose
1216
+ /// words are *"`a.read(address, undefined)` IS A SUPPLIED VALUE AT THIS POSITION AND TAKES `PAR-JS-6`'s
1217
+ /// DECLARED ANSWER — the store's own thrown `{status, message}` with `status` `AddressMalformed` — while the
1218
+ /// ONE CALL THAT FOLDS TO THE ABSENT ROW IS `a.read(address)`, WHICH SUPPLIED NOTHING THERE"*; the same
1219
+ /// adjudication stands at `acceptance.md §4.1` item `7`, whose *"folds to the ABSENT row"* is read through
1220
+ /// that row from that date). **SO `foldsUndefined` IS `false` AT EVERY SUPPLYING SITE — `read` ·
1221
+ /// `readLiteral` · `write` · `delete` — and the arity fold that reaches `{ k: 'A' }` is the NO-ARGUMENT CALL
1222
+ /// ALONE**, which is exactly what `supplied` carries: `n >= 2` at the readers and the writers, read off the
1223
+ /// METHOD's own call arity (`§2.12` item 3's one-spelling rule). **THE STORE'S OWN `TierArg::Undefined` ARM
1224
+ /// ANSWERS `AddressMalformed` AT ALL FOUR** (`src/args.rs`'s `read_tier_sel` and `write_tier`), so no code is
1225
+ /// minted here and the answer is the store's own.
959
1226
  ///
960
1227
  /// **AND `A76`'S CLASS ORDER IS TAKEN HERE FIRST (`JS-2`'s reach at this carrier):** a `Proxy` is refused
961
1228
  /// as an OBJECT before any element is read from it — **so a throwing `get` trap cannot be raised, because
@@ -1089,8 +1356,92 @@ function encodeListeners(listeners) {
1089
1356
  });
1090
1357
  }
1091
1358
 
1092
- /// `surface.md §2.1` / `DD-36`: `cfg` carries the store's THREE declared keys and no fourth. **Each key's
1093
- /// own ABSENCE is the member's own absence** — `crossing.md §1.3`'s absent-versus-`undefined` rule reads a
1359
+ /// **⟶ ADDED 2026-10-15 (`parameter-semantics.md §2.21`; `surface.md §2.1`'s `cfg` block dated 2026-10-15;
1360
+ /// `contract.md §8.1` #16) — THE CONSTRUCTION'S FOURTH DECLARED KEY, `constraints`: THE LIST'S OWN WALK.**
1361
+ ///
1362
+ /// **THE CLASS DECISION IS TAKEN FIRST, ON THE VALUE AS IT IS, AND NO COERCION IS PERFORMED ANYWHERE
1363
+ /// HERE** (`A76`'s part (1)): a `Proxy`, a class extending `Array` and every non-array is the LIST's own
1364
+ /// outside form and is carried as one; a plain array is walked element by element; **and ONE ELEMENT
1365
+ /// OUTSIDE THE `{ address, id }` PAIR'S SHAPE crosses as THE FAILING ENTRY'S OWN `<SEGMENT>` SPELLING**
1366
+ /// (`§8.2`'s row: *"the failing ENTRY's `address` spelling, joined by `/` … or the element's own position
1367
+ /// printed bare where the failing element carries no address at all"*). **THE CODE AND THE MESSAGE STAY THE
1368
+ /// STORE'S** (`§8.1` #16, `DD-40`): nothing here mints a status and nothing here authors a sentence.
1369
+ function encodeConstraints(constraints) {
1370
+ if (constraints === undefined) return undefined;
1371
+ if (constraints === null) return null;
1372
+ if (types.isProxy(constraints)) return { bad: 'non-array' }; // `DD-34`'s class order, taken first
1373
+ if (!Array.isArray(constraints)) return { bad: 'non-array' };
1374
+ if (arrayClass(constraints) === 'class') return { bad: 'non-array' };
1375
+ return constraints.map((entry, position) => constraintEntry(entry, position));
1376
+ }
1377
+
1378
+ /// ONE `constraints[]` ELEMENT: the closed `{ address, id }` pair, or the element's own `<SEGMENT>`
1379
+ /// spelling (`§8.2`). **AN ELEMENT THAT IS NOT A PLAIN OBJECT — an array, a `Proxy`, a class instance and
1380
+ /// every non-object included — CARRIES NO ADDRESS AT ALL**, so its slot is the element's own POSITION
1381
+ /// printed bare.
1382
+ function constraintEntry(entry, position) {
1383
+ const where = `the constraint entry at position ${position}`;
1384
+ if (!isPlainObjectValue(entry)) return { bad: 'element', subject: where };
1385
+ if (!Object.hasOwn(entry, 'address') || entry.address === undefined) {
1386
+ return { bad: 'element', subject: where };
1387
+ }
1388
+ const address = constraintAddress(entry.address);
1389
+ if (typeof address === 'string') return { bad: 'element', subject: address };
1390
+ // AN ELEMENT CARRYING NO `id` AT ALL IS THE SAME OUTSIDE FORM AS ONE WHOSE `id` IS NOT A STRING: the
1391
+ // `<SEGMENT>` slot prints the entry's own `address` spelling and the `<KEYLIST>`'s members are the
1392
+ // entry's own, read by the store's generator and never here.
1393
+ if (
1394
+ !Object.hasOwn(entry, 'id')
1395
+ || entry.id === undefined
1396
+ || typeof entry.id !== 'string'
1397
+ || entry.id === ''
1398
+ ) {
1399
+ return { bad: 'element', subject: spellConstraintAddress(address.s) };
1400
+ }
1401
+ return { address, id: entry.id };
1402
+ }
1403
+
1404
+ /// `§1.5`'s segment array as the carrier `encodeAddress` declares it — **or, where the value lies outside
1405
+ /// that domain, the failing ELEMENT's own `address` spelling as a STRING** (`§8.2`'s `<SEGMENT>` slot: a
1406
+ /// string key single-quoted, an integer index bare, joined by `/`).
1407
+ function constraintAddress(address) {
1408
+ if (types.isProxy(address) || !Array.isArray(address) || arrayClass(address) === 'class') {
1409
+ return `'${valueTargetSpelling(address)}'`;
1410
+ }
1411
+ const segments = [];
1412
+ for (let i = 0; i < address.length; i += 1) {
1413
+ if (!(i in address)) {
1414
+ return `${spellConstraintAddress(segments)} and no segment at position ${i}`;
1415
+ }
1416
+ const segment = address[i];
1417
+ if (typeof segment === 'string' && !hasLoneSurrogate(segment)) {
1418
+ segments.push(segment);
1419
+ } else if (typeof segment === 'number' && Number.isInteger(segment) && segment >= 0
1420
+ && Number.isSafeInteger(segment)) {
1421
+ segments.push(segment);
1422
+ } else {
1423
+ return `${spellConstraintAddress(segments)} and ${classSpelling(segment)} at position ${i}`;
1424
+ }
1425
+ }
1426
+ return { k: 'L', s: segments };
1427
+ }
1428
+
1429
+ /// `§8.2`'s whole-address spelling: **a string key SINGLE-QUOTED (`'a'`) and an integer index BARE (`0`),
1430
+ /// JOINED BY `/`** — the same spelling the store's own generator prints at its `<SEGMENT>` slot.
1431
+ function spellConstraintAddress(segments) {
1432
+ return segments
1433
+ .map((segment) => (typeof segment === 'string' ? `'${segment}'` : String(segment)))
1434
+ .join('/');
1435
+ }
1436
+
1437
+ /// `surface.md §2.1` / `DD-36`: the as-filed *"`cfg` carries the store's THREE declared keys and no
1438
+ /// fourth"* is read THROUGH this clause and is **the FOUR declared keys and no FIFTH** — `filePath` ·
1439
+ /// `journalLength` · `listeners` · `constraints` (`surface.md §2.1`'s `cfg` block dated 2026-10-15 and its
1440
+ /// dated clause of 2026-10-16; `parameter-semantics.md §2.21` = `PAR-JS-21`) — **and a CALLER-SUPPLIED key
1441
+ /// beyond those four is IGNORED, never refused: no code, no refusal and no member moved** (`§2.1`'s dated
1442
+ /// clause of 2026-10-16, `contract.md §7.1`'s third-key row governing the caller's key; `§8.1`'s
1443
+ /// complement). **Each key's own ABSENCE is the member's own absence** — `crossing.md §1.3`'s
1444
+ /// absent-versus-`undefined` rule reads a
1094
1445
  /// `cfg` key by MEMBERSHIP and never by arity, and **`A76`/`JS-5` fixes that membership as OWNERSHIP:
1095
1446
  /// `Object.hasOwn` and never `in`, which walks the prototype chain.**
1096
1447
  ///
@@ -1107,15 +1458,21 @@ function encodeListeners(listeners) {
1107
1458
  function encodeConfig(cfg) {
1108
1459
  if (!isPlainObjectValue(cfg)) {
1109
1460
  boundaryReject(
1110
- 'AddressMalformed', // `PAR-JS-1`'s declared answer for every outside form of `cfg`, carried
1461
+ 'AddressMalformed', // `PAR-JS-1`'s declared answer for every outside form of `cfg`, carried — **AND THE MESSAGE BELOW IS RE-SPELLED IN PLACE, 2026-10-16: *"carrying the store's three declared keys"* READS *"carrying the store's four declared keys"*, THE COUNT ALONE MOVING, because the set is `filePath` · `journalLength` · `listeners` · `constraints` (`§2.1`'s `cfg` block and dated clause, both of 2026-10-15), because the sentence's subject is the `cfg` CARRIER CLASS and NEVER a caller obligation (a CALLER-SUPPLIED key BEYOND the four is still IGNORED and never refused, `contract.md §7.1` — no semantics and no refusal path moves with the word), and because NOTHING PINNED THE OLD WORDING: no clause of `docs/specs/**` declares this message's figure and no test reads it — the drives read the TARGET `cfg` and the CLASS that failed (`negative-generators.test.mjs` · `registry.test.mjs`) — so it was ordinary prose written when the count was three and NOT a clause's own byte.**
1111
1462
  'cfg',
1112
- `the construction's cfg is ${classSpelling(cfg)}, and cfg is one plain object carrying the store's three declared keys`,
1463
+ `the construction's cfg is ${classSpelling(cfg)}, and cfg is one plain object carrying the store's four declared keys`,
1113
1464
  );
1114
1465
  }
1115
1466
  const out = {};
1116
1467
  if (Object.hasOwn(cfg, 'filePath')) out.filePath = encodeFilePath(cfg.filePath);
1117
1468
  if (Object.hasOwn(cfg, 'journalLength')) out.journalLength = encodeJournalLength(cfg.journalLength);
1118
1469
  if (Object.hasOwn(cfg, 'listeners')) out.listeners = encodeListeners(cfg.listeners);
1470
+ // **⟶ THE FOURTH DECLARED KEY** (`§2.21`; `§2.1`'s `cfg` block dated 2026-10-15): `constraints` passes
1471
+ // through by the SAME membership rule the three above take, so a key the caller did not supply is
1472
+ // ABSENT and a key the caller supplied as `undefined` is the key's own outside form. **A key BEYOND the
1473
+ // four is IGNORED and produces no code** (`§8.1`'s complement), and no default, no rename and no fifth
1474
+ // key is added here (`DD-36`).
1475
+ if (Object.hasOwn(cfg, 'constraints')) out.constraints = encodeConstraints(cfg.constraints);
1119
1476
  return out;
1120
1477
  }
1121
1478
 
@@ -1190,7 +1547,7 @@ function decodeJournalOp(encoded) {
1190
1547
  // THE PACKAGE'S OWN SURFACE — the opaque handle (`§2.3` item 2) and the per-instance registry (`§2.4`)
1191
1548
  // ---------------------------------------------------------------------------------------------
1192
1549
  /// **THE PACKAGE'S OWN INSTANCE HANDLE'S STATE**, keyed by the instance the factory returned. The handle
1193
- /// itself carries EXACTLY ONE member, `register` (`surface.md §2.4` item 5 (a)).
1550
+ /// itself carries EXACTLY ONE member, `register` (`surface.md §2.4` item 5 (a)) — **⟶ RE-SPELLED 2026-10-16: THAT ONE-MEMBER FIGURE IS THE AS-FILED READING AND IS SUPERSEDED AS A MEMBER-SET FIGURE — the instance's OPERATIVE member set is `{ register, on, off, settle }`, FOUR OWN MEMBERS AND NOTHING ELSE (`surface.md §2.7` item 8 AS AMENDED, where the as-filed `{register, on, off}` reads `{register, on, off, settle}`; `§2.11` clause 7; `docs/decisions.md` `A116` (D1)) — while the WeakMap below is still keyed by the INSTANCE alone and no member is added to it by this clause.**
1194
1551
  const INSTANCES = new WeakMap(); // instance -> {id, tokens: Map(handle -> token)}
1195
1552
 
1196
1553
  function wrapHandles(state, tokens) {
@@ -1287,14 +1644,17 @@ function writeCall(state, args, fault) {
1287
1644
  // (`A63`), no `exists` verb exists (`§2.9` item 3) and no release verb is declared (`A74`).
1288
1645
  // ---------------------------------------------------------------------------------------------
1289
1646
 
1290
- /// `§2.1`: `storeCreate(cfg)` takes ONE plain object carrying the store's THREE declared keys, passes them
1291
- /// through WITHOUT adding a default, a rename or a fourth key (`DD-36`), and **never returns a partial
1292
- /// instance** — it throws the single failure form instead. **⟶ `§2.1`'s dated clause (a), LANDED 2026-10-11
1647
+ /// `§2.1`: `storeCreate(cfg)` takes ONE plain object carrying the store's FOUR declared keys, passes them
1648
+ /// through WITHOUT adding a default, a rename or a fifth key (`DD-36`) — **the as-filed *"THREE declared
1649
+ /// keys … a fourth key"* is read THROUGH this re-spelling, at `§2.1`'s `cfg` block dated 2026-10-15 and its
1650
+ /// dated clause of 2026-10-16, and a CALLER-SUPPLIED key beyond the four is IGNORED, never refused
1651
+ /// (`contract.md §7.1`; `§8.1`'s complement)** — and **never returns a partial instance** — it throws the
1652
+ /// single failure form instead. **⟶ `§2.1`'s dated clause (a), LANDED 2026-10-11
1293
1653
  /// BY THE `Q1` CONTRACT AMENDMENT, RE-DERIVES THE MEMBER FIGURE THIS SENTENCE CARRIED: *"the object it
1294
1654
  /// returns carries EXACTLY the one own member `surface.md §2.4` item 5 (a) declares, and not one member
1295
1655
  /// beside it"* STANDS BYTE-FOR-BYTE ABOVE AND IS READ THROUGH THIS CLAUSE — from this date the member set
1296
- /// is `{ register, on, off }`, THREE OWN MEMBERS AND NOTHING ELSE, and `§2.4` item 5 (a)'s *"one own
1297
- /// member"* is superseded AS A MEMBER-SET FIGURE at its own `§` by the same amendment.** **THE MODULE
1656
+ /// is `{ register, on, off }`, THREE OWN MEMBERS AND NOTHING ELSE — **⟶ AND THAT FIGURE IS RE-SPELLED IN PLACE, 2026-10-16 BY THE FILE-TIER-SAVE COMMENT PASS: *"THREE OWN MEMBERS"* IS THE 2026-10-11 FIGURE OF THE CLAUSE ABOVE AND NOT THE OPERATIVE ONE, WHICH IS `{ register, on, off, settle }`, FOUR OWN MEMBERS AND NOTHING ELSE** — the fourth being the `A116` ORDERING SEAM, the ONE member the KERNEL calls and the entry implements (`docs/decisions.md` `A116` (D1): the set *"opens by ONE clause"* to carry it; (D3): the lift is NARROW, so NO FIFTH member; its own home is `surface.md §2.4` item 9, and a CALLER's addressable sub-surface stays the three there declared), the count read at `surface.md §2.7` item 8 AS AMENDED (the as-filed `{register, on, off}` there is *"SUPERSEDED AS FIGURES"* and reads `{register, on, off, settle}`), at `§2.11` clause 7, and by the live battery's `FTS-12.1`, whose members are exactly those four. And `§2.4` item 5 (a)'s *"one own
1657
+ /// member"* is superseded AS A MEMBER-SET FIGURE at its own `§` by the same amendment (`surface.md §2.11` clause 7: *"the instance's member set stays `{ register, on, off, settle }`"*).** **THE MODULE
1298
1658
  /// NAMESPACE IS UNMOVED at the eight declared verbs: neither new member is a named export, because both
1299
1659
  /// are reached through THIS factory's own product and through nothing else** (`surface.md §2.1`'s dated
1300
1660
  /// clauses (a)–(b); `A79`).
@@ -1314,70 +1674,313 @@ export function storeCreate(cfg) {
1314
1674
  // (rule 2, never a fan-out). **⟶ AND `off` — the ONE declared member that DOES remove an entry —
1315
1675
  // removes THE ONE THE HANDLE NAMES** (`§2.4` item 7 (b); `DD-53`), while the instance's own state is
1316
1676
  // still released with the instance and by nothing else (`DD-17`; `A74`: `off` is not a release verb).
1317
- const state = { id, tokens: new Map(), registry: new Map() };
1677
+ // **`withheld` IS THE WRITE-IN-FLIGHT SET** (`§2.4` item 9's instant (a)): the record identities this
1678
+ // instance has adopted as kernel-driven writes, whose post-verb invocation this instance withholds.
1679
+ // It holds IDENTITIES and no function, no handle and no address.
1680
+ // **`constraints` IS THE ENTRY'S OWN REGISTRY OF THE PAIRS IT CARRIES** (`surface.md §2.12` item 1's
1681
+ // preamble clause (a)–(b)): keyed by `(address, id)`, holding the pair's element, its state and ITS
1682
+ // address's own spelling — the three things `PAR-JS-24`, `§2.12` item 3's toggles and the write path's
1683
+ // carriage rule read. **IT IS POPULATED BY THE ONE ACT BOTH ROUTES REACH AND BY NOTHING ELSE**
1684
+ // (`carryConstraint` below), and **`leg` IS THE SLOT THE NESTED FIVE-POSITION CALL THE KERNEL'S STORE
1685
+ // LEG MAKES LEAVES ITS OWN RETURNED RECORD IN**, so that a kernel-driven write answers the record its
1686
+ // own write returned rather than a copy of it (`§2.12` item 1's stage 2).
1687
+ const state = { id, tokens: new Map(), home: [], registry: new Map(), withheld: new Set(), adopted: new Set(), answered: new Map(), delivered: new WeakSet(), constraints: new Map(), leg: null };
1688
+ // **TWO STRUCTURES CARRY THE ADOPTION** (`§2.4` item 9 (a)–(b)): `adopted` holds the record identities
1689
+ // whose own write verb has NOT YET ANSWERED — the identity a write in flight is keyed by, and the one
1690
+ // identity per write the entry's own verb consumes — and `answered` is THE LEDGER, mapping each adopted
1691
+ // identity to THE IDENTITY THE WRITE ITSELF RETURNED, which is the identity the terminal arm reads the
1692
+ // residue off (`record.pending`, the member `K-2` fills from its own verb's returned set and the member
1693
+ // the pass checks entries off in as they pass). **BOTH ARE EMPTIED BY THE TERMINAL ARM**: a pass that
1694
+ // reaches its terminal instant is the only writer either structure has.
1318
1695
  const instance = {
1319
- /// `surface.md §2.4` item 7 (a) / `§2.1`'s dated clause (a): **`on(address, listener) -> handle`** — the
1320
- /// combined call `A79` adopts, whose clauses are `§2.4` item 7 (a) and whose order is FIXED there.
1321
- /// **IT IS NOT A NINTH NAMED EXPORT OF THE ENTRY** (`package.md §1.3` item 3): it is reached through the
1322
- /// factory's own product alone.
1323
- on(address, listener) {
1324
- return onAt(state, instance, address, listener);
1696
+ /// **`surface.md §2.4` item 9 (f)'s `A127` clause — THE PRODUCT'S DECLARED MEMBER SET IS TWELVE OWN
1697
+ /// MEMBERS, `10 + 1 + 1 = 12` ✓: THE TEN METHODS, `register` AND `settle`.** Each is reached through
1698
+ /// THIS factory's own product alone (`package.md §1.3` item 3): the module namespace carries ONE name,
1699
+ /// `storeCreate` (`§2.9` item 1's `A127` clause; `11 → 1` ✓, and *"a deprecation window"* is declared
1700
+ /// away at that clause on `A128`'s fiat), so NO member below is a named export and the ten
1701
+ /// store-reaching names have no second spelling at any layer.
1702
+ /// **THE STATE STAYS PRIVATE** (`§2.1` (e) item 1): `state` below is this factory's own closure and is
1703
+ /// keyed in `INSTANCES` — NO own member is store data, a record, a Map, a Set, a tier, an address, a
1704
+ /// handle or a commit, and the twelve members above are the whole of what a caller sees.
1705
+ /// **`on` AND `off` ARE MERGED AWAY AND ARE NOT MEMBERS** (`A127`): the listener registration route is
1706
+ /// `listen` + `register` and its withdrawal is `unlisten`, exactly as the seven store-reaching methods
1707
+ /// and `register` below spell them.
1708
+ read(address, tier) {
1709
+ return read(instance, arguments.length, address, tier);
1325
1710
  },
1326
- /// `surface.md §2.4` item 7 (b) / `§2.1`'s dated clause (a): **`off(handle) -> undefined`** — the
1327
- /// store-side withdrawal AND the PACKAGE'S OWN registry removal, on the one order `DD-54` declares.
1328
- /// **It is NOT a ninth named export of the entry** (`package.md §1.3` item 3).
1329
- off(handle) {
1330
- return offAt(state, instance, handle);
1711
+ readLiteral(address, tier) {
1712
+ return readLiteral(instance, arguments.length, address, tier);
1713
+ },
1714
+ write(address, tier, value, commit) {
1715
+ return write(instance, arguments.length, address, tier, value, commit);
1716
+ },
1717
+ delete(address, tier) {
1718
+ return deleteOp(instance, arguments.length, address, tier);
1719
+ },
1720
+ rollback(opId) {
1721
+ return rollback(instance, arguments.length, opId);
1722
+ },
1723
+ listen(address) {
1724
+ return listen(instance, arguments.length, address);
1725
+ },
1726
+ unlisten(handle) {
1727
+ return unlisten(instance, arguments.length, handle);
1728
+ },
1729
+ /// `surface.md §2.12` item 2 (a): **`a.addConstraint(pair, constraint) -> constraint identity`** — the
1730
+ /// ADD route, which carries the function and OVERWRITES at a pair the entry already holds.
1731
+ addConstraint(pair, constraint) {
1732
+ return addConstraint(instance, arguments.length, pair, constraint);
1733
+ },
1734
+ /// `surface.md §2.12` item 2 (a): **`a.constraintOn(pair, constraint) -> undefined`** — the ENABLE half.
1735
+ constraintOn(pair, constraint) {
1736
+ return constraintToggle(true, instance, arguments.length, pair, constraint);
1737
+ },
1738
+ /// `surface.md §2.12` item 2 (a): **`a.constraintOff(pair, constraint) -> undefined`** — the DISABLE half.
1739
+ constraintOff(pair, constraint) {
1740
+ return constraintToggle(false, instance, arguments.length, pair, constraint);
1331
1741
  },
1332
1742
  /// `surface.md §2.4` item 5 (b): `register(handle, listener) -> undefined` — the OPAQUE handle a verb
1333
- /// returned or the construction adopted, and ANY JS function. **It is NOT a ninth named export of the
1334
- /// entry** (`package.md §1.3` item 3): it is reached through the factory's own product alone.
1743
+ /// returned or the construction adopted, and ANY JS function. **It is NOT a named export of the entry**
1744
+ /// (`package.md §1.3` item 3): it is reached through the factory's own product alone.
1335
1745
  register(handle, listener) {
1336
1746
  return registerOn(state, handle, listener);
1337
1747
  },
1748
+ /// `surface.md §2.4` item 9 / `§2.1`'s dated clause (a): **`settle(record) -> undefined`** — THE
1749
+ /// ORDERING SEAM, the one member the kernel calls and the entry implements, at the two instants of a
1750
+ /// kernel-driven write (`A116` (D1)–(D2)). **It is NOT a named export of the entry**
1751
+ /// (`package.md §1.3` item 3): it is reached through the factory's own product alone.
1752
+ settle(record) {
1753
+ return settleOn(state, record, arguments.length >= 1);
1754
+ },
1338
1755
  };
1339
1756
  INSTANCES.set(instance, state);
1757
+ // **⟶ `§2.12` ITEM 1 CLAUSE (b): `storeCreate` REGISTERS EACH OF `cfg.constraints`' ELEMENTS THAT CARRIES
1758
+ // ITS OWN FUNCTION AT `K-1`, AT THE INSTANCE IT IS CONSTRUCTING** — the SAME call the ADD route makes, so
1759
+ // a batch-populated pair is a pair the entry carries on the same footing (`§2.12` item 3's preamble clause
1760
+ // (a)). **A WELL-FORMED PAIR CARRYING NO FUNCTION IS NOT AN ELEMENT AND IS NOT REGISTERED**: it is read at
1761
+ // the store's two validation instants (`PAR-JS-21`) and by nothing here.
1762
+ if (isPlainObjectValue(cfg) && isAdmittedArray(cfg.constraints)) {
1763
+ const list = cfg.constraints;
1764
+ for (let i = 0; i < list.length; i += 1) {
1765
+ const element = list[i];
1766
+ const encoded = constraintEntry(element, i);
1767
+ if (encoded.bad !== undefined) continue;
1768
+ if (typeof element.constraint !== 'function') continue;
1769
+ carryConstraint(state, instance, encoded.address.s, encoded.id, element.constraint);
1770
+ }
1771
+ }
1772
+ // **⟶ AND THE CONSTRUCTION'S OWN ADOPTION ENTERS THE PACKAGE'S HOME MIRROR** (`§2.4` item 7 (b)'s dated
1773
+ // narrowing reads TWO lawful duplicate states, and the ONE-ADDRESS one is `DD-39`'s CONSTRUCTION duplicate;
1774
+ // `src/store.rs`'s own `adopt` keeps BOTH entries under one address and pushes the token's index entry for
1775
+ // each). **THE MIRROR IS THE HOME'S OWN SHAPE AND NOT A SECOND DECISION**: an accepted entry's handle is
1776
+ // adopted VERBATIM, in the caller's own spelling order ACROSS addresses and the bucket's own order WITHIN
1777
+ // one — which is the order `DD-42` clause (2)'s *"FIRST match"* is defined by. **A REJECTED ARRAY ADMITS
1778
+ // NOTHING** (`src/args.rs`), so a listeners list the store refused never reaches `storeCreate`'s return and
1779
+ // no mirror entry is written for it.
1780
+ //
1781
+ // **⟶ AND ONE ENTRY IS PUSHED PER ADOPTED ELEMENT, WITH NO `some(key)` TEST HERE — CORRECTED 2026-10-17**
1782
+ // (`§2.4` item 7 (a) item 3; rules 1, 3 and 4 with `DD-39`'s *"both entries are KEPT"*): the store's own
1783
+ // population calls `adopt` for EVERY admitted element, and two elements at ONE address stay TWO store
1784
+ // entries (`src/store.rs`'s bucket, whose `first_at` answers the bucket's FIRST). **SO A PER-KEY DEDUPE
1785
+ // HERE WOULD BE A SECOND DECISION THE STORE NEVER TAKES and the mirror would hold fewer entries than the
1786
+ // home** — the `-1` absence route below is what that divergence breaks. **THE PREDICATE IS THE ONE THE
1787
+ // STORE'S OWN ADMISSION AGREES WITH** (`isLawfulListenerElement`): a `cfg.listeners` array that reached
1788
+ // this line was admitted WHOLE by `encodeListeners`, the facade and `src/args.rs`, so a lawful element is
1789
+ // pushed and the two sides' element counts are the same number.
1790
+ if (isPlainObjectValue(cfg) && isAdmittedArray(cfg.listeners) && arrayClass(cfg.listeners) !== 'class') {
1791
+ for (const entry of cfg.listeners) {
1792
+ if (!isLawfulListenerElement(entry)) continue;
1793
+ state.home.push({ key: homeAddressKey(entry.address), token: entry.handle });
1794
+ }
1795
+ }
1340
1796
  return instance;
1341
1797
  }
1342
1798
 
1799
+ /// **`§2.4` ITEM 9 (f)'S `A127` CLAUSE — THE TEN STORE-REACHING NAMES ARE THE PRODUCT'S OWN METHODS AND
1800
+ /// THE MODULE NAMESPACE CARRIES ONE NAME.** Every function below is the BODY of one of those methods and is
1801
+ /// no longer a named export (`§2.9` item 1's `A127` clause; `11 → 1` ✓, no deprecation window and no second
1802
+ /// spelling — `A128`). **`n` IS THE RECEIVER'S OWN CALL ARITY** (`arguments.length` at the method), because
1803
+ /// the LEADING `instance` POSITION IS DROPPED (`§2.12` item 3's one-spelling rule): the arity folds that
1804
+ /// were written against `n_old` are read here against `n_old − 1` and nothing else moves.
1805
+
1343
1806
  /** `§2.2`: `read` — a leaf's literal, a branch's assembled value, the empty address's whole register. */
1344
- export function read(instance, address, tier) {
1807
+ function read(instance, n, address, tier) {
1345
1808
  const state = stateOf(instance);
1346
1809
  // A position the call supplied no value for is handed as the runtime's own `undefined` — NEVER as an
1347
1810
  // absent array slot — so the facade can tell an unsupplied position from a supplied `undefined` and the
1348
1811
  // core is never reached with a null pointer (`crossing.md §1.3`'s absent-versus-`undefined` rule).
1349
- const args = arguments.length >= 2 ? [encodeAddress(address)] : [];
1350
- args.push(encodeTier(tier, arguments.length >= 3, true));
1812
+ const args = n >= 1 ? [encodeAddress(address, undefined, 'first argument')] : [];
1813
+ // `PAR-JS-6`: a SUPPLIED `undefined` at this position is PRESENT and takes the row's own
1814
+ // `AddressMalformed`; the NO-ARGUMENT call is the one that folds to the ABSENT row.
1815
+ args.push(encodeTier(tier, n >= 2, false));
1351
1816
  return decodeValue(call(state, 'read', args));
1352
1817
  }
1353
1818
 
1354
1819
  /** `§2.2` / `§2.9` item 2: `readLiteral` narrows the read to a leaf and answers `ReadTargetIsBranch`. */
1355
- export function readLiteral(instance, address, tier) {
1820
+ function readLiteral(instance, n, address, tier) {
1356
1821
  const state = stateOf(instance);
1357
- const args = arguments.length >= 2 ? [encodeAddress(address)] : [];
1358
- args.push(encodeTier(tier, arguments.length >= 3, true));
1822
+ const args = n >= 1 ? [encodeAddress(address, undefined, 'first argument')] : [];
1823
+ args.push(encodeTier(tier, n >= 2, false));
1359
1824
  return decodeValue(call(state, 'readLiteral', args));
1360
1825
  }
1361
1826
 
1362
1827
  /// `PAR-JS-13`: the returned record is `{op, watched, triggered}` — fresh on every call, never a view.
1363
- export function write(instance, address, tier, value) {
1828
+ ///
1829
+ /// **⟶ AMENDED 2026-10-15 (`surface.md §2.2`'s dated clause of 2026-10-15; `parameter-semantics.md §2.20`):
1830
+ /// THE DECLARED ORDER IS `write(instance, address, tier, value, commit?)`** — FOUR REQUIRED ARGUMENTS AND
1831
+ /// THE OPTIONAL ONE AT POSITION FIVE (`proposal-review.md §22.5` item 5). **THE PACKAGE ADDS NO ARITY
1832
+ /// CHECK, NO DEFAULT AND NO VALIDATION OF ITS OWN AT THIS POSITION** (§2.2 clause 3): an ABSENT `commit` is
1833
+ /// IN DOMAIN — *"the write opens or joins a commit all the same"* — and **no default record is fabricated
1834
+ /// for it.**
1835
+ ///
1836
+ /// **THE FIFTH POSITION'S CLASS TEST IS `§2.4` ITEM 9 (g) ITEM 1's OWN** — *"an object position is a record
1837
+ /// position only where it CARRIES A `pending` MEMBER whose value is present and not `undefined`"* — **and
1838
+ /// ITS ANSWER IS ONE INSTANCE OF ONE CLASS, `TypeError`, whose `status` MEMBER IS ABSENT and whose string
1839
+ /// `message` member is required** (`§2.20`'s answer cell; the same refusal `settleOn` takes at the record
1840
+ /// position). **A REFUSED POSITION STOPS THE WRITE**: no store call is reached, so no version lands and no
1841
+ /// byte moves. **IT IS A CLASS TEST AND NEVER AN IDENTITY TEST** — no clause reads the caller's history
1842
+ /// here.
1843
+ function commitPositionRefusal(commit) {
1844
+ if (commit !== null && typeof commit === 'object') {
1845
+ // **A `Proxy` IS OUTSIDE THE POSITION'S DOMAIN** (`§2.20`'s outside-value row) and is refused BEFORE a
1846
+ // member is read from it, so a `get` trap is never raised — the class order `encodeAddress` and
1847
+ // `encodeTier` already take at their own carriers (`A76`/`JS-2`).
1848
+ if (!types.isProxy(commit) && !Array.isArray(commit)) {
1849
+ let pending;
1850
+ try {
1851
+ pending = commit.pending;
1852
+ } catch {
1853
+ pending = undefined; // the guarded read `JS-1` declares: catch, then classify
1854
+ }
1855
+ if (Object.hasOwn(commit, 'pending') && pending !== undefined) return null;
1856
+ }
1857
+ }
1858
+ return new TypeError(
1859
+ `the write's fifth argument is ${classSpelling(commit)}, and the commit position takes an object `
1860
+ + 'carrying a `pending` member',
1861
+ );
1862
+ }
1863
+
1864
+ function write(instance, n, address, tier, value, commit) {
1364
1865
  const state = stateOf(instance);
1365
- const args = arguments.length >= 2 ? [encodeAddress(address)] : [];
1366
- args.push(encodeTier(tier, arguments.length >= 3, true));
1367
- // THE WALK'S OWN FAULT RECORD — see `refusedValue`: the walk CLASSIFIES and RECORDS, and the record is
1368
- // read at the one site where the store answered `ValueNotAdmitted` for a value the walk refused.
1369
- const fault = { found: null, value: undefined, path: [] };
1370
- args.push(encodeValue(value, [], 0, [], fault));
1371
- const answer = writeCall(state, args, fault);
1866
+ // **⟶ `§2.12` ITEM 1, STAGE 1: A `write` CALLED WITH FOUR POSITIONS — `write(instance, address, tier,
1867
+ // value)` — ENTERS THE KERNEL'S `K-2`**, where this instance carries a constraint at this write's
1868
+ // address; the kernel's pass then evaluates every pair registered at that address and the two arms of
1869
+ // `§2.12` item 1's fail arm are taken by the kernel's own acts. **A CARRYING ADDRESS IS THE WHOLE OF THIS
1870
+ // GATE: an instance that carries no pair at this address takes the path this verb has always taken, and a
1871
+ // FIVE-POSITION CALL IS THE KERNEL'S OWN STORE LEG AND NEVER ENTERS `K-2`** — item 1's stage 4 no-recursion
1872
+ // clause: *"a five-position call can never start a second pass — and the call that carries an ADOPTED
1873
+ // identity is item 3's own, so there is no recursion and need not be one"*.
1874
+ if (n <= 3 && carriesConstraintAt(state, address)) {
1875
+ return constraintWrite(state, instance, address, tier, value);
1876
+ }
1877
+ let answer;
1878
+ try {
1879
+ // **THE CLASS TEST IS TAKEN BEFORE THE WALK AND BEFORE THE VERB** (`§2.4` item 9 (g) item 1): the
1880
+ // refused position leaves no landing, so the same release the catch block below performs is taken for
1881
+ // an adoption this refusal left unrun (`§2.4` item 9's table row (a) read with `§2.7` item 8).
1882
+ if (n >= 4) {
1883
+ const refusal = commitPositionRefusal(commit);
1884
+ if (refusal !== null) throw refusal;
1885
+ }
1886
+ const args = n >= 1 ? [encodeAddress(address, undefined, 'first argument')] : [];
1887
+ // `PAR-JS-7`: `write`'s tier is REQUIRED — an ABSENT position and a SUPPLIED `undefined` both answer
1888
+ // `AddressMalformed`, and neither folds.
1889
+ args.push(encodeTier(tier, n >= 2, false));
1890
+ // THE WALK'S OWN FAULT RECORD — see `refusedValue`: the walk CLASSIFIES and RECORDS, and the record is
1891
+ // read at the one site where the store answered `ValueNotAdmitted` for a value the walk refused.
1892
+ const fault = { found: null, value: undefined, path: [] };
1893
+ args.push(encodeValue(value, [], 0, [], fault));
1894
+ answer = writeCall(state, args, fault);
1895
+ } catch (refusal) {
1896
+ // **⟶ A WRITE THAT NEVER RAN RELEASES THE ADOPTION IT WAS TAKEN FOR** (`§2.4` item 9's table row (a)
1897
+ // read with `§2.7` item 8, and `PAR-JS-19`'s own keying of one adoption to one write): the adoption
1898
+ // instant (a) took is KEYED TO ONE WRITE and is *"never a queue an unrelated write may draw from"*,
1899
+ // so a `commit` the store refused between instant (a) and the verb — or a walk this boundary refused
1900
+ // before the verb was reached — leaves NO write for that adoption to belong to (`kernel-surface.md
1901
+ // §2.1` item 2: a refused `commit` *"threw BEFORE the write verb ran"*, so no residue exists for any
1902
+ // terminal arm to reach). **IT IS RELEASED HERE AND NOT CARRIED FORWARD**, so the NEXT write reaches
1903
+ // no adoption at all: `§2.7` ITEM 8'S POST-VERB INSTANT FOR A BARE CALLER-MADE WRITE IS UNMOVED BY
1904
+ // ANY KERNEL ACT (`§2.4` item 9 (e); `A116` (D1): the seam withholds *"the write in flight"* and
1905
+ // only it), and an abandoned adoption standing as a pending identity is exactly the withholding this
1906
+ // clause forbids. The store's own refusal crosses back UNCHANGED AND UNCONVERTED.
1907
+ const unrun = state.adopted.size === 0 ? null : state.adopted.values().next().value;
1908
+ if (unrun !== null) {
1909
+ state.adopted.delete(unrun);
1910
+ state.answered.delete(unrun);
1911
+ }
1912
+ throw refusal;
1913
+ }
1372
1914
  const record = {
1373
1915
  op: decodeJournalOp(answer.op),
1374
1916
  watched: answer.watched.map(decodeSegments),
1375
1917
  triggered: wrapHandles(state, answer.triggered),
1376
1918
  };
1919
+ // **AND THE RECORD IS LEFT IN THE SLOT THE KERNEL'S STORE LEG READS** (`state.leg`; `§2.12` item 1's
1920
+ // stage 2): a kernel-driven write takes the record THIS VERY WRITE returned and not a copy of it, and the
1921
+ // slot is read before the pass that may write again, so a repair's own write can never be mistaken for it.
1922
+ state.leg = record;
1377
1923
  // **THE INVOCATION WINDOW** (`§2.7` item 2, `DD-22`): the record above is COMPLETE before the window
1378
1924
  // opens, the invocation is SYNCHRONOUS, it happens AFTER the addon's call returned, and **its ONE
1379
1925
  // argument is the TRIGGERING ADDRESS** (`PAR-JS-12`).
1380
- deliver(state, record.triggered, answer.triggeringAddress);
1926
+ //
1927
+ // **⟶ AND WHERE THIS WRITE IS ONE `commit` ISSUED, THE WINDOW IS WITHHELD** (`§2.7` items 6–8 with
1928
+ // `§2.4` item 9's instant (a), and `A115` (D2)): the record identity the seam adopted BEFORE this
1929
+ // verb was called stands in `state.withheld`, so this instance invokes NO handle of that write here
1930
+ // and the delivery waits for the pass's terminal arm, where the seam delivers the record's `pending`
1931
+ // residue. **A BARE CALLER-MADE WRITE REACHES NO ADOPTION AND ITS POST-VERB INSTANT STANDS UNMOVED**
1932
+ // (`§2.7` item 8; `§2.4` item 9 (e)): such a record was never passed to the seam, so its set is
1933
+ // delivered exactly as it always was.
1934
+ // **THE ADOPTION IS CONSUMED HERE, AND THE IDENTITY THAT STANDS IN `withheld` IS THIS RECORD'S**
1935
+ // (`§2.4` item 9's table row (a): *"the record identity the instance adopted at instant (a)"*): the
1936
+ // seam marks the write in flight, and this verb — the very write that marker was made for, called by
1937
+ // `commit` on the next statement — is the one write it withholds. **A WRITE THAT FINDS NO ADOPTION IS A
1938
+ // BARE CALLER-MADE WRITE AND ITS POST-VERB INSTANT STANDS UNMOVED** (`§2.7` item 8; `§2.4` item 9 (e)).
1939
+ // **⟶ THE BARE WRITE'S OWN GUARD IS `withheld`, BECAUSE THE MARKER IS THE WITHHOLD AND NOT A
1940
+ // CONSTRUCTION ORDER** (`§2.4` item 9's table row (a): *"WITHHOLDS the package's own delivery for
1941
+ // IT"*; row (b): *"AT THE PASS'S TERMINAL ARM … the SAME record identity"*). **THE ONLY ADOPTION A
1942
+ // KERNEL-DRIVEN WRITE CAN FIND IS ITS OWN**: `settle`'s FIRST call records the identity in BOTH
1943
+ // structures, and the verb that carries that identity DELETES IT FROM `adopted` at `:1438` — so an
1944
+ // entry standing in `adopted` beside a non-empty `withheld` is a second identity, which is another
1945
+ // kernel-driven write's, and this write finds no marker of its own. **ONLY THIS WRITE'S OWN IDENTITY
1946
+ // IS CONSUMED AND ONLY ITS OWN WINDOW IS WITHHELD** — *"A WRITE THAT FINDS NO ADOPTION IS A BARE
1947
+ // CALLER-MADE WRITE AND ITS POST-VERB INSTANT STANDS UNMOVED"* (`§2.7` item 8; `§2.4` item 9 (e)).
1948
+ const pending = state.withheld.size === 0 ? null : state.adopted.values().next().value;
1949
+ // **WHETHER THIS WRITE'S LEDGER ENTRY WAS STILL EMPTY WHEN THE CALL CAME** (`§2.4` item 9 (a)): an
1950
+ // adoption whose own write verb has not yet answered is one a CALLER's own `settle` call may deliver
1951
+ // before the write runs, and it is that delivery the write's own record carries the mark of (`:1456`).
1952
+ const pendingAnswerEmpty = pending !== null && pending !== undefined && state.answered.get(pending) === null;
1953
+ if (pending === null || pending === undefined) {
1954
+ deliver(state, record.triggered, answer.triggeringAddress);
1955
+ } else {
1956
+ state.adopted.delete(pending);
1957
+ state.answered.set(pending, record); // THE IDENTITY THIS ADOPTION'S OWN WRITE RETURNED
1958
+ state.withheld.add(record);
1959
+ // **⟶ AND BOTH IDENTITIES ARE MARKED DELIVERED, BECAUSE THIS WRITE'S DELIVERY HAS NOW HAPPENED**
1960
+ // (`§2.4` item 9: the two instants are counted, and NO third instant is declared — *"there is NO
1961
+ // second adoption"*; `PAR-JS-19`'s domain cell). A delivery taken while the ledger entry stood EMPTY
1962
+ // is a caller's own call and it DELIVERS THIS WRITE'S RESIDUE — the adopted identity `pending` names —
1963
+ // so that identity's occurrence after this instant is no longer a first call, and **THE IDENTITY THE
1964
+ // WRITE RETURNED IS MARKED WITH IT**: `K-2` hands the write's own record to the seam at its terminal
1965
+ // arm, and where the caller took the delivery first, that record arrives with no ledger entry left to
1966
+ // answer it (`state.answered.delete(pending)` above) and would be READ AS A FIRST CALL — adopted, put
1967
+ // in flight a second time, and its marker left standing for a pass that never comes, which withholds
1968
+ // the next bare caller-made write's window (`§2.7` item 8; `§2.4` item 9 (e)). **THE MARK IS TAKEN
1969
+ // ONLY WHERE THE LEDGER ENTRY WAS EMPTY**: an identity delivered at the terminal arm is answered by
1970
+ // the write's own record through `answered`, and marking it there would reach the abandoned attempt's
1971
+ // late arm as a no-op — the delivery the clause owes at that instant (`§2.4` item 9 (b);
1972
+ // `ck_neg_dm_09_*`).
1973
+ if (pendingAnswerEmpty) {
1974
+ state.delivered.add(pending);
1975
+ state.delivered.add(record);
1976
+ }
1977
+ // **AND THE IDENTITY IS THIS WRITE'S FROM HERE ON** (`§2.4` item 9's table row (a): the write *"the
1978
+ // adopted identity names"* is the one its window withholds): a delivery this identity had already
1979
+ // taken — a caller's own call, made while the ledger entry stood EMPTY (`:1735`) — is SUPERSEDED by
1980
+ // the write it belongs to, and the seam's SECOND call for it is the terminal arm's delivery and not
1981
+ // a no-op, so the abandonment's own late arm still reaches the residue (`§2.4` item 9 (b)).
1982
+ state.delivered.delete(record);
1983
+ }
1381
1984
  return record;
1382
1985
  }
1383
1986
 
@@ -1474,12 +2077,12 @@ function deliver(state, triggered, triggeringAddress) {
1474
2077
  /// and the in-domain no-op arm a SUCCESS returning `tiers: []`. **Its declared NAME is `delete`, and it is
1475
2078
  /// published under that name ALONE** (`package.md §1.3` item 3): `deleteOp` is a reserved-word workaround
1476
2079
  /// for the declaration and never a member of the package's namespace.
1477
- function deleteOp(instance, address, tier) {
2080
+ function deleteOp(instance, n, address, tier) {
1478
2081
  const state = stateOf(instance);
1479
- const args = arguments.length >= 2 ? [encodeAddress(address)] : [];
2082
+ const args = n >= 1 ? [encodeAddress(address, undefined, 'first argument')] : [];
1480
2083
  // `delete`'s tier is read as a VALUE and not by an arity fold: an ABSENT position is the whole-target
1481
2084
  // removal, and a supplied `undefined` answers row 4's `AddressMalformed` (`crossing.md §1.3`).
1482
- args.push(encodeTier(tier, arguments.length >= 3, false));
2085
+ args.push(encodeTier(tier, n >= 2, false));
1483
2086
  const answer = call(state, 'delete', args);
1484
2087
  const receipt = {
1485
2088
  address: decodeSegments(answer.address),
@@ -1492,9 +2095,9 @@ function deleteOp(instance, address, tier) {
1492
2095
  }
1493
2096
 
1494
2097
  /// `PAR-JS-9`: `{opId, undoneOps, restoredTo}` — the constraint pattern's reverse step (`§2.6`).
1495
- export function rollback(instance, opId) {
2098
+ function rollback(instance, n, opId) {
1496
2099
  const state = stateOf(instance);
1497
- const args = arguments.length >= 2 ? [encodeOpId(opId)] : [];
2100
+ const args = n >= 1 ? [encodeOpId(opId)] : [];
1498
2101
  const answer = call(state, 'rollback', args);
1499
2102
  return {
1500
2103
  opId: answer.opId,
@@ -1505,26 +2108,166 @@ export function rollback(instance, opId) {
1505
2108
 
1506
2109
  /// `§2.10`: `listen` mints a token, populates the store's home and wraps it for JS — and its `address` is
1507
2110
  /// `AddressArg`'s domain and NOTHING MORE: a listener carries NO tier qualifier.
1508
- export function listen(instance, address) {
2111
+ ///
2112
+ /// **THE PACKAGE MIRRORS THE STORE'S OWN HOME, AND IT MIRRORS IT INSIDE THE SAME DECLARED RULES THE STORE
2113
+ /// USES — ONE ENTRY PER CALL, `DD-39`'s duplicate bucket included** (`write-and-read.md §6.5` item 12 (c)
2114
+ /// and its item 8; `src/store.rs`'s `first_at` FIRST and `mint` SECOND, whose `mint` skips any token the
2115
+ /// home already holds, `DD-42` clause (1)). **NO SECOND DECISION IS TAKEN HERE**: the store's answer is
2116
+ /// carried VERBATIM and the only thing this side adds is WHICH ENTRY THAT ANSWER NAMED — the address the
2117
+ /// call spelled, and the token the store answered. **THAT ONE DATUM IS THE WHOLE REASON THE MIRROR EXISTS**:
2118
+ /// `unlisten`'s declared **DEREGISTRATION** step (`surface.md §2.4` item 7 (b)) is defined over the two
2119
+ /// lawful duplicate states the SAME clause's dated narrowing names, and the store's `triggered` list carries
2120
+ /// tokens and never the address they were minted at (`§2.7` item 1) — **so the address is kept beside the
2121
+ /// identity rather than guessed from it.** Nothing of it is observable: it is this factory's own closure,
2122
+ /// like `tokens` and `registry`, and `§2.1` (e) item 1's private-state rule is untouched.
2123
+ /// **AND THE KEY IS INJECTIVE, 2026-10-17 — TWO DISTINCT LAWFUL ADDRESSES CANNOT SHARE ONE KEY**
2124
+ /// (`§2.4` rules 1 and 4 and item 7 (a)/(b), which all rest on the mirror holding EXACTLY the store's own
2125
+ /// entries). **THE DEFECT IT CLOSES, NAMED: the shipped key joined RAW segment spellings with `\u0000`, so
2126
+ /// `['a', 1]` and `['a', 'number:1']` BOTH keyed `a\u0000number:1` — one key, two lawful addresses — and
2127
+ /// every `some(key)` test below then read a second ADDRESS as an already-held one.** **THE KEY NOW CARRIES
2128
+ /// EACH SEGMENT'S OWN CLASS AND ITS LENGTH**, which is what makes it injective over the two classes
2129
+ /// `§1.5`'s domain holds (`PAR-JS-5`: a string key or a non-negative integer index): `s1:a` and `n1:1` can
2130
+ /// never be read off one another, because the class letter decides the spelling and the length decides
2131
+ /// where it ends. **THE STORE'S OWN KEY IS THE SEGMENT VECTOR ITSELF and the mirror's key is its faithful
2132
+ /// image**: no coercion, no case folding and no normalization stands between the two.
2133
+ function homeAddressKey(address) {
2134
+ if (!Array.isArray(address)) return `\u0001${typeof address}`;
2135
+ const parts = [];
2136
+ for (let i = 0; i < address.length; i += 1) {
2137
+ const segment = address[i];
2138
+ // **THE TWO CLASSES `§1.5`'S DOMAIN HOLDS, AND NOTHING ELSE IS EVER KEYED** (`inDomainAddress` below
2139
+ // is the one predicate that admits an address here): a string segment is `s<length>:<bytes>` and an
2140
+ // index segment is `n<length>:<digits>` — the length prefix is what makes the join injective.
2141
+ if (typeof segment === 'string') {
2142
+ parts.push(`s${segment.length}:${segment}`);
2143
+ } else {
2144
+ const digits = String(segment);
2145
+ parts.push(`n${digits.length}:${digits}`);
2146
+ }
2147
+ }
2148
+ return parts.join('\u0000');
2149
+ }
2150
+
2151
+ /// **ONE `listeners[]` ELEMENT IS LAWFUL WHERE THE STORE'S OWN ADMISSION AND THE BOUNDARY'S OWN WALK AGREE
2152
+ /// ON IT — ADDED 2026-10-17, SO THE SEEDING PREDICATE AND `listen`'S PUSH CONDITION CANNOT DISAGREE ABOUT
2153
+ /// WHAT A LAWFUL ELEMENT IS** (`§2.4` item 7 (a) item 3's *"ADMIT-OR-REFUSE COMES THIRD, and every element
2154
+ /// read … is reached ONLY for a value the first step has admitted"*, read with `§1.4`'s walk and the store's
2155
+ /// own `src/args.rs`, which admits exactly the elements whose every segment `Segment::is_in_domain` holds
2156
+ /// and whose handle token is not blank). **THE FOUR TESTS ARE THE ONES `encodeListeners` AND
2157
+ /// `constraintAddress` ALREADY TAKE, AND NOT ONE OF THEM IS NEW**: the entry is a plain object (a `Proxy`,
2158
+ /// an `Array` and a prototype-carrying object refused before a member is read — `§1.4` item 4 (e)–(g),
2159
+ /// `DD-34`/`DD-35`); `address` and `handle` are OWN members (`Object.hasOwn` and never `in`, `JS-5`); the
2160
+ /// handle is a non-empty string (`§0.4` clause 3 / `PAR-13`); and the address is an admitted array whose
2161
+ /// every segment is a string without a lone surrogate or a non-negative SAFE integer — the two classes
2162
+ /// `encodeSegment` pushes and `Segment::is_in_domain` admits, so the elements the store ADOPTS and the
2163
+ /// elements this predicate ACCEPTS are one set and the mirror holds one entry per store entry.
2164
+ function inDomainAddress(address) {
2165
+ if (types.isProxy(address) || !Array.isArray(address) || arrayClass(address) === 'class') return false;
2166
+ for (let i = 0; i < address.length; i += 1) {
2167
+ if (!(i in address)) return false; // a hole is `AddressArg` row 14's own outside shape (`DD-8`)
2168
+ const segment = address[i];
2169
+ if (typeof segment === 'string') {
2170
+ if (hasLoneSurrogate(segment)) return false; // the class the walk refuses before any verb (`C-4`)
2171
+ } else if (!(typeof segment === 'number' && Number.isInteger(segment) && segment >= 0
2172
+ && Number.isSafeInteger(segment))) {
2173
+ return false; // and every other class is `§1.5`'s own outside set
2174
+ }
2175
+ }
2176
+ return true;
2177
+ }
2178
+
2179
+ /// **AND THE SEEDING PREDICATE IS THAT ONE PREDICATE** — the entry's own four tests, taken together.
2180
+ function isLawfulListenerElement(entry) {
2181
+ if (!isPlainObjectValue(entry) || !Object.hasOwn(entry, 'address') || !Object.hasOwn(entry, 'handle')) return false;
2182
+ if (typeof entry.handle !== 'string' || entry.handle === '') return false;
2183
+ return inDomainAddress(entry.address);
2184
+ }
2185
+
2186
+ function listen(instance, n, address) {
1509
2187
  const state = stateOf(instance);
1510
- const args = arguments.length >= 2 ? [encodeAddress(address)] : [];
1511
- return wrapHandles(state, [call(state, 'listen', args)])[0];
2188
+ // **AND `listen`'s ONE POSITION IS AN ADDRESS POSITION THAT CARRIES ITS ARGUMENT POSITION** (`§2.17`'s dated
2189
+ // clause; `surface.md §2.5` item 5 (b)'s position half): the CLASS half is mandatory at every site and the
2190
+ // position half is read at the site that DECLARES one, and this verb's address is `1` of `1` — so a class
2191
+ // refusal here names the argument it is about (`NG-JS-I`'s `listen` arm). *"first argument"* is written
2192
+ // with the same bytes the registry's own registration clause spells; the constant below is declared with
2193
+ // the constraint sites and is NOT reachable from here.
2194
+ const args = n >= 1 ? [encodeAddress(address, 'first argument', 'first argument')] : [];
2195
+ const wrapped = wrapHandles(state, [call(state, 'listen', args)])[0];
2196
+ if (n >= 1) {
2197
+ // **THE STORE CONSULTED THE ADDRESS FIRST**: where a bucket already stands under this address the store
2198
+ // MINTED NOTHING and pushed NOTHING (`first_at`), so the mirror records nothing a second time either —
2199
+ // and where it did not, the store's own `mint` pushed exactly ONE entry, which is the ONE recorded.
2200
+ if (!state.home.some((entry) => entry.key === homeAddressKey(address))) {
2201
+ state.home.push({ key: homeAddressKey(address), token: state.tokens.get(wrapped) });
2202
+ }
2203
+ }
2204
+ return wrapped;
1512
2205
  }
1513
2206
 
1514
2207
  /// `§2.3` item 4 / `PAR-JS-8`: **`unlisten` over ANY value outside the domain is a NO-OP SUCCESS** — a
1515
2208
  /// foreign instance's value, a prior session's value, a fabricated value, a blank token, a non-opaque value
1516
2209
  /// and an absent handle are EACH a no-op success, no code is produced, and NO OTHER REGISTRATION IS REMOVED.
1517
- /// **The package's own registry entry STANDS** (`§2.4` rule 4, `DD-15`): only the store-side home entry is
1518
- /// withdrawn, so a withdrawn handle's function simply never fires again.
1519
- export function unlisten(instance, handle) {
2210
+ ///
2211
+ /// **⟶ THE `off`-CLASS WITHDRAWAL IS THE ONE A `A127`'S RECEIVER RULING LEAVES AT THIS MEMBER, AND IT HAS
2212
+ /// TWO HALVES — THE STORE'S AND THE PACKAGE'S OWN** (`surface.md §2.4` item 7 (b)'s `off` step list, whose
2213
+ /// three steps are VALIDATE · UNLISTEN · DEREGISTER, read with that item's own dated clause: *"the
2214
+ /// store-side home entry is withdrawn, the registry's entry for that identity is REMOVED, and `undefined` is
2215
+ /// returned"*, and `contract.md §5.5`'s fourth added failure-list entry, *"an `unlisten` that unregisters
2216
+ /// the function"*, which the `A127` surface closes by MERGING `off` INTO THIS MEMBER — `on` and `off` are
2217
+ /// *"MERGED AWAY AND ARE NOT MEMBERS"* and *"the listener registration route is `listen` + `register` and
2218
+ /// its withdrawal is `unlisten`"*, `surface.md §2.4` item 9 (f)'s `A127` clause). **THE REMOVAL IS KEYED TO
2219
+ /// THE IDENTITY THIS CALL WAS HANDED AND TO NOTHING ELSE — not to the address and not to the function**
2220
+ /// (`§2.4` item 7 (b)'s dated narrowing: *"the deregistration is keyed by the identity and not by a count of
2221
+ /// entries"*), so at the CALLER-SPELLED DUPLICATE the surviving entry's own trigger still CARRIES the
2222
+ /// identity while the package invokes NOTHING for it: rule 1's declared silence (*"an unregistered handle
2223
+ /// fires nothing silently"*). **A LATER TRIGGER THAT CARRIES THE IDENTITY AND A SILENT INVOCATION ARE NOT
2224
+ /// IN CONFLICT** — *"the silence is the registry-entry removal rather than a second withdrawal"* — and the
2225
+ /// store-side half stays EXACTLY the store's own FIRST-MATCH withdrawal, which removes ONE home entry per
2226
+ /// call (`DD-42` clause (2)).
2227
+ function unlisten(instance, n, handle) {
1520
2228
  const state = stateOf(instance);
1521
- if (arguments.length < 2) return undefined;
2229
+ if (n < 1) return undefined;
1522
2230
  const encoded = encodeHandle(state, handle);
1523
2231
  if (encoded.k !== 'O') return undefined; // outside the domain: a no-op success, and the store is not reached
1524
2232
  call(state, 'unlisten', [encoded]);
1525
- // **The package's registry entry STANDS** (`§2.4` rule 4, `DD-15`): only the store-side home entry is
1526
- // withdrawn, so the withdrawn handle's function simply never fires again, and a later re-`listen` at the
1527
- // same address mints a DIFFERENT handle whose registration is a NEW entry.
2233
+ // **⟶ STEP 3 — THE DEREGISTRATION, TAKEN WHERE AND ONLY WHERE THE IDENTITY NO LONGER STANDS** — read
2234
+ // against the PACKAGE'S OWN HOME MIRROR rather than against a second store call, so the withdrawal's own
2235
+ // observable (ONE entry, the token's FIRST match, `DD-42` clause (2)) is the whole of what this call does
2236
+ // to the store:
2237
+ // * **THE ONE-ENTRY STATE** and the token's entries at NO OTHER address: this call withdrew the ONE entry
2238
+ // the identity named, **so the identity no longer stands anywhere** and the registry's entry is
2239
+ // REMOVED (`§2.4` item 7 (b) item 1, *"WITH NO QUALIFICATION"*; `§5.5`'s WITHDRAWN arm).
2240
+ // * **THE CALLER-SPELLED TWO-ADDRESS DUPLICATE** — the token named ONE entry at EACH of two addresses:
2241
+ // this call withdrew the ONE entry ITS OWN address held, **so THAT ADDRESS carries the identity no
2242
+ // more** and **the identity's registry entry is REMOVED**. A later trigger at the OTHER entry's address
2243
+ // still CARRIES the identity — the store's half, unmoved — **while the package invokes NOTHING for it,
2244
+ // which is rule 1's declared silence and not a second withdrawal** (`convenience.test.mjs`'s
2245
+ // `off_deregisters_…`; `ng_js_k`'s two-address arm).
2246
+ // * **THE CALLER-SPELLED ONE-ADDRESS DUPLICATE** — the token named MORE THAN ONE entry at the SAME
2247
+ // address (`DD-39`, `DD-42` clause (2)): this call withdrew ONE of them, the bucket's FIRST match,
2248
+ // **and the address STILL HOLDS the identity**, so **the registry's entry STANDS** and a later trigger
2249
+ // under that address STILL returns the identity WITH THE FUNCTION FIRING FOR IT — which is
2250
+ // `contract.md §5.5`'s THIRD added entry (*"the registry still fires that ONE identity ONCE, never once
2251
+ // per occurrence and never once per entry"*) and `§2.4` rule 4's own *"never the function"*.
2252
+ //
2253
+ // **⟶ AND THE ABSENCE ROUTE REMOVES THE REGISTRY ENTRY ONLY WHERE THE STORE GENUINELY WITHDREW THE
2254
+ // IDENTITY — CORRECTED 2026-10-17** (`§2.4` item 7 (b) item 1, *"WITH WITHDRAWAL"*, read with rules 1 and
2255
+ // 4 and item 7 (a) item 3's own *"leaves no store-side home entry"*). **THE DEFECT IT CLOSES, NAMED: the
2256
+ // shipped arm deleted the registry entry UNCONDITIONALLY whenever the token was absent from the mirror —
2257
+ // including for a call whose token the mirror never held at all (an identity the store holds nothing for),
2258
+ // where NOTHING was withdrawn and the registry is not this call's to touch.** **THE WITHDRAWAL IS NOW THE
2259
+ // PRECONDITION: the mirror held the token, and this call's own single-entry removal left no survivor
2260
+ // carrying it** — which is exactly the state in which *"the store has genuinely withdrawn the identity"*
2261
+ // is true, and it is the state the mirror can read because it holds one entry per store entry (see
2262
+ // `homeAddressKey` and `isLawfulListenerElement` above). **WHERE THE MIRROR HELD NOTHING, THIS CALL
2263
+ // REMOVES NOTHING AND THE REGISTRY STANDS**, which is the no-op success `§2.10` declares for a withdrawal
2264
+ // the store makes none of.
2265
+ const mirror = state.home.findIndex((entry) => entry.token === encoded.v);
2266
+ if (mirror === -1) return undefined;
2267
+ const key = state.home[mirror].key;
2268
+ state.home.splice(mirror, 1); // the store's own FIRST-match withdrawal, mirrored entry for entry
2269
+ if (state.home.some((entry) => entry.token === encoded.v && entry.key === key)) return undefined;
2270
+ state.registry.delete(handle);
1528
2271
  return undefined;
1529
2272
  }
1530
2273
 
@@ -1577,6 +2320,214 @@ function registerOn(state, handle, listener) {
1577
2320
  return undefined;
1578
2321
  }
1579
2322
 
2323
+ /// **THE ORDERING SEAM — `settle(record) -> undefined`** (`surface.md §2.4` item 9; `A116` (D1)–(D4);
2324
+ /// `PAR-JS-19`). The one member the kernel calls and the entry implements, taken at the two instants of a
2325
+ /// kernel-driven write, AND IT REACHES THE REGISTRY AND NOTHING ELSE: no store verb is called, no node is
2326
+ /// minted and no journal entry is appended.
2327
+ ///
2328
+ /// * **INSTANT (a) — BEFORE THE STORE'S WRITE VERB IS CALLED.** The identity's FIRST call on this instance
2329
+ /// IS ITS ADOPTION (`PAR-JS-19`'s own domain cell: *"the adoption happens AT the first call and is not
2330
+ /// required before it"*). The record identity is marked as a kernel-driven write in flight, which is
2331
+ /// what makes the write's own post-verb window (`write` above) deliver NOTHING: `§2.4` item 9's table
2332
+ /// row (a), *"WITHHOLDS the package's own delivery for it: the package's post-verb invocation reaches
2333
+ /// NO handle of that write, so its in-window invocation set is EMPTY"*.
2334
+ /// * **INSTANT (b) — AT THE PASS'S TERMINAL ARM.** The SECOND call for that identity IS the delivery: the
2335
+ /// residue standing in the record's `pending` at that instant is iterated through this instance's own
2336
+ /// registry, one invocation per handle, each carrying the TRIGGERING ADDRESS as its single argument
2337
+ /// (`§2.4` item 9's table row (b); `§2.7` items 5 and 7 (a)–(b)). **WHAT IT ITERATES IS THE RESIDUE AND
2338
+ /// NEVER `triggered`**: on a passing attempt the check-off has removed the evaluated pair's entry, and on
2339
+ /// a write that FAILED on constraints the DISCARD has emptied the member — so an empty residue is a
2340
+ /// no-op and not a failure (`§2.7` item 7 (c)–(d)).
2341
+ /// * **EVERY OTHER FORM AT THE RECORD POSITION THROWS THE REGISTRATION SITE'S OWN `TypeError`** — absent,
2342
+ /// `undefined`, `null`, a primitive, a `function`, a `Proxy`, and an identity this instance never
2343
+ /// adopted — **and CHANGES NOTHING** (`§2.4` item 9 (a)–(b); `PAR-JS-19`'s outside-value row).
2344
+ /// * **A RESIDUE HANDLE WITH NO REGISTERED FUNCTION IS A SILENT NO-OP** (`§2.4` rule 1 read at instant
2345
+ /// (b), item 9 (c)): no code, no warning, no log and no throw.
2346
+ function settleOn(state, record, supplied) {
2347
+ // **THE CLASS DECISION COMES FIRST, ON THE VALUE AS IT IS** (`§2.4` item 5 (a)'s order walk;
2348
+ // `crossing.md §1.7`): an absent argument, every non-object and every `Proxy` is refused before any
2349
+ // marker is read or set.
2350
+ if (!supplied || record === null || typeof record !== 'object' || types.isProxy(record)) {
2351
+ throw new TypeError(
2352
+ `settle's argument is ${classSpelling(record)}, and the ordering seam takes a record identity this instance adopted`,
2353
+ );
2354
+ }
2355
+ // **⟶ ONE WRITE, ONE ADOPTION, AND TWO IDENTITIES CARRY IT** (`§2.4` item 9's table rows (a) and (b);
2356
+ // `PAR-JS-19`: *"the adoption happens AT the first call, and the SECOND call for that identity is the
2357
+ // delivery"*). `K-2` builds its record BEFORE the write verb and hands that identity to the seam at
2358
+ // instant (a); **THE ENTRY'S OWN `write` MINTS THE RECORD IT RETURNS** (`PAR-JS-13`), and that is the
2359
+ // identity this instance puts in flight and whose `pending` member carries the residue the terminal arm
2360
+ // reads. The two calls are ONE identity apart: the arm calls `settle` with the identity it built, and
2361
+ // the ledger entry made at instant (a) carries the write's own record forward to it.
2362
+ //
2363
+ // **THE DOMAIN IS THE INSTANCE'S OWN MARKER AND NOTHING ELSE** (`§2.4` item 9 (a)–(b)): an object this
2364
+ // instance never adopted — *"another instance's record included"* — carries no `pending` member and no
2365
+ // ledger entry, and is refused here with the registration site's own `TypeError`; nothing is set for it.
2366
+ const pre = state.answered.has(record); // this identity is the one a write verb was ADOPTED for
2367
+ const written = pre ? state.answered.get(record) : null;
2368
+ // **AN IDENTITY WHOSE DELIVERY HAS ALREADY HAPPENED SETS NO MARKER** (`§2.4` item 9's two instants,
2369
+ // counted: THE FIRST CALL IS THE ADOPTION and THE SECOND IS THE DELIVERY — *"there is NO second
2370
+ // adoption"*, and no third instant is declared). **THE SECOND CALL REMOVES THE IDENTITY FROM `answered`
2371
+ // AND FROM `adopted`, so its next occurrence arrives with NO LEDGER ENTRY** — and were that occurrence
2372
+ // read as a FIRST call, it would ADOPT, leaving the marker `:1438`'s own deletion never reaches: a
2373
+ // KERNEL-DRIVEN WRITE PUT IN FLIGHT A SECOND TIME, whose window is withheld for a pass that never
2374
+ // comes. **SO A THIRD CALL IS A NO-OP AND CHANGES NOTHING**, which leaves the write that OWNS the
2375
+ // identity as the only act that consumes it, and NO IDENTITY STANDING ADOPTED ON THIS INSTANCE that no
2376
+ // write belongs to — the state the caller-made bare write below reads, which `§2.7` item 8 declares
2377
+ // *"does not move"* whatever stands on the instance (`§2.4` item 9 (e); `PAR-JS-19`).
2378
+ if (!pre && state.delivered.has(record)) {
2379
+ // **AND AN OCCURRENCE AFTER THE TWO DECLARED INSTANTS ENDS ANY IN-FLIGHT STATE STANDING FOR IT**:
2380
+ // a marker is put in flight only by an adoption, and this identity's adoption was consumed (or the
2381
+ // write that would have consumed it never arrived), so the marker this occurrence names is the stale
2382
+ // one the NEXT BARE CALLER-MADE WRITE would otherwise draw on (`§2.4` item 9 (e); `§2.7` item 8).
2383
+ // **NOTHING ELSE CHANGES** — no invocation, no ledger, no residue, and the member's return `undefined`.
2384
+ state.withheld.delete(record);
2385
+ return undefined;
2386
+ }
2387
+ if (!pre) {
2388
+ if (record.pending === undefined) {
2389
+ throw new TypeError(
2390
+ `settle's argument is ${classSpelling(record)}, and the ordering seam takes a record identity this instance adopted`,
2391
+ );
2392
+ }
2393
+ // INSTANT (a): the adoption. The ledger entry stands EMPTY until the verb answers, so the write that
2394
+ // drains it is the one write identity this adoption is for.
2395
+ state.adopted.add(record);
2396
+ state.answered.set(record, null);
2397
+ // **AND THE IDENTITY IS THE WRITE IN FLIGHT FROM THIS INSTANT** (`§2.4` item 9's table row (a):
2398
+ // *"ADOPTS that identity as a kernel-driven write in flight AND WITHHOLDS the package's own delivery
2399
+ // for it"*): the two structures above carry the LEDGER, and `withheld` is the WITHHOLD ITSELF — the
2400
+ // marker the write verb reads (`:1450`) to know that the delivery of THIS write is not made in its own
2401
+ // window. **BOTH HALVES OF INSTANT (a) ARE TAKEN AT THIS ONE SITE OR NEITHER IS**: without it the
2402
+ // write delivers in-window and the terminal arm's `settle` finds no marker to end. **IT IS SET HERE AND
2403
+ // NOT AT THE VERB, BECAUSE THE SEAM IS CALLED BEFORE THE VERB IS REACHED** (`A116` (D1)).
2404
+ state.withheld.add(record);
2405
+ return undefined;
2406
+ }
2407
+ // **⟶ THE TERMINAL ARM'S OWN ACT, 2026-10-15** (`surface.md §2.11` clause 2; `contract.md §7.2` item 2 as
2408
+ // amended): **on the PASSING arm of a `file`-tier write, the arm PERFORMS THE STORE'S `commit_file` AS
2409
+ // ITS FIRST ACT — BEFORE ANY BODY OF THE DELIVERED SET IS INVOKED** (clause 3 (ii): *"no body before the
2410
+ // save"*; the delivery's one invocation site is `deliver`, below). **Its key is THE SETTLED RECORD'S OWN
2411
+ // `op`** — *"the record the kernel settled carries the journal op that write returned, and that op is the
2412
+ // key this act reads"* — and it is the FIRST THING this arm does, so an arm whose pass FAILED drives no
2413
+ // save and no store call of the write's own at all (clause 1: the lift's scope is the passing arm alone).
2414
+ // **THE ARM IS READ OFF THE MARK THE KERNEL SETS ON ITS PASSING ARM AND OFF NOTHING ELSE**: a `file`-tier
2415
+ // write whose pass failed reaches this same instant, and the act is NOT ITS.
2416
+ //
2417
+ // **A FAILED SAVE IS ANSWERED HERE AND ITS THROW TRAVELS OUT OF THE ARM**: the STORE has already rolled
2418
+ // the write back (`§8.1` #15; clause 5: ROLLBACK FIRST, MESSAGE SECOND) and no body of the delivered set
2419
+ // is reached.
2420
+ //
2421
+ // **⟶ AND THE KERNEL'S OWN HALF OF THIS CELL IS TOLD, ON THE IDENTITY IT HOLDS, 2026-10-15** (`§2.11`
2422
+ // clause 5; `kernel-surface.md §2.1` items 3–5; `fail-surface.md §1.1` item 3): **THE SAVE IS A CONSTRAINT
2423
+ // EVALUATED LAST, AND THE PASS REPORTS ITS FAILURE AS IT REPORTS ANY OTHER** — so the failed save's own
2424
+ // log gains the `outcome` entry, the closed record is the terminal answer and the report carries the
2425
+ // rollback that happened. **THE FAILURE'S OWN CHANNEL IS NOT MOVED BY THIS MARK**: the store's verb
2426
+ // produced it, so its two-member form reaches the caller UNCHANGED (`§1.2` item 2) and NO `log` member and
2427
+ // NO THIRD MEMBER IS ADDED HERE. The mark carries THE VERY THROWABLE — one identity, not a copy — so the
2428
+ // kernel's own catch reads the arm and NOTHING ELSE, and a body of the delivered set that throws (which
2429
+ // this arm never reaches: the throw above leaves the arm first) is never mistaken for the save.
2430
+ if (
2431
+ record[SETTLED_ON_THE_PASSING_ARM] === true
2432
+ && written !== null
2433
+ && written.op !== null
2434
+ && written.op !== undefined
2435
+ && written.op.tier === 'file'
2436
+ ) {
2437
+ try {
2438
+ call(state, 'commitFile', [encodeOpId(written.op.opId)]);
2439
+ } catch (saveFailure) {
2440
+ record[SAVE_FAILED_AT_THE_TERMINAL_ARM] = saveFailure;
2441
+ throw saveFailure;
2442
+ }
2443
+ }
2444
+ // **THE RESIDUE IS READ OFF THE ADOPTED IDENTITY** (`§2.4` item 9 (b)): the write's own record and the
2445
+ // adopted one are ONE WRITE AND ONE RESIDUE — `K-2` fills the member it built from the very set its own
2446
+ // verb returned (`record.pending = written.triggered.slice()`), and it is THAT member the pass checks each
2447
+ // entry off in as it passes (`releasePending`), so the adopted identity is the record whose `pending`
2448
+ // holds the residue AT THIS INSTANT and the write's own record is the identity that was put in flight.
2449
+ // **A SECOND CALL FOR THAT IDENTITY IS THE DELIVERY, WHATEVER THE LEDGER ENTRY HOLDS** (`§2.4` item 9's
2450
+ // table row (b): *"the SECOND call for that identity IS the delivery"* — the ONE clause that decides
2451
+ // this instant; `PAR-JS-19`'s domain cell). **THE EARLY RETURN THIS SITE ONCE SHIPPED — `if
2452
+ // (state.answered.get(record) === null) return undefined;` — WAS A CONSTRUCTION-ORDER DISCRIMINATOR
2453
+ // AND NOT THE CLAUSE'S READING: it asked whether the write verb had answered YET, left the marker
2454
+ // standing, and reached this seam's SECOND call as a no-op.** **A CALLER THAT MADE INSTANT (a)'s CALL
2455
+ // ITSELF — an identity whose write never ran (`§2.4` item 9 (a): *"the RECORD POSITIONS … AND NEVER AN
2456
+ // IDENTITY'S ADOPTION HISTORY"*) — therefore left an adopted identity standing for a write no act
2457
+ // issued, and THE NEXT BARE CALLER-MADE WRITE DREW ON IT: that write's marker was consumed by an
2458
+ // identity that was not its own, its own post-verb window was withheld, and `§2.7` item 8's instant
2459
+ // MOVED for a write the kernel never issued.** **THE DECLARED READING OF THIS CALL IS THE DELIVERY OF
2460
+ // THE IDENTITY'S OWN RESIDUE — the member the RECORD carries at THIS instant** (`§2.4` item 9 (c):
2461
+ // *"A TERMINAL ARM WHOSE RESIDUE CARRIES NO REGISTERED FUNCTION IS A SILENT NO-OP … this member's
2462
+ // return still `undefined`"*) — **AND IT ENDS THE IN-FLIGHT STATE IT TOOK**: the ledger entry goes with
2463
+ // it, so the identity is left adopted by NO write.
2464
+ state.adopted.delete(record);
2465
+ // **AND THE IDENTITY LEAVES `withheld` HERE, WHATEVER THE LEDGER ENTRY HOLDS** (`§2.4` item 9's table
2466
+ // row (b): the delivery *"ends the in-flight state"*, and a second call reaching a write whose verb has
2467
+ // not answered ends it too). **A MARKER THIS CALL LEAVES STANDING IS THE ONE THE NEXT BARE CALLER-MADE
2468
+ // WRITE DRAWS ON** (`§2.4` item 9 (e); `§2.7` item 8) — its window withheld for an act the kernel never
2469
+ // issued — and the identity that marker was taken for is the one this call names.
2470
+ state.withheld.delete(record);
2471
+ // INSTANT (b): the identity leaves the in-flight set and the residue it carries is delivered.
2472
+ state.answered.delete(record);
2473
+ state.withheld.delete(written);
2474
+ // **AND AN IDENTITY'S DELIVERY IS COUNTED WHERE IT HAPPENS, SO THE OCCURRENCES AFTER IT ARE READ AS
2475
+ // NEITHER AN ADOPTION NOR A DELIVERY** (`§2.4` item 9: THE FIRST CALL IS THE ADOPTION AND THE SECOND IS
2476
+ // THE DELIVERY — *"there is NO second adoption"*). **AN EMPTY RESIDUE MARKS NOTHING** (`ck_neg_dm_07_*`
2477
+ // route (i): a caller's first call takes an identity whose `pending` is empty, and its LATER call is
2478
+ // still the delivery that ends it, carrying nothing): the mark is taken by the write's own consumption
2479
+ // of its adoption below (`:1456`), which is the one place both the adopted identity and THE IDENTITY THE
2480
+ // WRITE RETURNED are in hand.
2481
+ // THE DELIVERY THIS CALL MAKES IS STILL THE CLAUSE'S DELIVERY WHATEVER THE LEDGER ENTRY HOLDS.
2482
+ // **THE RESIDUE IS THE MEMBER'S OWN VALUE AT THIS INSTANT** (`§2.7` item 7 (a): *"the handle set that
2483
+ // stands in `CommitRecord.pending` at that instant"*), and each member is the SAME opaque identity this
2484
+ // instance wraps its token as (`§2.3` item 1: handle identity is token equality alone; `§2.4` item 6
2485
+ // (b): the registry's lookup is by THAT identity and by nothing else). **A MEMBER THIS INSTANCE HOLDS
2486
+ // NO HANDLE FOR — the identity a FOREIGN instance minted — is not a member of this registry's key set
2487
+ // and fires nothing silently** (`§2.4` rule 1): this seam writes no entry and mints no identity, so
2488
+ // such a member is passed to `deliver` as it stands and matches no function there.
2489
+ const triggered = Array.isArray(record.pending) ? record.pending.slice() : [];
2490
+ // **⟶ AND BESIDE THE RESIDUE, THE IDENTITIES THE PASS CHECKED OFF WHOSE OWED FIRING STANDS**
2491
+ // (`docs/decisions.md` · `A117` (D5); `surface.md §2.7` item 7's keying of 2026-10-15 and its sub-item
2492
+ // (a)). **THE CHECK-OFF CONSUMES THE EVALUATED PAIR'S OWN DELIVERY OF THAT IDENTITY, NOT THAT
2493
+ // IDENTITY'S WHOLE OWED DELIVERY**: the carrier has ONE entry per address, and the entry's own owed
2494
+ // firings are not counted in `pending` — they are counted where the owed firings live, THIS REGISTRY.
2495
+ // So an identity whose pair the pass evaluated and checked off is NOT an identity with no owed firing,
2496
+ // and where this registry still holds a function for it the terminal arm delivers it ONCE, exactly as
2497
+ // the residue's own members are delivered (`§2.7` item 6 — the other listeners are reached ONCE every
2498
+ // constraint has passed — read with `§2.4` item 8 (c) AS CORRECTED 2026-10-15: *"the app's registration
2499
+ // at a pair-adopted address IS OWED ITS FIRING AFTER THE PASS"*).
2500
+ //
2501
+ // **THIS IS NOT A SECOND CHANNEL**: the resolution is the SAME ONE the residue is delivered by — this
2502
+ // registry's lookup by the identity alone — and it is the resolution that DECIDES the arm, so an
2503
+ // identity the registry holds no function for fires NOTHING SILENTLY, exactly as a residue member with
2504
+ // no function does (`§2.4` rule 1; item 9 (c)). **NO MEMBER IS ADDED ANYWHERE** (`A117` (D6)): the
2505
+ // finding is the kernel's own, carried on the record under a SYMBOL key, and `record.pending` — the
2506
+ // member the residue's own assertions read — stands EXACTLY as the check-off left it (the returned set
2507
+ // minus the checked-off entries and minus nothing else). **AND ON A FAILING WRITE NOTHING IS
2508
+ // DELIVERED**: the kernel publishes no such list on that arm, and its residue stands empty by the
2509
+ // discard (`§2.7` item 7 (d); `A114` (D1)/(D2)).
2510
+ const checkedOff = record[CHECKED_OFF];
2511
+ if (Array.isArray(checkedOff)) {
2512
+ for (const handle of checkedOff) {
2513
+ if (!triggered.includes(handle)) triggered.push(handle);
2514
+ }
2515
+ }
2516
+ // **THE INVOCATION'S ONE ARGUMENT IS THE TRIGGERING ADDRESS** (`§2.7` item 5): the address the
2517
+ // trigger's own op landed at, read off the op the record carries — the OP's address and never the
2518
+ // registration's watch address (`kernel-surface.md §2.1` item 2 (ii)).
2519
+ // **A SECOND CALL ARRIVING BEFORE THE WRITE VERB HAS ANSWERED CARRIES NO OP, AND ITS ADDRESS IS
2520
+ // `undefined` BESIDE IT** (`written` is the ledger entry and it stands EMPTY at instant (a)): the record
2521
+ // carries no op yet, and `§2.7` item 5's argument is the OP's own address or nothing.
2522
+ const triggeringAddress = written === null || written.op === null || written.op === undefined
2523
+ ? undefined
2524
+ : written.op.address;
2525
+ // `deliver` is THE SAME loop the post-verb window uses (`§2.4` rules 1–3 read once, at both instants):
2526
+ // ONE invocation per DISTINCT handle, and a handle with no registered function fires nothing silently.
2527
+ deliver(state, triggered, triggeringAddress);
2528
+ return undefined;
2529
+ }
2530
+
1580
2531
  // ---------------------------------------------------------------------------------------------
1581
2532
  // THE TWO NEW INSTANCE MEMBERS — `surface.md §2.4` ITEM 7, READ AT ITS OWN BYTES, AND `§2.1`'s DATED
1582
2533
  // CLAUSE (a): `on(address, listener) -> handle` AND `off(handle) -> undefined`, BESIDE `register`.
@@ -1596,254 +2547,260 @@ function registerOn(state, handle, listener) {
1596
2547
  // and contract directory untouched (`§2.1`'s dated clause (c); `A68`).
1597
2548
  // ---------------------------------------------------------------------------------------------
1598
2549
 
1599
- /// **THE ARGUMENT POSITION, AT THESE TWO SITES** — `parameter-semantics.md §2.17`'s dated clause: *"the
1600
- /// POSITION IS CARRIED BESIDE IT AS THE ARGUMENT POSITION: `1` OF `2` for an `address` or a `handle`, `2` OF
1601
- /// `2` for a `listener`"*, inside `docs/specs/storeroom-js/surface.md §2.5` item 5 (b)'s generated message
1602
- /// and NEVER as a third member. **The spelling is the two positions' own, named as the `register` site
1603
- /// already names its pair** (`§2.12`'s re-derived row carries the same two positions).
2550
+ /// **THE `on`/`off` ROUTE IS MERGED AWAY — `A127` (2026-10-16).** The combined `on(address, listener)`
2551
+ /// and the package-owned withdrawal `off(handle)`, together with their argument walks
2552
+ /// (`validateOnAddress`, `validateOnArguments`), their two step lists and `deregister`, are REMOVED FROM
2553
+ /// THIS FILE at that dated clause: the product's declared member set is the TWELVE `10 + 1 + 1 = 12` ✓.
2554
+ /// **THE LISTENER REGISTRATION ROUTE IS REACHED AS ITS TWO DECLARED HALVES** — `a.listen(address)` and
2555
+ /// `a.register(handle, listener)` — and withdrawal as `a.unlisten(handle)`. **NOTHING OF THE STORE'S OWN
2556
+ /// `listen`/`unlisten` MOVES** (`§2.10`: same names, same positions, same arity, same returns, and rule 4
2557
+ /// verbatim), and the ONE observable the removed route alone owned — `AddressMalformed` for an outside
2558
+ /// `handle` at `off`'s position — is declared away with it: `unlisten`'s own answer over an outside value
2559
+ /// stays the NO-OP SUCCESS `§2.3` item 4 / `PAR-JS-8` declares.
2560
+
2561
+ // ═══════════════════════════════════════════════════════════════════════════════════════════════════════
2562
+ // THE POST-CREATION CONSTRAINT SET — `surface.md §2.12` items 1–5, `A126` (2026-10-16), AND ITS TWO ROUTES
2563
+ // ═══════════════════════════════════════════════════════════════════════════════════════════════════════
2564
+ //
2565
+ // **TWO ROUTES POPULATE THE SET AND NEITHER SUBSTITUTES FOR THE OTHER**: the BATCH, which `storeCreate`
2566
+ // registers at `K-1` as it constructs (clause (b) above), and the ADD route's own argument. **THE ENTRY
2567
+ // CARRIES A PAIR IF AND ONLY IF A FUNCTION STANDS REGISTERED AT THAT PAIR IN THE KERNEL'S OWN PAIR-KEYED
2568
+ // REGISTRY** — so `state.constraints` is that registry's record and the ONE act both routes reach is
2569
+ // `carryConstraint` below. **NOTHING OF `§2.6` SURVIVES THE MOVEOUT**: the engine is behind this surface,
2570
+ // the constraint and repair limbs are the kernel's, and this file owns only the form of what crosses.
2571
+
2572
+ /// `parameter-semantics.md §2.17`'s dated clause, at this section's own sites: the two positions' own
2573
+ /// spelling, **read at the method's own arity — `pair` at `1` of `2` and `constraint` at `2` of `2`**, since
2574
+ /// the LEADING `instance` POSITION IS DROPPED by `§2.4` item 9 (f)'s `A127` clause (the receiver is not a
2575
+ /// position of any declared signature; `§2.12` item 3's one-spelling rule).
1604
2576
  const ARGUMENT_POSITION_FIRST = 'first argument';
1605
2577
  const ARGUMENT_POSITION_SECOND = 'second argument';
1606
2578
 
1607
- /// **`crossing.md §1.3`'s `AddressArg` domain AT ITS OWN ROWS 7–10 AND 14, DECIDED AT THE BOUNDARY FOR `on`
1608
- /// ALONE — `A81`'s *"always validate"*, VERBATIM** (`parameter-semantics.md §2.17`'s dated clause: *"An
1609
- /// `address` outside `AddressArg`'s domain at `on`'s position `1` of `2` → `AddressMalformed`"*).
1610
- ///
1611
- /// **WHY THIS WALK EXISTS, AND WHY IT IS NOT `DD-46`'s PRE-CHECK:** **`DD-46` is a declaration about the
1612
- /// DECLARED VERBS of `§2.2` and `§2.10`, whose arguments are passed through to the store's own carrier
1613
- /// so the STORE chooses which refusal answers** — and this walk is not taken on any of their paths.
1614
- /// **The listener home is the ONE store surface where that division fails: `listen` keeps the address's
1615
- /// segments as the caller spelled them, so an out-of-domain segment reaches the home's key without the
1616
- /// `L-1` walk ever running over it — measured, not assumed** (`bindings/js/test/convenience.test.mjs`'s
1617
- /// second cell drives the rows below through `on`). **`§2.4` item 7 (a) step 1 makes `on` the site that owns
1618
- /// this validation, so `on` decides the four rows the carrier cannot.**
1619
- ///
1620
- /// **THE ROWS DECIDED, EACH NAMED AT ITS OWN `AddressArg` ROW** — row 7: an array holding a NEGATIVE
1621
- /// integer · row 8: an array holding a NON-INTEGER number (`1.5`, `NaN`, `Infinity`) · row 9: an array
1622
- /// holding `null`/`undefined` · row 10: an array holding an object (and, by the same clause's own reading of
1623
- /// `§1.2`'s classes, an array, a `function`, a `symbol` or a `bigint`) · row 14: a sparse array. **AND ROW
1624
- /// 6's SHAPE HALF IS DECIDED FIRST AND BESIDE THEM: a non-array IS `AddressMalformed`, and `'a.b'` is not a
1625
- /// delimited address** — `classSpelling` names each class the value HAS (`§1.8`'s no-repair prohibition: no
1626
- /// value here is converted, defaulted or substituted). **EACH REFUSAL IS THE ONE FORM, with the failing
1627
- /// TARGET printed as its own value, the CLASS that failed and the ARGUMENT POSITION** (`§2.5` items 5 (a)
1628
- /// and (b); `§2.17`'s dated clause) — **and NOTHING HERE IS A SECOND STATUS, A THIRD MEMBER OR A RAW HOST
1629
- /// ERROR.**
1630
- ///
1631
- /// **AND NOTHING IS LEFT BEHIND:** this walk performs NO store call and NO registry write, so it runs at
1632
- /// step 1 and leaves no home entry, no registry entry, no node and no journal entry.
1633
- ///
1634
- /// **⟶ AND THE PROXY DECISION IS TAKEN FIRST, IN `encodeAddress`'S OWN ORDER — `C-1` OF THE GATE-4
1635
- /// ADVERSARIAL PASS, THE STOP-GRADE FINDING, CLOSED AT THIS SITE (2026-10-11).** The walk's first statement
1636
- /// was `isAdmittedArray(address)`, which reads `Array.isArray` and then `arrayClass`'s
1637
- /// `Object.getPrototypeOf` — **so a trap-carrying `Proxy` over an array RAN ITS TRAPS BEFORE ANY DECISION
1638
- /// WAS TAKEN**: a `getPrototypeOf` trap that throws raised a RAW HOST ERROR out of `on` (against
1639
- /// `§2.5` item 5 (e): *"a rejection is NEVER A RAW HOST ERROR"*), a `get` trap's side effects ran, and a
1640
- /// re-entrant verb could be invoked from inside the walk — for an argument the contract refuses as
1641
- /// `AddressArg` row 12 (`DD-34`) without reading it at all. **`encodeAddress` at `:609` already took this
1642
- /// decision first, in its own words** (*"A `Proxy` is refused BEFORE the array shape test and before any
1643
- /// element is read"*), **and this function now does the same, in the same order, with the same refusal.**
1644
- /// **NO TRAP RUNS ON ANY PATH: the shape test, the prototype read that follows it, the `.length` read, every
1645
- /// element read and the listener-position check are each reached only for a value `types.isProxy` has
1646
- /// already answered about — and `util.types.isProxy` reads no member and invokes no handler.** The refusal
1647
- /// is `AddressArg` row 12's own `AddressMalformed`, carried and never minted (`DD-40`).
1648
- function validateOnAddress(address) {
1649
- if (types.isProxy(address)) {
1650
- // `AddressArg` row 12 (`DD-34`): the CLASS decision first, before the shape test and before any read —
1651
- // the order `encodeAddress` takes at the same position.
1652
- boundaryReject(
1653
- 'AddressMalformed',
1654
- targetSpelling(address),
1655
- `the address at the ${ARGUMENT_POSITION_FIRST} of \`on\` is ${classSpelling(address)}, and an address is an array of segments`,
1656
- );
2579
+ /// **THE KERNEL, RESOLVED ON THE FIRST CONSTRAINT ACT AND NEVER AT LOAD** (`kernel-surface.md §1` item 1;
2580
+ /// `A121`, `A122`). **IT IS NOT AN EXPORT AND NOT A SUBPATH**: the module is reached as a FILE, at the path
2581
+ /// the allowlist publishes it at. **AND THE RESOLUTION IS LAZY ON PURPOSE**: the entry must still LOAD where
2582
+ /// nothing is staged beside it — the publish and negative drives assemble trees carrying `index.mjs` alone
2583
+ /// — and a load-time import of `./src/` would make every one of those trees unable to reach the artefact
2584
+ /// they were built to drive. A drive that never carries and never asks for a constraint reaches no byte of
2585
+ /// the kernel.
2586
+ let KERNEL = null;
2587
+ function constraintsKernel() {
2588
+ if (KERNEL === null) KERNEL = require_('./src/constraint-kernel.mjs');
2589
+ return KERNEL;
2590
+ }
2591
+
2592
+ /// `fail-surface.md §2` / `kernel-surface.md §2.2`'s `KC-1`…`KC-8`, read HERE for their ONE use: to tell a
2593
+ /// refusal the KERNEL raised from one a STORE VERB raised, so that `A120` (2) can be applied to the first
2594
+ /// and not to the second. **NO `KC` SPELLING CROSSES THIS SURFACE** (`§2.12` item 1's read-through clause:
2595
+ /// printed here it would be a second, unowned home for the kernel's own vocabulary).
2596
+ const KC_TOKENS = ['KC-1', 'KC-2', 'KC-3', 'KC-4', 'KC-5', 'KC-6', 'KC-7', 'KC-8'];
2597
+
2598
+ /// THE PAIR'S OWN KEY — `(address, id)`, the key the kernel's registry is keyed by (`kernel-surface.md §2.2`
2599
+ /// item 4). The address half is JSON's own spelling of the segment array, which is TOTAL over every address
2600
+ /// the pair's domain admits and collides across no two of them.
2601
+ function constraintPairKey(address, id) {
2602
+ return `${JSON.stringify(address)}\u0000${id}`;
2603
+ }
2604
+
2605
+ /// **THE ONE REFUSAL `§2.12` ITEM 4 DECLARES, TAKEN BEFORE ANY ACT AND LEAVING NOTHING CHANGED** — a JS
2606
+ /// `TypeError`, its `status` member ABSENT, no `message` member of this unit's own, **the store's closed
2607
+ /// `16`-member set neither minted nor widened, and the store reached by no call this refusal makes.**
2608
+ function constraintRefuse(where, value) {
2609
+ throw new TypeError(
2610
+ `the ${where} of this call is ${classSpelling(value)}, and it is not a value this position's domain `
2611
+ + 'admits',
2612
+ );
2613
+ }
2614
+
2615
+ /// **A POSITION BELOW THE DECLARED ONE — `§2.12` item 4 AND `§2.4` item 9 (f)'s RULE (ii): a SHORT ARITY
2616
+ /// TAKES THE SAME ONE `TypeError` AND CHANGES NOTHING.** *"No assertion is made over `message`, and its
2617
+ /// absence is the declared reading"* — the member is not one of the three this form is observed by.
2618
+ function constraintArity(verb) {
2619
+ throw new TypeError(`\`${verb}\` declares two positions, and this call supplied fewer`);
2620
+ }
2621
+
2622
+ /// **`§2.12` ITEM 4'S TWO CALLER POSITIONS, CLASS FIRST AND IN THEIR DECLARED ORDER** (`PAR-JS-22`–`PAR-JS-24`)
2623
+ /// — **the receiver, which was item 4's first position, is DROPPED and is judged by the CALL and no longer by
2624
+ /// a walk** (`§2.4` item 9 (f)'s `A127` clause): a member reached through the product IS a product of this
2625
+ /// factory, so no instance-domain arm stands here. **NOTHING BELOW RUNS UNLESS BOTH POSITIONS HAVE PASSED**
2626
+ /// (`A81`), so a refused call performs no store call, no registry write and no `K-1` — atomicity by the
2627
+ /// validation's POSITION.
2628
+ function constraintSite(verb, instance, supplied, pair, constraint) {
2629
+ if (supplied < 2) constraintArity(verb);
2630
+ const state = INSTANCES.get(instance);
2631
+ if (!isPlainObjectValue(pair)
2632
+ || !Object.hasOwn(pair, 'address')
2633
+ || pair.address === undefined) {
2634
+ constraintRefuse(`pair at the ${ARGUMENT_POSITION_FIRST} of \`${verb}\``, pair);
1657
2635
  }
1658
- if (!isAdmittedArray(address)) {
1659
- // `AddressArg` row 6 (a non-array, its five named classes), row 11 (a class extending `Array`), row 12
1660
- // (a `Proxy`) and rows 4–5 (`undefined`/`null`, whose own class spelling is the target's).
1661
- boundaryReject(
1662
- 'AddressMalformed', // `AddressArg` rows 4–6's own declared code, carried and never minted (`DD-40`)
1663
- targetSpelling(address),
1664
- `the address at the ${ARGUMENT_POSITION_FIRST} of \`on\` is ${classSpelling(address)}, and an address is an array of segments`,
1665
- );
2636
+ const encoded = constraintAddress(pair.address);
2637
+ if (typeof encoded === 'string'
2638
+ || !Object.hasOwn(pair, 'id')
2639
+ || pair.id === undefined
2640
+ || typeof pair.id !== 'string'
2641
+ || pair.id === '') {
2642
+ constraintRefuse(`pair at the ${ARGUMENT_POSITION_FIRST} of \`${verb}\``, pair);
1666
2643
  }
1667
- for (let i = 0; i < address.length; i += 1) {
1668
- // Row 14 (`DD-8`): a HOLE refuses the WHOLE value — and `isAdmittedArray` has already decided the
1669
- // CLASS, so `in` below reads an element of a genuine array and no chain.
1670
- if (!(i in address)) {
1671
- boundaryReject(
1672
- 'AddressMalformed',
1673
- 'an array with a hole',
1674
- `the address at the ${ARGUMENT_POSITION_FIRST} of \`on\` is a sparse array, and an address is a dense array of segments`,
1675
- );
1676
- }
1677
- const segment = address[i];
1678
- // Rows 2–3: the two IN-DOMAIN classes — a string (the empty string included) and a non-negative
1679
- // integer. **The integer test is taken on the value as it is and nothing is repaired**: `1.5`, `-1`,
1680
- // `NaN` and `Infinity` are each refused as `a number`, which is the class the value HAS.
1681
- //
1682
- // **⟶ AND THE TWO CLASSES THIS PASS ADDED ARE DECIDED HERE TOO, BEFORE THE STORE IS REACHED — `C-4`'s
1683
- // segment half and `C-12` (`2026-10-11`).** They are the same two decisions `encodeSegment` takes for
1684
- // the other verbs' addresses, taken at this site's own position and with this site's own ARGUMENT
1685
- // POSITION spelling, **so `on` and `listen` answer one address the same way and neither reaches the
1686
- // carrier with a value it cannot spell**: a LONE SURROGATE in a string segment (row 1's dated clause —
1687
- // the class has no Rust spelling and is refused *"at the PACKAGE's own edge, BEFORE any verb is
1688
- // called"*, never repaired), and an INTEGRAL segment above the `u64` the carrier's `Index` variant
1689
- // carries (`package.md §4.5` item 2's `JsSegment` row) — **which the facade's `n as u64` used to
1690
- // SATURATE, folding `2**64` and `1e30` onto one store address and one handle (`C-12`).**
1691
- if (typeof segment === 'string') {
1692
- if (hasLoneSurrogate(segment)) {
1693
- boundaryReject(
1694
- 'ValueNotAdmitted', // row 1's dated clause's own answer, carried and never minted (`DD-40`)
1695
- // **THE TARGET IS THE SEGMENT POSITION'S OWN NAME AND NOT THE STRING**: a lone surrogate cannot
1696
- // cross into the generator either — its bytes are not a `String` — so the failing TARGET is named
1697
- // as `encodeSegment` names it at the same class (`'address'`), and the failing segment is named by
1698
- // its INDEX beside it. **The class half is mandatory and it is carried; the failing VALUE is not
1699
- // printed, because the only spellings for it are the caller's own unrepresentable code unit or a
1700
- // REPAIR of it, and `§1.8` forbids the repair.**
1701
- 'address',
1702
- `the segment at index ${i} of the address at the ${ARGUMENT_POSITION_FIRST} of \`on\` is a string carrying a lone surrogate, and a segment is a string or a non-negative integer`,
1703
- );
1704
- }
1705
- continue;
1706
- }
1707
- if (typeof segment === 'number' && Number.isInteger(segment) && segment >= 0) {
1708
- if (!Number.isSafeInteger(segment)) {
1709
- boundaryReject(
1710
- 'AddressMalformed', // `AddressArg` row 8's own declared code, carried and never minted (`DD-40`)
1711
- targetSpelling(segment),
1712
- `the segment at index ${i} of the address at the ${ARGUMENT_POSITION_FIRST} of \`on\` is an integral segment above the carrier's own range, and a segment is a string or a non-negative integer a \`u64\` can carry exactly`,
1713
- );
1714
- }
1715
- continue;
1716
- }
1717
- // Rows 7–10 + `§1.2`'s class set: every other class is refused AT THE BOUNDARY, inside the one form,
1718
- // naming the failing SEGMENT — the target the item's own clause names — its class and the position.
1719
- boundaryReject(
1720
- 'AddressMalformed',
1721
- targetSpelling(segment),
1722
- `the segment at index ${i} of the address at the ${ARGUMENT_POSITION_FIRST} of \`on\` is ${classSpelling(segment)}, and a segment is a string or a non-negative integer`,
1723
- );
2644
+ if (typeof constraint !== 'function') {
2645
+ constraintRefuse(`constraint at the ${ARGUMENT_POSITION_SECOND} of \`${verb}\``, constraint);
1724
2646
  }
1725
- return undefined;
2647
+ return { state, address: encoded.s, id: pair.id };
1726
2648
  }
1727
2649
 
1728
- /// **`on`'s STEP 1, WHOLE: VALIDATE THE `address` THEN THE `listener`, CLASS FIRST AND NOTHING REPAIRED**
1729
- /// (`surface.md §2.4` item 7 (a); `A81` *"always validate"*, verbatim; `crossing.md §1.7`'s order — class,
1730
- /// then shape, then admit-or-refuse). **EACH REFUSAL IS `AddressMalformed` IN `§2.5`'s SINGLE FORM, carrying
1731
- /// the failing TARGET, the CLASS the value HAS and the ARGUMENT POSITION** (`§2.17`'s dated clause, whose
1732
- /// class set is EXHAUSTIVE AND CLOSED and whose two new arms are a non-function at `2` of `2` and an
1733
- /// `address` outside `AddressArg` at `1` of `2`).
1734
- ///
1735
- /// **AND NOTHING IS LEFT BEHIND** (`§2.4` item 7 (a)): this function performs NO store call and no registry
1736
- /// write, so a refusal here leaves NO STORE-SIDE HOME ENTRY, NO REGISTRY ENTRY, NO NODE MINTED AND NO
1737
- /// JOURNAL ENTRY APPENDED — **atomicity by the validation's POSITION and not by a rollback.**
1738
- function validateOnArguments(address, listener) {
1739
- validateOnAddress(address);
1740
- if (typeof listener !== 'function') {
1741
- boundaryReject(
1742
- 'AddressMalformed',
1743
- targetSpelling(listener),
1744
- `the listener at the ${ARGUMENT_POSITION_SECOND} of \`on\` is ${classSpelling(listener)}, and a listener is a JS function`,
1745
- );
2650
+ /// **THE ONE ACT THAT MAKES A PAIR A PAIR THE ENTRY CARRIES** (`§2.12` item 1's preamble clause (a)–(b)):
2651
+ /// `K-1` AT THE INSTANCE — the key at its own positions and the caller's function at the fourth, which is
2652
+ /// the SAME call `storeCreate`'s batch registration makes — and THE ENTRY'S OWN RECORD BESIDE IT, whose
2653
+ /// `enabled` member is the pair's state and whose `identity` is THE PAIR'S OWN OPAQUE VALUE (`PAR-JS-25`).
2654
+ /// **THE IDENTITY IS MINTED ONCE PER PAIR AND IT CARRIES NO READABLE MEMBER**: a second ADD at the same pair
2655
+ /// overwrites the element and answers THIS SAME VALUE, and two pairs answer two values. **`PAR-JS-25`'s
2656
+ /// opacity is the observable** — *"it has no own enumerable member at all"* — so it is a null-prototype
2657
+ /// object and NOT the entry record: every datum above stays the entry's own and never crosses.
2658
+ function carryConstraint(state, instance, address, id, constraint) {
2659
+ constraintsKernel().register(instance, address, id, constraint);
2660
+ const entry = {
2661
+ address,
2662
+ addressKey: JSON.stringify(address),
2663
+ id,
2664
+ fn: constraint,
2665
+ enabled: true,
2666
+ identity: Object.create(null),
2667
+ };
2668
+ state.constraints.set(constraintPairKey(address, id), entry);
2669
+ return entry;
2670
+ }
2671
+
2672
+ /// **THE DISABLED PAIR'S STANDING ELEMENT** — a function that PASSES (`kernel-surface.md §2.3` item 1:
2673
+ /// `true` is the only pass value). **THE ELEMENT IS PARKED AND NEVER WITHDRAWN**: `constraintOn` re-registers
2674
+ /// `entry.fn`, so *"it is the element the entry carried at that pair — never a second constraint and never a
2675
+ /// re-registration"* (`§2.12` item 3's `constraintOn` row).
2676
+ function constraintParked() {
2677
+ return true;
2678
+ }
2679
+
2680
+ /// **A WELL-FORMED PAIR THE ENTRY DOES NOT CARRY — `§2.12` item 3's second answered question and
2681
+ /// `PAR-JS-24`'s second declared answer: at EITHER toggle, in EITHER direction, an OUTSIDE VALUE taking
2682
+ /// item 4's refusal, ONE THROWN `TypeError`, THE ENTRY NOT WIDENED.** It is NOT a third population route:
2683
+ /// were the entry widened with the function the refused call carried, a pair would stand ENABLED WITH NO
2684
+ /// FUNCTION — a state no clause of that directory declares.
2685
+ function constraintUncarried(verb, pair) {
2686
+ throw new TypeError(
2687
+ `the pair at the ${ARGUMENT_POSITION_FIRST} of \`${verb}\` carries no constraint in this instance, and `
2688
+ + 'a toggle names a pair the entry carries',
2689
+ );
2690
+ }
2691
+
2692
+ /**
2693
+ * **`§2.12` ITEM 2 (a): `addConstraint(pair, constraint) -> constraint identity` — THE ADD ROUTE, WHICH
2694
+ * CARRIES THE FUNCTION.**
2695
+ *
2696
+ * **ITS TARGET STATE AT THE PAIR IS *"the pair's element IS the supplied `constraint`, whether the pair was
2697
+ * HELD or NOT"*, AND THE HELD ARM IS AN OVERWRITE AND NOT A THROW**: *"where the pair was already held, the
2698
+ * supplied constraint OVERWRITES the held one … and the call REFUSES NOTHING and THROWS NOTHING for the mere
2699
+ * fact that the pair was held"* — the SAME identity the pair was already added under is returned, and it is
2700
+ * THE IDENTITY AND NOT THE ENTRY RECORD (`PAR-JS-25`'s opacity, `carryConstraint` above).
2701
+ */
2702
+ function addConstraint(instance, n, pair, constraint) {
2703
+ const site = constraintSite('addConstraint', instance, n, pair, constraint);
2704
+ const key = constraintPairKey(site.address, site.id);
2705
+ const held = site.state.constraints.get(key);
2706
+ if (held === undefined) {
2707
+ return carryConstraint(site.state, instance, site.address, site.id, constraint).identity;
1746
2708
  }
2709
+ constraintsKernel().register(instance, site.address, site.id, constraint);
2710
+ held.fn = constraint;
2711
+ held.enabled = true;
2712
+ return held.identity;
1747
2713
  }
1748
2714
 
1749
- /// **`on(address, listener) -> handle`** — `surface.md §2.4` item 7 (a), ITS THREE STEPS IN THEIR ONE FIXED
1750
- /// ORDER, AND NO FOURTH:
1751
- /// ```
1752
- /// 1. VALIDATE this file's own step, above: the address, then the listener, class first, never repaired
1753
- /// 2. LISTEN the store's own listen(instance, address) — the SAME declared verb, unchanged
1754
- /// 3. REGISTER the package's registry takes the returned handle with this listener (rule 2 = replacement)
1755
- /// ```
1756
- /// **THE RETURN IS THE HANDLE** in `§2.3` item 2's ONE output spelling — the package's opaque value and
1757
- /// never the token string. **AND AT AN ADDRESS THE STORE'S HOME ALREADY HOLDS IT RETURNS THAT ADDRESS'S
1758
- /// EXISTING HANDLE**, because the store's own address-level idempotence makes a repeat `listen` mint
1759
- /// nothing and answer the entry's own handle (`write-and-read.md §6.5` item 12 (c); `§2.3`'s dated clause).
1760
- /// **THE TWO ARMS ARE THEREFORE THESE AND NO OTHERS:** the FRESH arm, where the store minted a token and
1761
- /// the package wrapped it, and the HELD arm, where the SAME opaque value is answered again and the
1762
- /// registry's function for it becomes THIS listener — **a REPLACEMENT, never a second entry and never a
1763
- /// fan-out** (`§2.4` rule 2), and **including over an entry `register` placed, which `DD-52` settles: the
1764
- /// registry does not record which member wrote an entry.** **SO A LATER WRITE UNDER THAT ADDRESS INVOKES
1765
- /// THIS FUNCTION ONCE AND THE REPLACED ONE NEVER FIRES AGAIN** — and *which* listener fires and *when* is
1766
- /// the STORE's rule, derived from `write-and-read.md §6.5` item 14 and never stated here.
1767
- function onAt(state, instance, address, listener) {
1768
- // STEP 1 — VALIDATE. Nothing below runs unless BOTH arguments have passed (`A81`; `A76`).
1769
- validateOnArguments(address, listener);
1770
- // STEP 2 — LISTEN. The store's own verb, reached with the address the caller supplied and through this
1771
- // package's ONE declared `listen` spelling (`§2.10`): same name, same position, same arity, same return.
1772
- const handle = listen(instance, address);
1773
- // STEP 3 — REGISTER. `§2.4` rule 2 at the registry that holds the function: ONE identity, ONE function.
1774
- state.registry.set(handle, listener);
1775
- return handle;
1776
- }
1777
-
1778
- /// **`off(handle) -> undefined`** — `surface.md §2.4` item 7 (b), ITS THREE STEPS IN THEIR ONE FIXED ORDER,
1779
- /// AND `DD-54`'s ONE OBSERVABLE: **after any `off` that throws, BOTH the store-side entry and the registry
1780
- /// entry are exactly as they were.**
1781
- /// ```
1782
- /// 1. VALIDATE the handle against THIS INSTANCE's own handle domain, class first, never repaired
1783
- /// 2. UNLISTEN the store's own unlisten(instance, handle) — the same declared verb, unchanged
1784
- /// 3. DEREGISTER the package's own registry entry for that identity, and NOTHING ELSE
1785
- /// ```
1786
- /// **AND ITS THREE ARMS, EACH WITH ITS OBSERVABLE** (item 7 (b)'s own table):
1787
- /// * **THE OWN ARM** — an in-domain identity the registry holds a function for: the store-side home entry
1788
- /// is withdrawn, the registry's entry for that identity is REMOVED, and `undefined` is returned.
1789
- /// * **THE OWN-ENTRYLESS ARM** — an in-domain identity the registry holds NO function for (registered
1790
- /// never, or already withdrawn): `undefined`, the store-side withdrawal IS performed, nothing is
1791
- /// removed that was not there and NO OTHER REGISTRATION IS DISTURBED (`DD-53`: `off`'s refusal arm is
1792
- /// the OUTSIDE-DOMAIN handle ALONE).
1793
- /// * **THE OUTSIDE ARM** — a foreign instance's value, a prior session's value, a fabricated value, a bare
1794
- /// `string`, a blank token, a non-opaque value, `null`, `undefined` or an ABSENT argument: **a REFUSAL**
1795
- /// — `AddressMalformed` in `§2.5`'s single form, with the failing target, the class and the position —
1796
- /// **and NEITHER removal is performed.** **THIS is the arm that makes `off` differ from `unlisten` over
1797
- /// one value, and the difference is DECLARED and not incidental** (`§2.3`'s dated clause 3; `§2.8`).
1798
- ///
1799
- /// **`unlisten` ITSELF IS UNTOUCHED AND KEEPS RULE 4 VERBATIM**: it withdraws the registration and NEVER the
1800
- /// function, with the registry's entry STANDING. `off` is the PACKAGE-OWNED verb that removes one, and a
1801
- /// reader who takes it as an exception to rule 4 has read a second withdrawal into the store's surface —
1802
- /// there is none. **AND `off` REMOVES NO MORE THAN THE HANDLE NAMES**: a lawful sibling registration —
1803
- /// another address's entry, another identity in the same instance — STANDS. **AND NEITHER IT NOR `on` IS A
1804
- /// RELEASE VERB** (`A74`): no `dispose()`, no `close()`, no finalizer and no teardown is declared here, and
1805
- /// the instance's state is still released with the instance and by nothing else.
1806
- ///
1807
- /// **AND `off` DOES NOT CANCEL A DELIVERY IN FLIGHT**, because the delivery's recipient set is read when the
1808
- /// window opens (item 7 (b); `§2.4`'s `CF-DUP-3` re-homing clause; `write-and-read.md §6.5` item 14).
1809
- function offAt(state, instance, handle) {
1810
- // STEP 1 — VALIDATE. An outside value is refused HERE, and steps 2 and 3 never run (`DD-54`).
1811
- const encoded = encodeHandle(state, handle);
1812
- if (encoded.k !== 'O') {
1813
- // The ONE form, with the failing TARGET printed as its own value (item 5 (a)), the CLASS the value HAS
1814
- // (item 5 (b), mandatory) and the ARGUMENT POSITION (`§2.17`'s dated clause, `1` of `2`) — **and NOT
1815
- // `unlisten`'s no-op `undefined`, which is that verb's own declared answer and not this one's.**
1816
- boundaryReject(
1817
- 'AddressMalformed', // `§2.8`'s own declared code at this site, carried and never minted (`DD-40`)
1818
- targetSpelling(handle),
1819
- `the handle at the ${ARGUMENT_POSITION_FIRST} of \`off\` is ${classSpelling(handle)}, and it is not an opaque value THIS INSTANCE minted or adopted`,
1820
- );
2715
+ /**
2716
+ * **`§2.12` ITEM 2 (a): `constraintOn(pair, constraint) -> undefined` / `constraintOff(pair, constraint) ->
2717
+ * undefined` — THE TWO HALVES OF THE ONE TOGGLE, AND NEITHER STANDS IN THE KERNEL.**
2718
+ *
2719
+ * **THEIR THREE ANSWERS, AND THE TWO SHARED CLAUSES:**
2720
+ * * **IDEMPOTENT SUCCESS WHERE THE PAIR ALREADY STANDS IN THE STATE IT ASKS FOR** (item 3's first answered
2721
+ * question): `undefined`, the pair and its element EXACTLY as they stood, and NOTHING THROWN.
2722
+ * * **THE SECOND POSITION IS REQUIRED AND IS A NO-OP ON EVERY SUCCESS** (`item 3`'s `constraintOn` row;
2723
+ * `§2.4` item 9 (f)'s method table: *"the third position is REQUIRED and is a no-op on success"*): a
2724
+ * FUNCTION there is never refused on the pair's ground, the entry NEVER SUBSTITUTES ONE, and it is
2725
+ * `entry.fn` — the element the entry carried — that is evaluated at the next write. **CARRIAGE IS
2726
+ * PAIR-KEYED AND THE TOGGLE'S OWN ARGUMENTS DO NOT DECIDE IT.**
2727
+ * * **AN OUTSIDE `pair` OR A SHORT ARITY TAKES `constraintSite`'s ONE `TypeError`**, and a WELL-FORMED PAIR
2728
+ * THE ENTRY DOES NOT CARRY takes `constraintUncarried`'s (`A126`).
2729
+ */
2730
+ function constraintToggle(enabled, instance, n, pair, constraint) {
2731
+ const verb = enabled ? 'constraintOn' : 'constraintOff';
2732
+ const site = constraintSite(verb, instance, n, pair, constraint);
2733
+ const entry = site.state.constraints.get(constraintPairKey(site.address, site.id));
2734
+ if (entry === undefined) constraintUncarried(verb, pair);
2735
+ if (entry.enabled !== enabled) {
2736
+ constraintsKernel().register(instance, site.address, site.id, enabled ? entry.fn : constraintParked);
2737
+ entry.enabled = enabled;
1821
2738
  }
1822
- // STEP 2 — UNLISTEN. The store's own verb through the ONE declared `unlisten` spelling (`§2.10`), reached
1823
- // with the handle this instance already owns. **A THROWING PATH LEAVES THE REGISTRY ENTRY STANDING**
1824
- // (`DD-54`): there is no `finally` here and none may be added.
1825
- unlisten(instance, handle);
1826
- // STEP 3 — DEREGISTER, the PACKAGE'S OWN state and nothing of the store's.
1827
- deregister(state, handle);
1828
2739
  return undefined;
1829
2740
  }
1830
2741
 
1831
- /// **THE DEREGISTRATION OF ONE IDENTITY — `§2.4` item 7 (b)'s THIRD STEP.** The registry's entry for THIS
1832
- /// identity is removed, and NOTHING ELSE OF THE PACKAGE'S STATE: **the identity's own token-to-handle
1833
- /// binding STANDS**, because it is not the withdrawal's to move and three declared answers rest on it —
1834
- /// `register(h, …)` over a handle this instance adopted or minted is judged by the INSTANCE's own domain
1835
- /// (`§2.4` item 5 (c)) and not by which verbs have run since, `unlisten`'s OPAQUE-only acceptance is the
1836
- /// same domain (`§2.3` item 2), and `off`'s own ENTRY-LESS arm is declared over an identity that has
1837
- /// ALREADY been removed by an earlier `off` (`DD-53`). **AND NO LATER `listen` CAN BE HANDED THIS BINDING
1838
- /// BY ACCIDENT**, because the store MINTS A FRESH TOKEN after its home entry is withdrawn
1839
- /// (`write-and-read.md §6.5` item 12; `A69`'s uniqueness is over the tokens the store MINTS), so a re-`listen`
1840
- /// at the same address reaches `wrapHandles` with a token no map entry holds and is wrapped as a NEW
1841
- /// identity — which is exactly `§2.4` rule 4's *"a later re-`listen` … mints a DIFFERENT handle"*. **A drive
1842
- /// that finds the withdrawn identity's function reachable after one `off` has found a failure of this step
1843
- /// and not of this sentence.**
1844
- function deregister(state, handle) {
1845
- state.registry.delete(handle);
2742
+ /// **WHETHER THIS INSTANCE CARRIES A PAIR AT THIS WRITE'S ADDRESS** (`§2.12` item 1's preamble clause (a)) —
2743
+ /// the gate stage 1 takes before the kernel is reached at all. **THE CLASS DECISION COMES FIRST AND NO TRAP
2744
+ /// IS RUN ON ANY PATH** (`DD-34`): a `Proxy` address, a class extending `Array` and every non-array lies
2745
+ /// outside every pair's own address domain, so no pair of this entry can stand at one.
2746
+ function carriesConstraintAt(state, address) {
2747
+ if (state.constraints.size === 0) return false;
2748
+ if (types.isProxy(address) || !isAdmittedArray(address)) return false;
2749
+ const key = JSON.stringify(address);
2750
+ for (const entry of state.constraints.values()) {
2751
+ if (entry.addressKey === key) return true;
2752
+ }
2753
+ return false;
2754
+ }
2755
+
2756
+ /**
2757
+ * **THE KERNEL-DRIVEN WRITE — `§2.12` ITEM 1'S FIVE STAGES, TAKEN IN THEIR ONE ORDER.**
2758
+ * ```
2759
+ * 1. K-2 the attempt is opened at this address, or the address's own live attempt is JOINED
2760
+ * 2. the store leg the kernel's own call on this entry's `write`, FIVE POSITIONS, the record
2761
+ * identity its fifth position carries — so the delivery of that write's handles
2762
+ * is WITHHELD here and owed to stage 5
2763
+ * 3. K-3 the pass: every pair registered at this address, each against this op's own value
2764
+ * 4. K-3 the attempt's terminal arm — the pass's, or the floor's where a save failed
2765
+ * 5. settle the residue the record's `pending` carries, delivered at instant (b), failing arm alone
2766
+ * ```
2767
+ * **THE CALLER MEETS A THROW INSTEAD OF A RETURN ON THE FAILING ARM, AND THE STORE'S OWN VERB PRODUCED
2768
+ * NEITHER FORM** (`§1.2` item 2): see `constraintCrossing` for what crosses.
2769
+ */
2770
+ function constraintWrite(state, instance, address, tier, value) {
2771
+ const kernel = constraintsKernel();
2772
+ let record;
2773
+ try {
2774
+ record = kernel.commit(instance, address, tier, value);
2775
+ } catch (refusal) {
2776
+ constraintCrossing(refusal);
2777
+ }
2778
+ const answer = state.leg;
2779
+ try {
2780
+ kernel.runAttempt(instance, record);
2781
+ } catch (refusal) {
2782
+ constraintCrossing(refusal);
2783
+ }
2784
+ return answer;
2785
+ }
2786
+
2787
+ /// **THE FAIL ARM'S CROSSING — `A120` (2): THE ENTRY CARRIES THE KERNEL'S TOKEN, THE THROW KEEPS THE
2788
+ /// STORE'S.** `§2.12` item 1's read-through clause fixes what crosses here: **A PLAIN OBJECT OF EXACTLY THE
2789
+ /// TWO MEMBERS `status` AND `message`, `status` A STRING DRAWN FROM THE STORE'S CLOSED `16`-MEMBER SET, the
2790
+ /// kernel's third member `log` ABSENT AND UNREACHABLE.** The member `status` carries is the store's
2791
+ /// `FileCommitFailed`, because no caller-side status can carry a `KC` token and a constraint-refused write
2792
+ /// is a commit that did not stand. **A STORE VERB'S OWN REFUSAL CROSSES VERBATIM AND UNCONVERTED** (`§1.2`).
2793
+ function constraintCrossing(refusal) {
2794
+ const status = refusal !== null && typeof refusal === 'object' ? refusal.status : undefined;
2795
+ if (typeof status !== 'string' || KC_TOKENS.includes(status) === false) throw refusal;
2796
+ throw {
2797
+ status: 'FileCommitFailed',
2798
+ message: typeof refusal.message === 'string'
2799
+ ? refusal.message
2800
+ : 'the write was refused by a constraint of this attempt',
2801
+ };
1846
2802
  }
1847
2803
 
1848
- // `delete` is a reserved word and the declared spelling is preserved on the way out.
1849
- export { deleteOp as delete };
2804
+ // **THE MODULE NAMESPACE CARRIES ONE NAME, `storeCreate` ALONE** (`surface.md §2.9` item 1's `A127` clause;
2805
+ // `11 → 1` ✓): `delete`'s reserved-word spelling, the ten store-reaching names and the three constraint
2806
+ // functions are the product's own members above and have no export and no second spelling at any layer.