provident-storeroom 1.12.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,24 @@
1
1
  // `D-2` (`docs/L1/entry-subdivision.md` §1 part `5`; the split is `D-33`'s) — bytes moved from `bindings/js/index.mjs`; no logic changed.
2
- import { types } from 'node:util';
3
- import { boundaryReject } from './artefact.mjs';
2
+ // **⟶ AND THE `Proxy` PREDICATE IS THE INSTALLED CLASS-DECISION INSTRUMENT FROM 2026-11-17** (`D-156` item 1 and
3
+ // the loader split's row for these five parts, `docs/L3/wasm-realm/design.md` §5: the host import line is *"swapped
4
+ // for a local helper"* — **neutralised**, conditional on that design's §4 instrument). **`isProxyOf` IS
5
+ // `class-instrument.mjs`'s one predicate and this file carries no host specifier for the class decision any more**:
6
+ // every site below takes the answer `util.types.isProxy` gave, because **the NODE entry installs `types.isProxy`
7
+ // ITSELF at load** (`index.mjs`, at the head of the module), and on the other arm the instrument is
8
+ // `structuredClone` while **the ANSWER does not move** (`D-156` item 1: the refusal stays rank-neutral and
9
+ // class-for-class what this arm answers). **NO DECISION, NO ORDER AND NO ANSWER OF THIS FILE MOVES** — only the
10
+ // predicate's name and its home.
11
+ // **⟶ AND THE CARRIER PREDICATE JOINS THE IMPORT FROM 2026-11-17 — `D-167`.** `class-instrument.mjs` holds two
12
+ // answers now: `isProxyOf` is THE DATA QUESTION (*does this value enter the Rust store?* — the `structuredClone`
13
+ // probe on the WASM arm) and `isProxyOfCarrier` is THE CARRIER QUESTION (*is this the package's own `cfg` /
14
+ // listeners / constraints carrier?* — `false` on that arm, with the declaration at the predicate itself).
15
+ // **EVERY `isProxyOf` SITE BELOW KEEPS ITS ANSWER BYTE-FOR-BYTE**: each is about a value's class or a value's
16
+ // PROTOTYPE LINK, and a link is data. **THE CARRIER ANSWER IS TAKEN BY ONE PREDICATE AND ONE ONLY** —
17
+ // `isPlainObjectCarrier` below, the carrier-shaped sibling of `isPlainObjectValue`, whose one reader is
18
+ // `frame.mjs`'s `encodeConfig`. **The split cannot live inside the shared predicate** (`isPlainObjectValue`
19
+ // classifies both carriers and values), so it lives at the call.
20
+ import { isProxyOf, isProxyOfCarrier } from './class-instrument.mjs';
21
+ import { boundaryReject } from './addon-slot.mjs';
4
22
  import { appendOwn } from './refusal.mjs';
5
23
 
6
24
  // ⟶ CARVED UP 2026-10-24 (`D-2`/`D-33`): `inDomainAddress` and `isLawfulListenerElement`, with the doc blocks that
@@ -286,7 +304,15 @@ function referenceSet(standardMembers, liveCensus, allowance) {
286
304
  /// reached.** Where a spend is refused this predicate answers `false`, i.e. **"not a standard shape"**: the
287
305
  /// conservative direction, since the class answer is `'class'` and the render guard keeps walking instead of
288
306
  /// exempting a link whose census it could not pay for.
289
- function isStandardObjectPrototype(proto, allowance) {
307
+ /// **⟶ AND WHICH PREDICATE THE LINK IS ASKED OF IS THE CALLER'S FROM 2026-11-17 — `D-167`.** The link test is
308
+ /// `linkInstrument`'s answer, **defaulting to `isProxyOf`, so every existing caller is byte-unmoved**; the carrier
309
+ /// sibling below passes `isProxyOfCarrier` instead, because the object whose prototype link is being read THERE is
310
+ /// the package's `cfg` and not a value (the split lives at the call and this is the one place the call has to
311
+ /// reach one link deeper). **ON THE NODE ARM THE TWO ARE THE SAME FUNCTION, so the parameter moves nothing there;
312
+ /// on the WASM arm it is the whole of what makes the carrier gate answer "not a `Proxy`" without reading a member
313
+ /// the API does not declare** — the declaration and its price are at `class-instrument.mjs`'s
314
+ /// `isProxyOfCarrier`.
315
+ function isStandardObjectPrototype(proto, allowance, linkInstrument = isProxyOf) {
290
316
  if (proto === null) return false;
291
317
  // **⟶ `contract.md §2`'s clause of 2026-10-24 on `F-RA-12`, item `(6)(a)`: A PROTOTYPE LINK THAT IS A
292
318
  // `Proxy` — INCLUDING A REVOKED ONE — IS `false`, WITH NO TRAP RUN AND BEFORE ANY CENSUS READ OF IT.** A
@@ -296,7 +322,7 @@ function isStandardObjectPrototype(proto, allowance) {
296
322
  // and invokes no handler, and a shape the package may not read is not a shape the value carries. **THE
297
323
  // GROUND IS `§1`'s OWN** — this guard covers `protoClass`'s whole census path, `arrayClass`'s chain link
298
324
  // and `isLanguageStandardPrototype`'s `above` read, so no limb and no conversion test reads a proxy link.
299
- if (types.isProxy(proto)) return false;
325
+ if (linkInstrument(proto)) return false;
300
326
  let names;
301
327
  try {
302
328
  if (!spendGuardRead(allowance, 1)) return false; // ONE `getPrototypeOf` CALL — item `(4c)(ii)`
@@ -351,10 +377,17 @@ function isStandardObjectPrototype(proto, allowance) {
351
377
  /// admitted, and unmoved by this clause — and `proto === Object.prototype ? 'plain' : 'foreign'` LABELS an
352
378
  /// admitted value's classification and decides NO admission (`§1`'s item `(5)`); a verdict that turned on it
353
379
  /// would be the removed test under another name.
354
- export function protoClass(value) {
380
+ /// **⟶ AND ITS LINK TEST IS A PARAMETER FROM 2026-11-17 (`D-167`), DEFAULTING TO `isProxyOf`** — the data
381
+ /// question, which is what every existing caller asks. `isPlainObjectCarrier` below — the one carrier-shaped
382
+ /// reader — passes `isProxyOfCarrier`, so the object whose link is read there is classified as the carrier it is
383
+ /// and not as a value. **NO CENSUS, NO TERMINALITY TEST AND NO `'class'` ANSWER MOVES**: only which predicate is
384
+ /// asked of the one link.
385
+ export function protoClass(value, linkInstrument = isProxyOf) {
355
386
  const proto = Object.getPrototypeOf(value);
356
387
  if (proto === null) return 'null';
357
- return isStandardObjectPrototype(proto) ? (proto === Object.prototype ? 'plain' : 'foreign') : 'class';
388
+ return isStandardObjectPrototype(proto, undefined, linkInstrument)
389
+ ? (proto === Object.prototype ? 'plain' : 'foreign')
390
+ : 'class';
358
391
  }
359
392
 
360
393
  /// `crossing.md §1.4` item 4 (c), (d) and item 1: an own ACCESSOR, or an own `Symbol`-keyed property,
@@ -416,7 +449,7 @@ export function arrayClass(value, allowance) {
416
449
  // THEREFORE BEFORE EVERY CENSUS READ BELOW.** The limb answers `'class'` and not a boolean, so the guard
417
450
  // is spelled here as well as in `isStandardObjectPrototype` above; `util.types.isProxy` reads no member,
418
451
  // runs no trap and throws for no revoked link.
419
- if (types.isProxy(proto)) return 'class';
452
+ if (isProxyOf(proto)) return 'class';
420
453
  let names;
421
454
  let symbols;
422
455
  let above;
@@ -491,10 +524,41 @@ export function isAdmittedArray(value) {
491
524
  /// ANY REALM IS ACCEPTED** — the (e)-half is structural, never an identity test (`DD-7`, `DD-35`).
492
525
  export function isPlainObjectValue(value) {
493
526
  if (value === null || typeof value !== 'object') return false;
494
- if (Array.isArray(value) || types.isProxy(value)) return false;
527
+ if (Array.isArray(value) || isProxyOf(value)) return false;
495
528
  return protoClass(value) !== 'class';
496
529
  }
497
530
 
531
+ /// **⟶ THE CARRIER-SHAPED SIBLING — `D-167`, ADDED 2026-11-17. THE SAME PREDICATE WITH THE ONE PREDICATE MOVED:**
532
+ /// the same own-data census (`Array.isArray`, the prototype-link rule below) and **`isProxyOfCarrier` asked of the
533
+ /// value AND of its link**, where `isPlainObjectValue` above asks `isProxyOf` of both.
534
+ ///
535
+ /// **IT EXISTS BECAUSE THE SPLIT CANNOT LIVE INSIDE ITS SIBLING.** `isPlainObjectValue` is SHARED: it classifies
536
+ /// `cfg` (a carrier) at `frame.mjs`'s `encodeConfig` and it classifies values (data) at the verbs' walks, so a
537
+ /// decision taken inside it would move the value crossing with the carrier gate. **THE DECISION IS THEREFORE AT
538
+ /// THE CALL, AND THIS IS THE CALL'S OWN COPY OF IT** — one reader, `frame.mjs`'s `encodeConfig`, and no other.
539
+ ///
540
+ /// **WHAT MOVES AND WHAT DOES NOT, ON EACH ARM:**
541
+ /// * **On the Node arm: NOTHING.** `isProxyOfCarrier` is `types.isProxy` there — precise, handler-free, exact —
542
+ /// so this predicate answers byte-for-byte what its sibling answers, and every Node cell that hands a `Proxy`
543
+ /// a `cfg` keeps its refusal, its form and its message (`NG-JS-*`, `F-RA-12`, `DD-34`).
544
+ /// * **On the WASM arm: THE ONE THING THAT LETS THE ARM CONSTRUCT A STORE.** The sibling's `isProxyOf` is
545
+ /// `structuredClone`, which throws for BOTH a `Proxy` AND any object carrying a function — and `cfg` carries
546
+ /// functions by definition (`cfg.saveCall`, a listener's `listener`, a constraint's `constraint`) — so the
547
+ /// shared predicate refused every `cfg` the arm exists for (`D-166`, measured: `storeCreate(bindings,
548
+ /// { journalLength, listeners: [], saveCall })` answered `AddressMalformed`). **`isProxyOfCarrier` answers
549
+ /// `false` for every value there, and the declaration and its price are stated at that predicate**
550
+ /// (`class-instrument.mjs`): **a `Proxy` at a carrier gate is NOT DETECTED on that arm.**
551
+ ///
552
+ /// **THE CENSUS IS THE SIBLING'S AND IS NOT RE-DERIVED**: `null` and every non-object `false` · an `Array`
553
+ /// `false` · the value's class through the SAME `protoClass` link rule · a class instance or another
554
+ /// prototype-carrying object `false` (`§1.4` item 4 (e)–(g)). **No member is read, no accessor runs and no
555
+ /// `Object.keys` is taken here** — the `cfg` gate's own reads happen after it, by `Object.hasOwn` (`A76`/`JS-5`).
556
+ export function isPlainObjectCarrier(value) {
557
+ if (value === null || typeof value !== 'object') return false;
558
+ if (Array.isArray(value) || isProxyOfCarrier(value)) return false;
559
+ return protoClass(value, isProxyOfCarrier) !== 'class';
560
+ }
561
+
498
562
  /// **THE CLASS THAT FAILED, SPELLED FOR THE VERBOSE REJECTION** (`A76`: *"the rejection names the failing
499
563
  /// target and the reason"*; `surface.md §2.5` item 5 (b): *"the reason is the CLASS the value HAS — named as
500
564
  /// `§1.2`'s or `§1.3`'s own class, never as a class the value could be converted to"*). **IT READS NO
@@ -505,7 +569,7 @@ export function classSpelling(value) {
505
569
  if (value === undefined) return 'undefined';
506
570
  const kind = typeof value;
507
571
  if (kind !== 'object' && kind !== 'function') return `a ${kind}`;
508
- if (types.isProxy(value)) return 'a Proxy';
572
+ if (isProxyOf(value)) return 'a Proxy';
509
573
  if (Array.isArray(value)) return arrayClass(value) === 'class' ? 'a class extending Array' : 'an Array';
510
574
  if (kind === 'function') return 'a function';
511
575
  return protoClass(value) === 'class'
@@ -550,7 +614,7 @@ export function targetSpelling(value) {
550
614
  // class and the renderer's `typeof` split is not a fact about it. Nothing else at this renderer moves: the
551
615
  // `bigint` limb, `String(value)`, the `try` and the `catch` all stand, and no identity is compared and no
552
616
  // prototype is frozen (`C-11` is untouched).
553
- if ((typeof value === 'object' || typeof value === 'function') && value !== null && types.isProxy(value)) {
617
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null && isProxyOf(value)) {
554
618
  return classSpelling(value);
555
619
  }
556
620
  return String(value);
@@ -759,7 +823,7 @@ function isLanguageStandardPrototype(link, allowance) {
759
823
  function carriesConversionMember(value, allowance) {
760
824
  if (value === null || (typeof value !== 'object' && typeof value !== 'function')) return false;
761
825
  try {
762
- if (types.isProxy(value)) return true;
826
+ if (isProxyOf(value)) return true;
763
827
  if (ownsConversionMember(value, allowance)) return true;
764
828
  if (!spendGuardRead(allowance, 1)) return true; // the `getPrototypeOf` read below — item `(4c)(ii)`
765
829
  let link = Object.getPrototypeOf(value);
@@ -768,7 +832,7 @@ function carriesConversionMember(value, allowance) {
768
832
  // ONE POSITION PER LINK ENTERED (item `(1c)`), charged BEFORE the read that reached the link, so no
769
833
  // chain can be entered unpaid and exhaustion answers "caller code is reachable".
770
834
  if (!spendGuardPosition(allowance, 1)) return true;
771
- if (types.isProxy(link)) return true;
835
+ if (isProxyOf(link)) return true;
772
836
  // ITEM `(1a)`'S READ — ONE KEY, OWN, BY DESCRIPTOR (so no getter is called), BEFORE THE STOP.
773
837
  if (!spendGuardRead(allowance, 1)) return true; // ONE descriptor read — item `(4c)(i)`
774
838
  if (Object.getOwnPropertyDescriptor(link, Symbol.toPrimitive) !== undefined) return true;
@@ -815,7 +879,7 @@ function carriesConversionMember(value, allowance) {
815
879
  function carriesTagMember(value, allowance) {
816
880
  if (value === null || (typeof value !== 'object' && typeof value !== 'function')) return false;
817
881
  try {
818
- if (types.isProxy(value)) return true; // a descriptor read on a `Proxy` would run a trap
882
+ if (isProxyOf(value)) return true; // a descriptor read on a `Proxy` would run a trap
819
883
  // **⟶ AND EVERY READ IS CHARGED, AS THE SIBLING WALK'S ARE** (`contract.md §2.1`'s clause of 2026-10-24 on
820
884
  // `F7-2`, items `(4c)` and `(4e)`): each `@@toStringTag` descriptor read is `1` and each `getPrototypeOf`
821
885
  // call is `1`; a refused spend answers `true` (the WITH branch, the class spelling).
@@ -826,7 +890,7 @@ function carriesTagMember(value, allowance) {
826
890
  while (link !== null) {
827
891
  // ONE POSITION PER LINK ENTERED (item `(1c)`), before the read that reached the link.
828
892
  if (!spendGuardPosition(allowance, 1)) return true;
829
- if (types.isProxy(link)) return true;
893
+ if (isProxyOf(link)) return true;
830
894
  if (!spendGuardRead(allowance, 1)) return true; // ONE descriptor read — item `(4c)(i)`
831
895
  if (Object.getOwnPropertyDescriptor(link, Symbol.toStringTag) !== undefined) return true;
832
896
  if (!spendGuardRead(allowance, 1)) return true; // the loop's `getPrototypeOf` — item `(4c)(ii)`
@@ -905,7 +969,7 @@ function carriesTagMember(value, allowance) {
905
969
  function arrayElementsReachCallerCode(value, path, allowance) {
906
970
  if (value === null || typeof value !== 'object') return false;
907
971
  try {
908
- if (types.isProxy(value)) return true;
972
+ if (isProxyOf(value)) return true;
909
973
  if (!Array.isArray(value)) return false;
910
974
  // AN ANCESTOR ON THE CURRENT PATH IS A CYCLE, NOT AN ALIAS — asked by a local loop over the datum's own
911
975
  // indices, never by `Array.prototype.includes`.
@@ -1088,7 +1152,7 @@ export function valueTargetSpelling(value, rowClass) {
1088
1152
  // `util.types.isProxy` refusal exists to avoid — even though a throwing trap was caught by the `catch`
1089
1153
  // below. **THE CLASS IS READ WITH `util.types.isProxy` ALONE AND NO TRAP RUNS**, exactly as
1090
1154
  // `targetSpelling` does at its own arm.
1091
- if ((typeof value === 'object' || typeof value === 'function') && value !== null && types.isProxy(value)) {
1155
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null && isProxyOf(value)) {
1092
1156
  return classSpelling(value);
1093
1157
  }
1094
1158
  // **AND A TARGET THE MESSAGE MAY NOT CARRY IS NAMED AS ITS OWN CLASS RATHER THAN AS ITS BYTES**: a string
@@ -1191,7 +1255,7 @@ export function shapeArmClass(refusal) {
1191
1255
  /// `encodeSegment` pushes and `Segment::is_in_domain` admits, so the elements the store ADOPTS and the
1192
1256
  /// elements this predicate ACCEPTS are one set and the mirror holds one entry per store entry.
1193
1257
  export function inDomainAddress(address) {
1194
- if (types.isProxy(address) || !Array.isArray(address) || arrayClass(address) === 'class') return false;
1258
+ if (isProxyOf(address) || !Array.isArray(address) || arrayClass(address) === 'class') return false;
1195
1259
  for (let i = 0; i < address.length; i += 1) {
1196
1260
  if (!(i in address)) return false; // a hole is `AddressArg` row 14's own outside shape (`DD-8`)
1197
1261
  const segment = address[i];
@@ -1207,7 +1271,7 @@ export function inDomainAddress(address) {
1207
1271
 
1208
1272
  /// **AND THE SEEDING PREDICATE IS THAT ONE PREDICATE** — the entry's own four tests, taken together.
1209
1273
  export function isLawfulListenerElement(entry) {
1210
- if (!isPlainObjectValue(entry) || !Object.hasOwn(entry, 'address') || !Object.hasOwn(entry, 'handle')) return false;
1274
+ if (!isPlainObjectCarrier(entry) || !Object.hasOwn(entry, 'address') || !Object.hasOwn(entry, 'handle')) return false;
1211
1275
  if (typeof entry.handle !== 'string' || entry.handle === '') return false;
1212
1276
  return inDomainAddress(entry.address);
1213
1277
  }
@@ -0,0 +1,186 @@
1
+ // **⟶ THE CLASS-DECISION INSTRUMENT, HELD BY THE REALM AND INSTALLED INTO THIS PART — ADDED 2026-11-17**
2
+ // (`D-156` item 1 and its item 1 of the unsettled — *"WHERE THE DETECTOR IS INJECTED … the five parts that
3
+ // import `node:util` (`frame.mjs` · `class-decision.mjs` · `carrier.mjs` · `delivery.mjs` · `constraints.mjs`,
4
+ // **25 `types.isProxy` sites**) must take their class-decision instrument from the realm"*; the loader split's
5
+ // row for them, `docs/L3/wasm-realm/design.md` §5: *"`node:util` in five parts | one import line swapped for a
6
+ // local helper | **neutralised**, conditional on §4's instrument"*).
7
+ //
8
+ // **WHAT IT IS, AT THE BYTE: THE ONE PREDICATE `DD-34`'s `Proxy` REFUSAL IS DECIDED WITH.** Each of those five
9
+ // parts imported `node:util`'s `types` for EXACTLY ONE predicate and nothing else — `types.isProxy` — and the
10
+ // twenty-five call sites are the whole of that import's use. **They call `isProxyOf` from here instead**, so no
11
+ // part carries a `node:` specifier for the class decision and the decision itself is unmoved: same predicate,
12
+ // same position in the order (`A76`: the class decision is taken on the value AS IT IS, before any read, before
13
+ // any trap can run), same refusal.
14
+ //
15
+ // **AND IT IS A MODULE-LEVEL INSTRUMENT ON PURPOSE** (`A117` (D6)'s discipline, read at its own words: *"NO
16
+ // MEMBER IS ADDED"* — the device *"is the precedent for attaching a datum without moving a census"*, the record's
17
+ // `Object.keys` and `Object.getOwnPropertyNames` being *"invisible to both"* — `surface.md §2.11` clause 9): it
18
+ // is NOT a member of any record, NOT an instance slot and NOT a symbol key on any value, so **no census anywhere
19
+ // in this package moves** and no store instance carries a second member for it. The seam is one module-level
20
+ // `let`, one setter and one predicate.
21
+ //
22
+ // **THE NODE ARM'S INSTRUMENT IS `types.isProxy` ITSELF, AND `index.mjs` INSTALLS IT AT LOAD.** The other arm's
23
+ // is `structuredClone` (`D-156` item 1: *"a `Proxy` exotic object is NOT serializable … so `try {
24
+ // structuredClone(value) } catch { refuse }` restores a detector that RUNS NO TRAP BEFORE THE REFUSAL"*), and
25
+ // **the instrument differs there while the ANSWER does not** — every refusal this predicate feeds stays
26
+ // rank-neutral and class-for-class what the Node arm answers.
27
+ //
28
+ // ★ **THE DEFAULT IS `false`, AND THIS IS THE MOST DANGEROUS LINE IN THIS FILE, SO IT IS STATED AT ITS BYTE:
29
+ // BEFORE AN INSTRUMENT IS INSTALLED, `isProxyOf` ANSWERS `false` — "not a `Proxy`" — FOR EVERY VALUE, WHICH IS A
30
+ // SILENT LOSS OF `DD-34`'S REFUSAL AND LETS A TRAP RUN.** It is the arm taken deliberately: the alternative —
31
+ // answering `true` until an instrument arrives, i.e. *"refuse everything"* — refuses every value's prototype link
32
+ // at `classSpelling`, `targetSpelling` and the address walk, so **no value crosses and no store can be
33
+ // constructed at all**; a lost refusal degrades the boundary, a default refusal destroys the arm. **THE LOSS IS
34
+ // UNREACHABLE ON THE NODE ARM ONLY BECAUSE THE ENTRY INSTALLS `types.isProxy` AT ITS OWN LOAD, BEFORE ANY PART
35
+ // CAN CLASSIFY ANYTHING** (`index.mjs`, at the head of the module, `D-156`; `docs/L3/wasm-realm/design.md` §5) —
36
+ // **so the entry's installation is the thing that makes this default unreachable, and a part driven without that
37
+ // entry has NO `Proxy` detector at all.**
38
+ //
39
+ // ⟶ **AMENDED 2026-11-17 — THE DEFAULT'S SENTENCE NAMES THE SET OF CELLS THAT HOLDS IT, AND THE SET THIS FILE
40
+ // ONCE NAMED WAS NOT LANDED.** The block above read *"`tests/e2e/class-instrument.test.mjs` is the cell that holds
41
+ // both halves of that sentence: the entry installs, and the un-installed predicate answers `false`"*; **that path
42
+ // does not exist in this tree** (`tests/e2e/` carries no `class-instrument` cell — read at the directory), and
43
+ // **no cell anywhere drives `installClassInstrument` with no instrument installed**. **The two halves are held,
44
+ // after this amendment, by the cells that do drive the seam**: `tests/e2e/blind-installed-surface.test.mjs` holds
45
+ // the module set (`class-instrument.mjs` is one of the eighteen parts the packed set carries), and the arm's own
46
+ // cells hold the installed arm (`tests/e2e/wasm-arm.test.mjs` — a value crosses by value, and a `Proxy` is
47
+ // refused with no trap run, which is only true of an arm whose instrument IS the probe). **NO BYTE OF THE
48
+ // PREDICATE MOVES WITH THIS SENTENCE**: it says where a claim is held and not what the code does.
49
+ //
50
+ // **NO `node:` SPECIFIER APPEARS IN THIS FILE AND NONE MAY** — that is the whole of the seam: the realm supplies
51
+ // the instrument and this file only holds it and answers with it.
52
+ //
53
+ // ═════════════════════════════════════════════════════════════════════════════════════════════════════════
54
+ // **⟶ `D-167` · THE SEAM GAINS A SECOND PREDICATE, BECAUSE THE PROBE ANSWERS TWO DIFFERENT QUESTIONS AND THE
55
+ // RULING SEPARATES THEM — 2026-11-17.**
56
+ // ═════════════════════════════════════════════════════════════════════════════════════════════════════════
57
+ //
58
+ // **THE ARCHITECT'S WORDS, VERBATIM: *"The clone requirement is for data that has to enter the Rust store.
59
+ // constraints, listeners, and the saveCall do not"*** (`D-167`, answering the finding `D-166` is). **THE FINDING
60
+ // IT ANSWERS, MEASURED AT ITS OWN INSTRUMENT: `structuredClone` throws for BOTH a `Proxy` AND any object carrying
61
+ // a function** — `structuredClone({ saveCall: () => {} })` and `structuredClone(new Proxy({}, {}))` fail
62
+ // identically (`DataCloneError`) — **so on the WASM arm the one instrument classified every `saveCall` `cfg` as
63
+ // "a Proxy" and refused it, and the arm could not construct the one store it exists for.**
64
+ //
65
+ // **SO THE SEAM HOLDS TWO PREDICATES AND EACH ANSWERS ONE QUESTION:**
66
+ // * **`isProxyOf` — THE DATA QUESTION**, unmoved in meaning: *does this value enter the Rust store?* It is the
67
+ // write's value, an address, a tier, a value's class and a value's prototype link — **and on the WASM arm it
68
+ // is still the `structuredClone` probe, so `DD-34`'s property is kept on that arm exactly as `D-156` states
69
+ // it: a `Proxy` is refused and NOT ONE TRAP RUNS** (`CW-7` in `tests/e2e/wasm-arm.test.mjs` is that cell).
70
+ // * **`isProxyOfCarrier` — THE CARRIER QUESTION**: *is this the package's own carrier — the `cfg` it is read
71
+ // from, the `listeners` and `constraints` arrays and their elements, the save the caller hands in, the commit
72
+ // record the package builds?* **A carrier DOES NOT CROSS**, so `invariant 2`'s domain (*"if it cannot cross
73
+ // IPC it cannot be stored"*) says nothing about it and the probe must not be asked of it.
74
+ //
75
+ // **AND THE SPLIT CANNOT LIVE INSIDE `isPlainObjectValue`, WHICH IS THE ONE PLACE IT WOULD LOOK NATURAL**: that
76
+ // predicate is **shared** between `cfg` (a carrier) and the values a verb admits (data), so a decision taken
77
+ // inside it would move the value crossing with the carrier gate. **THE SPLIT LIVES AT THE CALL** — the carrier
78
+ // gates call the carrier predicate and every data site keeps `isProxyOf` — and `class-decision.mjs` carries a
79
+ // carrier-shaped sibling of `isPlainObjectValue` (`isPlainObjectCarrier`) for the one gate whose subject is the
80
+ // `cfg` OBJECT itself rather than a member of it.
81
+ //
82
+ // **THE TWO PREDICATES ON EACH ARM, STATED TOGETHER SO NEITHER IS READ AS THE OTHER:**
83
+ // * **THE NODE ARM: BOTH ARE `types.isProxy`, AND NOTHING ABOUT THAT ARM MOVES.** `types.isProxy` is precise
84
+ // there — it answers *"is this exotic object a `Proxy`"* and invokes nothing — so it is the right answer to
85
+ // BOTH questions and the entry installs it twice. **Every Node cell that drives a `Proxy` at a carrier gate
86
+ // still refuses it in the same form with the same message** (`NG-JS-*`, `F-RA-12`, `DD-34`), because
87
+ // `isProxyOfCarrier(v)` and `isProxyOf(v)` are the same answer on that arm by construction.
88
+ // * **THE WASM ARM: `isProxyOf` IS THE `structuredClone` PROBE AND `isProxyOfCarrier` ANSWERS `false`.** **THE
89
+ // DECLARATION, AND IT IS THE WHOLE OF THE PRICE: a `Proxy` AT A CARRIER GATE IS NOT DETECTED ON THAT ARM** —
90
+ // because the only platform signal that distinguishes a `Proxy` from its target is `structuredClone`, and
91
+ // **it cannot distinguish a `Proxy` from a function-carrying carrier**, and **the carriers the API requires
92
+ // are function-bearing by definition** (`cfg.saveCall`, a listener's `listener`, a constraint's
93
+ // `constraint`). **A `cfg` that is a `Proxy` on that arm is therefore READ, not refused** — `encodeConfig`
94
+ // reads its four declared keys by `Object.hasOwn` and never by `in` (`A76`/`JS-5`), so what an un-detected
95
+ // carrier costs that arm is a `get` of exactly the keys the API declares and nothing wider; and **the value
96
+ // crossing keeps `DD-34` whole** — the arm's one claimed property in this matter is about what it STORES.
97
+
98
+ /// **THE INSTALLED DATA INSTRUMENT, OR `null` BEFORE AN ENTRY INSTALLS ONE.** Module-level, unexported and not a
99
+ /// member of anything (`A117` (D6)); `installClassInstrument` is its only writer and `isProxyOf` its only reader.
100
+ let instrument = null;
101
+
102
+ /// **⟶ AND THE CARRIER INSTRUMENT IS ITS OWN SLOT FROM 2026-11-17** (`D-167`) — a second module-level `let`, no
103
+ /// member on any record, its one writer the same setter and its one reader `isProxyOfCarrier` below. **TWO SLOTS
104
+ /// AND NOT ONE, BECAUSE THE TWO ANSWERS DIFFER ON ONE ARM**: a single slot could only hold one of them, and the
105
+ /// arm that needs them apart is the arm whose instrument cannot answer the second question at all.
106
+ let carrierInstrument = null;
107
+
108
+ /// **THE ONE SETTER, CALLED BY AN ENTRY AT ITS OWN LOAD** (`D-156`; `docs/L3/wasm-realm/design.md` §5). **A
109
+ /// NON-FUNCTION IS REFUSED** rather than held: a truthy non-function stored here would throw at the FIRST
110
+ /// classification instead of at the install, which is a host `TypeError` out of a caller's first verb and a
111
+ /// second failure form on a path `DD-12` allows none. The refusal is a load-time programming error and is a
112
+ /// plain `TypeError` on purpose — **it is NOT a store refusal, it mints no status (`DD-40`) and it can reach no
113
+ /// caller**, because the only caller is an entry's own evaluation.
114
+ ///
115
+ /// **⟶ AND IT TAKES BOTH INSTRUMENTS FROM 2026-11-17 — `D-167`'s one seam, two questions.** The second position
116
+ /// is the carrier answer and **it is REQUIRED**: an entry that installed only the data instrument would leave
117
+ /// `isProxyOfCarrier` at its `false` default, which on the Node arm would be a silent loss of the `DD-34`
118
+ /// refusal at every carrier gate — the exact class of loss this file's head declares as the dangerous default.
119
+ /// **A call that omits it therefore fails at its own evaluation**, where the mistake is, and not at the first
120
+ /// caller that hands a `Proxy` a `cfg`. `undefined` is refused like any other non-function: **absence is not a
121
+ /// lawful spelling of "answer `false`"** — the arm that answers `false` says so by passing a function that
122
+ /// answers `false` (the WASM fork's own install), so the declaration is written at the call that takes it.
123
+ export function installClassInstrument(fn, carrierFn) {
124
+ if (typeof fn !== 'function') {
125
+ throw new TypeError('installClassInstrument: the class-decision instrument is a function');
126
+ }
127
+ if (typeof carrierFn !== 'function') {
128
+ throw new TypeError('installClassInstrument: the carrier class-decision instrument is a function');
129
+ }
130
+ instrument = fn;
131
+ carrierInstrument = carrierFn;
132
+ }
133
+
134
+ /// **THE ONE PREDICATE THE FIVE PARTS CALL AT A DATA SITE** (`D-156`'s 25 sites) — **the installed instrument's
135
+ /// answer, and `false` where none is installed** (the default stated at the head of this file, with its
136
+ /// consequence). **THE ANSWER IS COERCED TO A BOOLEAN BY `=== true`**, so an instrument answering a truthy
137
+ /// non-boolean cannot admit a value by accident and one answering nothing cannot refuse one: the two arms of this
138
+ /// predicate are the two booleans, exactly as `util.types.isProxy` answered. **A THROWING INSTRUMENT IS NOT
139
+ /// CAUGHT HERE** — on the arm that needs a `try`, the `try` is the instrument's own (`D-156` item 1's
140
+ /// `structuredClone` probe), so a failure inside an instrument is its author's and never silently read as *"not a
141
+ /// `Proxy`"* — which would be a second, hidden copy of this file's default.
142
+ export function isProxyOf(value) {
143
+ return instrument === null ? false : instrument(value) === true;
144
+ }
145
+
146
+ /// **⟶ THE CARRIER PREDICATE — `D-167`, ADDED 2026-11-17. THE ONE PREDICATE THE CARRIER GATES CALL, AND THE
147
+ /// ANSWER IS THE ARM'S OWN.**
148
+ ///
149
+ /// **A CARRIER IS THE PACKAGE'S OWN DATA, AND IT DOES NOT ENTER THE RUST STORE** — `cfg` itself, the `listeners`
150
+ /// and `constraints` arrays and their elements, and the commit record the package builds — **so the probe that
151
+ /// decides what may CROSS (`invariant 2`: *"if it cannot cross IPC it cannot be stored"*) has no subject here.**
152
+ /// **THE ARCHITECT'S RULING, VERBATIM: *"The clone requirement is for data that has to enter the Rust store.
153
+ /// constraints, listeners, and the saveCall do not"*** (`D-167`).
154
+ ///
155
+ /// **THE NODE ARM ANSWERS `types.isProxy`, EXACTLY AS `isProxyOf` DOES, AND THAT IS NOT A SHORTCUT**: that
156
+ /// instrument is PRECISE there — it reads the exotic object's own internal slot, invokes no handler and throws
157
+ /// for nothing — so it is the right answer to this question too, and **every Node cell that drives a `Proxy` at a
158
+ /// carrier gate keeps its refusal, its form and its message** (`NG-JS-*`, `F-RA-12`, `DD-34`). **NO BYTE OF THE
159
+ /// NODE ARM'S BEHAVIOUR MOVES WITH THIS PREDICATE**; only the name at six carrier gates does.
160
+ ///
161
+ /// ★ **THE WASM ARM ANSWERS `false` — FOR EVERY VALUE — AND THIS IS THE DECLARATION, SAID WHERE THE PREDICATE IS
162
+ /// DECIDED AND NOT ONLY WHERE IT IS INSTALLED: A `Proxy` AT A CARRIER GATE IS NOT DETECTED ON THAT ARM.** **THE
163
+ /// GROUND IS THE PLATFORM'S AND IT IS NOT A PREFERENCE:** the only signal that distinguishes a `Proxy` from its
164
+ /// target is `structuredClone`, and **it cannot distinguish a `Proxy` from a function-carrying carrier** — both
165
+ /// throw `DataCloneError` (`D-166` items 1–2, measured) — **and the carriers this API requires are function-bearing
166
+ /// by definition: `cfg.saveCall`, a listener's `listener`, and a constraint's `constraint`.** The three ways to
167
+ /// make the probe answer anyway were priced by `D-166` item 4 and each is refused on a stated ground: projecting
168
+ /// around the functions **reads members of the object being tested**, which is the trap hazard the refusal exists
169
+ /// to prevent; a `Proxy`-only signal **does not exist in ECMAScript**; and there is no fourth. **SO THIS ARM
170
+ /// CHOOSES BETWEEN TWO REFUSALS IT CANNOT TELL APART AND TAKES THE ONE THAT LEAVES THE STORE CONSTRUCTIBLE.**
171
+ /// **WHAT IT COSTS, NAMED AT ITS SEAT:** a `cfg` handed as a `Proxy` on that arm is read rather than refused —
172
+ /// `encodeConfig` takes its four declared keys by `Object.hasOwn` (`A76`/`JS-5`) and reads those keys' values and
173
+ /// no member the API does not declare, so the traps an un-detected handler sees are the reads the construction
174
+ /// must make anyway; **a carrier gate is not a place where a trap can run that a construction would not run.** **AND
175
+ /// WHAT IT DOES NOT COST: the value crossing.** `isProxyOf` above still answers the probe at every DATA site, so a
176
+ /// `Proxy` handed to a verb as a VALUE is still refused in the declared form with **NO TRAP RUN** — `DD-34`'s
177
+ /// property is kept on this arm for the one population it is about, which is the data that enters the store.
178
+ ///
179
+ /// **THE DEFAULT IS `false`, AND IT IS THE SAME DIRECTION THE DATA PREDICATE'S DEFAULT TAKES, FOR A STRONGER
180
+ /// REASON:** a default `true` here would refuse every `cfg` ever constructed (*"'cfg' is a Proxy"* for an object
181
+ /// that is not one), so the arm would construct no store at all. **AND IT IS UNREACHABLE ON THE NODE ARM BY THE
182
+ /// ENTRY'S OWN INSTALLATION**, exactly as `isProxyOf`'s default is: `index.mjs` installs `types.isProxy` at both
183
+ /// positions at its own load, before any part can classify anything.
184
+ export function isProxyOfCarrier(value) {
185
+ return carrierInstrument === null ? false : carrierInstrument(value) === true;
186
+ }