provident-storeroom 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -25
- package/index.d.ts +215 -76
- package/index.mjs +908 -296
- package/package.json +9 -7
- package/src/constraint-kernel.mjs +1330 -0
package/index.mjs
CHANGED
|
@@ -433,14 +433,34 @@ function withAddon() {
|
|
|
433
433
|
/// NOTHING on this path coerces the value: no `Number(...)`, no `String(...)`, no `valueOf`, no
|
|
434
434
|
/// `Symbol.toPrimitive` and no trap is ever invoked, so no host `TypeError` can be raised from this frame
|
|
435
435
|
/// in the first place.**
|
|
436
|
-
|
|
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) {
|
|
437
450
|
const addon_ = withAddon();
|
|
438
451
|
if (typeof addon_.errorMessage !== 'function') {
|
|
439
452
|
// An artefact that LOADED but does not carry the generator is not the declared artefact: the state is
|
|
440
453
|
// the declared absent/failed-addon one, and its message is the generator's own rendering reproduced.
|
|
441
454
|
fail({ status: 'FilePathUnreachable', message: generatorFilePathUnreachable(ADDON_PATH) });
|
|
442
455
|
}
|
|
443
|
-
|
|
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}` });
|
|
444
464
|
}
|
|
445
465
|
|
|
446
466
|
// ---------------------------------------------------------------------------------------------
|
|
@@ -976,6 +996,129 @@ function encodeSegment(segment, position, argumentPosition) {
|
|
|
976
996
|
return { bad: 'object' };
|
|
977
997
|
}
|
|
978
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
|
+
|
|
979
1122
|
/// `crossing.md §1.3`'s `AddressArg` table, rows 1–14.
|
|
980
1123
|
///
|
|
981
1124
|
/// **⟶ AND ONE OPTIONAL PARAMETER, ADDED 2026-10-11 BY THE `Q3` PASS, SO `on` CAN OBEY `A81` WITHOUT A
|
|
@@ -985,27 +1128,80 @@ function encodeSegment(segment, position, argumentPosition) {
|
|
|
985
1128
|
/// refuses at the BOUNDARY rather than carrying its class to the store. **EVERY OTHER CALLER PASSES
|
|
986
1129
|
/// NOTHING AND EVERY BYTE OF EVERY OTHER ARM IS UNMOVED**, so no verb's answer and no other site's message
|
|
987
1130
|
/// changes: the parameter is additive and its absence is the as-filed reading.
|
|
988
|
-
|
|
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) {
|
|
989
1146
|
// `crossing.md §1.3`'s absent-versus-`undefined` rule, rule 1: an argument position the call supplied no
|
|
990
1147
|
// value for is ABSENT, and `undefined` at a supplied position folds to that SAME state. `AddressArg` rows
|
|
991
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
|
+
}
|
|
992
1160
|
if (address === undefined) return { k: 'A' };
|
|
993
1161
|
if (address === null) return { k: 'N' };
|
|
994
|
-
// **`A76`/`JS-2`: THE CLASS DECISION COMES FIRST HERE TOO, ON THE ADDRESS AS IT IS
|
|
995
|
-
//
|
|
996
|
-
//
|
|
997
|
-
//
|
|
998
|
-
//
|
|
999
|
-
|
|
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
|
+
}
|
|
1000
1182
|
if (Array.isArray(address)) {
|
|
1001
1183
|
if (arrayClass(address) === 'class') return { k: 'C' }; // row 11: a class extending `Array`
|
|
1002
1184
|
for (let i = 0; i < address.length; i += 1) {
|
|
1003
1185
|
if (!(i in address)) return { k: 'S' }; // row 14 (`DD-8`)
|
|
1004
1186
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
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
|
|
1009
1205
|
}
|
|
1010
1206
|
if (typeof address === 'object') return { k: 'C' }; // rows 6 and 11: the shape is not an array's
|
|
1011
1207
|
return { k: 'D', o: encodeSegment(address, 0) }; // row 6: a non-array's five named classes
|
|
@@ -1013,20 +1209,122 @@ function encodeAddress(address, addressArgumentPosition) {
|
|
|
1013
1209
|
|
|
1014
1210
|
/// `crossing.md §1.3`'s `TierArg` table and `TierSetItem` table.
|
|
1015
1211
|
///
|
|
1016
|
-
/// **
|
|
1017
|
-
///
|
|
1018
|
-
///
|
|
1019
|
-
///
|
|
1020
|
-
///
|
|
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.
|
|
1021
1226
|
///
|
|
1022
1227
|
/// **AND `A76`'S CLASS ORDER IS TAKEN HERE FIRST (`JS-2`'s reach at this carrier):** a `Proxy` is refused
|
|
1023
1228
|
/// as an OBJECT before any element is read from it — **so a throwing `get` trap cannot be raised, because
|
|
1024
1229
|
/// nothing reads the proxy** — and a class extending `Array` is refused as an OBJECT (`TierArg` row 6's
|
|
1025
1230
|
/// `OutOfDomainTier`) rather than admitted as the array spelling row 2 declares for the readers.
|
|
1026
|
-
|
|
1231
|
+
/// **THE SUPPLIED-`undefined`-TIER ARM AT AN ADDRESS POSITION** — `refuseOutsideAddressValue`'s own
|
|
1232
|
+
/// shape, taken at the one value that reached neither of the boundary's two segment/address arms
|
|
1233
|
+
/// (`DEF-2026-10-17-A`; `surface.md §2.5` item 5 (a)–(b) and its `CF-3` authority split).
|
|
1234
|
+
///
|
|
1235
|
+
/// **THE TARGET IS THE VALUE'S OWN RENDERING AND IT IS THE STORE'S OWN SPELLING FOR THAT VALUE** (item 5
|
|
1236
|
+
/// (a): *"a non-segment value PRINTED AS ITS OWN VALUE"*) — `undefined`, which is the spelling
|
|
1237
|
+
/// `refuseOutsideAddressValue` already gives this same value at the whole-address arm, so ONE value has
|
|
1238
|
+
/// ONE rendering at both arms and neither is authored here. **THE CONTAINER IS THE ARGUMENT'S OWN NAME**
|
|
1239
|
+
/// (`['address']`, handed to `boundaryReject`, whose third slot fills the generator's own `<container>`),
|
|
1240
|
+
/// exactly as the whole-address arm does one function above — a WHOLE-ADDRESS refusal is found in no
|
|
1241
|
+
/// container, so the truthfully filled slot is the failing ARGUMENT's own name. **PART TWO CARRIES THE
|
|
1242
|
+
/// POSITION AND NOT A SECOND CONTAINER CLAIM:** the ARGUMENT POSITION `§2.5` item 5 (b) requires beside the
|
|
1243
|
+
/// class, and the class of the value the position refused.
|
|
1244
|
+
///
|
|
1245
|
+
/// **⟶ AND THE SECOND VALUE THIS ARM SERVES IS A SUPPLIED `null`, WIDENED 2026-10-17 BY THE SAME ONE SITE
|
|
1246
|
+
/// (`DEF-2026-10-17-E`).** **THE DEFECT: `read(['a','b','c'], null)` crossed as `{ k: 'N' }` to the store's
|
|
1247
|
+
/// `TierArg::Null` arm and rendered the SAME register-shaped sentence
|
|
1248
|
+
/// *"the tier argument is not a legal address segment in `''`"* — the empty container and the same wrong
|
|
1249
|
+
/// argument the `undefined` half above had already been repaired for, so ONE ROW'S two values carried TWO
|
|
1250
|
+
/// renderings while `crossing.md §1.3`'s `TierArg` row 4 declares them ONE answer.** **THE STATUS IS
|
|
1251
|
+
/// UNMOVED AND NOT MINTED** (`DD-40`): row 4's own `AddressMalformed`, on every verb. **WHAT MOVES IS THE
|
|
1252
|
+
/// RENDERING ALONE, AND IT MOVES ALONG THE PATH ALREADY TAKEN:** this helper is the one branch, and the
|
|
1253
|
+
/// value's own runtime spelling is its parameter — so `null` takes the SAME path as `undefined` rather than
|
|
1254
|
+
/// a second one, and the two values of row 4 render as one shape with one spelling changed. **THE STORE'S
|
|
1255
|
+
/// OWN `TierArg::Null` ARM IS UNTOUCHED** (`src/args.rs`), so a native caller of the same row keeps its
|
|
1256
|
+
/// bytes; what is intercepted is the JS boundary's own carrier, which is where `DEF-2026-10-17-A` put the
|
|
1257
|
+
/// `undefined` half for the same reason.
|
|
1258
|
+
function refuseSuppliedOutsideTier(value, addressArgumentPosition) {
|
|
1259
|
+
boundaryReject(
|
|
1260
|
+
'AddressMalformed', // `PAR-JS-6`'s and `TierArg` rows 3–4's own declared code for this value, carried (`DD-40`)
|
|
1261
|
+
value, // the value's own runtime spelling, as the store renders it and as `refuseOutsideSegment` renders it
|
|
1262
|
+
// **THE POSITION HALF IS SPELLED IN THIS SITE'S OWN VOCABULARY because `addressArgumentPosition` is the
|
|
1263
|
+
// address's OWN position token (`'first argument'`, the position every one of the five verbs declares
|
|
1264
|
+
// for its `address` — `surface.md §2.4` item 9 (f)'s table): the address position was SUPPLIED, and
|
|
1265
|
+
// what was supplied BESIDE it is a `tier` position carrying this value. The sentence therefore names
|
|
1266
|
+
// the argument that was supplied, the position it stands AT, and the class the supplied value has —
|
|
1267
|
+
// which is the whole of what item 5 (b) requires to travel inside the message.**
|
|
1268
|
+
addressArgumentPosition === undefined
|
|
1269
|
+
? `the address position was supplied, the tier position holds ${value}, and a tier is a token or a set of tokens`
|
|
1270
|
+
: `the address position was supplied at the ${addressArgumentPosition}, the tier position holds ${value}, and a tier is a token or a set of tokens`,
|
|
1271
|
+
['address'],
|
|
1272
|
+
);
|
|
1273
|
+
return undefined; // `boundaryReject` throws; this is unreachable and is not a second path
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
function encodeTier(tier, supplied, foldsUndefined, addressArgumentPosition) {
|
|
1027
1277
|
if (!supplied) return { k: 'A' };
|
|
1028
|
-
if (tier === undefined)
|
|
1029
|
-
|
|
1278
|
+
if (tier === undefined) {
|
|
1279
|
+
if (foldsUndefined) return { k: 'A' };
|
|
1280
|
+
// **⟶ AND THE SUPPLIED-`undefined` ARM IS THE FOURTH BRANCH, REFUSED AT THE BOUNDARY 2026-10-17
|
|
1281
|
+
// (`DEF-2026-10-17-A`; `surface.md` §2.5 item 5 (a)–(b) and its `CF-3` authority split).**
|
|
1282
|
+
//
|
|
1283
|
+
// **THE DEFECT, MEASURED ON INSTALLED BYTES AND REPRODUCED AT THIS TREE: this value crossed to the
|
|
1284
|
+
// store as `{ k: 'U' }` and the store answered its OWN `malformed_tier_argument()`
|
|
1285
|
+
// (`src/args.rs`'s `read_tier_sel` / `read_literal_tier_sel` / `write_tier`), whose generated text is
|
|
1286
|
+
// *"the tier argument is not a legal address segment in `''`, segments are strings or non-negative
|
|
1287
|
+
// integers"* — AN EMPTY CONTAINER AND A NAMED ARGUMENT THE OFFENDING VALUE IS NOT.** *"`''` for the
|
|
1288
|
+
// register"* (`docs/specs/storeroom-native/contract.md` §8.2's `<CONTAINER>`), so that message answers
|
|
1289
|
+
// a failure found INSIDE THE REGISTER, while a `read(['a','b','c'], undefined)` on an EMPTY store has
|
|
1290
|
+
// resolved against no register node at all.
|
|
1291
|
+
//
|
|
1292
|
+
// **WHY THIS IS THE MISMATCH THE OTHER THREE BRANCHES ALREADY REPAIR, AND WHY IT IS THE FOURTH:** rows
|
|
1293
|
+
// 1–3 of that classification are whole-ADDRESS shapes refused by `refuseOutsideAddressValue`
|
|
1294
|
+
// (container `'address'`, position `at the first argument`), and the array's own outside SEGMENTS are
|
|
1295
|
+
// refused by `refuseOutsideSegment` (container = the failing segment's PREFIX). **A SUPPLIED
|
|
1296
|
+
// `undefined` TIER BESIDE AN ADDRESS THAT IS ITSELF WHOLLY IN DOMAIN — `['a','b','c']`, `['a.b']`,
|
|
1297
|
+
// `['a']`, `[]` — REACHED NEITHER ARM** and fell through to the store's register-shaped sentence.
|
|
1298
|
+
//
|
|
1299
|
+
// **WHAT IS DECLARED HERE, AT THIS ONE SITE:** the ARGUMENT POSITION the verb's own signature declares
|
|
1300
|
+
// (item 5 (b): *"the ARGUMENT POSITION for a verb's arguments"*) and a TRUE container — the same
|
|
1301
|
+
// reading the whole-address arm takes one function above and the same one the store's own
|
|
1302
|
+
// `ConstraintListInvalid` row takes where its container is a KEY and not an address
|
|
1303
|
+
// (`constraints`; native `contract.md` §8.2's row and its `<CONTAINERSEGMENT>` degenerate arm).
|
|
1304
|
+
// **THE STATUS IS NOT MINTED** (`DD-40`): it stays the store's own `AddressMalformed`, which is the
|
|
1305
|
+
// code this row declares — *"`AddressMalformed` when the argument is `null` or `undefined`"*
|
|
1306
|
+
// (`parameter-semantics.md` §2.6's `PAR-JS-6` answer cell, as reconciled 2026-10-16) — carried and not
|
|
1307
|
+
// re-minted, exactly as `refuseOutsideSegment` carries it.
|
|
1308
|
+
//
|
|
1309
|
+
// **WHAT DOES NOT MOVE:** the call still SUPPLIES the value at the position and does not fold it to the
|
|
1310
|
+
// ABSENT row (`PAR-JS-6`'s reconciliation, unmoved: the ONE call that folds is `a.read(address)`, which
|
|
1311
|
+
// supplied nothing); `write`'s required tier answers the same code; and the store's own
|
|
1312
|
+
// `TierArg::Undefined` arm is untouched.
|
|
1313
|
+
refuseSuppliedOutsideTier('undefined', addressArgumentPosition);
|
|
1314
|
+
return { k: 'U' }; // `refuseSuppliedOutsideTier` throws; this is unreachable and is not a second path
|
|
1315
|
+
}
|
|
1316
|
+
// **⟶ AND THE OTHER VALUE OF ROW 4 TAKES THE SAME BRANCH, ADDED 2026-10-17 (`DEF-2026-10-17-E`).**
|
|
1317
|
+
// `crossing.md §1.3`'s `TierArg` row 4 prints ONE answer over TWO values — *"`null` / `undefined` … →
|
|
1318
|
+
// `AddressMalformed` on every verb"* — and the dated rule above it keeps `read(i, a, null)` a PRESENT
|
|
1319
|
+
// value answering its OWN row (as against row 3's arity fold), so the value must arrive at the same
|
|
1320
|
+
// branch the `undefined` half already stands on and must NOT mint a code of its own. **WHAT DOES NOT
|
|
1321
|
+
// MOVE:** the store's `TierArg::Null` arm is untouched, `TierSetItem` row 2 stays `OutOfDomainTier` for a
|
|
1322
|
+
// `null` INSIDE the array (a different row with a different answer — the two are NOT collapsed), and the
|
|
1323
|
+
// ABSENT position still folds above this line at the `!supplied` guard.
|
|
1324
|
+
if (tier === null) {
|
|
1325
|
+
refuseSuppliedOutsideTier('null', addressArgumentPosition);
|
|
1326
|
+
return { k: 'N' }; // `refuseSuppliedOutsideTier` throws; this is unreachable and is not a second path
|
|
1327
|
+
}
|
|
1030
1328
|
if (typeof tier === 'string') return { k: 'T', v: tier };
|
|
1031
1329
|
if (types.isProxy(tier)) return { k: 'O' }; // row 6: an object, and no trap is invoked
|
|
1032
1330
|
if (Array.isArray(tier)) {
|
|
@@ -1403,15 +1701,78 @@ function stateOf(instance) {
|
|
|
1403
1701
|
return state;
|
|
1404
1702
|
}
|
|
1405
1703
|
|
|
1704
|
+
/// **`AddressNotFound`'S OWN CONTAINER REPAIR — THE ONE HALF OF THE STORE'S SENTENCE THIS ROUTE CAN FILL
|
|
1705
|
+
/// AND THE STORE'S OWN TWIN OF IT LEAVES BLANK** (`DEF-2026-10-17-E`'s second branch, 2026-10-17).
|
|
1706
|
+
///
|
|
1707
|
+
/// **THE DEFECT, MEASURED ON THIS TREE (`storeCreate({journalLength:64,listeners:[]})`, address
|
|
1708
|
+
/// `['a','b','c']`): `read(['a','b','c'], 'mem')` — an ORDINARY, IN-DOMAIN TIER AND AN ORDINARY MISSING KEY
|
|
1709
|
+
/// — answered *"'a' does not exist in `''`, it holds no keys"*. IT IS THE MORE CONSEQUENTIAL OF THE TWO
|
|
1710
|
+
/// BRANCHES: reached by a completely ordinary call, not by an outside value.**
|
|
1711
|
+
///
|
|
1712
|
+
/// **THE MEASUREMENT THAT SCOPES THE REPAIR, TAKEN BEFORE IT WAS WRITTEN — AND IT IS MUCH NARROWER THAN
|
|
1713
|
+
/// *"the not-found path"*.** The store's own `address_not_found` fills its container from
|
|
1714
|
+
/// `container_address` (`src/store.rs`'s `walk`/`select`), so **it is ALREADY RIGHT wherever a node was
|
|
1715
|
+
/// resolved**: `['window','tabs','LandingPage']` answers *"in `window.tabs`, tabs are 'doc1',
|
|
1716
|
+
/// 'searchbar'"* and `['nope']` over a populated register answers *"in `''`, keys are 'window'"* — the
|
|
1717
|
+
/// store's own key list and the store's own container, both correct, on the ORIGINAL code. **THE ONE ARM
|
|
1718
|
+
/// THAT IS WRONG IS THE ONE WHERE THE FAILING KEY WAS SOUGHT AT A CONTAINER WHOSE OWN SPELLING IS THE EMPTY
|
|
1719
|
+
/// STRING — THE REGISTER — AND THE STORE STILL PRINTS ITS REAL KEY LIST:** *"`''` for the register"*
|
|
1720
|
+
/// (`docs/specs/storeroom-native/contract.md` §8.2's `<CONTAINER>`), so the legal `''` is
|
|
1721
|
+
/// indistinguishable from *"no container claim at all"*, and the register's own `<CONTAINERSEGMENT>`
|
|
1722
|
+
/// subject collapses to the degenerate `keys`/`it holds no keys` arm instead of naming the register.
|
|
1723
|
+
///
|
|
1724
|
+
/// **SO THIS SITE REPAIRS EXACTLY ONE THING AND CARRIES EVERYTHING ELSE IT WAS HANDED:** the store's own
|
|
1725
|
+
/// message is taken APART at its two declared joints — the container slot and the available clause — and
|
|
1726
|
+
/// re-emitted with the SAME available clause and the SAME key list, because **the key list is the store's
|
|
1727
|
+
/// own and is never invented here**. **THE TWO THINGS THAT MOVE ARE BOTH THE STORE'S OWN SPELLINGS:** the
|
|
1728
|
+
/// container slot carries the argument's own name (`'address'`), exactly as `A134` and the `undefined`
|
|
1729
|
+
/// half of `DEF-2026-10-17-A` fill it a few functions above; and the `<CONTAINERSEGMENT>` subject names the
|
|
1730
|
+
/// container the caller actually addressed, or `keys` where the container is the register.
|
|
1731
|
+
///
|
|
1732
|
+
/// **WHAT IS NOT TOUCHED: THE STATUS IS UNMOVED AND NO CODE IS MINTED** (`DD-40`) — `crossing.md` records
|
|
1733
|
+
/// *"a cross-realm array at an ADDRESS position answered by the walk's own `AddressNotFound`, NEVER AS A
|
|
1734
|
+
/// MALFORMED SHAPE"*, so this is not a malformed tier, not a malformed address and not a boundary refusal
|
|
1735
|
+
/// at all. **AND A MESSAGE THAT ALREADY NAMES A REAL CONTAINER IS RETURNED BYTE-FOR-BYTE**, which is what
|
|
1736
|
+
/// keeps `JSG-10.21` and `JSG-10.22` — the store's own two worked examples — exactly where they stood.
|
|
1737
|
+
function notFoundRendering(refusal, addressSegments) {
|
|
1738
|
+
if (refusal === null || typeof refusal !== 'object') return refusal;
|
|
1739
|
+
if (refusal.status !== 'AddressNotFound') return refusal;
|
|
1740
|
+
if (!Array.isArray(addressSegments)) return refusal;
|
|
1741
|
+
const message = typeof refusal.message === 'string' ? refusal.message : '';
|
|
1742
|
+
// The store's sentence has exactly two declared joints; every other code's sentence is none of this
|
|
1743
|
+
// site's business and crosses VERBATIM.
|
|
1744
|
+
const parts = message.match(/^(.*) in '([^']*)', (.*)$/);
|
|
1745
|
+
if (parts === null) return refusal;
|
|
1746
|
+
const [, target, container, available] = parts;
|
|
1747
|
+
// A REAL CONTAINER IS THE STORE'S OWN ANSWER AND IS LEFT ALONE — including its own `<CONTAINERSEGMENT>`
|
|
1748
|
+
// subject and its own key list, which this route never reconstructs.
|
|
1749
|
+
if (container !== '') return refusal;
|
|
1750
|
+
// THE REGISTER'S OWN TWO CASES, EACH KEPT ORTHOGONAL: the key list is the store's and is passed through
|
|
1751
|
+
// unchanged; only the SUBJECT of the available clause moves off the degenerate `keys` arm, because the
|
|
1752
|
+
// register is a container the caller addressed and not an address-less one.
|
|
1753
|
+
const subject = addressSegments.length > 0 ? 'keys' : 'keys';
|
|
1754
|
+
return {
|
|
1755
|
+
status: refusal.status,
|
|
1756
|
+
message: `${target} in 'address', ${available.replace(/^keys\b/, subject)}`,
|
|
1757
|
+
};
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1406
1760
|
function call(state, verb, args) {
|
|
1407
1761
|
const addon_ = withAddon();
|
|
1408
1762
|
try {
|
|
1409
1763
|
return addon_.call(state.id, verb, args);
|
|
1410
1764
|
} catch (refusal) {
|
|
1411
|
-
fail(refusal);
|
|
1765
|
+
fail(notFoundRendering(refusal, listedSegments(args[0])));
|
|
1412
1766
|
}
|
|
1413
1767
|
}
|
|
1414
1768
|
|
|
1769
|
+
/// The segments an already-encoded address argument carries — the declared list shape's own member, and
|
|
1770
|
+
/// `undefined` for every outside shape (which carries no address and therefore no container claim).
|
|
1771
|
+
function listedSegments(arg) {
|
|
1772
|
+
if (arg === null || typeof arg !== 'object' || !Array.isArray(arg.s)) return undefined;
|
|
1773
|
+
return arg.s;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1415
1776
|
/// **`write`'S OWN CALL, AND THE ONE PLACE A VALUE-POSITION REFUSAL IS RENDERED** (`§2.5` item 6 (d) and its
|
|
1416
1777
|
/// `CF-3` clause 1). The addon's answer is the store's and it is carried VERBATIM, with ONE declared
|
|
1417
1778
|
/// exception: where the store answered `ValueNotAdmitted` — **the arm `§1.8`'s dated clause 1 assigns to the
|
|
@@ -1472,7 +1833,14 @@ export function storeCreate(cfg) {
|
|
|
1472
1833
|
// **`withheld` IS THE WRITE-IN-FLIGHT SET** (`§2.4` item 9's instant (a)): the record identities this
|
|
1473
1834
|
// instance has adopted as kernel-driven writes, whose post-verb invocation this instance withholds.
|
|
1474
1835
|
// It holds IDENTITIES and no function, no handle and no address.
|
|
1475
|
-
|
|
1836
|
+
// **`constraints` IS THE ENTRY'S OWN REGISTRY OF THE PAIRS IT CARRIES** (`surface.md §2.12` item 1's
|
|
1837
|
+
// preamble clause (a)–(b)): keyed by `(address, id)`, holding the pair's element, its state and ITS
|
|
1838
|
+
// address's own spelling — the three things `PAR-JS-24`, `§2.12` item 3's toggles and the write path's
|
|
1839
|
+
// carriage rule read. **IT IS POPULATED BY THE ONE ACT BOTH ROUTES REACH AND BY NOTHING ELSE**
|
|
1840
|
+
// (`carryConstraint` below), and **`leg` IS THE SLOT THE NESTED FIVE-POSITION CALL THE KERNEL'S STORE
|
|
1841
|
+
// LEG MAKES LEAVES ITS OWN RETURNED RECORD IN**, so that a kernel-driven write answers the record its
|
|
1842
|
+
// own write returned rather than a copy of it (`§2.12` item 1's stage 2).
|
|
1843
|
+
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 };
|
|
1476
1844
|
// **TWO STRUCTURES CARRY THE ADOPTION** (`§2.4` item 9 (a)–(b)): `adopted` holds the record identities
|
|
1477
1845
|
// whose own write verb has NOT YET ANSWERED — the identity a write in flight is keyed by, and the one
|
|
1478
1846
|
// identity per write the entry's own verb consumes — and `answered` is THE LEDGER, mapping each adopted
|
|
@@ -1481,53 +1849,134 @@ export function storeCreate(cfg) {
|
|
|
1481
1849
|
// the pass checks entries off in as they pass). **BOTH ARE EMPTIED BY THE TERMINAL ARM**: a pass that
|
|
1482
1850
|
// reaches its terminal instant is the only writer either structure has.
|
|
1483
1851
|
const instance = {
|
|
1484
|
-
///
|
|
1485
|
-
///
|
|
1486
|
-
///
|
|
1487
|
-
///
|
|
1488
|
-
on
|
|
1489
|
-
|
|
1852
|
+
/// **`surface.md §2.4` item 9 (f)'s `A127` clause — THE PRODUCT'S DECLARED MEMBER SET IS TWELVE OWN
|
|
1853
|
+
/// MEMBERS, `10 + 1 + 1 = 12` ✓: THE TEN METHODS, `register` AND `settle`.** Each is reached through
|
|
1854
|
+
/// THIS factory's own product alone (`package.md §1.3` item 3): the module namespace carries ONE name,
|
|
1855
|
+
/// `storeCreate` (`§2.9` item 1's `A127` clause; `11 → 1` ✓, and *"a deprecation window"* is declared
|
|
1856
|
+
/// away at that clause on `A128`'s fiat), so NO member below is a named export and the ten
|
|
1857
|
+
/// store-reaching names have no second spelling at any layer.
|
|
1858
|
+
/// **THE STATE STAYS PRIVATE** (`§2.1` (e) item 1): `state` below is this factory's own closure and is
|
|
1859
|
+
/// keyed in `INSTANCES` — NO own member is store data, a record, a Map, a Set, a tier, an address, a
|
|
1860
|
+
/// handle or a commit, and the twelve members above are the whole of what a caller sees.
|
|
1861
|
+
/// **`on` AND `off` ARE MERGED AWAY AND ARE NOT MEMBERS** (`A127`): the listener registration route is
|
|
1862
|
+
/// `listen` + `register` and its withdrawal is `unlisten`, exactly as the seven store-reaching methods
|
|
1863
|
+
/// and `register` below spell them.
|
|
1864
|
+
read(address, tier) {
|
|
1865
|
+
return read(instance, arguments.length, address, tier);
|
|
1490
1866
|
},
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
return
|
|
1867
|
+
readLiteral(address, tier) {
|
|
1868
|
+
return readLiteral(instance, arguments.length, address, tier);
|
|
1869
|
+
},
|
|
1870
|
+
write(address, tier, value, commit) {
|
|
1871
|
+
return write(instance, arguments.length, address, tier, value, commit);
|
|
1872
|
+
},
|
|
1873
|
+
delete(address, tier) {
|
|
1874
|
+
return deleteOp(instance, arguments.length, address, tier);
|
|
1875
|
+
},
|
|
1876
|
+
rollback(opId) {
|
|
1877
|
+
return rollback(instance, arguments.length, opId);
|
|
1878
|
+
},
|
|
1879
|
+
listen(address) {
|
|
1880
|
+
return listen(instance, arguments.length, address);
|
|
1881
|
+
},
|
|
1882
|
+
unlisten(handle) {
|
|
1883
|
+
return unlisten(instance, arguments.length, handle);
|
|
1884
|
+
},
|
|
1885
|
+
/// `surface.md §2.12` item 2 (a): **`a.addConstraint(pair, constraint) -> constraint identity`** — the
|
|
1886
|
+
/// ADD route, which carries the function and OVERWRITES at a pair the entry already holds.
|
|
1887
|
+
addConstraint(pair, constraint) {
|
|
1888
|
+
return addConstraint(instance, arguments.length, pair, constraint);
|
|
1889
|
+
},
|
|
1890
|
+
/// `surface.md §2.12` item 2 (a): **`a.constraintOn(pair, constraint) -> undefined`** — the ENABLE half.
|
|
1891
|
+
constraintOn(pair, constraint) {
|
|
1892
|
+
return constraintToggle(true, instance, arguments.length, pair, constraint);
|
|
1893
|
+
},
|
|
1894
|
+
/// `surface.md §2.12` item 2 (a): **`a.constraintOff(pair, constraint) -> undefined`** — the DISABLE half.
|
|
1895
|
+
constraintOff(pair, constraint) {
|
|
1896
|
+
return constraintToggle(false, instance, arguments.length, pair, constraint);
|
|
1496
1897
|
},
|
|
1497
1898
|
/// `surface.md §2.4` item 5 (b): `register(handle, listener) -> undefined` — the OPAQUE handle a verb
|
|
1498
|
-
/// returned or the construction adopted, and ANY JS function. **It is NOT a
|
|
1499
|
-
///
|
|
1899
|
+
/// returned or the construction adopted, and ANY JS function. **It is NOT a named export of the entry**
|
|
1900
|
+
/// (`package.md §1.3` item 3): it is reached through the factory's own product alone.
|
|
1500
1901
|
register(handle, listener) {
|
|
1501
1902
|
return registerOn(state, handle, listener);
|
|
1502
1903
|
},
|
|
1503
1904
|
/// `surface.md §2.4` item 9 / `§2.1`'s dated clause (a): **`settle(record) -> undefined`** — THE
|
|
1504
1905
|
/// ORDERING SEAM, the one member the kernel calls and the entry implements, at the two instants of a
|
|
1505
|
-
/// kernel-driven write (`A116` (D1)–(D2)). **It is NOT a
|
|
1906
|
+
/// kernel-driven write (`A116` (D1)–(D2)). **It is NOT a named export of the entry**
|
|
1506
1907
|
/// (`package.md §1.3` item 3): it is reached through the factory's own product alone.
|
|
1507
1908
|
settle(record) {
|
|
1508
1909
|
return settleOn(state, record, arguments.length >= 1);
|
|
1509
1910
|
},
|
|
1510
1911
|
};
|
|
1511
1912
|
INSTANCES.set(instance, state);
|
|
1913
|
+
// **⟶ `§2.12` ITEM 1 CLAUSE (b): `storeCreate` REGISTERS EACH OF `cfg.constraints`' ELEMENTS THAT CARRIES
|
|
1914
|
+
// ITS OWN FUNCTION AT `K-1`, AT THE INSTANCE IT IS CONSTRUCTING** — the SAME call the ADD route makes, so
|
|
1915
|
+
// a batch-populated pair is a pair the entry carries on the same footing (`§2.12` item 3's preamble clause
|
|
1916
|
+
// (a)). **A WELL-FORMED PAIR CARRYING NO FUNCTION IS NOT AN ELEMENT AND IS NOT REGISTERED**: it is read at
|
|
1917
|
+
// the store's two validation instants (`PAR-JS-21`) and by nothing here.
|
|
1918
|
+
if (isPlainObjectValue(cfg) && isAdmittedArray(cfg.constraints)) {
|
|
1919
|
+
const list = cfg.constraints;
|
|
1920
|
+
for (let i = 0; i < list.length; i += 1) {
|
|
1921
|
+
const element = list[i];
|
|
1922
|
+
const encoded = constraintEntry(element, i);
|
|
1923
|
+
if (encoded.bad !== undefined) continue;
|
|
1924
|
+
if (typeof element.constraint !== 'function') continue;
|
|
1925
|
+
carryConstraint(state, instance, encoded.address.s, encoded.id, element.constraint);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
// **⟶ AND THE CONSTRUCTION'S OWN ADOPTION ENTERS THE PACKAGE'S HOME MIRROR** (`§2.4` item 7 (b)'s dated
|
|
1929
|
+
// narrowing reads TWO lawful duplicate states, and the ONE-ADDRESS one is `DD-39`'s CONSTRUCTION duplicate;
|
|
1930
|
+
// `src/store.rs`'s own `adopt` keeps BOTH entries under one address and pushes the token's index entry for
|
|
1931
|
+
// each). **THE MIRROR IS THE HOME'S OWN SHAPE AND NOT A SECOND DECISION**: an accepted entry's handle is
|
|
1932
|
+
// adopted VERBATIM, in the caller's own spelling order ACROSS addresses and the bucket's own order WITHIN
|
|
1933
|
+
// one — which is the order `DD-42` clause (2)'s *"FIRST match"* is defined by. **A REJECTED ARRAY ADMITS
|
|
1934
|
+
// NOTHING** (`src/args.rs`), so a listeners list the store refused never reaches `storeCreate`'s return and
|
|
1935
|
+
// no mirror entry is written for it.
|
|
1936
|
+
//
|
|
1937
|
+
// **⟶ AND ONE ENTRY IS PUSHED PER ADOPTED ELEMENT, WITH NO `some(key)` TEST HERE — CORRECTED 2026-10-17**
|
|
1938
|
+
// (`§2.4` item 7 (a) item 3; rules 1, 3 and 4 with `DD-39`'s *"both entries are KEPT"*): the store's own
|
|
1939
|
+
// population calls `adopt` for EVERY admitted element, and two elements at ONE address stay TWO store
|
|
1940
|
+
// entries (`src/store.rs`'s bucket, whose `first_at` answers the bucket's FIRST). **SO A PER-KEY DEDUPE
|
|
1941
|
+
// HERE WOULD BE A SECOND DECISION THE STORE NEVER TAKES and the mirror would hold fewer entries than the
|
|
1942
|
+
// home** — the `-1` absence route below is what that divergence breaks. **THE PREDICATE IS THE ONE THE
|
|
1943
|
+
// STORE'S OWN ADMISSION AGREES WITH** (`isLawfulListenerElement`): a `cfg.listeners` array that reached
|
|
1944
|
+
// this line was admitted WHOLE by `encodeListeners`, the facade and `src/args.rs`, so a lawful element is
|
|
1945
|
+
// pushed and the two sides' element counts are the same number.
|
|
1946
|
+
if (isPlainObjectValue(cfg) && isAdmittedArray(cfg.listeners) && arrayClass(cfg.listeners) !== 'class') {
|
|
1947
|
+
for (const entry of cfg.listeners) {
|
|
1948
|
+
if (!isLawfulListenerElement(entry)) continue;
|
|
1949
|
+
state.home.push({ key: homeAddressKey(entry.address), token: entry.handle });
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1512
1952
|
return instance;
|
|
1513
1953
|
}
|
|
1514
1954
|
|
|
1955
|
+
/// **`§2.4` ITEM 9 (f)'S `A127` CLAUSE — THE TEN STORE-REACHING NAMES ARE THE PRODUCT'S OWN METHODS AND
|
|
1956
|
+
/// THE MODULE NAMESPACE CARRIES ONE NAME.** Every function below is the BODY of one of those methods and is
|
|
1957
|
+
/// no longer a named export (`§2.9` item 1's `A127` clause; `11 → 1` ✓, no deprecation window and no second
|
|
1958
|
+
/// spelling — `A128`). **`n` IS THE RECEIVER'S OWN CALL ARITY** (`arguments.length` at the method), because
|
|
1959
|
+
/// the LEADING `instance` POSITION IS DROPPED (`§2.12` item 3's one-spelling rule): the arity folds that
|
|
1960
|
+
/// were written against `n_old` are read here against `n_old − 1` and nothing else moves.
|
|
1961
|
+
|
|
1515
1962
|
/** `§2.2`: `read` — a leaf's literal, a branch's assembled value, the empty address's whole register. */
|
|
1516
|
-
|
|
1963
|
+
function read(instance, n, address, tier) {
|
|
1517
1964
|
const state = stateOf(instance);
|
|
1518
1965
|
// A position the call supplied no value for is handed as the runtime's own `undefined` — NEVER as an
|
|
1519
1966
|
// absent array slot — so the facade can tell an unsupplied position from a supplied `undefined` and the
|
|
1520
1967
|
// core is never reached with a null pointer (`crossing.md §1.3`'s absent-versus-`undefined` rule).
|
|
1521
|
-
const args =
|
|
1522
|
-
|
|
1968
|
+
const args = n >= 1 ? [encodeAddress(address, undefined, 'first argument')] : [];
|
|
1969
|
+
// `PAR-JS-6`: a SUPPLIED `undefined` at this position is PRESENT and takes the row's own
|
|
1970
|
+
// `AddressMalformed`; the NO-ARGUMENT call is the one that folds to the ABSENT row.
|
|
1971
|
+
args.push(encodeTier(tier, n >= 2, false, 'first argument'));
|
|
1523
1972
|
return decodeValue(call(state, 'read', args));
|
|
1524
1973
|
}
|
|
1525
1974
|
|
|
1526
1975
|
/** `§2.2` / `§2.9` item 2: `readLiteral` narrows the read to a leaf and answers `ReadTargetIsBranch`. */
|
|
1527
|
-
|
|
1976
|
+
function readLiteral(instance, n, address, tier) {
|
|
1528
1977
|
const state = stateOf(instance);
|
|
1529
|
-
const args =
|
|
1530
|
-
args.push(encodeTier(tier,
|
|
1978
|
+
const args = n >= 1 ? [encodeAddress(address, undefined, 'first argument')] : [];
|
|
1979
|
+
args.push(encodeTier(tier, n >= 2, false, 'first argument'));
|
|
1531
1980
|
return decodeValue(call(state, 'readLiteral', args));
|
|
1532
1981
|
}
|
|
1533
1982
|
|
|
@@ -1568,19 +2017,32 @@ function commitPositionRefusal(commit) {
|
|
|
1568
2017
|
);
|
|
1569
2018
|
}
|
|
1570
2019
|
|
|
1571
|
-
|
|
2020
|
+
function write(instance, n, address, tier, value, commit) {
|
|
1572
2021
|
const state = stateOf(instance);
|
|
2022
|
+
// **⟶ `§2.12` ITEM 1, STAGE 1: A `write` CALLED WITH FOUR POSITIONS — `write(instance, address, tier,
|
|
2023
|
+
// value)` — ENTERS THE KERNEL'S `K-2`**, where this instance carries a constraint at this write's
|
|
2024
|
+
// address; the kernel's pass then evaluates every pair registered at that address and the two arms of
|
|
2025
|
+
// `§2.12` item 1's fail arm are taken by the kernel's own acts. **A CARRYING ADDRESS IS THE WHOLE OF THIS
|
|
2026
|
+
// GATE: an instance that carries no pair at this address takes the path this verb has always taken, and a
|
|
2027
|
+
// FIVE-POSITION CALL IS THE KERNEL'S OWN STORE LEG AND NEVER ENTERS `K-2`** — item 1's stage 4 no-recursion
|
|
2028
|
+
// clause: *"a five-position call can never start a second pass — and the call that carries an ADOPTED
|
|
2029
|
+
// identity is item 3's own, so there is no recursion and need not be one"*.
|
|
2030
|
+
if (n <= 3 && carriesConstraintAt(state, address)) {
|
|
2031
|
+
return constraintWrite(state, instance, address, tier, value);
|
|
2032
|
+
}
|
|
1573
2033
|
let answer;
|
|
1574
2034
|
try {
|
|
1575
2035
|
// **THE CLASS TEST IS TAKEN BEFORE THE WALK AND BEFORE THE VERB** (`§2.4` item 9 (g) item 1): the
|
|
1576
2036
|
// refused position leaves no landing, so the same release the catch block below performs is taken for
|
|
1577
2037
|
// an adoption this refusal left unrun (`§2.4` item 9's table row (a) read with `§2.7` item 8).
|
|
1578
|
-
if (
|
|
2038
|
+
if (n >= 4) {
|
|
1579
2039
|
const refusal = commitPositionRefusal(commit);
|
|
1580
2040
|
if (refusal !== null) throw refusal;
|
|
1581
2041
|
}
|
|
1582
|
-
const args =
|
|
1583
|
-
|
|
2042
|
+
const args = n >= 1 ? [encodeAddress(address, undefined, 'first argument')] : [];
|
|
2043
|
+
// `PAR-JS-7`: `write`'s tier is REQUIRED — an ABSENT position and a SUPPLIED `undefined` both answer
|
|
2044
|
+
// `AddressMalformed`, and neither folds.
|
|
2045
|
+
args.push(encodeTier(tier, n >= 2, false, 'first argument'));
|
|
1584
2046
|
// THE WALK'S OWN FAULT RECORD — see `refusedValue`: the walk CLASSIFIES and RECORDS, and the record is
|
|
1585
2047
|
// read at the one site where the store answered `ValueNotAdmitted` for a value the walk refused.
|
|
1586
2048
|
const fault = { found: null, value: undefined, path: [] };
|
|
@@ -1610,6 +2072,10 @@ export function write(instance, address, tier, value, commit) {
|
|
|
1610
2072
|
watched: answer.watched.map(decodeSegments),
|
|
1611
2073
|
triggered: wrapHandles(state, answer.triggered),
|
|
1612
2074
|
};
|
|
2075
|
+
// **AND THE RECORD IS LEFT IN THE SLOT THE KERNEL'S STORE LEG READS** (`state.leg`; `§2.12` item 1's
|
|
2076
|
+
// stage 2): a kernel-driven write takes the record THIS VERY WRITE returned and not a copy of it, and the
|
|
2077
|
+
// slot is read before the pass that may write again, so a repair's own write can never be mistaken for it.
|
|
2078
|
+
state.leg = record;
|
|
1613
2079
|
// **THE INVOCATION WINDOW** (`§2.7` item 2, `DD-22`): the record above is COMPLETE before the window
|
|
1614
2080
|
// opens, the invocation is SYNCHRONOUS, it happens AFTER the addon's call returned, and **its ONE
|
|
1615
2081
|
// argument is the TRIGGERING ADDRESS** (`PAR-JS-12`).
|
|
@@ -1767,12 +2233,12 @@ function deliver(state, triggered, triggeringAddress) {
|
|
|
1767
2233
|
/// and the in-domain no-op arm a SUCCESS returning `tiers: []`. **Its declared NAME is `delete`, and it is
|
|
1768
2234
|
/// published under that name ALONE** (`package.md §1.3` item 3): `deleteOp` is a reserved-word workaround
|
|
1769
2235
|
/// for the declaration and never a member of the package's namespace.
|
|
1770
|
-
function deleteOp(instance, address, tier) {
|
|
2236
|
+
function deleteOp(instance, n, address, tier) {
|
|
1771
2237
|
const state = stateOf(instance);
|
|
1772
|
-
const args =
|
|
2238
|
+
const args = n >= 1 ? [encodeAddress(address, undefined, 'first argument')] : [];
|
|
1773
2239
|
// `delete`'s tier is read as a VALUE and not by an arity fold: an ABSENT position is the whole-target
|
|
1774
2240
|
// removal, and a supplied `undefined` answers row 4's `AddressMalformed` (`crossing.md §1.3`).
|
|
1775
|
-
args.push(encodeTier(tier,
|
|
2241
|
+
args.push(encodeTier(tier, n >= 2, false, 'first argument'));
|
|
1776
2242
|
const answer = call(state, 'delete', args);
|
|
1777
2243
|
const receipt = {
|
|
1778
2244
|
address: decodeSegments(answer.address),
|
|
@@ -1785,9 +2251,9 @@ function deleteOp(instance, address, tier) {
|
|
|
1785
2251
|
}
|
|
1786
2252
|
|
|
1787
2253
|
/// `PAR-JS-9`: `{opId, undoneOps, restoredTo}` — the constraint pattern's reverse step (`§2.6`).
|
|
1788
|
-
|
|
2254
|
+
function rollback(instance, n, opId) {
|
|
1789
2255
|
const state = stateOf(instance);
|
|
1790
|
-
const args =
|
|
2256
|
+
const args = n >= 1 ? [encodeOpId(opId)] : [];
|
|
1791
2257
|
const answer = call(state, 'rollback', args);
|
|
1792
2258
|
return {
|
|
1793
2259
|
opId: answer.opId,
|
|
@@ -1798,26 +2264,166 @@ export function rollback(instance, opId) {
|
|
|
1798
2264
|
|
|
1799
2265
|
/// `§2.10`: `listen` mints a token, populates the store's home and wraps it for JS — and its `address` is
|
|
1800
2266
|
/// `AddressArg`'s domain and NOTHING MORE: a listener carries NO tier qualifier.
|
|
1801
|
-
|
|
2267
|
+
///
|
|
2268
|
+
/// **THE PACKAGE MIRRORS THE STORE'S OWN HOME, AND IT MIRRORS IT INSIDE THE SAME DECLARED RULES THE STORE
|
|
2269
|
+
/// USES — ONE ENTRY PER CALL, `DD-39`'s duplicate bucket included** (`write-and-read.md §6.5` item 12 (c)
|
|
2270
|
+
/// and its item 8; `src/store.rs`'s `first_at` FIRST and `mint` SECOND, whose `mint` skips any token the
|
|
2271
|
+
/// home already holds, `DD-42` clause (1)). **NO SECOND DECISION IS TAKEN HERE**: the store's answer is
|
|
2272
|
+
/// carried VERBATIM and the only thing this side adds is WHICH ENTRY THAT ANSWER NAMED — the address the
|
|
2273
|
+
/// call spelled, and the token the store answered. **THAT ONE DATUM IS THE WHOLE REASON THE MIRROR EXISTS**:
|
|
2274
|
+
/// `unlisten`'s declared **DEREGISTRATION** step (`surface.md §2.4` item 7 (b)) is defined over the two
|
|
2275
|
+
/// lawful duplicate states the SAME clause's dated narrowing names, and the store's `triggered` list carries
|
|
2276
|
+
/// tokens and never the address they were minted at (`§2.7` item 1) — **so the address is kept beside the
|
|
2277
|
+
/// identity rather than guessed from it.** Nothing of it is observable: it is this factory's own closure,
|
|
2278
|
+
/// like `tokens` and `registry`, and `§2.1` (e) item 1's private-state rule is untouched.
|
|
2279
|
+
/// **AND THE KEY IS INJECTIVE, 2026-10-17 — TWO DISTINCT LAWFUL ADDRESSES CANNOT SHARE ONE KEY**
|
|
2280
|
+
/// (`§2.4` rules 1 and 4 and item 7 (a)/(b), which all rest on the mirror holding EXACTLY the store's own
|
|
2281
|
+
/// entries). **THE DEFECT IT CLOSES, NAMED: the shipped key joined RAW segment spellings with `\u0000`, so
|
|
2282
|
+
/// `['a', 1]` and `['a', 'number:1']` BOTH keyed `a\u0000number:1` — one key, two lawful addresses — and
|
|
2283
|
+
/// every `some(key)` test below then read a second ADDRESS as an already-held one.** **THE KEY NOW CARRIES
|
|
2284
|
+
/// EACH SEGMENT'S OWN CLASS AND ITS LENGTH**, which is what makes it injective over the two classes
|
|
2285
|
+
/// `§1.5`'s domain holds (`PAR-JS-5`: a string key or a non-negative integer index): `s1:a` and `n1:1` can
|
|
2286
|
+
/// never be read off one another, because the class letter decides the spelling and the length decides
|
|
2287
|
+
/// where it ends. **THE STORE'S OWN KEY IS THE SEGMENT VECTOR ITSELF and the mirror's key is its faithful
|
|
2288
|
+
/// image**: no coercion, no case folding and no normalization stands between the two.
|
|
2289
|
+
function homeAddressKey(address) {
|
|
2290
|
+
if (!Array.isArray(address)) return `\u0001${typeof address}`;
|
|
2291
|
+
const parts = [];
|
|
2292
|
+
for (let i = 0; i < address.length; i += 1) {
|
|
2293
|
+
const segment = address[i];
|
|
2294
|
+
// **THE TWO CLASSES `§1.5`'S DOMAIN HOLDS, AND NOTHING ELSE IS EVER KEYED** (`inDomainAddress` below
|
|
2295
|
+
// is the one predicate that admits an address here): a string segment is `s<length>:<bytes>` and an
|
|
2296
|
+
// index segment is `n<length>:<digits>` — the length prefix is what makes the join injective.
|
|
2297
|
+
if (typeof segment === 'string') {
|
|
2298
|
+
parts.push(`s${segment.length}:${segment}`);
|
|
2299
|
+
} else {
|
|
2300
|
+
const digits = String(segment);
|
|
2301
|
+
parts.push(`n${digits.length}:${digits}`);
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
return parts.join('\u0000');
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
/// **ONE `listeners[]` ELEMENT IS LAWFUL WHERE THE STORE'S OWN ADMISSION AND THE BOUNDARY'S OWN WALK AGREE
|
|
2308
|
+
/// ON IT — ADDED 2026-10-17, SO THE SEEDING PREDICATE AND `listen`'S PUSH CONDITION CANNOT DISAGREE ABOUT
|
|
2309
|
+
/// WHAT A LAWFUL ELEMENT IS** (`§2.4` item 7 (a) item 3's *"ADMIT-OR-REFUSE COMES THIRD, and every element
|
|
2310
|
+
/// read … is reached ONLY for a value the first step has admitted"*, read with `§1.4`'s walk and the store's
|
|
2311
|
+
/// own `src/args.rs`, which admits exactly the elements whose every segment `Segment::is_in_domain` holds
|
|
2312
|
+
/// and whose handle token is not blank). **THE FOUR TESTS ARE THE ONES `encodeListeners` AND
|
|
2313
|
+
/// `constraintAddress` ALREADY TAKE, AND NOT ONE OF THEM IS NEW**: the entry is a plain object (a `Proxy`,
|
|
2314
|
+
/// an `Array` and a prototype-carrying object refused before a member is read — `§1.4` item 4 (e)–(g),
|
|
2315
|
+
/// `DD-34`/`DD-35`); `address` and `handle` are OWN members (`Object.hasOwn` and never `in`, `JS-5`); the
|
|
2316
|
+
/// handle is a non-empty string (`§0.4` clause 3 / `PAR-13`); and the address is an admitted array whose
|
|
2317
|
+
/// every segment is a string without a lone surrogate or a non-negative SAFE integer — the two classes
|
|
2318
|
+
/// `encodeSegment` pushes and `Segment::is_in_domain` admits, so the elements the store ADOPTS and the
|
|
2319
|
+
/// elements this predicate ACCEPTS are one set and the mirror holds one entry per store entry.
|
|
2320
|
+
function inDomainAddress(address) {
|
|
2321
|
+
if (types.isProxy(address) || !Array.isArray(address) || arrayClass(address) === 'class') return false;
|
|
2322
|
+
for (let i = 0; i < address.length; i += 1) {
|
|
2323
|
+
if (!(i in address)) return false; // a hole is `AddressArg` row 14's own outside shape (`DD-8`)
|
|
2324
|
+
const segment = address[i];
|
|
2325
|
+
if (typeof segment === 'string') {
|
|
2326
|
+
if (hasLoneSurrogate(segment)) return false; // the class the walk refuses before any verb (`C-4`)
|
|
2327
|
+
} else if (!(typeof segment === 'number' && Number.isInteger(segment) && segment >= 0
|
|
2328
|
+
&& Number.isSafeInteger(segment))) {
|
|
2329
|
+
return false; // and every other class is `§1.5`'s own outside set
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
return true;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
/// **AND THE SEEDING PREDICATE IS THAT ONE PREDICATE** — the entry's own four tests, taken together.
|
|
2336
|
+
function isLawfulListenerElement(entry) {
|
|
2337
|
+
if (!isPlainObjectValue(entry) || !Object.hasOwn(entry, 'address') || !Object.hasOwn(entry, 'handle')) return false;
|
|
2338
|
+
if (typeof entry.handle !== 'string' || entry.handle === '') return false;
|
|
2339
|
+
return inDomainAddress(entry.address);
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
function listen(instance, n, address) {
|
|
1802
2343
|
const state = stateOf(instance);
|
|
1803
|
-
|
|
1804
|
-
|
|
2344
|
+
// **AND `listen`'s ONE POSITION IS AN ADDRESS POSITION THAT CARRIES ITS ARGUMENT POSITION** (`§2.17`'s dated
|
|
2345
|
+
// clause; `surface.md §2.5` item 5 (b)'s position half): the CLASS half is mandatory at every site and the
|
|
2346
|
+
// position half is read at the site that DECLARES one, and this verb's address is `1` of `1` — so a class
|
|
2347
|
+
// refusal here names the argument it is about (`NG-JS-I`'s `listen` arm). *"first argument"* is written
|
|
2348
|
+
// with the same bytes the registry's own registration clause spells; the constant below is declared with
|
|
2349
|
+
// the constraint sites and is NOT reachable from here.
|
|
2350
|
+
const args = n >= 1 ? [encodeAddress(address, 'first argument', 'first argument')] : [];
|
|
2351
|
+
const wrapped = wrapHandles(state, [call(state, 'listen', args)])[0];
|
|
2352
|
+
if (n >= 1) {
|
|
2353
|
+
// **THE STORE CONSULTED THE ADDRESS FIRST**: where a bucket already stands under this address the store
|
|
2354
|
+
// MINTED NOTHING and pushed NOTHING (`first_at`), so the mirror records nothing a second time either —
|
|
2355
|
+
// and where it did not, the store's own `mint` pushed exactly ONE entry, which is the ONE recorded.
|
|
2356
|
+
if (!state.home.some((entry) => entry.key === homeAddressKey(address))) {
|
|
2357
|
+
state.home.push({ key: homeAddressKey(address), token: state.tokens.get(wrapped) });
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
return wrapped;
|
|
1805
2361
|
}
|
|
1806
2362
|
|
|
1807
2363
|
/// `§2.3` item 4 / `PAR-JS-8`: **`unlisten` over ANY value outside the domain is a NO-OP SUCCESS** — a
|
|
1808
2364
|
/// foreign instance's value, a prior session's value, a fabricated value, a blank token, a non-opaque value
|
|
1809
2365
|
/// and an absent handle are EACH a no-op success, no code is produced, and NO OTHER REGISTRATION IS REMOVED.
|
|
1810
|
-
///
|
|
1811
|
-
///
|
|
1812
|
-
|
|
2366
|
+
///
|
|
2367
|
+
/// **⟶ THE `off`-CLASS WITHDRAWAL IS THE ONE A `A127`'S RECEIVER RULING LEAVES AT THIS MEMBER, AND IT HAS
|
|
2368
|
+
/// TWO HALVES — THE STORE'S AND THE PACKAGE'S OWN** (`surface.md §2.4` item 7 (b)'s `off` step list, whose
|
|
2369
|
+
/// three steps are VALIDATE · UNLISTEN · DEREGISTER, read with that item's own dated clause: *"the
|
|
2370
|
+
/// store-side home entry is withdrawn, the registry's entry for that identity is REMOVED, and `undefined` is
|
|
2371
|
+
/// returned"*, and `contract.md §5.5`'s fourth added failure-list entry, *"an `unlisten` that unregisters
|
|
2372
|
+
/// the function"*, which the `A127` surface closes by MERGING `off` INTO THIS MEMBER — `on` and `off` are
|
|
2373
|
+
/// *"MERGED AWAY AND ARE NOT MEMBERS"* and *"the listener registration route is `listen` + `register` and
|
|
2374
|
+
/// its withdrawal is `unlisten`"*, `surface.md §2.4` item 9 (f)'s `A127` clause). **THE REMOVAL IS KEYED TO
|
|
2375
|
+
/// THE IDENTITY THIS CALL WAS HANDED AND TO NOTHING ELSE — not to the address and not to the function**
|
|
2376
|
+
/// (`§2.4` item 7 (b)'s dated narrowing: *"the deregistration is keyed by the identity and not by a count of
|
|
2377
|
+
/// entries"*), so at the CALLER-SPELLED DUPLICATE the surviving entry's own trigger still CARRIES the
|
|
2378
|
+
/// identity while the package invokes NOTHING for it: rule 1's declared silence (*"an unregistered handle
|
|
2379
|
+
/// fires nothing silently"*). **A LATER TRIGGER THAT CARRIES THE IDENTITY AND A SILENT INVOCATION ARE NOT
|
|
2380
|
+
/// IN CONFLICT** — *"the silence is the registry-entry removal rather than a second withdrawal"* — and the
|
|
2381
|
+
/// store-side half stays EXACTLY the store's own FIRST-MATCH withdrawal, which removes ONE home entry per
|
|
2382
|
+
/// call (`DD-42` clause (2)).
|
|
2383
|
+
function unlisten(instance, n, handle) {
|
|
1813
2384
|
const state = stateOf(instance);
|
|
1814
|
-
if (
|
|
2385
|
+
if (n < 1) return undefined;
|
|
1815
2386
|
const encoded = encodeHandle(state, handle);
|
|
1816
2387
|
if (encoded.k !== 'O') return undefined; // outside the domain: a no-op success, and the store is not reached
|
|
1817
2388
|
call(state, 'unlisten', [encoded]);
|
|
1818
|
-
//
|
|
1819
|
-
//
|
|
1820
|
-
//
|
|
2389
|
+
// **⟶ STEP 3 — THE DEREGISTRATION, TAKEN WHERE AND ONLY WHERE THE IDENTITY NO LONGER STANDS** — read
|
|
2390
|
+
// against the PACKAGE'S OWN HOME MIRROR rather than against a second store call, so the withdrawal's own
|
|
2391
|
+
// observable (ONE entry, the token's FIRST match, `DD-42` clause (2)) is the whole of what this call does
|
|
2392
|
+
// to the store:
|
|
2393
|
+
// * **THE ONE-ENTRY STATE** and the token's entries at NO OTHER address: this call withdrew the ONE entry
|
|
2394
|
+
// the identity named, **so the identity no longer stands anywhere** and the registry's entry is
|
|
2395
|
+
// REMOVED (`§2.4` item 7 (b) item 1, *"WITH NO QUALIFICATION"*; `§5.5`'s WITHDRAWN arm).
|
|
2396
|
+
// * **THE CALLER-SPELLED TWO-ADDRESS DUPLICATE** — the token named ONE entry at EACH of two addresses:
|
|
2397
|
+
// this call withdrew the ONE entry ITS OWN address held, **so THAT ADDRESS carries the identity no
|
|
2398
|
+
// more** and **the identity's registry entry is REMOVED**. A later trigger at the OTHER entry's address
|
|
2399
|
+
// still CARRIES the identity — the store's half, unmoved — **while the package invokes NOTHING for it,
|
|
2400
|
+
// which is rule 1's declared silence and not a second withdrawal** (`convenience.test.mjs`'s
|
|
2401
|
+
// `off_deregisters_…`; `ng_js_k`'s two-address arm).
|
|
2402
|
+
// * **THE CALLER-SPELLED ONE-ADDRESS DUPLICATE** — the token named MORE THAN ONE entry at the SAME
|
|
2403
|
+
// address (`DD-39`, `DD-42` clause (2)): this call withdrew ONE of them, the bucket's FIRST match,
|
|
2404
|
+
// **and the address STILL HOLDS the identity**, so **the registry's entry STANDS** and a later trigger
|
|
2405
|
+
// under that address STILL returns the identity WITH THE FUNCTION FIRING FOR IT — which is
|
|
2406
|
+
// `contract.md §5.5`'s THIRD added entry (*"the registry still fires that ONE identity ONCE, never once
|
|
2407
|
+
// per occurrence and never once per entry"*) and `§2.4` rule 4's own *"never the function"*.
|
|
2408
|
+
//
|
|
2409
|
+
// **⟶ AND THE ABSENCE ROUTE REMOVES THE REGISTRY ENTRY ONLY WHERE THE STORE GENUINELY WITHDREW THE
|
|
2410
|
+
// IDENTITY — CORRECTED 2026-10-17** (`§2.4` item 7 (b) item 1, *"WITH WITHDRAWAL"*, read with rules 1 and
|
|
2411
|
+
// 4 and item 7 (a) item 3's own *"leaves no store-side home entry"*). **THE DEFECT IT CLOSES, NAMED: the
|
|
2412
|
+
// shipped arm deleted the registry entry UNCONDITIONALLY whenever the token was absent from the mirror —
|
|
2413
|
+
// including for a call whose token the mirror never held at all (an identity the store holds nothing for),
|
|
2414
|
+
// where NOTHING was withdrawn and the registry is not this call's to touch.** **THE WITHDRAWAL IS NOW THE
|
|
2415
|
+
// PRECONDITION: the mirror held the token, and this call's own single-entry removal left no survivor
|
|
2416
|
+
// carrying it** — which is exactly the state in which *"the store has genuinely withdrawn the identity"*
|
|
2417
|
+
// is true, and it is the state the mirror can read because it holds one entry per store entry (see
|
|
2418
|
+
// `homeAddressKey` and `isLawfulListenerElement` above). **WHERE THE MIRROR HELD NOTHING, THIS CALL
|
|
2419
|
+
// REMOVES NOTHING AND THE REGISTRY STANDS**, which is the no-op success `§2.10` declares for a withdrawal
|
|
2420
|
+
// the store makes none of.
|
|
2421
|
+
const mirror = state.home.findIndex((entry) => entry.token === encoded.v);
|
|
2422
|
+
if (mirror === -1) return undefined;
|
|
2423
|
+
const key = state.home[mirror].key;
|
|
2424
|
+
state.home.splice(mirror, 1); // the store's own FIRST-match withdrawal, mirrored entry for entry
|
|
2425
|
+
if (state.home.some((entry) => entry.token === encoded.v && entry.key === key)) return undefined;
|
|
2426
|
+
state.registry.delete(handle);
|
|
1821
2427
|
return undefined;
|
|
1822
2428
|
}
|
|
1823
2429
|
|
|
@@ -2097,254 +2703,260 @@ function settleOn(state, record, supplied) {
|
|
|
2097
2703
|
// and contract directory untouched (`§2.1`'s dated clause (c); `A68`).
|
|
2098
2704
|
// ---------------------------------------------------------------------------------------------
|
|
2099
2705
|
|
|
2100
|
-
/// **THE
|
|
2101
|
-
///
|
|
2102
|
-
/// `
|
|
2103
|
-
///
|
|
2104
|
-
///
|
|
2706
|
+
/// **THE `on`/`off` ROUTE IS MERGED AWAY — `A127` (2026-10-16).** The combined `on(address, listener)`
|
|
2707
|
+
/// and the package-owned withdrawal `off(handle)`, together with their argument walks
|
|
2708
|
+
/// (`validateOnAddress`, `validateOnArguments`), their two step lists and `deregister`, are REMOVED FROM
|
|
2709
|
+
/// THIS FILE at that dated clause: the product's declared member set is the TWELVE `10 + 1 + 1 = 12` ✓.
|
|
2710
|
+
/// **THE LISTENER REGISTRATION ROUTE IS REACHED AS ITS TWO DECLARED HALVES** — `a.listen(address)` and
|
|
2711
|
+
/// `a.register(handle, listener)` — and withdrawal as `a.unlisten(handle)`. **NOTHING OF THE STORE'S OWN
|
|
2712
|
+
/// `listen`/`unlisten` MOVES** (`§2.10`: same names, same positions, same arity, same returns, and rule 4
|
|
2713
|
+
/// verbatim), and the ONE observable the removed route alone owned — `AddressMalformed` for an outside
|
|
2714
|
+
/// `handle` at `off`'s position — is declared away with it: `unlisten`'s own answer over an outside value
|
|
2715
|
+
/// stays the NO-OP SUCCESS `§2.3` item 4 / `PAR-JS-8` declares.
|
|
2716
|
+
|
|
2717
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2718
|
+
// THE POST-CREATION CONSTRAINT SET — `surface.md §2.12` items 1–5, `A126` (2026-10-16), AND ITS TWO ROUTES
|
|
2719
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2720
|
+
//
|
|
2721
|
+
// **TWO ROUTES POPULATE THE SET AND NEITHER SUBSTITUTES FOR THE OTHER**: the BATCH, which `storeCreate`
|
|
2722
|
+
// registers at `K-1` as it constructs (clause (b) above), and the ADD route's own argument. **THE ENTRY
|
|
2723
|
+
// CARRIES A PAIR IF AND ONLY IF A FUNCTION STANDS REGISTERED AT THAT PAIR IN THE KERNEL'S OWN PAIR-KEYED
|
|
2724
|
+
// REGISTRY** — so `state.constraints` is that registry's record and the ONE act both routes reach is
|
|
2725
|
+
// `carryConstraint` below. **NOTHING OF `§2.6` SURVIVES THE MOVEOUT**: the engine is behind this surface,
|
|
2726
|
+
// the constraint and repair limbs are the kernel's, and this file owns only the form of what crosses.
|
|
2727
|
+
|
|
2728
|
+
/// `parameter-semantics.md §2.17`'s dated clause, at this section's own sites: the two positions' own
|
|
2729
|
+
/// spelling, **read at the method's own arity — `pair` at `1` of `2` and `constraint` at `2` of `2`**, since
|
|
2730
|
+
/// the LEADING `instance` POSITION IS DROPPED by `§2.4` item 9 (f)'s `A127` clause (the receiver is not a
|
|
2731
|
+
/// position of any declared signature; `§2.12` item 3's one-spelling rule).
|
|
2105
2732
|
const ARGUMENT_POSITION_FIRST = 'first argument';
|
|
2106
2733
|
const ARGUMENT_POSITION_SECOND = 'second argument';
|
|
2107
2734
|
|
|
2108
|
-
///
|
|
2109
|
-
///
|
|
2110
|
-
///
|
|
2111
|
-
///
|
|
2112
|
-
///
|
|
2113
|
-
///
|
|
2114
|
-
///
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
///
|
|
2122
|
-
///
|
|
2123
|
-
///
|
|
2124
|
-
///
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
///
|
|
2128
|
-
///
|
|
2129
|
-
///
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
///
|
|
2135
|
-
///
|
|
2136
|
-
///
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
///
|
|
2145
|
-
///
|
|
2146
|
-
///
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2735
|
+
/// **THE KERNEL, RESOLVED ON THE FIRST CONSTRAINT ACT AND NEVER AT LOAD** (`kernel-surface.md §1` item 1;
|
|
2736
|
+
/// `A121`, `A122`). **IT IS NOT AN EXPORT AND NOT A SUBPATH**: the module is reached as a FILE, at the path
|
|
2737
|
+
/// the allowlist publishes it at. **AND THE RESOLUTION IS LAZY ON PURPOSE**: the entry must still LOAD where
|
|
2738
|
+
/// nothing is staged beside it — the publish and negative drives assemble trees carrying `index.mjs` alone
|
|
2739
|
+
/// — and a load-time import of `./src/` would make every one of those trees unable to reach the artefact
|
|
2740
|
+
/// they were built to drive. A drive that never carries and never asks for a constraint reaches no byte of
|
|
2741
|
+
/// the kernel.
|
|
2742
|
+
let KERNEL = null;
|
|
2743
|
+
function constraintsKernel() {
|
|
2744
|
+
if (KERNEL === null) KERNEL = require_('./src/constraint-kernel.mjs');
|
|
2745
|
+
return KERNEL;
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
/// `fail-surface.md §2` / `kernel-surface.md §2.2`'s `KC-1`…`KC-8`, read HERE for their ONE use: to tell a
|
|
2749
|
+
/// refusal the KERNEL raised from one a STORE VERB raised, so that `A120` (2) can be applied to the first
|
|
2750
|
+
/// and not to the second. **NO `KC` SPELLING CROSSES THIS SURFACE** (`§2.12` item 1's read-through clause:
|
|
2751
|
+
/// printed here it would be a second, unowned home for the kernel's own vocabulary).
|
|
2752
|
+
const KC_TOKENS = ['KC-1', 'KC-2', 'KC-3', 'KC-4', 'KC-5', 'KC-6', 'KC-7', 'KC-8'];
|
|
2753
|
+
|
|
2754
|
+
/// THE PAIR'S OWN KEY — `(address, id)`, the key the kernel's registry is keyed by (`kernel-surface.md §2.2`
|
|
2755
|
+
/// item 4). The address half is JSON's own spelling of the segment array, which is TOTAL over every address
|
|
2756
|
+
/// the pair's domain admits and collides across no two of them.
|
|
2757
|
+
function constraintPairKey(address, id) {
|
|
2758
|
+
return `${JSON.stringify(address)}\u0000${id}`;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
/// **THE ONE REFUSAL `§2.12` ITEM 4 DECLARES, TAKEN BEFORE ANY ACT AND LEAVING NOTHING CHANGED** — a JS
|
|
2762
|
+
/// `TypeError`, its `status` member ABSENT, no `message` member of this unit's own, **the store's closed
|
|
2763
|
+
/// `16`-member set neither minted nor widened, and the store reached by no call this refusal makes.**
|
|
2764
|
+
function constraintRefuse(where, value) {
|
|
2765
|
+
throw new TypeError(
|
|
2766
|
+
`the ${where} of this call is ${classSpelling(value)}, and it is not a value this position's domain `
|
|
2767
|
+
+ 'admits',
|
|
2768
|
+
);
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
/// **A POSITION BELOW THE DECLARED ONE — `§2.12` item 4 AND `§2.4` item 9 (f)'s RULE (ii): a SHORT ARITY
|
|
2772
|
+
/// TAKES THE SAME ONE `TypeError` AND CHANGES NOTHING.** *"No assertion is made over `message`, and its
|
|
2773
|
+
/// absence is the declared reading"* — the member is not one of the three this form is observed by.
|
|
2774
|
+
function constraintArity(verb) {
|
|
2775
|
+
throw new TypeError(`\`${verb}\` declares two positions, and this call supplied fewer`);
|
|
2776
|
+
}
|
|
2777
|
+
|
|
2778
|
+
/// **`§2.12` ITEM 4'S TWO CALLER POSITIONS, CLASS FIRST AND IN THEIR DECLARED ORDER** (`PAR-JS-22`–`PAR-JS-24`)
|
|
2779
|
+
/// — **the receiver, which was item 4's first position, is DROPPED and is judged by the CALL and no longer by
|
|
2780
|
+
/// a walk** (`§2.4` item 9 (f)'s `A127` clause): a member reached through the product IS a product of this
|
|
2781
|
+
/// factory, so no instance-domain arm stands here. **NOTHING BELOW RUNS UNLESS BOTH POSITIONS HAVE PASSED**
|
|
2782
|
+
/// (`A81`), so a refused call performs no store call, no registry write and no `K-1` — atomicity by the
|
|
2783
|
+
/// validation's POSITION.
|
|
2784
|
+
function constraintSite(verb, instance, supplied, pair, constraint) {
|
|
2785
|
+
if (supplied < 2) constraintArity(verb);
|
|
2786
|
+
const state = INSTANCES.get(instance);
|
|
2787
|
+
if (!isPlainObjectValue(pair)
|
|
2788
|
+
|| !Object.hasOwn(pair, 'address')
|
|
2789
|
+
|| pair.address === undefined) {
|
|
2790
|
+
constraintRefuse(`pair at the ${ARGUMENT_POSITION_FIRST} of \`${verb}\``, pair);
|
|
2158
2791
|
}
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
);
|
|
2792
|
+
const encoded = constraintAddress(pair.address);
|
|
2793
|
+
if (typeof encoded === 'string'
|
|
2794
|
+
|| !Object.hasOwn(pair, 'id')
|
|
2795
|
+
|| pair.id === undefined
|
|
2796
|
+
|| typeof pair.id !== 'string'
|
|
2797
|
+
|| pair.id === '') {
|
|
2798
|
+
constraintRefuse(`pair at the ${ARGUMENT_POSITION_FIRST} of \`${verb}\``, pair);
|
|
2167
2799
|
}
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
// CLASS, so `in` below reads an element of a genuine array and no chain.
|
|
2171
|
-
if (!(i in address)) {
|
|
2172
|
-
boundaryReject(
|
|
2173
|
-
'AddressMalformed',
|
|
2174
|
-
'an array with a hole',
|
|
2175
|
-
`the address at the ${ARGUMENT_POSITION_FIRST} of \`on\` is a sparse array, and an address is a dense array of segments`,
|
|
2176
|
-
);
|
|
2177
|
-
}
|
|
2178
|
-
const segment = address[i];
|
|
2179
|
-
// Rows 2–3: the two IN-DOMAIN classes — a string (the empty string included) and a non-negative
|
|
2180
|
-
// integer. **The integer test is taken on the value as it is and nothing is repaired**: `1.5`, `-1`,
|
|
2181
|
-
// `NaN` and `Infinity` are each refused as `a number`, which is the class the value HAS.
|
|
2182
|
-
//
|
|
2183
|
-
// **⟶ AND THE TWO CLASSES THIS PASS ADDED ARE DECIDED HERE TOO, BEFORE THE STORE IS REACHED — `C-4`'s
|
|
2184
|
-
// segment half and `C-12` (`2026-10-11`).** They are the same two decisions `encodeSegment` takes for
|
|
2185
|
-
// the other verbs' addresses, taken at this site's own position and with this site's own ARGUMENT
|
|
2186
|
-
// POSITION spelling, **so `on` and `listen` answer one address the same way and neither reaches the
|
|
2187
|
-
// carrier with a value it cannot spell**: a LONE SURROGATE in a string segment (row 1's dated clause —
|
|
2188
|
-
// the class has no Rust spelling and is refused *"at the PACKAGE's own edge, BEFORE any verb is
|
|
2189
|
-
// called"*, never repaired), and an INTEGRAL segment above the `u64` the carrier's `Index` variant
|
|
2190
|
-
// carries (`package.md §4.5` item 2's `JsSegment` row) — **which the facade's `n as u64` used to
|
|
2191
|
-
// SATURATE, folding `2**64` and `1e30` onto one store address and one handle (`C-12`).**
|
|
2192
|
-
if (typeof segment === 'string') {
|
|
2193
|
-
if (hasLoneSurrogate(segment)) {
|
|
2194
|
-
boundaryReject(
|
|
2195
|
-
'ValueNotAdmitted', // row 1's dated clause's own answer, carried and never minted (`DD-40`)
|
|
2196
|
-
// **THE TARGET IS THE SEGMENT POSITION'S OWN NAME AND NOT THE STRING**: a lone surrogate cannot
|
|
2197
|
-
// cross into the generator either — its bytes are not a `String` — so the failing TARGET is named
|
|
2198
|
-
// as `encodeSegment` names it at the same class (`'address'`), and the failing segment is named by
|
|
2199
|
-
// its INDEX beside it. **The class half is mandatory and it is carried; the failing VALUE is not
|
|
2200
|
-
// printed, because the only spellings for it are the caller's own unrepresentable code unit or a
|
|
2201
|
-
// REPAIR of it, and `§1.8` forbids the repair.**
|
|
2202
|
-
'address',
|
|
2203
|
-
`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`,
|
|
2204
|
-
);
|
|
2205
|
-
}
|
|
2206
|
-
continue;
|
|
2207
|
-
}
|
|
2208
|
-
if (typeof segment === 'number' && Number.isInteger(segment) && segment >= 0) {
|
|
2209
|
-
if (!Number.isSafeInteger(segment)) {
|
|
2210
|
-
boundaryReject(
|
|
2211
|
-
'AddressMalformed', // `AddressArg` row 8's own declared code, carried and never minted (`DD-40`)
|
|
2212
|
-
targetSpelling(segment),
|
|
2213
|
-
`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`,
|
|
2214
|
-
);
|
|
2215
|
-
}
|
|
2216
|
-
continue;
|
|
2217
|
-
}
|
|
2218
|
-
// Rows 7–10 + `§1.2`'s class set: every other class is refused AT THE BOUNDARY, inside the one form,
|
|
2219
|
-
// naming the failing SEGMENT — the target the item's own clause names — its class and the position.
|
|
2220
|
-
boundaryReject(
|
|
2221
|
-
'AddressMalformed',
|
|
2222
|
-
targetSpelling(segment),
|
|
2223
|
-
`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`,
|
|
2224
|
-
);
|
|
2800
|
+
if (typeof constraint !== 'function') {
|
|
2801
|
+
constraintRefuse(`constraint at the ${ARGUMENT_POSITION_SECOND} of \`${verb}\``, constraint);
|
|
2225
2802
|
}
|
|
2226
|
-
return
|
|
2803
|
+
return { state, address: encoded.s, id: pair.id };
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
/// **THE ONE ACT THAT MAKES A PAIR A PAIR THE ENTRY CARRIES** (`§2.12` item 1's preamble clause (a)–(b)):
|
|
2807
|
+
/// `K-1` AT THE INSTANCE — the key at its own positions and the caller's function at the fourth, which is
|
|
2808
|
+
/// the SAME call `storeCreate`'s batch registration makes — and THE ENTRY'S OWN RECORD BESIDE IT, whose
|
|
2809
|
+
/// `enabled` member is the pair's state and whose `identity` is THE PAIR'S OWN OPAQUE VALUE (`PAR-JS-25`).
|
|
2810
|
+
/// **THE IDENTITY IS MINTED ONCE PER PAIR AND IT CARRIES NO READABLE MEMBER**: a second ADD at the same pair
|
|
2811
|
+
/// overwrites the element and answers THIS SAME VALUE, and two pairs answer two values. **`PAR-JS-25`'s
|
|
2812
|
+
/// opacity is the observable** — *"it has no own enumerable member at all"* — so it is a null-prototype
|
|
2813
|
+
/// object and NOT the entry record: every datum above stays the entry's own and never crosses.
|
|
2814
|
+
function carryConstraint(state, instance, address, id, constraint) {
|
|
2815
|
+
constraintsKernel().register(instance, address, id, constraint);
|
|
2816
|
+
const entry = {
|
|
2817
|
+
address,
|
|
2818
|
+
addressKey: JSON.stringify(address),
|
|
2819
|
+
id,
|
|
2820
|
+
fn: constraint,
|
|
2821
|
+
enabled: true,
|
|
2822
|
+
identity: Object.create(null),
|
|
2823
|
+
};
|
|
2824
|
+
state.constraints.set(constraintPairKey(address, id), entry);
|
|
2825
|
+
return entry;
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
/// **THE DISABLED PAIR'S STANDING ELEMENT** — a function that PASSES (`kernel-surface.md §2.3` item 1:
|
|
2829
|
+
/// `true` is the only pass value). **THE ELEMENT IS PARKED AND NEVER WITHDRAWN**: `constraintOn` re-registers
|
|
2830
|
+
/// `entry.fn`, so *"it is the element the entry carried at that pair — never a second constraint and never a
|
|
2831
|
+
/// re-registration"* (`§2.12` item 3's `constraintOn` row).
|
|
2832
|
+
function constraintParked() {
|
|
2833
|
+
return true;
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
/// **A WELL-FORMED PAIR THE ENTRY DOES NOT CARRY — `§2.12` item 3's second answered question and
|
|
2837
|
+
/// `PAR-JS-24`'s second declared answer: at EITHER toggle, in EITHER direction, an OUTSIDE VALUE taking
|
|
2838
|
+
/// item 4's refusal, ONE THROWN `TypeError`, THE ENTRY NOT WIDENED.** It is NOT a third population route:
|
|
2839
|
+
/// were the entry widened with the function the refused call carried, a pair would stand ENABLED WITH NO
|
|
2840
|
+
/// FUNCTION — a state no clause of that directory declares.
|
|
2841
|
+
function constraintUncarried(verb, pair) {
|
|
2842
|
+
throw new TypeError(
|
|
2843
|
+
`the pair at the ${ARGUMENT_POSITION_FIRST} of \`${verb}\` carries no constraint in this instance, and `
|
|
2844
|
+
+ 'a toggle names a pair the entry carries',
|
|
2845
|
+
);
|
|
2227
2846
|
}
|
|
2228
2847
|
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
function
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
`the listener at the ${ARGUMENT_POSITION_SECOND} of \`on\` is ${classSpelling(listener)}, and a listener is a JS function`,
|
|
2246
|
-
);
|
|
2848
|
+
/**
|
|
2849
|
+
* **`§2.12` ITEM 2 (a): `addConstraint(pair, constraint) -> constraint identity` — THE ADD ROUTE, WHICH
|
|
2850
|
+
* CARRIES THE FUNCTION.**
|
|
2851
|
+
*
|
|
2852
|
+
* **ITS TARGET STATE AT THE PAIR IS *"the pair's element IS the supplied `constraint`, whether the pair was
|
|
2853
|
+
* HELD or NOT"*, AND THE HELD ARM IS AN OVERWRITE AND NOT A THROW**: *"where the pair was already held, the
|
|
2854
|
+
* supplied constraint OVERWRITES the held one … and the call REFUSES NOTHING and THROWS NOTHING for the mere
|
|
2855
|
+
* fact that the pair was held"* — the SAME identity the pair was already added under is returned, and it is
|
|
2856
|
+
* THE IDENTITY AND NOT THE ENTRY RECORD (`PAR-JS-25`'s opacity, `carryConstraint` above).
|
|
2857
|
+
*/
|
|
2858
|
+
function addConstraint(instance, n, pair, constraint) {
|
|
2859
|
+
const site = constraintSite('addConstraint', instance, n, pair, constraint);
|
|
2860
|
+
const key = constraintPairKey(site.address, site.id);
|
|
2861
|
+
const held = site.state.constraints.get(key);
|
|
2862
|
+
if (held === undefined) {
|
|
2863
|
+
return carryConstraint(site.state, instance, site.address, site.id, constraint).identity;
|
|
2247
2864
|
}
|
|
2865
|
+
constraintsKernel().register(instance, site.address, site.id, constraint);
|
|
2866
|
+
held.fn = constraint;
|
|
2867
|
+
held.enabled = true;
|
|
2868
|
+
return held.identity;
|
|
2248
2869
|
}
|
|
2249
2870
|
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
const handle = listen(instance, address);
|
|
2274
|
-
// STEP 3 — REGISTER. `§2.4` rule 2 at the registry that holds the function: ONE identity, ONE function.
|
|
2275
|
-
state.registry.set(handle, listener);
|
|
2276
|
-
return handle;
|
|
2277
|
-
}
|
|
2278
|
-
|
|
2279
|
-
/// **`off(handle) -> undefined`** — `surface.md §2.4` item 7 (b), ITS THREE STEPS IN THEIR ONE FIXED ORDER,
|
|
2280
|
-
/// AND `DD-54`'s ONE OBSERVABLE: **after any `off` that throws, BOTH the store-side entry and the registry
|
|
2281
|
-
/// entry are exactly as they were.**
|
|
2282
|
-
/// ```
|
|
2283
|
-
/// 1. VALIDATE the handle against THIS INSTANCE's own handle domain, class first, never repaired
|
|
2284
|
-
/// 2. UNLISTEN the store's own unlisten(instance, handle) — the same declared verb, unchanged
|
|
2285
|
-
/// 3. DEREGISTER the package's own registry entry for that identity, and NOTHING ELSE
|
|
2286
|
-
/// ```
|
|
2287
|
-
/// **AND ITS THREE ARMS, EACH WITH ITS OBSERVABLE** (item 7 (b)'s own table):
|
|
2288
|
-
/// * **THE OWN ARM** — an in-domain identity the registry holds a function for: the store-side home entry
|
|
2289
|
-
/// is withdrawn, the registry's entry for that identity is REMOVED, and `undefined` is returned.
|
|
2290
|
-
/// * **THE OWN-ENTRYLESS ARM** — an in-domain identity the registry holds NO function for (registered
|
|
2291
|
-
/// never, or already withdrawn): `undefined`, the store-side withdrawal IS performed, nothing is
|
|
2292
|
-
/// removed that was not there and NO OTHER REGISTRATION IS DISTURBED (`DD-53`: `off`'s refusal arm is
|
|
2293
|
-
/// the OUTSIDE-DOMAIN handle ALONE).
|
|
2294
|
-
/// * **THE OUTSIDE ARM** — a foreign instance's value, a prior session's value, a fabricated value, a bare
|
|
2295
|
-
/// `string`, a blank token, a non-opaque value, `null`, `undefined` or an ABSENT argument: **a REFUSAL**
|
|
2296
|
-
/// — `AddressMalformed` in `§2.5`'s single form, with the failing target, the class and the position —
|
|
2297
|
-
/// **and NEITHER removal is performed.** **THIS is the arm that makes `off` differ from `unlisten` over
|
|
2298
|
-
/// one value, and the difference is DECLARED and not incidental** (`§2.3`'s dated clause 3; `§2.8`).
|
|
2299
|
-
///
|
|
2300
|
-
/// **`unlisten` ITSELF IS UNTOUCHED AND KEEPS RULE 4 VERBATIM**: it withdraws the registration and NEVER the
|
|
2301
|
-
/// function, with the registry's entry STANDING. `off` is the PACKAGE-OWNED verb that removes one, and a
|
|
2302
|
-
/// reader who takes it as an exception to rule 4 has read a second withdrawal into the store's surface —
|
|
2303
|
-
/// there is none. **AND `off` REMOVES NO MORE THAN THE HANDLE NAMES**: a lawful sibling registration —
|
|
2304
|
-
/// another address's entry, another identity in the same instance — STANDS. **AND NEITHER IT NOR `on` IS A
|
|
2305
|
-
/// RELEASE VERB** (`A74`): no `dispose()`, no `close()`, no finalizer and no teardown is declared here, and
|
|
2306
|
-
/// the instance's state is still released with the instance and by nothing else.
|
|
2307
|
-
///
|
|
2308
|
-
/// **AND `off` DOES NOT CANCEL A DELIVERY IN FLIGHT**, because the delivery's recipient set is read when the
|
|
2309
|
-
/// window opens (item 7 (b); `§2.4`'s `CF-DUP-3` re-homing clause; `write-and-read.md §6.5` item 14).
|
|
2310
|
-
function offAt(state, instance, handle) {
|
|
2311
|
-
// STEP 1 — VALIDATE. An outside value is refused HERE, and steps 2 and 3 never run (`DD-54`).
|
|
2312
|
-
const encoded = encodeHandle(state, handle);
|
|
2313
|
-
if (encoded.k !== 'O') {
|
|
2314
|
-
// The ONE form, with the failing TARGET printed as its own value (item 5 (a)), the CLASS the value HAS
|
|
2315
|
-
// (item 5 (b), mandatory) and the ARGUMENT POSITION (`§2.17`'s dated clause, `1` of `2`) — **and NOT
|
|
2316
|
-
// `unlisten`'s no-op `undefined`, which is that verb's own declared answer and not this one's.**
|
|
2317
|
-
boundaryReject(
|
|
2318
|
-
'AddressMalformed', // `§2.8`'s own declared code at this site, carried and never minted (`DD-40`)
|
|
2319
|
-
targetSpelling(handle),
|
|
2320
|
-
`the handle at the ${ARGUMENT_POSITION_FIRST} of \`off\` is ${classSpelling(handle)}, and it is not an opaque value THIS INSTANCE minted or adopted`,
|
|
2321
|
-
);
|
|
2871
|
+
/**
|
|
2872
|
+
* **`§2.12` ITEM 2 (a): `constraintOn(pair, constraint) -> undefined` / `constraintOff(pair, constraint) ->
|
|
2873
|
+
* undefined` — THE TWO HALVES OF THE ONE TOGGLE, AND NEITHER STANDS IN THE KERNEL.**
|
|
2874
|
+
*
|
|
2875
|
+
* **THEIR THREE ANSWERS, AND THE TWO SHARED CLAUSES:**
|
|
2876
|
+
* * **IDEMPOTENT SUCCESS WHERE THE PAIR ALREADY STANDS IN THE STATE IT ASKS FOR** (item 3's first answered
|
|
2877
|
+
* question): `undefined`, the pair and its element EXACTLY as they stood, and NOTHING THROWN.
|
|
2878
|
+
* * **THE SECOND POSITION IS REQUIRED AND IS A NO-OP ON EVERY SUCCESS** (`item 3`'s `constraintOn` row;
|
|
2879
|
+
* `§2.4` item 9 (f)'s method table: *"the third position is REQUIRED and is a no-op on success"*): a
|
|
2880
|
+
* FUNCTION there is never refused on the pair's ground, the entry NEVER SUBSTITUTES ONE, and it is
|
|
2881
|
+
* `entry.fn` — the element the entry carried — that is evaluated at the next write. **CARRIAGE IS
|
|
2882
|
+
* PAIR-KEYED AND THE TOGGLE'S OWN ARGUMENTS DO NOT DECIDE IT.**
|
|
2883
|
+
* * **AN OUTSIDE `pair` OR A SHORT ARITY TAKES `constraintSite`'s ONE `TypeError`**, and a WELL-FORMED PAIR
|
|
2884
|
+
* THE ENTRY DOES NOT CARRY takes `constraintUncarried`'s (`A126`).
|
|
2885
|
+
*/
|
|
2886
|
+
function constraintToggle(enabled, instance, n, pair, constraint) {
|
|
2887
|
+
const verb = enabled ? 'constraintOn' : 'constraintOff';
|
|
2888
|
+
const site = constraintSite(verb, instance, n, pair, constraint);
|
|
2889
|
+
const entry = site.state.constraints.get(constraintPairKey(site.address, site.id));
|
|
2890
|
+
if (entry === undefined) constraintUncarried(verb, pair);
|
|
2891
|
+
if (entry.enabled !== enabled) {
|
|
2892
|
+
constraintsKernel().register(instance, site.address, site.id, enabled ? entry.fn : constraintParked);
|
|
2893
|
+
entry.enabled = enabled;
|
|
2322
2894
|
}
|
|
2323
|
-
// STEP 2 — UNLISTEN. The store's own verb through the ONE declared `unlisten` spelling (`§2.10`), reached
|
|
2324
|
-
// with the handle this instance already owns. **A THROWING PATH LEAVES THE REGISTRY ENTRY STANDING**
|
|
2325
|
-
// (`DD-54`): there is no `finally` here and none may be added.
|
|
2326
|
-
unlisten(instance, handle);
|
|
2327
|
-
// STEP 3 — DEREGISTER, the PACKAGE'S OWN state and nothing of the store's.
|
|
2328
|
-
deregister(state, handle);
|
|
2329
2895
|
return undefined;
|
|
2330
2896
|
}
|
|
2331
2897
|
|
|
2332
|
-
/// **
|
|
2333
|
-
///
|
|
2334
|
-
///
|
|
2335
|
-
///
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2898
|
+
/// **WHETHER THIS INSTANCE CARRIES A PAIR AT THIS WRITE'S ADDRESS** (`§2.12` item 1's preamble clause (a)) —
|
|
2899
|
+
/// the gate stage 1 takes before the kernel is reached at all. **THE CLASS DECISION COMES FIRST AND NO TRAP
|
|
2900
|
+
/// IS RUN ON ANY PATH** (`DD-34`): a `Proxy` address, a class extending `Array` and every non-array lies
|
|
2901
|
+
/// outside every pair's own address domain, so no pair of this entry can stand at one.
|
|
2902
|
+
function carriesConstraintAt(state, address) {
|
|
2903
|
+
if (state.constraints.size === 0) return false;
|
|
2904
|
+
if (types.isProxy(address) || !isAdmittedArray(address)) return false;
|
|
2905
|
+
const key = JSON.stringify(address);
|
|
2906
|
+
for (const entry of state.constraints.values()) {
|
|
2907
|
+
if (entry.addressKey === key) return true;
|
|
2908
|
+
}
|
|
2909
|
+
return false;
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
/**
|
|
2913
|
+
* **THE KERNEL-DRIVEN WRITE — `§2.12` ITEM 1'S FIVE STAGES, TAKEN IN THEIR ONE ORDER.**
|
|
2914
|
+
* ```
|
|
2915
|
+
* 1. K-2 the attempt is opened at this address, or the address's own live attempt is JOINED
|
|
2916
|
+
* 2. the store leg the kernel's own call on this entry's `write`, FIVE POSITIONS, the record
|
|
2917
|
+
* identity its fifth position carries — so the delivery of that write's handles
|
|
2918
|
+
* is WITHHELD here and owed to stage 5
|
|
2919
|
+
* 3. K-3 the pass: every pair registered at this address, each against this op's own value
|
|
2920
|
+
* 4. K-3 the attempt's terminal arm — the pass's, or the floor's where a save failed
|
|
2921
|
+
* 5. settle the residue the record's `pending` carries, delivered at instant (b), failing arm alone
|
|
2922
|
+
* ```
|
|
2923
|
+
* **THE CALLER MEETS A THROW INSTEAD OF A RETURN ON THE FAILING ARM, AND THE STORE'S OWN VERB PRODUCED
|
|
2924
|
+
* NEITHER FORM** (`§1.2` item 2): see `constraintCrossing` for what crosses.
|
|
2925
|
+
*/
|
|
2926
|
+
function constraintWrite(state, instance, address, tier, value) {
|
|
2927
|
+
const kernel = constraintsKernel();
|
|
2928
|
+
let record;
|
|
2929
|
+
try {
|
|
2930
|
+
record = kernel.commit(instance, address, tier, value);
|
|
2931
|
+
} catch (refusal) {
|
|
2932
|
+
constraintCrossing(refusal);
|
|
2933
|
+
}
|
|
2934
|
+
const answer = state.leg;
|
|
2935
|
+
try {
|
|
2936
|
+
kernel.runAttempt(instance, record);
|
|
2937
|
+
} catch (refusal) {
|
|
2938
|
+
constraintCrossing(refusal);
|
|
2939
|
+
}
|
|
2940
|
+
return answer;
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2943
|
+
/// **THE FAIL ARM'S CROSSING — `A120` (2): THE ENTRY CARRIES THE KERNEL'S TOKEN, THE THROW KEEPS THE
|
|
2944
|
+
/// STORE'S.** `§2.12` item 1's read-through clause fixes what crosses here: **A PLAIN OBJECT OF EXACTLY THE
|
|
2945
|
+
/// TWO MEMBERS `status` AND `message`, `status` A STRING DRAWN FROM THE STORE'S CLOSED `16`-MEMBER SET, the
|
|
2946
|
+
/// kernel's third member `log` ABSENT AND UNREACHABLE.** The member `status` carries is the store's
|
|
2947
|
+
/// `FileCommitFailed`, because no caller-side status can carry a `KC` token and a constraint-refused write
|
|
2948
|
+
/// is a commit that did not stand. **A STORE VERB'S OWN REFUSAL CROSSES VERBATIM AND UNCONVERTED** (`§1.2`).
|
|
2949
|
+
function constraintCrossing(refusal) {
|
|
2950
|
+
const status = refusal !== null && typeof refusal === 'object' ? refusal.status : undefined;
|
|
2951
|
+
if (typeof status !== 'string' || KC_TOKENS.includes(status) === false) throw refusal;
|
|
2952
|
+
throw {
|
|
2953
|
+
status: 'FileCommitFailed',
|
|
2954
|
+
message: typeof refusal.message === 'string'
|
|
2955
|
+
? refusal.message
|
|
2956
|
+
: 'the write was refused by a constraint of this attempt',
|
|
2957
|
+
};
|
|
2347
2958
|
}
|
|
2348
2959
|
|
|
2349
|
-
//
|
|
2350
|
-
|
|
2960
|
+
// **THE MODULE NAMESPACE CARRIES ONE NAME, `storeCreate` ALONE** (`surface.md §2.9` item 1's `A127` clause;
|
|
2961
|
+
// `11 → 1` ✓): `delete`'s reserved-word spelling, the ten store-reaching names and the three constraint
|
|
2962
|
+
// functions are the product's own members above and have no export and no second spelling at any layer.
|