@auspicion/provident-storeroom-js-wasm 0.0.0-stage → 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.
@@ -0,0 +1,327 @@
1
+ // **⟶ THE NODE-ONLY HALF OF `bindings/js/src/entry/artefact.mjs`, EXTRACTED 2026-11-17** (`D-156` item 1; the
2
+ // loader split's step 3, `docs/L3/wasm-realm/design.md` §5's `artefact.mjs` row: *"the three static `node:`
3
+ // imports — the module cannot even load without them"*, answered by *"fork by extraction"*). **EVERY BYTE BELOW IS
4
+ // THE BYTE IT WAS IN `artefact.mjs`**, whose own `D-2` provenance line still stands at its first line: the three
5
+ // `node:` imports, the module-context seam (`adoptModuleContext` and its three slots, `entryUrl` among them),
6
+ // `PLATFORM_NAMES` and both of its helpers, `packageVersion()`, the three-rung walk and its mismatch arm and its
7
+ // rung-one success site, the recorded attempt list, `absentSubject` and `generatorFilePathUnreachable`. **NOT ONE
8
+ // LOGIC BYTE MOVED.**
9
+ //
10
+ // **WHY THESE BYTES AND NOT OTHERS: THEY ARE THE ONES THAT CANNOT LOAD WITHOUT A HOST.** The three specifiers
11
+ // below are STATIC, so a realm that does not carry them cannot evaluate this module AT ALL — while `withAddon`,
12
+ // `boundaryReject`, `addonLoadMessage` and `spellDottedContainer` need no host byte and therefore stay where they
13
+ // stood, in `artefact.mjs`, which now carries no host specifier of its own and imports this half.
14
+ //
15
+ // **THE DIRECTION IS ONE WAY AND CLOSES NO CYCLE**: nothing of this file imports `artefact.mjs`. **AND THE NAMES
16
+ // THE CUT CROSSES ARE LIVE BINDINGS AND NEVER COPIES** — `addon` · `addonArm` · `ADDON_PATH` · `require_` ·
17
+ // `loadAddon` · `absentSubject` · `generatorFilePathUnreachable` are this module's own exported slots and
18
+ // functions, so `artefact.mjs`'s `withAddon` reads the very slot `loadAddon` writes, on the evaluation that writes
19
+ // it and on every later one: **its answer and `loadAddon`'s body are byte-identical where they now stand.**
20
+ //
21
+ // **AND `generatorFilePathUnreachable` MOVES WITH THE WALK RATHER THAN STAYING BESIDE THE FORM ITSELF**: its three
22
+ // readers are this file's own arm (b) in `mismatchArmMessage`, the absent form's rendering in `artefact.mjs`'s
23
+ // `addonLoadMessage` and `boundaryReject`'s absent-generator arm beside it — so leaving it behind would have made
24
+ // THIS file import `artefact.mjs` and closed the very two-module cycle the sentence above forbids.
25
+ //
26
+ // **⟶ AND THAT SENTENCE IS SUPERSEDED AT ITS SUBJECT FROM 2026-11-17, NOT AT ITS GROUND** (`D-156` item 1; the
27
+ // loader split's step 3). **THE GENERATOR STRING IS THE FORM'S AND HAS MOVED TO `src/entry/addon-slot.mjs`**, beside
28
+ // the two readers that are realm-neutral (`addonLoadMessage` and `boundaryReject` — **both of which left the old
29
+ // `artefact.mjs` for the slot on the same day**), and this file imports it from THERE: **the direction is still one
30
+ // way and the cycle the clause above forbids is still closed** — `addon-slot.mjs` imports nothing but `refusal.mjs`,
31
+ // so the edge runs this file → the slot and never back.
32
+ //
33
+ // **AND THE KERNEL'S LAZY REACH IS INSTALLED HERE, BESIDE THE ONE LOADER THAT CAN ANSWER IT** (`D-156` item 1;
34
+ // `design.md` §5's `constraints.mjs` row). `require_` is THIS half's — it is the HUB's own
35
+ // `createRequire(import.meta.url)`, adopted at the entry's evaluation — so `src/entry/kernel-loader.mjs`'s one slot
36
+ // is filled here with a thunk over it, and `constraints.mjs` asks the slot instead of importing this half. **THE
37
+ // BARREL IS STILL RESOLVED FROM THE HUB'S DIRECTORY AND STILL ONLY ON THE FIRST CONSTRAINT ACT** (`A121`, `A122`;
38
+ // `D-14`'s resolution base): the thunk runs nothing at load and resolves nothing until the part asks.
39
+ import { readFileSync } from 'node:fs';
40
+ import { dirname as dirOf, join } from 'node:path';
41
+ import { fileURLToPath } from 'node:url';
42
+ import { appendOwn } from './refusal.mjs';
43
+ import { generatorFilePathUnreachable } from './addon-slot.mjs';
44
+ import { installKernelResolver } from './kernel-loader.mjs';
45
+
46
+ // **THE ONE INSTALLATION OF THE KERNEL'S REACH** — see the clause above. It sits at this module's own evaluation
47
+ // because the loader it closes over is this module's own live binding, and it performs no act: `require_` is read
48
+ // when `constraintsKernel()` first asks, and the barrel is not resolved here.
49
+ installKernelResolver(() => require_('./src/constraint-kernel.mjs'));
50
+
51
+ // **THE ENTRY'S OWN MODULE CONTEXT, HANDED IN AND NOT RE-DERIVED HERE** (`docs/L1/module-map.md` `I-29`):
52
+ // `require_`, `ADDON_PATH` and the manifest path are all derived from `index.mjs`'s own `import.meta.url`, because
53
+ // rung two must find the artefact beside the ENTRY and rung one's version read must find `package.json` beside it. A
54
+ // part deriving either from its own URL would search `src/entry/` for both. `adoptModuleContext` is called once, by the
55
+ // entry, at its own evaluation; every reader below sits inside a function body and reads the adopted value.
56
+ let entryUrl = null;
57
+ export let require_ = null;
58
+ export let ADDON_PATH = null;
59
+ export function adoptModuleContext(url, requireBase, addonPath) {
60
+ entryUrl = url;
61
+ require_ = requireBase;
62
+ ADDON_PATH = addonPath;
63
+ }
64
+
65
+ // ---------------------------------------------------------------------------------------------
66
+ // THE RESOLUTION RULE — THREE RUNGS, IN ORDER, AND THE CLOSED KEY SET (`docs/specs/storeroom-publish/
67
+ // resolution.md §2` · `§3`; `docs/specs/storeroom-publish/contract.md §1.1` · `§1.3` · `§1.5`).
68
+ //
69
+ // **RUNG ONE — THE SCOPED PLATFORM PACKAGE FOR THIS RUNTIME'S KEY.** The table below is the WHOLE of the
70
+ // table the entry carries: it maps the runtime's `process.platform` × `process.arch` pair to ONE of the
71
+ // FIVE DECLARED NAMES, and to NO other value. **A name is SELECTED from this table and is NEVER BUILT by
72
+ // concatenating a platform token, an architecture token and a toolchain token** (`C-1`, `docs/specs/storeroom-publish/contract.md §1.3` item 1):
73
+ // **an uncovered pair IS NOT A MISS BUT A DECLARED `NOT COVERED`**, so rung one is NOT ATTEMPTED at all
74
+ // and no sixth name is computed (`resolution.md §2.2`; `§4.1`'s `NOT COVERED` row).
75
+ //
76
+ // **AND NO C-LIBRARY IS READ, DETECTED OR MEASURED BY ANY CLAUSE OF THIS UNIT** (`PUB-DD-8`; the two
77
+ // names this prohibition is about are spelled at `resolution.md §4.2` and are DELIBERATELY ABSENT FROM
78
+ // THIS FILE, so the entry declares no detection mechanism, no value set and no measured domain): the keys
79
+ // are the PAIR alone, a host whose C library differs from its artefact's still selects its `-gnu` name
80
+ // exactly as any other covered pair does, and that state is a STATE the load path reaches (`§4.2`) rather
81
+ // than a sixth key. **THE CONSEQUENCE IS THE DECLARED ONE: the `os`/`cpu` fields cannot express a C
82
+ // library, so such a host meets the `-gnu` artefact's own `dlopen` outcome and lands on the same state
83
+ // that outcome produces at any other key.**
84
+ //
85
+ // **RUNG TWO — THE MODULE-RELATIVE ADDON.** `ADDON_PATH` above, constructed from the entry module's own
86
+ // location and from no other source — `PUB-DD-20`: no environment variable, no configuration key, no path
87
+ // relative to the process's working directory and no search of a parent directory.
88
+ //
89
+ // **RUNG THREE — THE DECLARED ABSENT-ADDON FORM.** The single failure arm of `docs/specs/storeroom-publish/contract.md §1.4`, its subject the
90
+ // artefact paths that WERE TRIED.
91
+ //
92
+ // **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
93
+ // MISS — a `MODULE_NOT_FOUND` for an absent package, an `ERR_DLOPEN_FAILED` for a present-but-unloadable
94
+ // artefact, and any other throw alike — so the loader moves to rung two and never answers a second shape.
95
+ // ---------------------------------------------------------------------------------------------
96
+ const PLATFORM_NAMES = {
97
+ 'linux·x64': '@auspicion/provident-storeroom-js-linux-x64-gnu',
98
+ 'linux·arm64': '@auspicion/provident-storeroom-js-linux-arm64-gnu',
99
+ 'darwin·x64': '@auspicion/provident-storeroom-js-darwin-x64',
100
+ 'darwin·arm64': '@auspicion/provident-storeroom-js-darwin-arm64',
101
+ 'win32·x64': '@auspicion/provident-storeroom-js-win32-x64-msvc',
102
+ };
103
+
104
+ /// **THE TOTAL PLATFORM TABLE** (`resolution.md §4.1`): the value is one of the five declared names or the
105
+ /// token `NOT COVERED`, and NO other value (`C-1`).
106
+ function platformNameFor(platform, arch) {
107
+ const pair = `${platform}·${arch}`;
108
+ if (!Object.prototype.hasOwnProperty.call(PLATFORM_NAMES, pair)) return 'NOT COVERED';
109
+ return PLATFORM_NAMES[pair];
110
+ }
111
+
112
+ /// **THE RUNTIME'S KEY, READ ONCE AT THE LOAD PATH** (`resolution.md §4.1`: `process.platform` ×
113
+ /// `process.arch`). **IT IS NOT READ AT MODULE EVALUATION, so the pair a drive fixes before the entry is
114
+ /// imported is the pair this table answers** — and no clause here reads a C library.
115
+ function platformNameForRuntime() {
116
+ return platformNameFor(process.platform, process.arch);
117
+ }
118
+
119
+ /// **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,
120
+ /// configured or defaulted"*). The manifest stands beside the entry module, as `ADDON_PATH`'s artefact does.
121
+ function packageVersion() {
122
+ try {
123
+ return JSON.parse(readFileSync(join(dirOf(fileURLToPath(entryUrl)), 'package.json'), 'utf8')).version;
124
+ } catch {
125
+ return undefined;
126
+ }
127
+ }
128
+
129
+ // ---------------------------------------------------------------------------------------------
130
+ // THE DECLARED ABSENT/FAILED-ADDON STATE (`A75`: *"an addon that is absent or fails to load is a DECLARED
131
+ // FAILURE and never a silent JS store (`V-3` was refused by this choice)"*).
132
+ //
133
+ // **THERE IS NO FALLBACK, BECAUSE THERE IS NO SECOND IMPLEMENTATION.** `require_(ADDON_PATH)` is called
134
+ // ONCE; if the artefact is absent, unreadable or refuses to load, the construction answers `docs/specs/storeroom-js/surface.md §2.5`'s
135
+ // SINGLE FAILURE FORM and NO instance is returned — the package never falls back to a JS store and never
136
+ // absorbs the state silently.
137
+ //
138
+ // **THE DECLARED STATE:** an addon that is absent or fails to load answers
139
+ // `{status: 'FilePathUnreachable', message: <the store's own generated string for that code at the
140
+ // addon's own path>}`. The status is a member of the store's closed `15`-member set carried VERBATIM
141
+ // (`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
142
+ // through the addon where it loaded far enough to carry the generator (`errorMessage`), and the ONE string
143
+ // stated at its own site where the generator itself is the thing that failed to load.
144
+ // **THE ROW THAT PINS THIS STATE IS `P-TP-7`'s `S-LOAD`, and no clause of the contract names a status or a
145
+ // message-home for it** — reported as a CONTRACT FINDING rather than repaired here.
146
+ //
147
+ // **⟶ AND GATE 4'S `JS-3` IS CLOSED AT THIS SITE, WITH ITS DERIVATION MADE EXPLICIT RATHER THAN ACCIDENTAL.**
148
+ // **THE FINDING, NAMED: the absent/failed-addon constant was NOT the same bytes as the generator's string —
149
+ // the fallback wrote the template directly, so the equality held only for the exact spelling `'<path>'` and
150
+ // nothing compared the two arms.** **THE FIX: the generator is reached where it CAN be reached (the artefact
151
+ // that loaded far enough to carry `errorMessage`), and where it CANNOT — which is exactly this state, since
152
+ // the generator is the thing that failed to load — the fallback IS the generator's own rendering of that
153
+ // subject, reproduced BYTE-FOR-BYTE from the generator's own clause and named as the reproduction.** **THE
154
+ // EQUALITY OF THE TWO ARMS IS THEREFORE A PROPERTY OF THE SOURCE, asserted by the cell that drives the state
155
+ // (`NG-JS-H`'s byte-equality arm): measured against the built addon, `errorMessage('FilePathUnreachable',
156
+ // <path>)` and `generatorFilePathUnreachable(<path>)` are byte-identical for the same subject.**
157
+ //
158
+ // **THE GENERATOR'S OWN ROW, REPRODUCED (`src/error.rs`, the `FilePathUnreachable` arm, read with the
159
+ // facade's own subject spelling `format!("'{subject}'")`):**
160
+ // `format!("{} is not reachable at construction, the path must exist or the application must be able to
161
+ // write it", m.subject)` — `package.md §1.2` item 4's *"one string for the state on both arms"*.
162
+ // ---------------------------------------------------------------------------------------------
163
+ export let addon = null;
164
+ let addonLoadError = null;
165
+ // **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
166
+ // load path's OWN declared answer, remembered so that the mismatch is TERMINAL — rung two's `require` is
167
+ // not reached on the evaluation that meets the mismatch and not on any LATER one either, because the walk
168
+ // reads this state before it walks anything. **THE STATE IS THE DECLARED FORM ITSELF AND NEVER A HOST
169
+ // `Error`**: `docs/specs/storeroom-publish/contract.md §1.4` item 1 admits ONE failure shape — `{status, message}`, thrown, no third member — so a
170
+ // second failure INSTANCE held in the module's own state is not a shape this unit admits (`PUB-R-3`).
171
+ export let addonArm = null;
172
+ // **THE RUNGS THE LOAD PATH ACTUALLY WALKED** (`docs/specs/storeroom-publish/contract.md §1.4` item 2; `resolution.md §5.3`): `tried` collects the
173
+ // subjects a candidate was sought at, IN THE ORDER THEY WERE TRIED — rung one's RESOLVED NAME where rung
174
+ // one was attempted at all, and rung two's module-relative path. **THE SUBJECT IS ONE PATH WHERE ONE RUNG
175
+ // WAS TRIED AND BOTH PATHS WHERE BOTH WERE** (`resolution.md §2.2`), and an uncovered key's rung one is
176
+ // never attempted, so its subject is rung two's path ALONE.
177
+ let rungOneName = null;
178
+ let tried = [];
179
+ // **⟶ AND THIS LIST'S APPEND IS ITS OWN MEMBER — ADDED 2026-10-25 ON THE `F8-2` CLASS'S WRITE VECTOR, AND ITS
180
+ // TWO CALL SITES ARE UNMOVED BYTE-FOR-BYTE ON PURPOSE.**
181
+ // **THE DEFECT:** `tried.push(path)` was `Array.prototype.push`, which performs `[[Set]]` and WALKS THE
182
+ // PROTOTYPE CHAIN. With a caller's own getter-only accessor at `Array.prototype[0]` — a mutation a caller owns
183
+ // and `C-11` forbids this package to freeze away — the first append threw the raw host `TypeError` *"Cannot
184
+ // set property 0 of [object Array] which has only a getter"* out of a LAWFUL `storeCreate`, before the artefact
185
+ // was even looked for, with `reads === 0`: no verdict, no user code and no declared form. **THE FIX:** the
186
+ // append is given to THIS list as an OWN data member that DEFINES the own property (`appendOwn`), so the append
187
+ // takes no member from a mutable prototype and consults no chain; the member is `push` because that is what the
188
+ // call sites spell.
189
+ // **AND WHY THE CALL SITES KEEP THEIR BYTES RATHER THAN READING `appendOwn(tried, path)` DIRECTLY:**
190
+ // `tests/e2e/staged-install/publish-generators.test.mjs`'s `NG-PUB-A` control anchors the rung-one success arm
191
+ // by those very bytes (`:734`) and its own message declares that a moved site must be RE-CUT — an act that
192
+ // belongs to the test writer and that this pass may not take. So the form is moved to the member, and the two
193
+ // sites stand where they stood.
194
+ Object.defineProperty(tried, 'push', {
195
+ value: (path) => appendOwn(tried, path),
196
+ writable: true,
197
+ enumerable: false,
198
+ configurable: true,
199
+ });
200
+ // **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
201
+ // alone, so the rung is remembered rather than inferred from a path's spelling).
202
+ let loadedFrom = null;
203
+
204
+ /// **THE RUNG-ONE CANDIDATE FOR THIS RUNTIME, COMPUTED ONCE FROM THE CLOSED TABLE** (`C-1`): the pair's
205
+ /// own declared name, or `NOT COVERED` — and `NOT COVERED` means rung one is NOT ATTEMPTED, so no name is
206
+ /// computed for it and no speculative fallback exists (`docs/specs/storeroom-publish/contract.md §1.3` item 3).
207
+ function rungOneCandidate() {
208
+ if (rungOneName === null) rungOneName = platformNameForRuntime();
209
+ return rungOneName;
210
+ }
211
+
212
+ // ---------------------------------------------------------------------------------------------
213
+ // **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
214
+ // name, `require`d at the package root — then, failing it, RUNG TWO — the module-relative `ADDON_PATH`.
215
+ // **EVERY THROW AT RUNG ONE IS A MISS** (`resolution.md §2.3`): the catch neither classifies the throw nor
216
+ // reports it, so a `MODULE_NOT_FOUND`, an `ERR_DLOPEN_FAILED` and any other throw alike leave the loader
217
+ // at rung two, and NO second failure shape is produced anywhere on this path.
218
+ // ---------------------------------------------------------------------------------------------
219
+ export function loadAddon() {
220
+ if (addon !== null || addonArm !== null || addonLoadError !== null) return;
221
+ const name = rungOneCandidate();
222
+ if (name !== 'NOT COVERED') {
223
+ tried.push(name);
224
+ let candidate = null;
225
+ try {
226
+ candidate = require_(name);
227
+ } catch {
228
+ // **A MISS, AND NOTHING MORE** (`resolution.md §2.3`): the throw is not classified, not rethrown and
229
+ // not reported — rung two is where the walk continues.
230
+ candidate = null;
231
+ }
232
+ if (candidate !== null && candidate !== undefined) {
233
+ // **`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
234
+ // exported `version`, called as a function, against the version the package's own manifest declares,
235
+ // compared for EXACT STRING EQUALITY (`PUB-DD-19`: a different string, an empty string, a value that
236
+ // is not a string and a `version` that is not callable are EACH the mismatch arm).
237
+ const declared = packageVersion();
238
+ let answered;
239
+ try {
240
+ answered = typeof candidate.version === 'function' ? candidate.version() : undefined;
241
+ } catch (err) {
242
+ answered = err;
243
+ }
244
+ if (typeof answered !== 'string' || answered !== declared) {
245
+ // **THE MISMATCH ARM — THE SINGLE DECLARED FAILURE ARM** (`docs/specs/storeroom-publish/contract.md §1.5` item 2; `PUB-DD-17`): the subject
246
+ // is RUNG ONE'S OWN PATH, and **NO FALLBACK TO RUNG TWO exists** — the load path stops here, loads
247
+ // nothing from the substituted artefact and returns no instance.
248
+ //
249
+ // **⟶ AND `PUB-R-3`: THE ARM IS MADE TERMINAL BY CONSTRUCTION RATHER THAN BY THE `if`'S SHAPE.**
250
+ // The walk RETURNS at the arm, so rung two's `require` below is not reached on the evaluation that
251
+ // meets the mismatch; **and what keeps a LATER evaluation at the arm is the ARM ITSELF, held in
252
+ // `addonArm` and read by this walk's own entry test** — never a second failure instance beside it.
253
+ // **THE SHIPPED STATE WAS `addonLoadError = new Error('addon-version-mismatch')`, and it was a shape
254
+ // `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
255
+ // form. THAT ASSIGNMENT IS REMOVED** (the `addonLoadError` slot is left to the load path's own
256
+ // cause, rung two's throw) **and its whole duty — halting the walk before rung two — is taken by
257
+ // the declared arm.** **A state in which a caught mismatch could then fall through to
258
+ // `require_(ADDON_PATH)` and load the checkout's own artefact no longer exists at any call.**
259
+ //
260
+ // **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,
261
+ // arm (a); `PUB-DD-25`; `P-PUB-4`'s failure list's last member): the artefact that loaded and
262
+ // answered `version` is the artefact that carries the store's generator, so the string is reached
263
+ // through ITS `errorMessage` at the subject `docs/specs/storeroom-publish/contract.md §1.5` item 2 fixes. **`mismatchArmMessage` below names
264
+ // the fallback where that artefact cannot supply it.**
265
+ addon = null;
266
+ addonArm = { status: 'FilePathUnreachable', message: mismatchArmMessage(candidate, name) };
267
+ return;
268
+ }
269
+ addon = candidate;
270
+ loadedFrom = 'one';
271
+ return;
272
+ }
273
+ }
274
+ tried.push(ADDON_PATH);
275
+ try {
276
+ addon = require_(ADDON_PATH);
277
+ loadedFrom = 'two';
278
+ } catch (err) {
279
+ addon = null;
280
+ addonLoadError = err;
281
+ }
282
+ }
283
+
284
+ /// **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
285
+ /// paths that were TRIED. **ONE PATH WHERE ONE RUNG WAS TRIED; BOTH PATHS WHERE BOTH WERE** — and where
286
+ /// both were, they are ordered RUNG ONE FIRST and RUNG TWO SECOND, joined by `', '`.
287
+ /// **EACH PATH IS RENDERED INTO THE GENERATOR'S OWN `'<subject>'` SLOT BY THE GENERATOR ITSELF, whose
288
+ /// clause already supplies the surrounding apostrophes for a single subject** (`src/error.rs`'s
289
+ /// `FilePathUnreachable` arm at the facade's own subject spelling): **so the single-path form is the RAW
290
+ /// path, exactly as the store's own generator renders it, and the two-path form is a comma-separated list
291
+ /// whose separator sits BETWEEN the generator's own renderings of its two subjects.**
292
+ /// **⟶ CONTRACT FINDING (`PUB-CF-7`, reported and NOT patched here):** **no clause of
293
+ /// `docs/specs/storeroom-publish/` declares this JOIN** — neither the separator nor the order — while
294
+ /// `resolution.md §5.3` item 2 requires BOTH PATHS to be the subject. **This file therefore CHOOSES the
295
+ /// separator `', '` and the order rung one then rung two, so a consumer reads both subjects in the order
296
+ /// they were tried; the choice is reported to `role_spec_writer` as a contract finding rather than taken
297
+ /// as a silent invention.**
298
+ export function absentSubject() {
299
+ if (tried.length === 1) return tried[0];
300
+ return tried.map((path) => `'${path}'`).join(', ');
301
+ }
302
+
303
+ /// ⟶ **AND ITS BODY IS `src/entry/addon-slot.mjs`'S FROM 2026-11-17** (`D-156` item 1; the loader split's step 3):
304
+ /// the generator's own rendering of this one row is a FORM and not a host fact, two of its three readers are
305
+ /// realm-neutral, and this file imports it back from there — the direction the clause at the head of this file
306
+ /// states, and the cycle it forbids is still closed. **NOT ONE CHARACTER OF ITS OUTPUT MOVES.**
307
+
308
+ /// **THE MISMATCH ARM'S `message`, AND ITS ONE DECLARED FALLBACK** (`docs/specs/storeroom-publish/contract.md §1.4` item 6; `PUB-DD-25`).
309
+ /// **ARM (a) FIRST: THE LOADED ARTEFACT'S OWN GENERATOR AUTHORS THE STRING**, reached through the artefact's
310
+ /// `errorMessage` — the artefact that loaded and answered `version` is the artefact that carries the
311
+ /// 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
312
+ /// `errorMessage`, OR ITS OWN GENERATOR THROWS, OR IT ANSWERS A VALUE THAT IS NOT A `string`, THE GENERATOR
313
+ /// IS UNREACHABLE AND ARM (b) ANSWERS: THE STORE'S OWN CLAUSE, REPRODUCED BYTE-FOR-BYTE AT THAT SAME
314
+ /// 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
315
+ /// reached, so the fallback is named rather than taken silently, and a failure inside the loaded
316
+ /// artefact's generator cannot become a second failure shape.
317
+ function mismatchArmMessage(candidate, name) {
318
+ if (candidate !== null && candidate !== undefined && typeof candidate.errorMessage === 'function') {
319
+ try {
320
+ const rendered = candidate.errorMessage('FilePathUnreachable', name);
321
+ if (typeof rendered === 'string') return rendered;
322
+ } catch {
323
+ // the loaded artefact's own generator failed in turn: arm (b) below is the declared answer
324
+ }
325
+ }
326
+ return generatorFilePathUnreachable(name);
327
+ }
@@ -0,0 +1,57 @@
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,
55
+ });
56
+
57
+ export { withAddon } from './addon-slot.mjs';