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,396 +1,57 @@
1
- // `D-2` (`docs/L1/entry-subdivision.md` §1 part `3`) — bytes moved from `bindings/js/index.mjs`; no logic changed.
2
- import { readFileSync } from 'node:fs';
3
- import { dirname as dirOf, join } from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
- import { appendOwn, fail } from './refusal.mjs';
6
-
7
- // **THE ENTRY'S OWN MODULE CONTEXT, HANDED IN AND NOT RE-DERIVED HERE** (`docs/L1/module-map.md` `I-29`):
8
- // `require_`, `ADDON_PATH` and the manifest path are all derived from `index.mjs`'s own `import.meta.url`, because
9
- // rung two must find the artefact beside the ENTRY and rung one's version read must find `package.json` beside it. A
10
- // part deriving either from its own URL would search `src/entry/` for both. `adoptModuleContext` is called once, by the
11
- // entry, at its own evaluation; every reader below sits inside a function body and reads the adopted value.
12
- let entryUrl = null;
13
- export let require_ = null;
14
- let ADDON_PATH = null;
15
- export function adoptModuleContext(url, requireBase, addonPath) {
16
- entryUrl = url;
17
- require_ = requireBase;
18
- ADDON_PATH = addonPath;
19
- }
20
-
21
- // ---------------------------------------------------------------------------------------------
22
- // THE RESOLUTION RULE — THREE RUNGS, IN ORDER, AND THE CLOSED KEY SET (`docs/specs/storeroom-publish/
23
- // resolution.md §2` · `§3`; `docs/specs/storeroom-publish/contract.md §1.1` · `§1.3` · `§1.5`).
24
- //
25
- // **RUNG ONE — THE SCOPED PLATFORM PACKAGE FOR THIS RUNTIME'S KEY.** The table below is the WHOLE of the
26
- // table the entry carries: it maps the runtime's `process.platform` × `process.arch` pair to ONE of the
27
- // FIVE DECLARED NAMES, and to NO other value. **A name is SELECTED from this table and is NEVER BUILT by
28
- // concatenating a platform token, an architecture token and a toolchain token** (`C-1`, `docs/specs/storeroom-publish/contract.md §1.3` item 1):
29
- // **an uncovered pair IS NOT A MISS BUT A DECLARED `NOT COVERED`**, so rung one is NOT ATTEMPTED at all
30
- // and no sixth name is computed (`resolution.md §2.2`; `§4.1`'s `NOT COVERED` row).
31
- //
32
- // **AND NO C-LIBRARY IS READ, DETECTED OR MEASURED BY ANY CLAUSE OF THIS UNIT** (`PUB-DD-8`; the two
33
- // names this prohibition is about are spelled at `resolution.md §4.2` and are DELIBERATELY ABSENT FROM
34
- // THIS FILE, so the entry declares no detection mechanism, no value set and no measured domain): the keys
35
- // are the PAIR alone, a host whose C library differs from its artefact's still selects its `-gnu` name
36
- // exactly as any other covered pair does, and that state is a STATE the load path reaches (`§4.2`) rather
37
- // than a sixth key. **THE CONSEQUENCE IS THE DECLARED ONE: the `os`/`cpu` fields cannot express a C
38
- // library, so such a host meets the `-gnu` artefact's own `dlopen` outcome and lands on the same state
39
- // that outcome produces at any other key.**
40
- //
41
- // **RUNG TWO — THE MODULE-RELATIVE ADDON.** `ADDON_PATH` above, constructed from the entry module's own
42
- // location and from no other source — `PUB-DD-20`: no environment variable, no configuration key, no path
43
- // relative to the process's working directory and no search of a parent directory.
44
- //
45
- // **RUNG THREE — THE DECLARED ABSENT-ADDON FORM.** The single failure arm of `docs/specs/storeroom-publish/contract.md §1.4`, its subject the
46
- // artefact paths that WERE TRIED.
47
- //
48
- // **THE CATCH'S DECLARED WIDTH** (`docs/specs/storeroom-publish/contract.md §1.1`; `resolution.md §2.3`): EVERY throw of rung one's `require` is a
49
- // MISS — a `MODULE_NOT_FOUND` for an absent package, an `ERR_DLOPEN_FAILED` for a present-but-unloadable
50
- // artefact, and any other throw alike — so the loader moves to rung two and never answers a second shape.
51
- // ---------------------------------------------------------------------------------------------
52
- const PLATFORM_NAMES = {
53
- 'linux·x64': '@auspicion/provident-storeroom-js-linux-x64-gnu',
54
- 'linux·arm64': '@auspicion/provident-storeroom-js-linux-arm64-gnu',
55
- 'darwin·x64': '@auspicion/provident-storeroom-js-darwin-x64',
56
- 'darwin·arm64': '@auspicion/provident-storeroom-js-darwin-arm64',
57
- 'win32·x64': '@auspicion/provident-storeroom-js-win32-x64-msvc',
58
- };
59
-
60
- /// **THE TOTAL PLATFORM TABLE** (`resolution.md §4.1`): the value is one of the five declared names or the
61
- /// token `NOT COVERED`, and NO other value (`C-1`).
62
- function platformNameFor(platform, arch) {
63
- const pair = `${platform}·${arch}`;
64
- if (!Object.prototype.hasOwnProperty.call(PLATFORM_NAMES, pair)) return 'NOT COVERED';
65
- return PLATFORM_NAMES[pair];
66
- }
67
-
68
- /// **THE RUNTIME'S KEY, READ ONCE AT THE LOAD PATH** (`resolution.md §4.1`: `process.platform` ×
69
- /// `process.arch`). **IT IS NOT READ AT MODULE EVALUATION, so the pair a drive fixes before the entry is
70
- /// imported is the pair this table answers** — and no clause here reads a C library.
71
- function platformNameForRuntime() {
72
- return platformNameFor(process.platform, process.arch);
73
- }
74
-
75
- /// **THE PACKAGE'S OWN VERSION, READ FROM THE PACKAGE'S OWN MANIFEST** (`docs/specs/storeroom-publish/contract.md §1.5` item 1: *"never passed in,
76
- /// configured or defaulted"*). The manifest stands beside the entry module, as `ADDON_PATH`'s artefact does.
77
- function packageVersion() {
78
- try {
79
- return JSON.parse(readFileSync(join(dirOf(fileURLToPath(entryUrl)), 'package.json'), 'utf8')).version;
80
- } catch {
81
- return undefined;
82
- }
83
- }
84
-
85
- // ---------------------------------------------------------------------------------------------
86
- // THE DECLARED ABSENT/FAILED-ADDON STATE (`A75`: *"an addon that is absent or fails to load is a DECLARED
87
- // FAILURE and never a silent JS store (`V-3` was refused by this choice)"*).
88
- //
89
- // **THERE IS NO FALLBACK, BECAUSE THERE IS NO SECOND IMPLEMENTATION.** `require_(ADDON_PATH)` is called
90
- // ONCE; if the artefact is absent, unreadable or refuses to load, the construction answers `docs/specs/storeroom-js/surface.md §2.5`'s
91
- // SINGLE FAILURE FORM and NO instance is returned — the package never falls back to a JS store and never
92
- // absorbs the state silently.
93
- //
94
- // **THE DECLARED STATE:** an addon that is absent or fails to load answers
95
- // `{status: 'FilePathUnreachable', message: <the store's own generated string for that code at the
96
- // addon's own path>}`. The status is a member of the store's closed `15`-member set carried VERBATIM
97
- // (`docs/specs/storeroom-js/surface.md §2.5` item 1, `DD-40`) and is not minted here; the message is the STORE'S generator's string, reached
98
- // through the addon where it loaded far enough to carry the generator (`errorMessage`), and the ONE string
99
- // stated at its own site where the generator itself is the thing that failed to load.
100
- // **THE ROW THAT PINS THIS STATE IS `P-TP-7`'s `S-LOAD`, and no clause of the contract names a status or a
101
- // message-home for it** — reported as a CONTRACT FINDING rather than repaired here.
102
- //
103
- // **⟶ AND GATE 4'S `JS-3` IS CLOSED AT THIS SITE, WITH ITS DERIVATION MADE EXPLICIT RATHER THAN ACCIDENTAL.**
104
- // **THE FINDING, NAMED: the absent/failed-addon constant was NOT the same bytes as the generator's string —
105
- // the fallback wrote the template directly, so the equality held only for the exact spelling `'<path>'` and
106
- // nothing compared the two arms.** **THE FIX: the generator is reached where it CAN be reached (the artefact
107
- // that loaded far enough to carry `errorMessage`), and where it CANNOT — which is exactly this state, since
108
- // the generator is the thing that failed to load — the fallback IS the generator's own rendering of that
109
- // subject, reproduced BYTE-FOR-BYTE from the generator's own clause and named as the reproduction.** **THE
110
- // EQUALITY OF THE TWO ARMS IS THEREFORE A PROPERTY OF THE SOURCE, asserted by the cell that drives the state
111
- // (`NG-JS-H`'s byte-equality arm): measured against the built addon, `errorMessage('FilePathUnreachable',
112
- // <path>)` and `generatorFilePathUnreachable(<path>)` are byte-identical for the same subject.**
113
- //
114
- // **THE GENERATOR'S OWN ROW, REPRODUCED (`src/error.rs`, the `FilePathUnreachable` arm, read with the
115
- // facade's own subject spelling `format!("'{subject}'")`):**
116
- // `format!("{} is not reachable at construction, the path must exist or the application must be able to
117
- // write it", m.subject)` — `package.md §1.2` item 4's *"one string for the state on both arms"*.
118
- // ---------------------------------------------------------------------------------------------
119
- let addon = null;
120
- let addonLoadError = null;
121
- // **THE ARM THE LOAD PATH ANSWERED WITH, WHERE THE STATE IS THE VERSION MISMATCH** (`docs/specs/storeroom-publish/contract.md §1.5` item 2): the
122
- // load path's OWN declared answer, remembered so that the mismatch is TERMINAL — rung two's `require` is
123
- // not reached on the evaluation that meets the mismatch and not on any LATER one either, because the walk
124
- // reads this state before it walks anything. **THE STATE IS THE DECLARED FORM ITSELF AND NEVER A HOST
125
- // `Error`**: `docs/specs/storeroom-publish/contract.md §1.4` item 1 admits ONE failure shape — `{status, message}`, thrown, no third member — so a
126
- // second failure INSTANCE held in the module's own state is not a shape this unit admits (`PUB-R-3`).
127
- let addonArm = null;
128
- // **THE RUNGS THE LOAD PATH ACTUALLY WALKED** (`docs/specs/storeroom-publish/contract.md §1.4` item 2; `resolution.md §5.3`): `tried` collects the
129
- // subjects a candidate was sought at, IN THE ORDER THEY WERE TRIED — rung one's RESOLVED NAME where rung
130
- // one was attempted at all, and rung two's module-relative path. **THE SUBJECT IS ONE PATH WHERE ONE RUNG
131
- // WAS TRIED AND BOTH PATHS WHERE BOTH WERE** (`resolution.md §2.2`), and an uncovered key's rung one is
132
- // never attempted, so its subject is rung two's path ALONE.
133
- let rungOneName = null;
134
- let tried = [];
135
- // **⟶ AND THIS LIST'S APPEND IS ITS OWN MEMBER — ADDED 2026-10-25 ON THE `F8-2` CLASS'S WRITE VECTOR, AND ITS
136
- // TWO CALL SITES ARE UNMOVED BYTE-FOR-BYTE ON PURPOSE.**
137
- // **THE DEFECT:** `tried.push(path)` was `Array.prototype.push`, which performs `[[Set]]` and WALKS THE
138
- // PROTOTYPE CHAIN. With a caller's own getter-only accessor at `Array.prototype[0]` — a mutation a caller owns
139
- // and `C-11` forbids this package to freeze away — the first append threw the raw host `TypeError` *"Cannot
140
- // set property 0 of [object Array] which has only a getter"* out of a LAWFUL `storeCreate`, before the artefact
141
- // was even looked for, with `reads === 0`: no verdict, no user code and no declared form. **THE FIX:** the
142
- // append is given to THIS list as an OWN data member that DEFINES the own property (`appendOwn`), so the append
143
- // takes no member from a mutable prototype and consults no chain; the member is `push` because that is what the
144
- // call sites spell.
145
- // **AND WHY THE CALL SITES KEEP THEIR BYTES RATHER THAN READING `appendOwn(tried, path)` DIRECTLY:**
146
- // `tests/e2e/staged-install/publish-generators.test.mjs`'s `NG-PUB-A` control anchors the rung-one success arm
147
- // by those very bytes (`:734`) and its own message declares that a moved site must be RE-CUT — an act that
148
- // belongs to the test writer and that this pass may not take. So the form is moved to the member, and the two
149
- // sites stand where they stood.
150
- Object.defineProperty(tried, 'push', {
151
- value: (path) => appendOwn(tried, path),
152
- writable: true,
153
- enumerable: false,
154
- configurable: true,
1
+ // `D-2` (`docs/L1/entry-subdivision.md` §1 part `3`) — and **⟶ FROM 2026-11-17 THIS FILE IS THE NODE ARM'S GLUE AND
2
+ // NOTHING ELSE** (`D-156` item 1; the loader split's step 3, `docs/L3/wasm-realm/design.md` §5). **EVERY FUNCTION
3
+ // IT USED TO CARRY HAS TWO HOMES AND THIS FILE HAS NONE OF THEM**:
4
+ //
5
+ // * `withAddon` · `boundaryReject` · `addonLoadMessage` · `spellDottedContainer` · `generatorFilePathUnreachable`
6
+ // stand in **`src/entry/addon-slot.mjs`**, BYTE FOR BYTE, because they are the FORM and the form is the
7
+ // surface's: a realm that injects its bindings reads the same slot and answers the same declared absence, and
8
+ // that file carries no `node:` specifier at all.
9
+ // * the three `node:` imports, the module-context seam (`adoptModuleContext` and its three slots), `PLATFORM_NAMES`
10
+ // and both of its helpers, `packageVersion()`, the three-rung walk and the attempt list it records,
11
+ // `absentSubject` and the mismatch arm stand in **`src/entry/artefact-node.mjs`**, byte for byte, because they
12
+ // are the host's.
13
+ //
14
+ // **WHAT THIS FILE IS FOR, IN ONE SENTENCE: IT HANDS THE NODE ARM'S OWN LOAD PATH TO THE SLOT, ONCE, AT ITS OWN
15
+ // EVALUATION.** The slot takes three functions and never a module — `loadAddon` (the walk), `absentSubject` (the
16
+ // attempt list the walk records) and `artefactPath` (the path this ENTRY derived from its own `import.meta.url`) —
17
+ // so **NOTHING IS LOOKED FOR AT LOAD**: the walk runs at the first construction, exactly where it ran when it lived
18
+ // beside the reader, and this module's evaluation performs one assignment and no filesystem act. **`I-29` /
19
+ // `PUB-DD-20` ARE UNMOVED**: the path handed over is the ENTRY's own (adopted at `index.mjs`'s evaluation through
20
+ // `adoptModuleContext`), read here as the live binding it is, and no part derives a path from its own URL.
21
+ //
22
+ // **AND THE THREE FUNCTIONS ARE THUNKS OVER LIVE BINDINGS, NOT COPIES**, which is what keeps the walk's answer and
23
+ // the slot's state the same fact at every instant: `artefact-node.mjs` owns `addon` and `addonArm`, the walk writes
24
+ // them, and this glue reads them AFTER the walk returns (`loadAddon` is idempotent — its first line answers
25
+ // immediately once any of the three states is reached — so the read is of the answer the walk gave, never of a
26
+ // half-run state). **THE SLOT'S OWN `addon` IS THEN THE WALKED MODULE ITSELF**, so every receiver-handed site in the
27
+ // parts reaches a Node-API entry with `this` as the receiver, exactly as it did.
28
+ //
29
+ // **⟶ AND `withAddon` IS RE-EXPORTED FROM HERE FOR ITS TWO READERS THAT NAME THIS PATH** — `tests/e2e/
30
+ // def-ae-restore-mark.test.mjs` and `tests/e2e/discard-witness.mjs` import it from this file and drive the store's
31
+ // own `journalMark` through it. **NO PART IMPORTS THIS FILE ANY MORE** (the seven parts and the entry's body read
32
+ // `addon-slot.mjs` directly), so this re-export moves no package byte and breaks no part; it is a test's own path
33
+ // kept working rather than a second home for the reader.
34
+ //
35
+ // **THE DIRECTION IS ONE WAY AND CLOSES NO CYCLE**: this file imports `artefact-node.mjs` and `addon-slot.mjs`, and
36
+ // neither imports it — `artefact-node.mjs` imports the slot's generator string and the kernel resolver's setter, and
37
+ // the slot imports nothing but `refusal.mjs`.
38
+ import { ADDON_PATH, absentSubject, addon, addonArm, loadAddon } from './artefact-node.mjs';
39
+ import { installAddonPath } from './addon-slot.mjs';
40
+
41
+ installAddonPath({
42
+ // **THE WALK, THEN THE STATE IT LEFT** — the answer `withAddon`'s slot reads (the module, or `null`, beside the
43
+ // declared arm a version mismatch answers with).
44
+ loadAddon: () => {
45
+ loadAddon();
46
+ return { addon, arm: addonArm };
47
+ },
48
+ // **THE SUBJECT OF THE DECLARED ABSENT FORM ON THIS ARM** — the paths that were tried, in the order they were
49
+ // tried (`artefact-node.mjs`'s `absentSubject`, unmoved).
50
+ absentSubject,
51
+ // **THE PATH THE BOUNDARY'S ABSENT-GENERATOR ARM NAMES** — the ENTRY's own artefact path, live: `ADDON_PATH` is
52
+ // `adoptModuleContext`'s slot and is `null` until the entry adopts its context, which is why this is a thunk and
53
+ // not a value.
54
+ artefactPath: () => ADDON_PATH,
155
55
  });
156
- // **THE RUNG WHOSE LOAD STANDS, WHERE ONE DID** (`docs/specs/storeroom-publish/contract.md §1.5` item 3: the version read applies at rung one
157
- // alone, so the rung is remembered rather than inferred from a path's spelling).
158
- let loadedFrom = null;
159
-
160
- /// **THE RUNG-ONE CANDIDATE FOR THIS RUNTIME, COMPUTED ONCE FROM THE CLOSED TABLE** (`C-1`): the pair's
161
- /// own declared name, or `NOT COVERED` — and `NOT COVERED` means rung one is NOT ATTEMPTED, so no name is
162
- /// computed for it and no speculative fallback exists (`docs/specs/storeroom-publish/contract.md §1.3` item 3).
163
- function rungOneCandidate() {
164
- if (rungOneName === null) rungOneName = platformNameForRuntime();
165
- return rungOneName;
166
- }
167
-
168
- // ---------------------------------------------------------------------------------------------
169
- // **THE RUNG WALK** (`docs/specs/storeroom-publish/contract.md §1.1` items 1–2; `resolution.md §2.1`): RUNG ONE first — a covered key's one declared
170
- // name, `require`d at the package root — then, failing it, RUNG TWO — the module-relative `ADDON_PATH`.
171
- // **EVERY THROW AT RUNG ONE IS A MISS** (`resolution.md §2.3`): the catch neither classifies the throw nor
172
- // reports it, so a `MODULE_NOT_FOUND`, an `ERR_DLOPEN_FAILED` and any other throw alike leave the loader
173
- // at rung two, and NO second failure shape is produced anywhere on this path.
174
- // ---------------------------------------------------------------------------------------------
175
- function loadAddon() {
176
- if (addon !== null || addonArm !== null || addonLoadError !== null) return;
177
- const name = rungOneCandidate();
178
- if (name !== 'NOT COVERED') {
179
- tried.push(name);
180
- let candidate = null;
181
- try {
182
- candidate = require_(name);
183
- } catch {
184
- // **A MISS, AND NOTHING MORE** (`resolution.md §2.3`): the throw is not classified, not rethrown and
185
- // not reported — rung two is where the walk continues.
186
- candidate = null;
187
- }
188
- if (candidate !== null && candidate !== undefined) {
189
- // **`docs/specs/storeroom-publish/contract.md §1.5` item 1 — THE VERSION READ, AT RUNG ONE AND NOWHERE ELSE** (`PUB-DD-18`): the addon's own
190
- // exported `version`, called as a function, against the version the package's own manifest declares,
191
- // compared for EXACT STRING EQUALITY (`PUB-DD-19`: a different string, an empty string, a value that
192
- // is not a string and a `version` that is not callable are EACH the mismatch arm).
193
- const declared = packageVersion();
194
- let answered;
195
- try {
196
- answered = typeof candidate.version === 'function' ? candidate.version() : undefined;
197
- } catch (err) {
198
- answered = err;
199
- }
200
- if (typeof answered !== 'string' || answered !== declared) {
201
- // **THE MISMATCH ARM — THE SINGLE DECLARED FAILURE ARM** (`docs/specs/storeroom-publish/contract.md §1.5` item 2; `PUB-DD-17`): the subject
202
- // is RUNG ONE'S OWN PATH, and **NO FALLBACK TO RUNG TWO exists** — the load path stops here, loads
203
- // nothing from the substituted artefact and returns no instance.
204
- //
205
- // **⟶ AND `PUB-R-3`: THE ARM IS MADE TERMINAL BY CONSTRUCTION RATHER THAN BY THE `if`'S SHAPE.**
206
- // The walk RETURNS at the arm, so rung two's `require` below is not reached on the evaluation that
207
- // meets the mismatch; **and what keeps a LATER evaluation at the arm is the ARM ITSELF, held in
208
- // `addonArm` and read by this walk's own entry test** — never a second failure instance beside it.
209
- // **THE SHIPPED STATE WAS `addonLoadError = new Error('addon-version-mismatch')`, and it was a shape
210
- // `docs/specs/storeroom-publish/contract.md §1.4` item 1 does not admit: an `Error` minted here for a state whose declared answer is the one
211
- // form. THAT ASSIGNMENT IS REMOVED** (the `addonLoadError` slot is left to the load path's own
212
- // cause, rung two's throw) **and its whole duty — halting the walk before rung two — is taken by
213
- // the declared arm.** **A state in which a caught mismatch could then fall through to
214
- // `require_(ADDON_PATH)` and load the checkout's own artefact no longer exists at any call.**
215
- //
216
- // **AND THE `message` IS THE LOADED ARTEFACT'S OWN GENERATOR'S, NOT THIS FILE'S** (`docs/specs/storeroom-publish/contract.md §1.4` item 6,
217
- // arm (a); `PUB-DD-25`; `P-PUB-4`'s failure list's last member): the artefact that loaded and
218
- // answered `version` is the artefact that carries the store's generator, so the string is reached
219
- // through ITS `errorMessage` at the subject `docs/specs/storeroom-publish/contract.md §1.5` item 2 fixes. **`mismatchArmMessage` below names
220
- // the fallback where that artefact cannot supply it.**
221
- addon = null;
222
- addonArm = { status: 'FilePathUnreachable', message: mismatchArmMessage(candidate, name) };
223
- return;
224
- }
225
- addon = candidate;
226
- loadedFrom = 'one';
227
- return;
228
- }
229
- }
230
- tried.push(ADDON_PATH);
231
- try {
232
- addon = require_(ADDON_PATH);
233
- loadedFrom = 'two';
234
- } catch (err) {
235
- addon = null;
236
- addonLoadError = err;
237
- }
238
- }
239
-
240
- /// **THE SUBJECT OF THE DECLARED ABSENT FORM** (`docs/specs/storeroom-publish/contract.md §1.4` item 2; `resolution.md §5.3` item 2): the artefact
241
- /// paths that were TRIED. **ONE PATH WHERE ONE RUNG WAS TRIED; BOTH PATHS WHERE BOTH WERE** — and where
242
- /// both were, they are ordered RUNG ONE FIRST and RUNG TWO SECOND, joined by `', '`.
243
- /// **EACH PATH IS RENDERED INTO THE GENERATOR'S OWN `'<subject>'` SLOT BY THE GENERATOR ITSELF, whose
244
- /// clause already supplies the surrounding apostrophes for a single subject** (`src/error.rs`'s
245
- /// `FilePathUnreachable` arm at the facade's own subject spelling): **so the single-path form is the RAW
246
- /// path, exactly as the store's own generator renders it, and the two-path form is a comma-separated list
247
- /// whose separator sits BETWEEN the generator's own renderings of its two subjects.**
248
- /// **⟶ CONTRACT FINDING (`PUB-CF-7`, reported and NOT patched here):** **no clause of
249
- /// `docs/specs/storeroom-publish/` declares this JOIN** — neither the separator nor the order — while
250
- /// `resolution.md §5.3` item 2 requires BOTH PATHS to be the subject. **This file therefore CHOOSES the
251
- /// separator `', '` and the order rung one then rung two, so a consumer reads both subjects in the order
252
- /// they were tried; the choice is reported to `role_spec_writer` as a contract finding rather than taken
253
- /// as a silent invention.**
254
- function absentSubject() {
255
- if (tried.length === 1) return tried[0];
256
- return tried.map((path) => `'${path}'`).join(', ');
257
- }
258
-
259
- /// **THE STORE'S GENERATOR'S OWN RENDERING OF `FilePathUnreachable` FOR A SUBJECT** — the ONE row this file
260
- /// reproduces, and it reproduces it because there is exactly ONE state in which the generator cannot be
261
- /// reached at all: the state in which the generator is the thing that failed to load. **IT IS NEVER A
262
- /// HAND-AUTHORED MESSAGE** (`docs/specs/storeroom-js/surface.md §2.5` item 2): it is the generator's clause, subject slot included, rendered
263
- /// byte-for-byte — see the derivation above this block.
264
- function generatorFilePathUnreachable(subject) {
265
- return `'${subject}' is not reachable at construction, the path must exist or the application must be able to write it`;
266
- }
267
-
268
- /// **THE MISMATCH ARM'S `message`, AND ITS ONE DECLARED FALLBACK** (`docs/specs/storeroom-publish/contract.md §1.4` item 6; `PUB-DD-25`).
269
- /// **ARM (a) FIRST: THE LOADED ARTEFACT'S OWN GENERATOR AUTHORS THE STRING**, reached through the artefact's
270
- /// `errorMessage` — the artefact that loaded and answered `version` is the artefact that carries the
271
- /// generator — at the subject `docs/specs/storeroom-publish/contract.md §1.5` item 2 fixes, RUNG ONE'S OWN PATH. **WHERE THAT ARTEFACT CARRIES NO
272
- /// `errorMessage`, OR ITS OWN GENERATOR THROWS, OR IT ANSWERS A VALUE THAT IS NOT A `string`, THE GENERATOR
273
- /// IS UNREACHABLE AND ARM (b) ANSWERS: THE STORE'S OWN CLAUSE, REPRODUCED BYTE-FOR-BYTE AT THAT SAME
274
- /// SUBJECT.** Arm (b) is the ONE arm `docs/specs/storeroom-publish/contract.md §1.4` item 6 declares for a state in which no generator can be
275
- /// reached, so the fallback is named rather than taken silently, and a failure inside the loaded
276
- /// artefact's generator cannot become a second failure shape.
277
- function mismatchArmMessage(candidate, name) {
278
- if (candidate !== null && candidate !== undefined && typeof candidate.errorMessage === 'function') {
279
- try {
280
- const rendered = candidate.errorMessage('FilePathUnreachable', name);
281
- if (typeof rendered === 'string') return rendered;
282
- } catch {
283
- // the loaded artefact's own generator failed in turn: arm (b) below is the declared answer
284
- }
285
- }
286
- return generatorFilePathUnreachable(name);
287
- }
288
-
289
- /// **THE DECLARED ABSENT FORM'S MESSAGE** — the store's own generator's string for `FilePathUnreachable`
290
- /// at the subject `absentSubject()` fixes (`docs/specs/storeroom-publish/contract.md §1.4` items 1–2). **WHERE AN ARTEFACT LOADED FAR ENOUGH TO
291
- /// CARRY THE GENERATOR, THE GENERATOR AUTHORS THE STRING** (`A75`: *"reached through the addon where it
292
- /// loaded far enough to carry the generator"*) — `addon.errorMessage` at each subject in turn.
293
- /// **WHERE THE GENERATOR IS UNREACHABLE — which is exactly this state, since the artefact that carries it
294
- /// is the thing that failed to load — THE STRING IS THE GENERATOR'S OWN RENDERING OF THAT SUBJECT,
295
- /// REPRODUCED BYTE-FOR-BYTE** (`JS-3`'s fix) and **NOT hand-authored** (`docs/specs/storeroom-js/surface.md §2.5` item 2).
296
- function addonLoadMessage() {
297
- loadAddon();
298
- const subject = absentSubject();
299
- if (addon !== null && typeof addon.errorMessage === 'function') {
300
- return addon.errorMessage('FilePathUnreachable', subject);
301
- }
302
- // THE GENERATOR'S OWN RENDERING OF THIS SUBJECT, where it could not be reached (`JS-3`'s fix).
303
- return generatorFilePathUnreachable(subject);
304
- }
305
-
306
- export function withAddon() {
307
- loadAddon();
308
- // **THE MISMATCH ARM STANDS FIRST, AND IT IS THE ARM THE LOAD PATH ITSELF ANSWERED WITH** (`docs/specs/storeroom-publish/contract.md §1.5` item 2;
309
- // `PUB-R-3`): where the version read refused, THE WALK IS OVER — no rung-two attempt is made here and none
310
- // is made at any later call, and the value re-thrown is the arm's own `{status, message}` and not a state
311
- // re-derived from a path list.
312
- if (addonArm !== null) fail(addonArm);
313
- if (addon === null) fail({ status: 'FilePathUnreachable', message: addonLoadMessage() });
314
- return addon;
315
- }
316
-
317
- /// **`A76`'S VERBOSE REJECTION, AT THE PACKAGE'S OWN EDGE** — used where the refusal is the BOUNDARY's own:
318
- /// a class the walk rejects BEFORE any verb is called, and whose carrier the store's own tables do not
319
- /// declare. **THE MESSAGE NAMES THE FAILING TARGET AND WHY.** The target is rendered by the **STORE'S OWN
320
- /// GENERATOR** — reached through the addon's `errorMessage`, so the message is never hand-authored here
321
- /// (`docs/specs/storeroom-js/surface.md §2.5` item 2) — and the clause the ruling requires beside it is the CLASS that failed, plus the
322
- /// POSITION where the carrier declares one. **THE STATUS IS NEVER MINTED** (`DD-40`): it is the member of
323
- /// the store's closed set that the crossing's own table declares for the row the class falls under, and it
324
- /// is passed as an argument at each site rather than chosen here.
325
- /// **AND NO SECOND FORM EXISTS** (`A76`'s reach, verbatim: *"it does NOT license a SECOND failure form"*):
326
- /// the rejection travels inside the one `{status, message}` and never as a raw host error — **which is why
327
- /// NOTHING on this path coerces the value: no `Number(...)`, no `String(...)`, no `valueOf`, no
328
- /// `Symbol.toPrimitive` and no trap is ever invoked, so no host `TypeError` can be raised from this frame
329
- /// in the first place.**
330
- ///
331
- /// **⟶ AND THE FAILING SEGMENT'S CONTAINER IS HANDED TO THE GENERATOR'S OWN `<container>` SLOT, ADDED
332
- /// 2026-10-17 (`§2.5` item 5 (a)–(b) AND ITS `CF-3` AUTHORITY SPLIT; `docs/specs/storeroom-native/contract.md`
333
- /// §8.2's `MessageArgs.container`, *"the container or node the mismatch was found in: `''` for the register,
334
- /// a dotted path otherwise"*).** **THE DEFECT IT CLOSES, NAMED: the two-slot route filled `segment` and
335
- /// `path` ALONE, so `container` took its default and PART ONE READ *"the number 1.5 is not a legal address
336
- /// segment in `''`"* — a FALSE container — while PART TWO appended *"in 'a'"* and the store's own bytes for
337
- /// that same input are `the number 1.5 is not a legal address segment in 'a'` (`src/store.rs`'s `listen`
338
- /// arm, whose container is the prefix `['a']`; `src/error.rs`'s `malformed_segment`).** **TWO CONTAINERS
339
- /// STOOD, ONE OF THEM FALSE; ONE STANDS NOW AND IT IS THE TRUE ONE.** **`container` is the failing
340
- /// segment's OWN PREFIX — the store's own `dotted_address` spelling of it — and `undefined` at every site
341
- /// that declares none, where the slot is left at its default and THE GENERATOR'S OWN BYTES ARE UNMOVED**
342
- /// (the two-argument `errorMessage(code, subject)` call included).
343
- ///
344
- /// **⟶ AND THE DOTTED SPELLING TAKES NOTHING FROM A MUTABLE PROTOTYPE FROM 2026-10-24** (`contract.md §2.1`'s
345
- /// clause of this date on `F7-1`, items `(2b)`'s row `40` and `(10d)`): the as-built limb was
346
- /// `container.map((segment) => String(segment)).join('.')` — `Array.prototype.map` and `Array.prototype.join`
347
- /// taken off a MUTABLE PROTOTYPE on a REFUSAL path — so a caller's `map` answering a string made the next
348
- /// `.join` throw a raw host `TypeError` out of a refusal (`§2.5` item 5 (e) allows no second form), and a
349
- /// caller's `join` answering a marker wrote that marker into the store's own `<container>` slot as
350
- /// `in 'OPMARK'`. **`spellDottedContainer` below is item `(1c)(i)`'s local loop**; the separator, the bare
351
- /// spellings and the absent-container default are unmoved.
352
- function spellDottedContainer(container) {
353
- let spelled = '';
354
- for (let i = 0; i < container.length; i += 1) {
355
- spelled += i === 0 ? String(container[i]) : `.${String(container[i])}`;
356
- }
357
- return spelled;
358
- }
359
-
360
- /// **⟶ AND ONE APPENDED FIFTH PARAMETER IS THE ARM TOKEN, ADDED 2026-11-01 (`D-98` item 4; `C-7`/`C-12`;
361
- /// §3.2, §3.7).** `boundaryReject(status, subject, clause, container, token)` — **POSITIONS 1–4 ARE UNMOVED, so
362
- /// every one of the `27` existing call sites is BYTE-IDENTICAL**, and the token is supplied by the four
363
- /// cross-kind arms alone.
364
- ///
365
- /// **WHAT IT IS, EXACTLY: A CLOSED ARM TOKEN AND NEVER TEXT.** The one token this correction requires is
366
- /// `'handle'`. It is **not** a message, a clause, a spelling or a member name the store will print: the store
367
- /// renders ITS OWN WORDS from the flag the token sets (`src/error.rs`'s two qualified branches, §3.3), and **an
368
- /// unknown token leaves the slot absent, so the ordinary rendering stands — which is the two-argument call's
369
- /// bytes.** **NO CALLER-SUPPLIED TEXT CAN ENTER A GENERATED SENTENCE** (`surface.md §2.5` item 2, `DD-52`).
370
- ///
371
- /// **WHY A TOKEN AND NOT A BETTER CONTAINER** (§3.2 (e)–(f), refused there on two measured grounds): no container
372
- /// repairs a DOMAIN claim, `Some('')` is already occupied by genuine register-level refusals, and a sentinel
373
- /// spelling would be **an identity carried by a spelling** — exactly the seam `D-22` deleted by name. **The
374
- /// qualified arm prints NO `<CONTAINER>` slot at all**, which is why the fourth position is passed `undefined`
375
- /// ON PURPOSE at those four sites: it is a DECLARATION and not an omission (§3.4).
376
- export function boundaryReject(status, subject, clause, container, token) {
377
- const addon_ = withAddon();
378
- if (typeof addon_.errorMessage !== 'function') {
379
- // An artefact that LOADED but does not carry the generator is not the declared artefact: the state is
380
- // the declared absent/failed-addon one, and its message is the generator's own rendering reproduced.
381
- fail({ status: 'FilePathUnreachable', message: generatorFilePathUnreachable(ADDON_PATH) });
382
- }
383
- // **THE CONTAINER IS THE PREFIX'S OWN DOTTED SPELLING AND NOTHING ELSE** (`src/error.rs`'s
384
- // `dotted_address`: a key bare, an index bare, joined by `.`) — the same reading the store's own
385
- // `malformed_segment` triggers take, where the container is the segment the mismatch was found in.
386
- const where = container === undefined ? undefined : spellDottedContainer(container);
387
- // **THE TOKEN REACHES THE GENERATOR'S APPENDED FOURTH POSITION, AND THE THREE-POSITION AND TWO-POSITION CALLS
388
- // ARE THE BYTES THEY WERE**: a call that supplies no token takes the branch it always took, so **not one byte
389
- // of the generator's output moves where no token is supplied** (`facade.rs`'s own `..Default::default()`
390
- // device, reused at this site).
391
- const generated = token === undefined
392
- ? (where === undefined ? addon_.errorMessage(status, subject) : addon_.errorMessage(status, subject, where))
393
- : addon_.errorMessage(status, subject, where, token);
394
- fail({ status, message: `${generated}, ${clause}` });
395
- }
396
56
 
57
+ export { withAddon } from './addon-slot.mjs';
@@ -1,6 +1,15 @@
1
1
  // `D-2` (`docs/L1/entry-subdivision.md` §1 part `6a`, `D-33`'s seam at `L2799`) — bytes moved from `bindings/js/index.mjs`; no logic changed.
2
- 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
+ import { isProxyOf } from './class-instrument.mjs';
12
+ import { boundaryReject } from './addon-slot.mjs';
4
13
  import { appendOwn } from './refusal.mjs';
5
14
  import { NODE_CEILING, VALUE_ARGUMENT_POSITION, accessorOrSymbolArm, arrayClass, classSpelling, extendedPath, hasLoneSurrogate, protoClass, shapeArmClass, targetSpelling } from './class-decision.mjs';
6
15
 
@@ -254,7 +263,7 @@ export function encodeValue(value, ancestors, depth, path, fault) {
254
263
  if (kind === 'function') return refusedValue(fault, value, 'a function', path, { k: 'f' }); // row 8
255
264
  if (kind === 'symbol') return refusedValue(fault, value, 'a symbol', path, { k: 'y' }); // row 9
256
265
  // `§1.4` item 4 (g), `DD-34` — and NO trap is invoked: `util.types.isProxy` reads no member.
257
- if (types.isProxy(value)) return refusedValue(fault, value, 'a Proxy', path, { k: 'P' });
266
+ if (isProxyOf(value)) return refusedValue(fault, value, 'a Proxy', path, { k: 'P' });
258
267
  // `§1.4` item 6: the ancestor stack, never a `WeakSet` — which is what ADMITS an acyclic diamond.
259
268
  // **⟶ AND THE STACK IS READ BY INDEX, NOT BY `Array.prototype.includes`** (`contract.md §2.1`'s clause of
260
269
  // 2026-10-24 on `F7-1`, items `(1c)(vi)`, `(2b)`'s rows `18` and `29`, and `(10b)`): the as-built membership
@@ -583,7 +592,7 @@ function refuseOutsideSegment(segment, position, prefix, addressArgumentPosition
583
592
  /// THIS predicate either.
584
593
  function isOutsideAddressValue(value) {
585
594
  if (value === undefined || value === null) return true; // row 5's two named classes, on the value as it is
586
- if (types.isProxy(value)) return false; // row 12's own arm, decided above, with no trap run
595
+ if (isProxyOf(value)) return false; // row 12's own arm, decided above, with no trap run
587
596
  if (Array.isArray(value)) return false; // rows 1–3, 13, 14 — the ordinary array arm and its own tests
588
597
  return true; // rows 5–6: a string, a number, a boolean, an object, a function, a symbol, a bigint
589
598
  }
@@ -697,7 +706,7 @@ export function encodeAddress(address, addressArgumentPosition, addressValuePosi
697
706
  // `Array.isArray` is TRUE — is refused under its own declared class (`AddressArg` row 11's
698
707
  // `AddressMalformed`: *"the shape is not an array"*) rather than ADMITTED because a language predicate made
699
708
  // it look like one.
700
- if (types.isProxy(address)) {
709
+ if (isProxyOf(address)) {
701
710
  boundaryReject(
702
711
  'AddressMalformed', // row 12's own declared code (`DD-34`), carried and never minted (`DD-40`)
703
712
  classSpelling(address), // the class half, mandatory under item 5 (b): `a Proxy`
@@ -875,7 +884,7 @@ export function encodeTier(tier, supplied, foldsUndefined, addressArgumentPositi
875
884
  return { k: 'N' }; // `refuseSuppliedOutsideTier` throws; this is unreachable and is not a second path
876
885
  }
877
886
  if (typeof tier === 'string') return { k: 'T', v: tier };
878
- if (types.isProxy(tier)) return { k: 'O' }; // row 6: an object, and no trap is invoked
887
+ if (isProxyOf(tier)) return { k: 'O' }; // row 6: an object, and no trap is invoked
879
888
  if (Array.isArray(tier)) {
880
889
  if (arrayClass(tier) === 'class') return { k: 'O' }; // row 6: a class extending `Array` is an object
881
890
  // **⟶ AND THE TIER SET IS ENCODED BY A LOCAL INDEX LOOP, NOT BY `Array.prototype.map`** (`contract.md §2.1`'s