provident-storeroom 1.12.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,36 @@
1
1
  // `D-2` (`docs/L1/entry-subdivision.md` §1 part `8`) — bytes moved from `bindings/js/index.mjs`; no logic changed.
2
- import { types } from 'node:util';
2
+ // **⟶ AND THE `Proxy` PREDICATE IS THE INSTALLED CLASS-DECISION INSTRUMENT FROM 2026-11-17** (`D-156` item 1 and
3
+ // the loader split's row for these five parts, `docs/L3/wasm-realm/design.md` §5: the host import line is *"swapped
4
+ // for a local helper"* — **neutralised**, conditional on that design's §4 instrument). **`isProxyOf` IS
5
+ // `class-instrument.mjs`'s one predicate and this file carries no host specifier for the class decision any more**:
6
+ // every site below takes the answer `util.types.isProxy` gave, because **the NODE entry installs `types.isProxy`
7
+ // ITSELF at load** (`index.mjs`, at the head of the module), and on the other arm the instrument is
8
+ // `structuredClone` while **the ANSWER does not move** (`D-156` item 1: the refusal stays rank-neutral and
9
+ // class-for-class what this arm answers). **NO DECISION, NO ORDER AND NO ANSWER OF THIS FILE MOVES** — only the
10
+ // predicate's name and its home.
11
+ import { isProxyOf } from './class-instrument.mjs';
3
12
  import { appendOwn, fail, refusalAddress, refusalLog } from './refusal.mjs';
4
- import { withAddon, require_ } from './artefact.mjs';
13
+ import { withAddon } from './addon-slot.mjs';
14
+ // **⟶ AND `require_` IS THE NODE HALF'S FROM 2026-11-17** (`D-156` item 1; `docs/L3/wasm-realm/design.md` §5's
15
+ // row for this part — *"the lazy `require_` of the barrel"*, *"neutralised"*, conditional on that design's §4).
16
+ // The kernel's lazy reach below is the HUB's own `createRequire(import.meta.url)`, handed in through
17
+ // `adoptModuleContext` (`I-29`), and from this pass the slot and that seam are `src/entry/artefact-node.mjs`'s —
18
+ // the three-rung walk reads it there too and it is the SAME live binding, so `D-14`'s resolution base does not move
19
+ // either: the kernel's barrel is still required from the HUB's own directory and never from this part's.
20
+ // **THE LAZINESS ITSELF IS UNMOVED** (`kernel-surface.md` §1 item 1; `A121`, `A122`): this file still reaches no
21
+ // byte of the kernel until the first constraint act. **NO NAME OF THE LINE ABOVE MOVES.**
22
+ import { requireKernel } from './kernel-loader.mjs';
5
23
  import { classSpelling, isAdmittedArray, isPlainObjectValue } from './class-decision.mjs';
6
24
  import { constraintAddress } from './frame.mjs';
7
- import { INSTANCES, carryRefusal, commitFile, currentWindow, homeAddressKey, installRestartConsumer, isStoreReceiver, openCommits, closeCommit, openCommit, windowMark } from './state.mjs';
25
+ // **⟶ AND TWO NAMES JOIN THIS IMPORT, 2026-11-17 — `U-STOREROOM-06 DELIVERY-SETTLE`.** **`BODY_FAILURES` IS THE KEY
26
+ // THE RECEIPT'S ACCESSOR READS** (`state.mjs`'s symbol block, beside `COMMIT_LOG`; `design.md §5`) **and
27
+ // `BODY_FAILURES_EMPTY` IS THE ONE FROZEN `{}` THAT ACCESSOR ANSWERS WHERE THE KEY IS ABSENT** — the same value
28
+ // `delivery.mjs`'s `bodyFailures` answers when a settle found no rejection, so the two arms of the same fact cannot
29
+ // answer two different objects. **NO OTHER NAME OF THIS LINE MOVES.**
30
+ // **⟶ AND TWO MORE NAMES DO, 2026-11-17 — `U-STOREROOM-08 RETURN-VALUES`** (`D-150` items 1–2):
31
+ // `RETURNED_VALUES` is the key the fourth accessor reads and `RETURNED_VALUES_EMPTY` is the one frozen `{}` it answers
32
+ // where the key is absent — the same value `delivery.mjs`'s `settledAnswer` installs when a settle found no value.
33
+ import { INSTANCES, carryRefusal, commitFile, currentWindow, homeAddressKey, installRestartConsumer, isStoreReceiver, openCommits, closeCommit, openCommit, windowMark, BODY_FAILURES, BODY_FAILURES_EMPTY, RETURNED_VALUES, RETURNED_VALUES_EMPTY } from './state.mjs';
8
34
  // **THE KERNEL'S OWN RECORD, FOR ONE FIELD AND ONE ONLY** (`D-46`/`D-30`): `kernelFor(store)` answers the
9
35
  // instance's kernel record — the same accessor every kernel act takes the instance through — and
10
36
  // `reversalAtRest` below reads that record's own `live` map for the count of OPEN ATTEMPTS. `kernel-foundations`
@@ -34,7 +60,13 @@ import { repairInCommit, repairLegs, runAttempt } from './kernel-attempt.mjs';
34
60
  // IS ACYCLIC AND MEASURED**: `delivery.mjs` imports `state.mjs`, `kernel-foundations.mjs`, `carrier.mjs`,
35
61
  // `frame.mjs`, `refusal.mjs`, `artefact.mjs` and `class-decision.mjs`, **and imports neither this file nor
36
62
  // `kernel-attempt.mjs`**, so this reach adds no cycle and no second conversion rule.
37
- import { deliver } from './delivery.mjs';
63
+ //
64
+ // **⟶ AND A SECOND NAME DOES, 2026-11-17 — `settledAnswer`, THE WRITE's OWN SUSPENSION POINT**
65
+ // (`U-STOREROOM-06 DELIVERY-SETTLE`; `contract.md §3`'s `constraintWrite` row: *"the tail's **read-and-clear** of
66
+ // `state.legSettle` into a local, and the branch `settle === null ? recordOut : settledAnswer(settle, recordOut)`"*).
67
+ // **IT IS `delivery.mjs`'S AND IS NOT A SECOND SETTLE**: one `await` over one `Promise.allSettled` that `deliver`
68
+ // already started, inside a function body, and the edge it travels is the one above — so no cycle is added either.
69
+ import { deliver, settledAnswer, isSaveSettle, settledSaveAnswer } from './delivery.mjs';
38
70
  // **⟶ AND THE CARRIERS, ADDED 2026-10-26 FOR THE REFUSAL'S OWN UNDOING (`DEF-W`'s `(a)`).** The
39
71
  // compensating act below reaches the store's own verb at its entry, with the SAME carrier forms every member
40
72
  // hands it (`carrier.mjs` is the boundary's one encoder for the three positions and imports nothing of this
@@ -83,7 +115,7 @@ const ARGUMENT_POSITION_SECOND = 'second argument';
83
115
  /// the kernel.
84
116
  let KERNEL = null;
85
117
  export function constraintsKernel() {
86
- if (KERNEL === null) KERNEL = require_('./src/constraint-kernel.mjs');
118
+ if (KERNEL === null) KERNEL = requireKernel();
87
119
  return KERNEL;
88
120
  }
89
121
 
@@ -765,7 +797,7 @@ export function enumerateConstraints(state) {
765
797
  /// outside every pair's own address domain, so no pair of this entry can stand at one.
766
798
  function carriesConstraintAt(state, address) {
767
799
  if (state.constraints.size === 0) return false;
768
- if (types.isProxy(address) || !isAdmittedArray(address)) return false;
800
+ if (isProxyOf(address) || !isAdmittedArray(address)) return false;
769
801
  // **⟶ THE PER-WRITE GATE IS A SET-MEMBERSHIP TEST, NOT AN EQUALITY TEST** (`P: docs/pending.md · P-7`'s
770
802
  // keying ruling, item (iv), verbatim: *"`carriesConstraintAt`'s `JSON.stringify(address)` key and
771
803
  // `entry.addressKey` must answer TRUE where ANY of the pair's N addresses matches — the per-write gate is a
@@ -826,6 +858,27 @@ export function constraintWrite(state, instance, address, tier, value) {
826
858
  // left it in hand.**
827
859
  constraintCrossing(refusal, address);
828
860
  }
861
+ // ── THE DELIVERED SET'S SETTLE, READ AND CLEARED IN ONE SYNCHRONOUS BREATH ─────────────────────────────────────
862
+ // **⟶ THE SLOT'S ONE READER-AND-CLEARER, ADDED 2026-11-17 — `PIN-8`** (`contract.md §3`'s `constraintWrite` row;
863
+ // `PIN-8`: *"`state.legSettle` has exactly **one writer** (`terminalArm:987`) and **one reader-and-clearer**
864
+ // (`constraintWrite`'s tail, synchronously, before `settledAnswer` is invoked); its value is `null` at every
865
+ // microtask boundary"*).
866
+ //
867
+ // **THE INSTANT IS THE WHOLE OF THE SAFETY ARGUMENT AND IT IS THREE FACTS.** *(i)* **IT IS AFTER THE KERNEL
868
+ // RETURNED** — `runAttempt` is the frame whose `settleArm` performed the terminal arm's delivery, so the slot can
869
+ // hold nothing but THIS act's settle; *(ii)* **IT IS BEFORE ANY RECORD ACCESSOR IS READ** — `report`'s members, the
870
+ // report's last op and the store leg's `watched`/`triggered` are all read below, and none of them may be read while
871
+ // a slot two acts could share is still standing; *(iii)* **IT IS BEFORE THE ONE `await`** — `settledAnswer` is
872
+ // reached at the tail, on the value this local holds, so **no suspension can stand between the write and the
873
+ // clear** and the value is `null` at every microtask boundary.
874
+ //
875
+ // **NOTHING IS CAUGHT, RETRIED OR ROLLED BACK HERE** — a refusal above threw before these bytes, and both `catch`
876
+ // arms of this function are untouched (`contract.md §3`: *"a change to either `catch`"* is in the must-not column).
877
+ // **A NESTED WRITE HAS ALREADY CLEARED ITS OWN VALUE BEFORE THIS LINE SEES ANYTHING**: `deliver` runs the whole
878
+ // start loop inside the assignment `terminalArm` makes, so a body's own write — and its own tail — completes
879
+ // inside `runAttempt`, and this read then sees the ENCLOSING act's settle and never the nested one's.
880
+ const settle = state.legSettle;
881
+ state.legSettle = null;
829
882
  // **⟶ AND THE RESTART'S REFUSAL, WHERE THE RESTARTED CHECK REFUSED — `D-42` (2026-10-27), REACHED THROUGH
830
883
  // THE REPORT SINCE 2026-10-27.** The attempt's own terminal arm returned (its pass, its save and its
831
884
  // delivery all ran, so a listener body's `rollback` and a constraint body's `rollback` have both been
@@ -893,7 +946,44 @@ export function constraintWrite(state, instance, address, tier, value) {
893
946
  // entries (`resolution-log.md` §4.2). **NO DECLARED MEMBER MOVES**: the record keeps the three `index.d.ts`
894
947
  // declares, and `Object.keys` reads them and nothing else (`A117` (D6)).
895
948
  defineResolutionLog(recordOut, resolutionLogOf(report));
896
- return recordOut;
949
+ // **⟶ AND THE RECEIPT'S THIRD ACCESSOR IS INSTALLED AT THE BUILD — `PIN-10`, 2026-11-17.**
950
+ // **THE RULING, `PIN-10`, VERBATIM: *"`Object.keys(record)` stays `["op","watched","triggered"]`;
951
+ // `Object.getOwnPropertyNames` moves `5 → 6` with `bodyFailures` present; the descriptor is `{ enumerable: false,
952
+ // configurable: true, get: … }`; the plain arm reads the frozen empty `{}` and is present, never absent and never
953
+ // `undefined`; and no seventh name is added here."*** **IT IS INSTALLED HERE AND NOT BY THE SETTLE** (`contract.md
954
+ // §3`: *"the **accessor's installation on every arm**, at the build; the **datum's installation by `settledAnswer`
955
+ // only**"*) — **which is why it is a GETTER and not a datum**: this record is built *before* the delivered set has
956
+ // settled, so a value captured here would answer `{}` about a body that then rejects (`design.md §5`: *"A getter by
957
+ // necessity, not by taste"*). **BESIDE THE TWO ACCESSORS ALREADY HERE, BY THE FAMILY'S OWN DEVICE** — one
958
+ // `Object.defineProperty`, `enumerable: false`, `configurable: true` — so the record's declared three are unmoved
959
+ // and `Object.keys` reads them and nothing else.
960
+ defineBodyFailures(recordOut);
961
+ // **⟶ AND THE RECEIPT'S FOURTH ACCESSOR IS INSTALLED BESIDE IT, AT THE SAME BUILD — 2026-11-17** (`D-150` item 1;
962
+ // `D-149` item 2). `contract.md §8`'s boundary fixes that the outcomes are already total and final at the answer's
963
+ // instant, so this unit defines a member over data it does not recompute — no second wait, no second settle. The
964
+ // ACCESSOR is installed on every arm and the DATUM is `settledAnswer`'s alone, which is why it is a getter again.
965
+ defineReturnedValues(recordOut);
966
+ //
967
+ // **⟶ AND THE ANSWER IS THE SETTLE'S OR THE RECORD'S, AND THE WAIT IS THE LAST THING THIS FUNCTION DOES —
968
+ // 2026-11-17** (`contract.md §3`: *"answers `settle === null ? recordOut : settledAnswer(settle, recordOut)`"*;
969
+ // `PIN-6`: *"an all-synchronous delivered set answers a **record**, not a thenable"*). **THE LOCAL IS THE READ THE
970
+ // TAIL ALREADY TOOK** — one read of the slot, never a second — **and `recordOut`'s three members are the three it
971
+ // built above, byte for byte** (`:859`–`:863`, unmoved). **NO `async` AND NO `await` STANDS IN THIS FUNCTION**:
972
+ // the suspension is `delivery.mjs`'s `settledAnswer`, entered here and nowhere else, **after** `closeCommit` has
973
+ // run in the caller's `finally` (`index.mjs:759`–`:761`) and after the record is complete.
974
+ //
975
+ // **⟶ AND THE BRANCH IS THREE-WAY FROM 2026-11-17 — `D-153` ITEM 2, THE ARCHITECT, VERBATIM: *"5. Add third arm"***
976
+ // (`strata/decisions.md` · `D-153`), given to the design's `O-5`. **The third arm is the awaited save's**: a `saveCall`
977
+ // store whose saver answered a thenable hands this slot THE SAVE'S OWN COMPOSED SETTLE, **and a settle that settles into a
978
+ // REFUSAL answers the refusal** — rank `15` `FileCommitFailed`, widened and never minted, with the saver's `message[]`
979
+ // already standing on the log as the fifth kind's entries. **The arm is told by the value and never by a flag the tail
980
+ // sets**: `isSaveSettle` is the settle's own mark, so the DELIVERY's settle takes the arm it has always taken, byte for
981
+ // byte, and `settledAnswer` keeps its body and **cannot reject on any arm** (`PIN-5`). **The refusal is a datum the settle
982
+ // resolves into and never a rejection of the settle**: the composed promise resolves, `settledSaveAnswer` reads what it
983
+ // resolved into, and what crosses the caller's answer is the surface's ONE thrown form — `D-153` item 2's own sentence,
984
+ // kept at the only frame that can throw it. **No `async` and no `await` stands in this function.**
985
+ if (settle === null) return recordOut;
986
+ return isSaveSettle(settle) ? settledSaveAnswer(settle, recordOut) : settledAnswer(settle, recordOut);
897
987
  }
898
988
 
899
989
  /**
@@ -1975,6 +2065,66 @@ export function defineResolutionLog(record, list) {
1975
2065
  return record;
1976
2066
  }
1977
2067
 
2068
+ /// **⟶ ADDED 2026-11-17 — THE DELIVERED SET'S FAILURES ON A RECORD: THE THIRD OF THIS FAMILY, THE SAME DEVICE**
2069
+ /// (`U-STOREROOM-06 DELIVERY-SETTLE`; `contract.md §3`'s `defineBodyFailures` row; `PIN-5`, `PIN-10`; `design.md §5`:
2070
+ /// *"The accessor is the **third of the family** and lives with the other two"*).
2071
+ ///
2072
+ /// **IT INSTALLS A NON-ENUMERABLE, `configurable` OWN `GETTER` AT THE NAME `bodyFailures`, OVER `record[BODY_FAILURES]`,
2073
+ /// ANSWERING THE FROZEN EMPTY MAP WHERE THE SYMBOL KEY IS ABSENT** — **present always, never absent and never
2074
+ /// `undefined`** (`D-138`'s unsettled item 3, which forces the presence: *"a body's failure must be readable
2075
+ /// **exactly when no channel stands**, so no `channel`-conditional presence and no `undefined` arm"*; `D-139` item 1:
2076
+ /// *"`bodyFailures` and *present always, `{}`* are ACCEPTED"*).
2077
+ ///
2078
+ /// **A GETTER BY NECESSITY, NOT BY TASTE** (`design.md §5`): *"the record is built at `constraints.mjs:859`–`:895`
2079
+ /// *before* the set settles, so a datum captured there would answer `{}` about a body that then rejects — the same
2080
+ /// reason `discarded` is a read"*. **SO THE DATUM ARRIVES LATER THAN THE ACCESSOR** (`delivery.mjs`'s `settledAnswer`
2081
+ /// installs it after the one `Promise.allSettled`) **and the read answers at the read.**
2082
+ ///
2083
+ /// **THE READ IS THE FAMILY'S `[[GetOwnProperty]]` AND NEVER A `[[Get]]`** (`D-35`'s read half, the form
2084
+ /// `state.mjs`'s `commitLogOf` and `delivery.mjs`'s `ownDataMember` take): a caller's accessor planted at the
2085
+ /// well-known symbol on `Object.prototype` answers nothing, because only an OWN data row is taken — and an absent
2086
+ /// row, and an own accessor row, both answer the frozen constant exactly as an absent key does. **NO DATA PROPERTY,
2087
+ /// NO ENUMERABLE MEMBER, NO FRESH `{}` PER CALL AND NO SECOND ACCESSOR**: `returnedValues` is `U-08`'s and this unit
2088
+ /// adds one name to `Object.getOwnPropertyNames` and nothing to `Object.keys` (`PIN-10`; `contract.md §8`).
2089
+ export function defineBodyFailures(record) {
2090
+ // **A RECEIPT THAT IS NOT AN OBJECT CANNOT CARRY A MEMBER** — `defineResolutionLog`'s own guard, read for this
2091
+ // member: the member never depends on the arm for its PRESENCE, and a non-object answer has no census to move.
2092
+ if (record === null || typeof record !== 'object') return record;
2093
+ Object.defineProperty(record, 'bodyFailures', {
2094
+ get: () => {
2095
+ const descriptor = Object.getOwnPropertyDescriptor(record, BODY_FAILURES);
2096
+ return descriptor === undefined || !Object.hasOwn(descriptor, 'value')
2097
+ ? BODY_FAILURES_EMPTY
2098
+ : descriptor.value;
2099
+ },
2100
+ enumerable: false,
2101
+ configurable: true,
2102
+ });
2103
+ return record;
2104
+ }
2105
+
2106
+ /// **⟶ ADDED 2026-11-17 — THE DELIVERED SET'S SETTLED RETURN VALUES ON A RECORD: THE FOURTH OF THIS FAMILY, THE SAME
2107
+ /// DEVICE MEMBER FOR MEMBER** (`U-STOREROOM-08 RETURN-VALUES`; `D-149` item 2; `D-150` items 1–2). **It installs a
2108
+ /// NON-ENUMERABLE, `configurable` own GETTER at the name `returnedValues`, over `record[RETURNED_VALUES]`, answering the
2109
+ /// frozen empty map where the key is absent — present always, never absent, never `undefined`** (`D-150` item 2).
2110
+ /// **A getter by necessity, for `defineBodyFailures`' exact reason** (`design.md §5`): the record is built BEFORE the set
2111
+ /// settles, so a datum captured here would answer `{}` about a body that then returns a value. **The read is the family's
2112
+ /// `[[GetOwnProperty]]` and never a `[[Get]]`**, so a caller's accessor planted at the well-known symbol answers nothing.
2113
+ export function defineReturnedValues(record) {
2114
+ if (record === null || typeof record !== 'object') return record;
2115
+ Object.defineProperty(record, 'returnedValues', {
2116
+ get: () => {
2117
+ const descriptor = Object.getOwnPropertyDescriptor(record, RETURNED_VALUES);
2118
+ return descriptor === undefined || !Object.hasOwn(descriptor, 'value')
2119
+ ? RETURNED_VALUES_EMPTY
2120
+ : descriptor.value;
2121
+ },
2122
+ enumerable: false,
2123
+ configurable: true,
2124
+ });
2125
+ return record;
2126
+ }
2127
+
1978
2128
  /// **THE ONE READ OF THE SEALED REPORT'S CACHE — `D-119`.** The sealed report is the cache: `sealHandoff` froze
1979
2129
  /// the commit's list and the ownership fact together BEFORE `dropHandoff` stripped the closed map's copy, and
1980
2130
  /// the entry's frame holds that report from the attempt's return until it builds the answer. **So the list is
@@ -3109,8 +3259,8 @@ export function judgeReversal(instance, watched, reversalId, state) {
3109
3259
  /// openings are outermost: a repair's write and a pass's scope join, so they take the outermost mark and not a
3110
3260
  /// later one), and **a callback's own commit is its own opening with its own cache** (a listener body's call names
3111
3261
  /// nothing and opens, so the mark it restores to is where ITS window opened). **THE MARK IS OPAQUE HERE**: the
3112
- /// store answered a carrier — `{k:'s', v:<op id>}`, or `{k:'F'}` for the FLOOR, the state the store was born with
3113
- /// when the journal held no entry at the opening — and this act hands the very same carrier back. **NEITHER THE
3262
+ /// store answered a carrier — `{k:'s', v:<op id>}`, or `{k:'F'}` for the FLOOR, **the state the journal's floor stands at
3263
+ /// when the opening found no entry** — and this act hands the very same carrier back. **NEITHER THE
3114
3264
  /// PACKAGE NOR THIS FUNCTION COMPOSES A POSITION.**
3115
3265
  ///
3116
3266
  /// **AND A WINDOW WITH NO CACHE IS A WINDOW THAT NEVER OPENED: THIS ACT REFUSES RATHER THAN FALLING BACK TO THE
@@ -3189,8 +3339,11 @@ function restoreReversal(instance, moved) {
3189
3339
  // and the delivery), **so what this act restores is THE LAST VALIDATED STATE**: a validated edit STANDS against a
3190
3340
  // later refusal in the same commit, and a commit whose sweep never passed still restores to its opening.
3191
3341
  // **THE CARRIER IS THE STORE'S OWN ANSWER, HANDED BACK VERBATIM**: `{k:'s', v:<op id>}` names an entry and
3192
- // `{k:'F'}` names the FLOOR (the state the store was born with, where the journal held no entry when the commit
3193
- // opened). **NOTHING IS COMPOSED HERE**, so the mark has one spelling and it lives at the store's edge.
3342
+ // `{k:'F'}` names the FLOOR — **and since `D-179` the floor is NOT "the state the store was born with"**: it is the
3343
+ // state the COMPACTION stands at, which equals the creation state only where nothing has been dropped. **THE STORE
3344
+ // CANNOT TELL THE TWO CLASSES APART AT THAT ENTRY** (both answer `None`; `D-179` item 4), **so this sentence names
3345
+ // the floor rather than its two arms** — and it is TRUE OF BOTH, which the born-reading was not.
3346
+ // **NOTHING IS COMPOSED HERE**, so the mark has one spelling and it lives at the store's edge.
3194
3347
  let refused = null;
3195
3348
  let cacheless = false;
3196
3349
  const mark = windowMark(instance);