provident-storeroom 1.9.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.guide.md +72 -72
- package/README.md +19 -18
- package/RELEASE-NOTES.md +21 -1
- package/index.d.ts +109 -5
- package/index.mjs +41 -5
- package/package.json +6 -6
- package/src/entry/constraints.mjs +535 -49
- package/src/entry/delivery.mjs +55 -3
- package/src/entry/kernel-attempt.mjs +20 -2
- package/src/entry/kernel-foundations.mjs +34 -0
- package/src/entry/kernel-registration.mjs +221 -20
- package/src/entry/kernel-terminal.mjs +54 -25
- package/src/entry/state.mjs +15 -1
|
@@ -4,7 +4,7 @@ import { appendOwn, fail, refusalAddress, refusalLog } from './refusal.mjs';
|
|
|
4
4
|
import { withAddon, require_ } from './artefact.mjs';
|
|
5
5
|
import { classSpelling, isAdmittedArray, isPlainObjectValue } from './class-decision.mjs';
|
|
6
6
|
import { constraintAddress } from './frame.mjs';
|
|
7
|
-
import { currentWindow, homeAddressKey, installRestartConsumer, isStoreReceiver, openCommits, closeCommit, openCommit, windowMark } from './state.mjs';
|
|
7
|
+
import { INSTANCES, carryRefusal, commitFile, currentWindow, homeAddressKey, installRestartConsumer, isStoreReceiver, openCommits, closeCommit, openCommit, windowMark } from './state.mjs';
|
|
8
8
|
// **THE KERNEL'S OWN RECORD, FOR ONE FIELD AND ONE ONLY** (`D-46`/`D-30`): `kernelFor(store)` answers the
|
|
9
9
|
// instance's kernel record — the same accessor every kernel act takes the instance through — and
|
|
10
10
|
// `reversalAtRest` below reads that record's own `live` map for the count of OPEN ATTEMPTS. `kernel-foundations`
|
|
@@ -19,7 +19,7 @@ import { currentWindow, homeAddressKey, installRestartConsumer, isStoreReceiver,
|
|
|
19
19
|
// function the pass appends with — rather than pushed here with a member set of its own; the REFUSAL's own
|
|
20
20
|
// list keeps its five members and no `seq`, because no attempt stands at the judgement that built it
|
|
21
21
|
// (`D-41` item 4). Two records, two honest forms, one append.
|
|
22
|
-
import { append, boundedEntryMessage, boundedQuotation, externalCall, kernelFor, pairAppliesAt, throwableForm } from './kernel-foundations.mjs';
|
|
22
|
+
import { append, boundedEntryMessage, boundedQuotation, COMMIT_LOG_SHARED, enterCommitFrame, externalCall, kernelFor, leaveCommitFrame, pairAppliesAt, pairsTriggered, throwableForm } from './kernel-foundations.mjs';
|
|
23
23
|
// **⟶ AND THE TWO KERNEL ACTS THE DELETE'S PATH OWES — `D-55` ITEM 3, 2026-10-29.** The kernel's public
|
|
24
24
|
// barrel (`src/constraint-kernel.mjs`) is untouched and keeps its five names; **these are two PART modules' own
|
|
25
25
|
// acts, reached here the way `append` and `kernelFor` above are** (`kernel-surface.md §1` item 1's empty import
|
|
@@ -27,7 +27,14 @@ import { append, boundedEntryMessage, boundedQuotation, externalCall, kernelFor,
|
|
|
27
27
|
// module). `commitRemoval` is the commit part's remove-shaped act — a delete-shaped attempt that lands no write
|
|
28
28
|
// — and `runAttempt` is the ONE pass, taken verbatim so no second pass loop is minted for a delete.
|
|
29
29
|
import { commitRemoval } from './kernel-commit.mjs';
|
|
30
|
-
import { runAttempt } from './kernel-attempt.mjs';
|
|
30
|
+
import { repairInCommit, repairLegs, runAttempt } from './kernel-attempt.mjs';
|
|
31
|
+
// **⟶ AND ONE NAME FROM THE DELIVERY'S OWN MODULE, 2026-11-02 — `D-117` ITEM 1: THE REVERSAL DELIVERS.**
|
|
32
|
+
// `deliver` is THE one loop `surface.md §2.4` rules 1–3 declare, handed the state that holds this instance's
|
|
33
|
+
// registry and receiver; **this file imports it and mints no second delivery** (`§2.7` (iii) (a)–(c)). **THE EDGE
|
|
34
|
+
// IS ACYCLIC AND MEASURED**: `delivery.mjs` imports `state.mjs`, `kernel-foundations.mjs`, `carrier.mjs`,
|
|
35
|
+
// `frame.mjs`, `refusal.mjs`, `artefact.mjs` and `class-decision.mjs`, **and imports neither this file nor
|
|
36
|
+
// `kernel-attempt.mjs`**, so this reach adds no cycle and no second conversion rule.
|
|
37
|
+
import { deliver } from './delivery.mjs';
|
|
31
38
|
// **⟶ AND THE CARRIERS, ADDED 2026-10-26 FOR THE REFUSAL'S OWN UNDOING (`DEF-W`'s `(a)`).** The
|
|
32
39
|
// compensating act below reaches the store's own verb at its entry, with the SAME carrier forms every member
|
|
33
40
|
// hands it (`carrier.mjs` is the boundary's one encoder for the three positions and imports nothing of this
|
|
@@ -506,10 +513,12 @@ export function registrationCrossing(refusal, address) {
|
|
|
506
513
|
// is the caller's own value and is answered as it was thrown.
|
|
507
514
|
const carried = bodyThrowCarried(refusal);
|
|
508
515
|
if (carried !== null) {
|
|
509
|
-
// **`false` —
|
|
510
|
-
//
|
|
511
|
-
//
|
|
512
|
-
//
|
|
516
|
+
// **`false` — NEITHER REGISTRATION ARM RECORDS THE THROWABLE'S FORM, AND THE CLAUSE SAYS SO.** At the FIRST
|
|
517
|
+
// evaluation no attempt stands and the crossing's `log` is `surface.md §2.5` item 4's declared `[]`; at the
|
|
518
|
+
// RE-RUN an attempt DOES stand and the list it carries is that attempt's own — the `constraint-check` entry,
|
|
519
|
+
// the rewritten `repair-run` entry and, where the rollback met a store code, ONE `outcome` entry (`PIN-15`
|
|
520
|
+
// (ii), `D-118` read with `PIN-10` (iv)) — **and still no entry of it records the throwable's form** (`DEF-AK`'s
|
|
521
|
+
// recorded arm is the landing's), so the crossed sentence points at no log that does not hold what it says.
|
|
513
522
|
const converted = bodyThrowRefusal(carried, refusal, false);
|
|
514
523
|
if (converted !== null) throw converted;
|
|
515
524
|
}
|
|
@@ -874,6 +883,16 @@ export function constraintWrite(state, instance, address, tier, value) {
|
|
|
874
883
|
// inside): a read taken later would name whatever window happened to be open then.
|
|
875
884
|
const witnessed = currentWindow(instance);
|
|
876
885
|
defineDiscardWitness(recordOut, () => witnessWindow(instance, witnessed));
|
|
886
|
+
// **⟶ AND THE PASSING ANSWER CARRIES THE COMMIT'S OWN LIST FROM 2026-11-02 — `D-119`.** **THE CACHE IS THE
|
|
887
|
+
// SEALED REPORT THIS FRAME ALREADY HOLDS**: `sealHandoff` froze the commit's list and the ownership fact
|
|
888
|
+
// together before `dropHandoff` stripped the closed map's copy, so the entries a passing call appended —
|
|
889
|
+
// its `constraint-check` entries, every `repair-run` a repair landed, and the `commit` entry that closes the
|
|
890
|
+
// arm — answer at `record.log`, in append order, as the SAME objects and the SAME array a refusal about this
|
|
891
|
+
// commit crosses with (`D-53`; `D-119` item 4). **WHERE THIS CALL JOINED AN ENCLOSING COMMIT THE MEMBER IS
|
|
892
|
+
// `[]` AND MEANS IT** — the list it joined has not crossed, and the act that owns that window reports the
|
|
893
|
+
// entries (`resolution-log.md` §4.2). **NO DECLARED MEMBER MOVES**: the record keeps the three `index.d.ts`
|
|
894
|
+
// declares, and `Object.keys` reads them and nothing else (`A117` (D6)).
|
|
895
|
+
defineResolutionLog(recordOut, resolutionLogOf(report));
|
|
877
896
|
return recordOut;
|
|
878
897
|
}
|
|
879
898
|
|
|
@@ -971,6 +990,11 @@ export function constraintDelete(instance, address, tier, remove) {
|
|
|
971
990
|
// absent (`D-21`: a member whose act did not run says so).
|
|
972
991
|
if (attempt === null) {
|
|
973
992
|
exposeCommit(receipt, null);
|
|
993
|
+
// **AND THE `D-3` ARM'S `log` IS `[]` AND IS PRESENT — `D-119`, `resolution-log.md` §4.3's second shape.**
|
|
994
|
+
// Nothing was removed, no attempt was opened and no pass ran, so no entry was appended: the frozen empty
|
|
995
|
+
// list is this arm's honest answer, and the member is defined HERE rather than left absent, because
|
|
996
|
+
// `D-77`/`D-78`'s rule is presence on every arm.
|
|
997
|
+
defineResolutionLog(receipt, null);
|
|
974
998
|
return receipt;
|
|
975
999
|
}
|
|
976
1000
|
// THE PASS, INSIDE THE COMMIT THE MEMBER OPENED (`D-44`): `runAttempt` names THE RECORD `commitRemoval`
|
|
@@ -995,6 +1019,14 @@ export function constraintDelete(instance, address, tier, remove) {
|
|
|
995
1019
|
constraintCrossing(restarted, address);
|
|
996
1020
|
}
|
|
997
1021
|
exposeCommit(receipt, attempt.record);
|
|
1022
|
+
// **⟶ AND THE PASSING RECEIPT CARRIES THE COMMIT'S OWN LIST FROM 2026-11-02 — `D-119`**, installed beside the
|
|
1023
|
+
// two non-enumerable members that were already here (`exposeCommit`'s `commit` above, `index.mjs`'s
|
|
1024
|
+
// `discarded`). **`receipt.log` AND `receipt.commit[COMMIT_LOG]` ARE THE SAME ARRAY BY IDENTITY** on this arm —
|
|
1025
|
+
// one list, two names on it, and the `log` name is the one the refusal uses and the one a consumer should
|
|
1026
|
+
// read — **and the member is present on the `D-3` arm below, `[]` included** (`D-77`/`D-78`'s rule read for a
|
|
1027
|
+
// third member: `[]` is never absent and never `undefined`). Nothing in `index.mjs`'s `delete` member moves:
|
|
1028
|
+
// the sealed report and the ownership fact are both this frame's.
|
|
1029
|
+
defineResolutionLog(receipt, resolutionLogOf(report));
|
|
998
1030
|
return receipt;
|
|
999
1031
|
}
|
|
1000
1032
|
|
|
@@ -1327,11 +1359,21 @@ function bodyThrowRefusal(carried, thrown, recorded) {
|
|
|
1327
1359
|
// FACT, SAID BY THE CROSSING THAT CALLED THIS FRAME** (`constraintCrossing` reads the arm that records it;
|
|
1328
1360
|
// `registrationCrossing` and the judgement do not), **so no arm points at a `log` that does not carry it**:
|
|
1329
1361
|
// where the arm records nothing the clause says so and names the declared `[]` (`surface.md §2.5` item 4).
|
|
1362
|
+
// **⟶ AND THE `recorded === false` SENTENCE IS RE-DERIVED, 2026-11-02 — `PIN-15` (ii), `arms.md §A.4`:
|
|
1363
|
+
// `recorded` STAYS `false` AND WHAT IT SAYS IS NOW TRUE ON EVERY ARM THAT REACHES IT.** The sentence that
|
|
1364
|
+
// stood here read *"`log` is the declared empty list where no attempt stands"*, and at the registration's
|
|
1365
|
+
// RE-RUN'S body-throw arm an attempt DOES stand and its list is NOT empty — it holds `constraint-check`, the
|
|
1366
|
+
// rewritten `repair-run`, and, where a rollback met a store code, ONE `outcome` entry. **What is still true,
|
|
1367
|
+
// and is the fact this sentence owes, is that NO ENTRY OF IT RECORDS THE THROWABLE'S FORM**: `DEF-AK`'s
|
|
1368
|
+
// recorded arm is the LANDING's terminal act, and the re-run appends none (`kernel-registration.mjs`'s
|
|
1369
|
+
// `registrationRerun`). **So the replacement names the list it crosses with rather than claiming the list is
|
|
1370
|
+
// empty, and no arm points at a `log` that does not carry what the sentence claims.**
|
|
1330
1371
|
const where = recorded === true
|
|
1331
1372
|
? `the form the throwable took stands in the \`outcome\` entry of this refusal's \`log\`, which is where `
|
|
1332
1373
|
+ `a throwable's own message crosses`
|
|
1333
|
-
: `no entry of this failure's \`log\` records
|
|
1334
|
-
+ `
|
|
1374
|
+
: `no entry of this failure's \`log\` records the form the throwable took, so nothing of the value crosses: `
|
|
1375
|
+
+ `the list this refusal carries is the one the attempt that caught the throwable held, and a throwing `
|
|
1376
|
+
+ `RE-RUN appends no entry of it`;
|
|
1335
1377
|
generated = `${generated} — the value the constraint body threw does NOT cross as this refusal: ${where}`;
|
|
1336
1378
|
}
|
|
1337
1379
|
const crossed = {
|
|
@@ -1888,6 +1930,69 @@ export function defineDiscardWitness(record, read) {
|
|
|
1888
1930
|
return record;
|
|
1889
1931
|
}
|
|
1890
1932
|
|
|
1933
|
+
/// **⟶ AND THE PASSING RESOLUTION'S OWN LIST, 2026-11-02 — `D-119`: THE LOG CROSSES ON RESOLUTION TOO.**
|
|
1934
|
+
///
|
|
1935
|
+
/// **THE RULING, THE ARCHITECT, VERBATIM: *"Cache the log and pass to the surface on resolution, same as on
|
|
1936
|
+
/// failure. This is needed so that manual data changes can check what additional data changed downstream of
|
|
1937
|
+
/// their request."*** **`defineDiscardWitness` above is the DEVICE and this is its SECOND USE, not a new kind of
|
|
1938
|
+
/// member**: a **NON-ENUMERABLE, `configurable` own ACCESSOR at the name `log`** — **the very name the failure
|
|
1939
|
+
/// form uses** (`StoreRefusal.log`, its third declared member) — so a consumer that catches a refusal and a
|
|
1940
|
+
/// consumer that holds a passing answer read ONE name. **`Object.keys`, every deep-equality a consumer writes,
|
|
1941
|
+
/// the instance's FOURTEEN and the kernel's barrel move by nothing**; **`Object.getOwnPropertyNames` gains the
|
|
1942
|
+
/// name, which is the one census a STRING-keyed member cannot hide from, and it is declared rather than
|
|
1943
|
+
/// discovered** (`docs/specs/storeroom-file-save-coverage/resolution-log.md` §1.1, the two cells).
|
|
1944
|
+
///
|
|
1945
|
+
/// **IT ANSWERS ONE CACHED REFERENCE AND DERIVES NOTHING AT THE READ — AND THAT IS THE ONE PLACE THIS MEMBER
|
|
1946
|
+
/// DIFFERS FROM `discarded`, WHOSE ACCESSOR IS A LIVE READ BY NECESSITY.** `discarded` is built BEFORE the pass
|
|
1947
|
+
/// that judges its raise (`D-42`); **a log is built AFTER every act that can append to it** (`D-119` item 4: *"the
|
|
1948
|
+
/// list is cached at the crossing and stable after it"*), so the list is frozen where it crosses and the getter
|
|
1949
|
+
/// hands back the same array at every read. **THE SHAPE IS THE SAME AND THE REASON IS NOT: a later pass must not
|
|
1950
|
+
/// carry `discarded`'s justification across.** **THE GETTER IS STILL AN ACCESSOR** because the record's declared
|
|
1951
|
+
/// census counts MEMBERS and not accessors, and because `D-77`/`D-78`'s rule — the member is PRESENT on every
|
|
1952
|
+
/// passing answer, `[]` included, never absent and never `undefined` — is the rule this serves.
|
|
1953
|
+
///
|
|
1954
|
+
/// **THE EMPTY LIST IS ONE MODULE-LEVEL FROZEN CONSTANT AND NOT A FRESH `[]` PER CALL.** `[]` here means *"this
|
|
1955
|
+
/// act appended nothing it can report"*: the JOINED arm (a body's nested call inside a commit whose list has not
|
|
1956
|
+
/// crossed), a `D-3` delete, a reversal's non-judging arms, and a judgement that ran and appended nothing
|
|
1957
|
+
/// (§4.3). **It carries no client data at all, so a shared constant is a VALUE and not a cache** — the bound
|
|
1958
|
+
/// `D-58` sets is a retained LIST, and there is none here.
|
|
1959
|
+
const RESOLUTION_LOG_EMPTY = Object.freeze([]);
|
|
1960
|
+
|
|
1961
|
+
export function defineResolutionLog(record, list) {
|
|
1962
|
+
// **A RECEIPT THAT IS NOT AN OBJECT CANNOT CARRY A MEMBER** — `exposeCommit`'s own guard, read for this
|
|
1963
|
+
// member: the member never depends on the arm for its PRESENCE (`D-78`), and a non-object answer has no
|
|
1964
|
+
// census to move.
|
|
1965
|
+
if (record === null || typeof record !== 'object') return record;
|
|
1966
|
+
// **ONE CAPTURED REFERENCE** — the array this read answers is the array the crossing froze (`sealHandoff`'s
|
|
1967
|
+
// freeze for a `write` or a `delete`, the judgement frame's own end for a `rollback`), or the frozen constant
|
|
1968
|
+
// where the act owns no list of its own. **No derivation, no copy-out, no second list.**
|
|
1969
|
+
const held = Array.isArray(list) === true ? list : RESOLUTION_LOG_EMPTY;
|
|
1970
|
+
Object.defineProperty(record, 'log', {
|
|
1971
|
+
get: () => held,
|
|
1972
|
+
enumerable: false,
|
|
1973
|
+
configurable: true,
|
|
1974
|
+
});
|
|
1975
|
+
return record;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
/// **THE ONE READ OF THE SEALED REPORT'S CACHE — `D-119`.** The sealed report is the cache: `sealHandoff` froze
|
|
1979
|
+
/// the commit's list and the ownership fact together BEFORE `dropHandoff` stripped the closed map's copy, and
|
|
1980
|
+
/// the entry's frame holds that report from the attempt's return until it builds the answer. **So the list is
|
|
1981
|
+
/// read off the report and from nowhere else** — no `WeakMap`, no instance slot and no module map is minted, and
|
|
1982
|
+
/// the list outlives the drop by the order the seal already runs in.
|
|
1983
|
+
///
|
|
1984
|
+
/// **THE JOINED ARM ANSWERS `undefined` AND THAT IS ITS HONEST `[]`.** `COMMIT_LOG_SHARED` is the seal's own
|
|
1985
|
+
/// fact: where it reads `true`, this call joined an enclosing commit (`D-53`) whose list has not crossed, so
|
|
1986
|
+
/// this answer owns no list to hand over — and a frozen PREFIX COPY is refused, because a copy taken at the
|
|
1987
|
+
/// nested crossing necessarily holds fewer entries than the enclosing commit's later answer and the two would
|
|
1988
|
+
/// disagree, which is the one thing `D-119` item 4 forbids. **One list, one crossing, one answer: the act that
|
|
1989
|
+
/// owns that commit reports the entries, the nested call's own included** (`DW-09.2`'s sentence, read for the
|
|
1990
|
+
/// log; `resolution-log.md` §4.2).
|
|
1991
|
+
function resolutionLogOf(report) {
|
|
1992
|
+
if (report === null || typeof report !== 'object') return undefined;
|
|
1993
|
+
return report[COMMIT_LOG_SHARED] === true ? undefined : report.log;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1891
1996
|
/// **⟶ THE RESTART ITSELF, MOVED 2026-10-27 TO WHERE THE COMMIT SCOPE IS OWNED — `runAttempt`'s drain.**
|
|
1892
1997
|
///
|
|
1893
1998
|
/// **WHAT IT WAS, AND THE FINDING THAT MOVED IT.** It was `restartInvalidatedCheck(instance)`, called by
|
|
@@ -1992,7 +2097,13 @@ export function drainRestartRequests(instance, report) {
|
|
|
1992
2097
|
reversalRefusal(one, after, null, request.reversalId, undo, null, true, asked !== null));
|
|
1993
2098
|
}
|
|
1994
2099
|
try {
|
|
1995
|
-
|
|
2100
|
+
// **⟶ AND THE RESTARTED CHECK'S OWN JUDGEMENT IS HANDED THIS INSTANCE'S STATE TOO, 2026-11-02 — `§2` FACT
|
|
2101
|
+
// 2's OTHER HALF.** This is the DEFERRED arm's judgement proper, and it is the call that takes the asking
|
|
2102
|
+
// arm's save and delivery (inside this pass's commit and before that commit's terminal act). **THE STATE IS
|
|
2103
|
+
// THE ONE THE PACKAGE KEYED ON THIS INSTANCE** (`state.mjs`'s `INSTANCES`, the map every member's closure
|
|
2104
|
+
// state stands in) — reached here because this frame is the seam's own consumer and holds no `state`
|
|
2105
|
+
// parameter; **nothing is minted and no second store of the package's state is made.**
|
|
2106
|
+
judgeReversal(instance, request.watched, request.reversalId, INSTANCES.get(instance));
|
|
1996
2107
|
} catch (refused) {
|
|
1997
2108
|
// THE REFUSAL IS THE OUTCOME: the store was restored by its own compensation inside `judgeReversal`, and
|
|
1998
2109
|
// a request raised by the refusal's own bodies stands for nobody — the restarted check is over, so the
|
|
@@ -2471,7 +2582,40 @@ function movedStanding(instance, watched) {
|
|
|
2471
2582
|
/// gets. The crossed code stays the body's own rank-`18` member (`ConstraintBodyThrew`, the code that says what
|
|
2472
2583
|
/// actually happened: a body threw), while the treatment — restore, one log entry naming the pair, one plain
|
|
2473
2584
|
/// form — is the violation's.
|
|
2474
|
-
|
|
2585
|
+
///
|
|
2586
|
+
/// **⟶ AND FROM 2026-11-02 THE JUDGEMENT IS A PASS AND NOT A VETO — `D-113` ITEM 3, `D-116` ITEM 2, `D-117` ITEM 1.**
|
|
2587
|
+
/// `RCA-8(d)`'s ANNOTATE-BESIDE convention, applied once: **every byte above stands as the reading of its own
|
|
2588
|
+
/// date and is read THROUGH this clause, which re-decides no term of it.** The architect, verbatim: *"The
|
|
2589
|
+
/// reversal is already pointing to an op and should be checking constraints and running repairs, if any are
|
|
2590
|
+
/// needed."* **WHAT THIS FRAME GAINS, EACH AT ITS OWN SEAT IN THE BODY BELOW:**
|
|
2591
|
+
/// * **A REPAIR ARM** (`D-113` item 3): a pair that refuses may carry a repair on its own answer, the repair
|
|
2592
|
+
/// lands in THIS commit through `repairInCommit` with this judgement's commit named, it is credited by the
|
|
2593
|
+
/// failing pair's own key (`D-105` item 1), and **the ordinary re-run asks again over the judgement's subject
|
|
2594
|
+
/// widened by the pairs that write's returned set names** (`§3` (iii) 2–4). **NO SECOND PASS LOOP AND NO
|
|
2595
|
+
/// THIRD ATTEMPT KIND**: the walk is this one, re-entered;
|
|
2596
|
+
/// * **THE SAVE, after the last ask and before the window closes** (`D-112` item 2): the store's existing
|
|
2597
|
+
/// state-keyed write, reached through the entry's one position **supplied with nothing** — `commitFile`'s
|
|
2598
|
+
/// absent carrier, which is exactly the call this frame makes with `state.receiver` and no second position.
|
|
2599
|
+
/// **THE STORE'S `rollback` PERFORMS NO WRITE** from this date, so this is the reversal's only save, and the
|
|
2600
|
+
/// equality guard inside it — not a mark, not a record and not a flag — is what makes a second identical
|
|
2601
|
+
/// reversal write nothing;
|
|
2602
|
+
/// * **THE DELIVERY, after the save and before this frame returns** (`D-117` item 1): one `deliver` call per leg
|
|
2603
|
+
/// the repair's invocation answered, in creation order, each carrying that leg's own `op.address`, with the
|
|
2604
|
+
/// handle list held ACROSS the legs so an identity two legs returned is invoked once (`§2.7` (iii)).
|
|
2605
|
+
/// **AND THE THREE SILENT ARMS ARE THE ORDER'S AND NOT A PREDICATE'S**: the throwing arm and the failing arm
|
|
2606
|
+
/// throw before either act is reached, a reversal that fired nothing delivers an empty batch, a failed save
|
|
2607
|
+
/// never returns to the delivery, and **a compensation returns at the first byte of this function and reaches
|
|
2608
|
+
/// neither the judgement nor the save** (`D-112` item 3). **NOTHING DECLARED MOVES**: no member, no status, no
|
|
2609
|
+
/// rank, no entry, no arity and no barrel name (`§1` (iii)).
|
|
2610
|
+
///
|
|
2611
|
+
/// **⟶ AND FROM 2026-11-02 THIS FRAME ANSWERS THE LIST IT APPENDED TO — `D-119`.** **A JUDGING ARM ANSWERS THE
|
|
2612
|
+
/// JUDGEMENT'S OWN `judgementLog`, FROZEN IN PLACE AT THIS FRAME'S `finally`** — the very array the frame
|
|
2613
|
+
/// appended to, the `repair-run` entries included, and not a copy of it — so a PASSING `rollback` can hand a
|
|
2614
|
+
/// caller what its judgement moved downstream (`resolution-log.md` §3.3; `index.mjs`'s `rollback` installs it).
|
|
2615
|
+
/// **EVERY ARM THAT RETURNS ABOVE THE WALK STILL ANSWERS `undefined`** — the compensating arm, the deferred arm
|
|
2616
|
+
/// and the at-rest judgement over an empty watch own no list of their own — **and the ANSWER IS NOT A REFUSAL'S
|
|
2617
|
+
/// SUBJECT**: a refusing judgement crosses `reversalRefusal`'s own one-entry list (`D-41`), unmoved by this row.
|
|
2618
|
+
export function judgeReversal(instance, watched, reversalId, state) {
|
|
2475
2619
|
// **A COMPENSATING ROLLBACK IS NOT JUDGED AS A STEP EITHER — `D-54` (b)**: the member is reached by the
|
|
2476
2620
|
// kernel's own terminal act with the flag standing, and this act must not touch a pending request or ask a
|
|
2477
2621
|
// pair. The consumer's own judgement is the drain's, at the pass's terminal state.
|
|
@@ -2502,7 +2646,27 @@ export function judgeReversal(instance, watched, reversalId) {
|
|
|
2502
2646
|
record.pending.reversalId = raise.opId;
|
|
2503
2647
|
}
|
|
2504
2648
|
}
|
|
2649
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2650
|
+
// **⟶ AND THE DEFERRED ARM RETURNS HERE, AND IT TAKES NO SAVE — `D-112` ITEM 2, `§2` FACT 2.** The
|
|
2651
|
+
// reversal was raised inside an open window, so the judgement proper is that window's own drain
|
|
2652
|
+
// (`drainRestartRequests`), and THAT call takes the asking arm's save — inside the pass's commit and
|
|
2653
|
+
// before that commit's terminal act. **A SAVE AT THIS RETURN WOULD SAVE A STATE THE LATER JUDGEMENT MAY
|
|
2654
|
+
// REFUSE**, so this arm saves nothing, performs no delivery — the delivery stands below this return,
|
|
2655
|
+
// behind the asking arm's walk, exactly as the save does — and answers the shape it always answered.
|
|
2656
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2657
|
+
return undefined;
|
|
2505
2658
|
}
|
|
2659
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2660
|
+
// **⟶ AND A JUDGEMENT OVER NOTHING STILL OWES THE SAVE, 2026-11-02 — `D-112` ITEM 2, `§2` FACT 2.** **THIS IS
|
|
2661
|
+
// THE AT-REST EMPTY-WATCH ARM, AND IT IS REACHED BEHIND THE DEFERRED ARM'S OWN RETURN** — `record ===
|
|
2662
|
+
// undefined` means every pair is disabled or none is carried, so the judgement is a judgement over nothing
|
|
2663
|
+
// — **and a reversal that moved `file`-tier data still owes the bytes that describe where it left the store**,
|
|
2664
|
+
// which is the arm `D-106` arm 3 was measured on. **THE DEFERRED ARM SAVED NOTHING AND RETURNED ABOVE**, so
|
|
2665
|
+
// the save below is reached on this arm alone and no byte may move at an in-flight return. **THE LIST IS
|
|
2666
|
+
// EMPTY HERE** (no commit window stands and no repair ran) **and the address is `[]`**: this arm's save
|
|
2667
|
+
// names the register and carries no judgement entry, because there is no judgement list at this instant.
|
|
2668
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2669
|
+
carryRefusal(() => commitFile(state.receiver), [], [], []);
|
|
2506
2670
|
return undefined;
|
|
2507
2671
|
}
|
|
2508
2672
|
// **⟶ AND THE AT-REST JUDGEMENT RUNS INSIDE A COMMIT, 2026-10-27 — `D-44`'s INVARIANT AND `DEF-AE`'S CACHE.**
|
|
@@ -2531,53 +2695,375 @@ export function judgeReversal(instance, watched, reversalId) {
|
|
|
2531
2695
|
// taken at its opening, **no sweep has passed inside it**, and a reversal appends no entry — so the mark still
|
|
2532
2696
|
// names the PRE-REVERSAL state and the at-rest control restores exactly what it restored before.
|
|
2533
2697
|
const opened = openCommit(instance);
|
|
2698
|
+
// ═════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2699
|
+
// **⟶ AND THE JUDGEMENT'S FRAME GAINS FOUR THINGS FROM 2026-11-02 — `D-113` ITEM 3's REPAIR ARM, `D-116`'s
|
|
2700
|
+
// STATE-KEYED SAVE AND `D-117` ITEM 1's DELIVERY — AND NONE OF THEM IS A MEMBER OF ANYTHING.** Its ONE LIST,
|
|
2701
|
+
// its commit FRAME, and the frame-local sets the pass's own arms are taken by: **no record, attempt, kernel
|
|
2702
|
+
// item, product member or census moves** (`A117` (D6); `PIN-3` (ii)(a)'s *"one frame local, no member
|
|
2703
|
+
// minted"*), and every one of them is read inside this frame alone.
|
|
2704
|
+
// ═════════════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2705
|
+
const kernel = kernelFor(instance);
|
|
2706
|
+
// **THE ONE LIST** (`D-53`: the log is the COMMIT's and not the attempt's — a judgement mints no
|
|
2707
|
+
// `CommitRecord` and no attempt, so its list is created HERE and read by nothing outside this frame). **THE
|
|
2708
|
+
// ENTRIES A REPAIR'S WRITE MINTS IN THIS WINDOW LAND IN IT** (`K-2` appends a joined write's entries to the
|
|
2709
|
+
// innermost frame's list, `kernel-commit.mjs`), **and so do this frame's own `repair-run` entries** — which is
|
|
2710
|
+
// what makes `D-113` item 5's *"the judgement's entries"* a referent rather than a phrase: **a failed save
|
|
2711
|
+
// crosses with THIS list** (`§2` fact 4). **ITS ENTRIES CARRY NO `seq`** (`D-65`: the array index is the
|
|
2712
|
+
// position), and its kinds are the kernel's own vocabulary.
|
|
2713
|
+
const judgementLog = [];
|
|
2714
|
+
// **THE DELIVERY'S SET, TAKEN ONCE AND HELD FRAME-LOCALLY** (`§2.7` (i)): the legs the repair's invocation
|
|
2715
|
+
// answered, carried to the delivery's instant beside the list. **THE READ MUST BE THE ONE READ** — the
|
|
2716
|
+
// `REPAIR_LEG` channel ANSWERS AND CLEARS in the same call, so a second read at the delivery would answer
|
|
2717
|
+
// `[]` and the delivery would be silent on every arm.
|
|
2718
|
+
const held = [];
|
|
2719
|
+
// **THE PASS'S OWN TWO SETS, READ AS FACTS** (`kernel-attempt.mjs`'s `attempt.ran` and
|
|
2720
|
+
// `attempt.appliedRepairs`; `D-105` item 1): the pair's registry membership together with these two lists is
|
|
2721
|
+
// THE one discriminator, so the pass's repeat arms are taken at this instant as facts — and no repair
|
|
2722
|
+
// function is invoked a second time (`P-SM-6`).
|
|
2723
|
+
const ran = [];
|
|
2724
|
+
const credited = [];
|
|
2725
|
+
// **THE COMMIT'S NAME, SPELLED THE WAY A DELETE-SHAPED ACT SPELLS ONE** (`kernel-attempt.mjs`'s
|
|
2726
|
+
// `name: { attempt: ref }` — *"the one member `commitAttemptIdOf` reads"*): a repair's write that names its
|
|
2727
|
+
// commit names THIS and JOINS, so `D-53`'s *"Constraints/Repairs should always use the same commit"* holds at
|
|
2728
|
+
// the reversal's instant too — **and a write whose commit is NOT named would open a second one and start a
|
|
2729
|
+
// second list.** **THE ID IT CARRIES IS NEVER READ** (nothing closes a judgement by name) **and no attempt,
|
|
2730
|
+
// record, count or `kernel.live` entry is minted with it**: this object is a NAME and not a record.
|
|
2731
|
+
const judgementName = { attempt: { id: 'reversal-judgement' } };
|
|
2732
|
+
// **⟶ WHETHER THIS FRAME ANSWERS ITS OWN LIST — ONE FRAME LOCAL, AND NO MEMBER MINTED** (`D-119`; `PIN-3`
|
|
2733
|
+
// (ii)(a)). It is `false` on every arm that returns above this point and on every throwing arm, so the freeze
|
|
2734
|
+
// the `finally` takes applies to the array this frame HANDS OVER and to no refusal's list.
|
|
2735
|
+
let judgedList = false;
|
|
2736
|
+
enterCommitFrame(kernel, judgementLog);
|
|
2534
2737
|
try {
|
|
2535
2738
|
// THE MOVED SET IS TAKEN FIRST, ONCE: the judgement's subject is the CHANGE the reversal made and nothing
|
|
2536
2739
|
// wider, and the same list is what a refusal has to put back — with the tier capture the watch took, so a
|
|
2537
2740
|
// restore knows WHERE each value stood and not merely what it was.
|
|
2538
2741
|
const moved = movedStanding(instance, watched);
|
|
2742
|
+
// **THE JUDGEMENT'S SUBJECT IS A LIST OF `{ entry, address }` AND NOT `moved` ITSELF**, because a repair's
|
|
2743
|
+
// write WIDENS it (`§3` (iii) 4) while `moved` stays exactly what a refusal owes back to the watch.
|
|
2744
|
+
const subject = [];
|
|
2539
2745
|
for (let index = 0; index < moved.length; index += 1) {
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2746
|
+
appendOwn(subject, { entry: moved[index].entry, address: moved[index].address });
|
|
2747
|
+
}
|
|
2748
|
+
// **THE WALK, AND THE PASS'S OWN `rerun` ARM AS ITS CONTINUATION** (`kernel-attempt.mjs`'s
|
|
2749
|
+
// `{ terminal: null, rerun: true }`, `attempt-lifecycle.md §2.4` item 5 (i), (iv)): a repair that landed
|
|
2750
|
+
// widens the subject and the judgement asks again over it. **NO SECOND PASS LOOP IS MINTED** — it is the
|
|
2751
|
+
// same walk, re-entered — and it terminates because every round credits at least one pair and no pair is
|
|
2752
|
+
// ever invited to repair twice.
|
|
2753
|
+
for (;;) {
|
|
2754
|
+
let repaired = false;
|
|
2755
|
+
for (let index = 0; index < subject.length; index += 1) {
|
|
2756
|
+
const one = subject[index];
|
|
2757
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2758
|
+
// **⟶ THE PAIR-APPLICATION RULE IS READ AT THE REVERSAL'S JUDGEMENT — `D-96`, `PIN-2` (v), `PIN-3`,
|
|
2759
|
+
// `PIN-4` (iv).**
|
|
2760
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2761
|
+
//
|
|
2762
|
+
// **A `rollback` APPENDS NO JOURNAL ENTRY, so no pass reaches it** (`kernel-attempt.mjs`'s loop runs on a
|
|
2763
|
+
// landed act): **the reversal's judgement is this walk, and the rule reaches it because the rule is
|
|
2764
|
+
// GLOBAL** — a reversal over a state that leaves a pair's parent unresolvable is the fifth instant's own
|
|
2765
|
+
// case (`D-90` (4)). **ONE GUARD, THE PASS'S OWN PREDICATE** (`pairAppliesAt`, asked of the pair's own
|
|
2766
|
+
// registry row and never minted again here): **a pair the rule skips is NOT ASKED here either** — it is
|
|
2767
|
+
// not refused for, it appends no `constraint-check` entry, and it cannot refuse the reversal, so the
|
|
2768
|
+
// reversal LANDS. **IT IS NOT REMOVED**: the pair stays CARRIED (`PIN-4` (i)) and is asked at the first
|
|
2769
|
+
// later instant its parent stands.
|
|
2770
|
+
if (pairAppliesAt(instance, one.entry) === false) continue;
|
|
2771
|
+
// **THE FIRST-VISIT FACT — THE PASS'S `ran`, READ AS A FACT** (`kernel-attempt.mjs`'s
|
|
2772
|
+
// `const attempt.ran.includes(key)` at its own head): a pair already asked at this judgement is a
|
|
2773
|
+
// REPEAT, and a repeat takes the pass's own arm below rather than a second repair (`P-SM-6`).
|
|
2774
|
+
const key = one.entry.id;
|
|
2775
|
+
let askedBefore = false;
|
|
2776
|
+
for (let seen = 0; seen < ran.length; seen += 1) {
|
|
2777
|
+
if (ran[seen] === key) {
|
|
2778
|
+
askedBefore = true;
|
|
2779
|
+
break;
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
if (askedBefore === false) appendOwn(ran, key);
|
|
2783
|
+
// **THE VALUE IS READ FRESH AT THIS INSTANT AND NOT OFF ANY OP A LEG CARRIES** (`§3` (iii) 4, `§3` (iv)):
|
|
2784
|
+
// the pair is asked against the state the store STANDS AT, and the same reading is what a refusal prints
|
|
2785
|
+
// and what the repair's context carries. **THE FIRST ROUND'S READING IS `movedStanding`'S OWN** — nothing
|
|
2786
|
+
// has moved between that capture and this ask — **and a re-run's is the state the repair left.**
|
|
2787
|
+
const after = standingAt(instance, one.address);
|
|
2788
|
+
// **THE BODY'S THROW IS THE JUDGEMENT'S OWN CATCH AND NOT A PROPAGATING VALUE** — `reversalOutcome`
|
|
2789
|
+
// converts a body's throwable to the surface's rank-`18` form and re-throws anything unmarked as itself,
|
|
2790
|
+
// and BOTH arrive here: the reversal has run, so a judgement that cannot complete restores and refuses.
|
|
2791
|
+
let outcome;
|
|
2792
|
+
// **⟶ AND THE ASK IS NAMED BEFORE THE BODY RUNS, 2026-10-28 (`DEF-AL`).** A body that acts does it
|
|
2793
|
+
// inside this one invocation, and the request it raises must name the pair the check was ASKING — not
|
|
2794
|
+
// the watch's first address. The mark is cleared on every arm, the throwing one included, so no later
|
|
2795
|
+
// act inherits an ask that has ended.
|
|
2796
|
+
ASKING.set(instance, { entry: one.entry, address: one.address });
|
|
2797
|
+
try {
|
|
2798
|
+
outcome = reversalOutcome(instance, one.entry, one.address, after);
|
|
2799
|
+
} catch (thrown) {
|
|
2800
|
+
const undo = restoreReversal(instance, moved);
|
|
2801
|
+
throw reversalRefusal(one, after, null, reversalId, undo, thrown);
|
|
2802
|
+
} finally {
|
|
2803
|
+
ASKING.delete(instance);
|
|
2804
|
+
}
|
|
2805
|
+
if (outcome === true) continue;
|
|
2806
|
+
// **THE REPAIR COMES OFF THE PAIR'S OWN ANSWER, WHICH THIS FRAME ALREADY HOLDS** (`§3` (iii) 1): a repair
|
|
2807
|
+
// is not a registry entry — the pass reads it off the refusing evaluation's `{message}` arm and this
|
|
2808
|
+
// frame takes the same read, minting no second invitation.
|
|
2809
|
+
let repair = null;
|
|
2810
|
+
if (outcome !== null && typeof outcome === 'object' && Object.hasOwn(outcome, 'message')) {
|
|
2811
|
+
const offered = ownDataMember(outcome, 'repair');
|
|
2812
|
+
if (typeof offered === 'function') repair = offered;
|
|
2813
|
+
}
|
|
2814
|
+
// **THE PASS'S OWN DISCRIMINATOR, TAKEN AS A FACT** (`kernel-attempt.mjs`'s arms (c), (e) and (f)): a pair
|
|
2815
|
+
// with no repair, a pair already asked, and a pair whose repair has already been applied all answer the
|
|
2816
|
+
// SAME arm at this instant — **restore, then the surface's one plain form at rank `20`**, with no repair
|
|
2817
|
+
// function invoked a second time. **THE ENTRY THAT SPELLS THE ARM IS `reversalRefusal`'S OWN**, unmoved
|
|
2818
|
+
// (`D-41` item 4).
|
|
2819
|
+
let applied = false;
|
|
2820
|
+
for (let seen = 0; seen < credited.length; seen += 1) {
|
|
2821
|
+
if (credited[seen] === key) {
|
|
2822
|
+
applied = true;
|
|
2823
|
+
break;
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
if (repair === null || askedBefore === true || applied === true) {
|
|
2827
|
+
// **THE FIRST VIOLATING PAIR DECIDES AND THE SECOND IS NOT EVALUATED** (`attempt-lifecycle.md §2.4`
|
|
2828
|
+
// item 5 (ii)–(iii), at the reversal's own instant) — and BEFORE the refusal is built, EVERY address the
|
|
2829
|
+
// reversal moved is put back, so the store the consumer meets holds no state this refusal refused.
|
|
2830
|
+
const undo = restoreReversal(instance, moved);
|
|
2831
|
+
throw reversalRefusal(one, after, reversalSaid(outcome), reversalId, undo, null);
|
|
2832
|
+
}
|
|
2833
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2834
|
+
// **⟶ THE REPAIR ARM — `D-113` ITEM 3, `§3` (iii) 2–4: ONE INVITATION, THE PASS'S CREDIT, THE PASS'S OWN
|
|
2835
|
+
// RE-RUN.** The architect, verbatim: *"The reversal is already pointing to an op and should be checking
|
|
2836
|
+
// constraints and running repairs, if any are needed."* **THE BODY RUNS UNDER THE INVOCATION BRACKET
|
|
2837
|
+
// WITH THIS JUDGEMENT'S COMMIT NAMED** (`repairInCommit`, `state.mjs`'s channel at its second position),
|
|
2838
|
+
// so a verb the repair calls without a name JOINS this commit instead of opening a second one — and the
|
|
2839
|
+
// bracket is also what opens the leg list the credit and the re-run are read from.
|
|
2840
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2841
|
+
//
|
|
2842
|
+
// **THE CONTEXT'S OTHER FIVE MEMBERS ARE THE CONSTRAINT CONTEXT'S OWN** (`reversalOutcome`'s
|
|
2843
|
+
// `address` · `tier` · `value` · `attempt` · `op`), **AND ITS `pending` MEMBER IS THE HONEST `[]`**: the
|
|
2844
|
+
// pass hands `attempt.record.pending.slice()` so that a repair naming its commit at `write`'s fourth
|
|
2845
|
+
// position names the same commit by its own hand (`D-103`'s supported route), **and at a reversal there is
|
|
2846
|
+
// no residue to copy and nothing pending to deliver, so the member is an empty list — a statement of fact
|
|
2847
|
+
// and not a placeholder.**
|
|
2848
|
+
const repairContext = {
|
|
2849
|
+
address: one.address.slice(),
|
|
2850
|
+
tier: null,
|
|
2851
|
+
value: after,
|
|
2852
|
+
attempt: null,
|
|
2853
|
+
op: null,
|
|
2854
|
+
pending: [],
|
|
2855
|
+
};
|
|
2856
|
+
const invocation = { bracketed: false };
|
|
2857
|
+
const attemptsBefore = kernel.attempts;
|
|
2858
|
+
// **THE `repair-run` ENTRY IS APPENDED BEFORE THE BODY RUNS**, exactly as the pass appends it — so a
|
|
2859
|
+
// repair that throws or refuses still leaves its own record in the judgement's one list, which is the
|
|
2860
|
+
// list a failed save crosses with.
|
|
2861
|
+
appendOwn(judgementLog, {
|
|
2862
|
+
kind: 'repair-run',
|
|
2863
|
+
id: key,
|
|
2864
|
+
opId: null,
|
|
2865
|
+
message: `the repair ${key} was attempted`,
|
|
2866
|
+
state: null,
|
|
2867
|
+
});
|
|
2868
|
+
const attemptEntry = judgementLog[judgementLog.length - 1];
|
|
2869
|
+
let result;
|
|
2870
|
+
try {
|
|
2871
|
+
result = repairInCommit(instance, judgementName, () => repair(repairContext), invocation);
|
|
2872
|
+
} catch (body) {
|
|
2873
|
+
// **A REPAIR BODY THAT THROWS IS A CHECK THAT DID NOT PASS — `§3` (v), AND NO TOKEN IS MINTED FOR IT**
|
|
2874
|
+
// (`D-117` item 4 (b)): the repair's own failure crosses in the MESSAGE, the status stays the set's
|
|
2875
|
+
// rank `20`, and the store is put back before the throw.
|
|
2876
|
+
const failure = 'the pair\'s repair threw, so the check does not pass';
|
|
2877
|
+
attemptEntry.message = `${failure}: the value it threw was ${throwableForm(body)}`;
|
|
2878
|
+
const undo = restoreReversal(instance, moved);
|
|
2879
|
+
throw reversalRefusal(one, after, failure, reversalId, undo, null);
|
|
2880
|
+
}
|
|
2881
|
+
// **THE LEGS ARE READ ONCE — `D-104`'s TWO GUARDS, WHICH ARE THE PASS'S AND ARE CARRIED UNCHANGED.** The
|
|
2882
|
+
// invocation's own bracket (`invocation.bracketed`) and whether any nested attempt opened across it
|
|
2883
|
+
// (`kernel.attempts`) are both `repairLegs`' and neither is re-implemented here; **under either guard's
|
|
2884
|
+
// absent arm the list is `[]`** — the family's conservative side, the same one the pass takes. **THE
|
|
2885
|
+
// LIST IS ALSO WHAT THE DELIVERY DELIVERS, SO IT IS HELD FRAME-LOCALLY AND NEVER RE-READ** (`§2.7` (i)).
|
|
2886
|
+
const legs = repairLegs(instance, kernel, invocation, attemptsBefore);
|
|
2887
|
+
for (let leg = 0; leg < legs.length; leg += 1) appendOwn(held, legs[leg]);
|
|
2888
|
+
// **THE LANDING TEST — THE ARM READS `op` FOR IT AND `triggered` FOR THE RE-RUN'S WIDENING, AND NOTHING
|
|
2889
|
+
// ELSE** (`§3` (iv)): the invocation landed at least one op iff some leg carries a journal op. **THE
|
|
2890
|
+
// SAVE NO LONGER NAMES AN OP** (`D-116` removed the op from the save's route), so the op's only office
|
|
2891
|
+
// here is this test and the entry it names.
|
|
2892
|
+
let landedOpId = null;
|
|
2893
|
+
for (let leg = 0; leg < legs.length; leg += 1) {
|
|
2894
|
+
const one_ = legs[leg];
|
|
2895
|
+
if (one_ === null || typeof one_ !== 'object') continue;
|
|
2896
|
+
const legOp = ownDataMember(one_, 'op');
|
|
2897
|
+
if (legOp === null || typeof legOp !== 'object') continue;
|
|
2898
|
+
const legOpId = ownDataMember(legOp, 'opId');
|
|
2899
|
+
if (typeof legOpId === 'string' && legOpId.length > 0) landedOpId = legOpId;
|
|
2900
|
+
}
|
|
2901
|
+
if (landedOpId === null) {
|
|
2902
|
+
// **THE PASS'S RESIDUAL ARM AND THE JUDGEMENT'S OWN `repair-run` ENTRY SAYING SO** (`§3` (v)): a repair
|
|
2903
|
+
// that landed no op is a check that did not pass, restore-first and rank `20`.
|
|
2904
|
+
const failure = `the repair ${key} produced no op at ${addressSpelling(one.address)}`;
|
|
2905
|
+
attemptEntry.message = failure;
|
|
2906
|
+
const undo = restoreReversal(instance, moved);
|
|
2907
|
+
throw reversalRefusal(one, after, `${failure}, so the check does not pass`, reversalId, undo, null);
|
|
2908
|
+
}
|
|
2909
|
+
// **THE CREDIT IS `D-105`'S AND IT IS THE FAILING PAIR'S MARK**: the pair's own key joined to the
|
|
2910
|
+
// judgement's applied set — **and the returned op is neither required nor read**
|
|
2911
|
+
// (`kernel-attempt.mjs`'s `appendOwn(attempt.appliedRepairs, key)` is the pass's form of the same act).
|
|
2912
|
+
attemptEntry.opId = landedOpId;
|
|
2913
|
+
attemptEntry.message = `the repair ${key} landed ${landedOpId}`;
|
|
2914
|
+
appendOwn(credited, key);
|
|
2915
|
+
// **THE RE-RUN'S WIDENING — THE PASS'S OWN ONE-CALL SELECTION, ONE SELECTION FUNCTION AND TWO CALLERS**
|
|
2916
|
+
// (`§3` (iii) 4): the pairs the repair's write's returned set names, read through `pairsTriggered` —
|
|
2917
|
+
// whose membership test is `triggeredNames` and whose `joined` argument is `D-105` item 3's — **and each
|
|
2918
|
+
// is asked AT THE ADDRESS ITS ELEMENT NAMES, because that is the address the write touched.** The pair's
|
|
2919
|
+
// own body comes from this package's registry row (`state.constraints`, the read model the judgement's
|
|
2920
|
+
// walk already reads) **and never from a second membership rule**.
|
|
2921
|
+
for (let leg = 0; leg < legs.length; leg += 1) {
|
|
2922
|
+
const one_ = legs[leg];
|
|
2923
|
+
if (one_ === null || typeof one_ !== 'object') continue;
|
|
2924
|
+
const elements = ownDataMember(one_, 'triggered');
|
|
2925
|
+
if (!Array.isArray(elements)) continue;
|
|
2926
|
+
const named = pairsTriggered(kernel, elements, []);
|
|
2927
|
+
for (let position = 0; position < named.length; position += 1) {
|
|
2928
|
+
const pair = kernel.pairs.get(named[position]);
|
|
2929
|
+
if (pair === undefined) continue;
|
|
2930
|
+
for (let element = 0; element < elements.length; element += 1) {
|
|
2931
|
+
const carried = elements[element];
|
|
2932
|
+
if (carried === null || typeof carried !== 'object') continue;
|
|
2933
|
+
if (ownDataMember(carried, 'handle') !== pair.id) continue;
|
|
2934
|
+
const address = ownDataMember(carried, 'address');
|
|
2935
|
+
if (!Array.isArray(address)) continue;
|
|
2936
|
+
let stands = false;
|
|
2937
|
+
for (let seen = 0; seen < subject.length; seen += 1) {
|
|
2938
|
+
if (subject[seen].entry.id !== pair.id) continue;
|
|
2939
|
+
if (homeAddressKey(subject[seen].address) === homeAddressKey(address)) {
|
|
2940
|
+
stands = true;
|
|
2941
|
+
break;
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
if (stands === true) continue;
|
|
2945
|
+
// **THE ROW THE JUDGEMENT ASKS THROUGH** — the pair's own registry row at that address where one
|
|
2946
|
+
// stands, and the first row carrying the id where none does (a pair over N addresses is N rows
|
|
2947
|
+
// and one identity, `contract.md §2.6` item 4).
|
|
2948
|
+
let row = null;
|
|
2949
|
+
for (const candidate of state.constraints.values()) {
|
|
2950
|
+
if (candidate.id !== pair.id) continue;
|
|
2951
|
+
let holds = false;
|
|
2952
|
+
for (let watched_ = 0; watched_ < candidate.addresses.length; watched_ += 1) {
|
|
2953
|
+
if (homeAddressKey(candidate.addresses[watched_]) === homeAddressKey(address)) {
|
|
2954
|
+
holds = true;
|
|
2955
|
+
break;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
if (row === null) row = candidate;
|
|
2959
|
+
if (holds === true) {
|
|
2960
|
+
row = candidate;
|
|
2961
|
+
break;
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
if (row === null) continue;
|
|
2965
|
+
appendOwn(subject, { entry: row, address });
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
repaired = true;
|
|
2970
|
+
// **THE PASS ANSWERS `rerun: true` HERE AND THE WALK RESTARTS OVER THE WIDENED SUBJECT**, which is the
|
|
2971
|
+
// selection the re-run is run over and not a second pass loop.
|
|
2972
|
+
break;
|
|
2571
2973
|
}
|
|
2572
|
-
if (
|
|
2573
|
-
// **THE FIRST VIOLATING PAIR DECIDES AND THE SECOND IS NOT EVALUATED** (`attempt-lifecycle.md §2.4` item 5
|
|
2574
|
-
// (ii)–(iii), at the reversal's own instant) — and BEFORE the refusal is built, EVERY address the reversal
|
|
2575
|
-
// moved is put back, so the store the consumer meets holds no state this refusal refused.
|
|
2576
|
-
const undo = restoreReversal(instance, moved);
|
|
2577
|
-
throw reversalRefusal(one, one.after, reversalSaid(outcome), reversalId, undo, null);
|
|
2974
|
+
if (repaired === false) break;
|
|
2578
2975
|
}
|
|
2579
|
-
|
|
2976
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2977
|
+
// **⟶ THE SAVE — `D-112` ITEM 2's INSTANT, AND THE LAST ACT BEFORE THE DELIVERY.** It stands between the
|
|
2978
|
+
// last ask and the window's close, inside this `try`, **so the ordering discharges both of `D-112`'s
|
|
2979
|
+
// exclusions structurally**: the compensation returned above the walk (`:2478`) and never reaches this line,
|
|
2980
|
+
// and a judgement that refuses never reaches it either. **THE SAVE IS THE STORE'S EXISTING STATE-KEYED
|
|
2981
|
+
// WRITE, reached through the entry's ONE POSITION IN ITS OWN ABSENT CARRIER** — `commitFile(state.receiver)`
|
|
2982
|
+
// supplies no position, so the codec answers `JsOpIdArg::Absent` and the addon's absent arm performs
|
|
2983
|
+
// `save_state` (`state.mjs`'s `commitFile` frame; `src/facade.rs`'s absent arm). **THE LIST IT CARRIES IS
|
|
2984
|
+
// THIS JUDGEMENT'S** (`D-113` item 5): a failed save crosses as the surface's one plain form with the
|
|
2985
|
+
// entries this window appended, and `[]` as its `address` — **the reversal stands in memory and the bytes
|
|
2986
|
+
// are not updated** (`D-107` item 3), and no journal entry is removed, no pre-state restored and no `seq`
|
|
2987
|
+
// stepped, because this route never reaches `commit_file`'s failing arm. **`§9.4` IS NOT WIDENED.**
|
|
2988
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2989
|
+
carryRefusal(() => commitFile(state.receiver), [], judgementLog, []);
|
|
2990
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
2991
|
+
// **⟶ AND THE DELIVERY — `D-117` ITEM 1: THE REVERSAL DELIVERS.** The order is the write's terminal arm's,
|
|
2992
|
+
// instant for instant — **ASK → REPAIRS LAND → RE-RUN → SAVE → DELIVER → THE MEMBER'S RECORD** (`D-117` item
|
|
2993
|
+
// 2) — and this seat is the DELIVER's: after the save, behind the passing arm alone, and inside this `try`,
|
|
2994
|
+
// so a failed save never returns to it. **ONE `deliver` CALL PER LEG, IN CREATION ORDER, EACH CARRYING THAT
|
|
2995
|
+
// LEG'S OWN `op.address`** — the address whose triggering produced the event (`surface.md §2.7` item 5;
|
|
2996
|
+
// `PAR-JS-12`) — **and a leg whose `op` is `null` delivers at the absent address**, which is `deliver`'s own
|
|
2997
|
+
// `[]` arm read at this one and not a second rule.
|
|
2998
|
+
//
|
|
2999
|
+
// **THE DE-DUPLICATION IS HELD ACROSS THE LEGS AND NOT ONLY INSIDE ONE OF THEM** (`§2.7` (iii) (a);
|
|
3000
|
+
// `surface.md §2.4` rule 3): the running handle list is `deliver`'s own spelled once more and not a second
|
|
3001
|
+
// mechanism — a handle an earlier leg already returned is handed to no later call, so an identity two legs
|
|
3002
|
+
// returned is invoked ONCE, at the FIRST leg that returned it. **A CARRIED PAIR's `id` IS ASKED AND NEVER
|
|
3003
|
+
// DELIVERED** (`D-69`) and the exclusion is `deliver`'s own kind test, **and each call takes `deliver`'s own
|
|
3004
|
+
// recipient snapshot at its own opening** (`C-2`; `CF-DUP-3`), so a registration made inside an earlier leg's
|
|
3005
|
+
// body takes effect at the NEXT leg and at no element of the one in flight. **NO ORDER IS ASSERTED ACROSS THE
|
|
3006
|
+
// BODIES OR ACROSS THE LEGS** (`DD-22`): a drive compares sets and counts. **AN EMPTY BATCH IS A NO-OP AND
|
|
3007
|
+
// NOT A FAILURE** (`surface.md §2.7` item 7 (c)), and a reversal that fired nothing delivers nothing.
|
|
3008
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
3009
|
+
const delivered = [];
|
|
3010
|
+
for (let leg = 0; leg < held.length; leg += 1) {
|
|
3011
|
+
const one_ = held[leg];
|
|
3012
|
+
if (one_ === null || typeof one_ !== 'object') continue;
|
|
3013
|
+
const elements = ownDataMember(one_, 'triggered');
|
|
3014
|
+
const owed = [];
|
|
3015
|
+
if (Array.isArray(elements)) {
|
|
3016
|
+
for (let element = 0; element < elements.length; element += 1) {
|
|
3017
|
+
const carried = elements[element];
|
|
3018
|
+
if (carried === null || typeof carried !== 'object') continue;
|
|
3019
|
+
const handle = ownDataMember(carried, 'handle');
|
|
3020
|
+
if (handle === undefined) continue;
|
|
3021
|
+
let seen = false;
|
|
3022
|
+
for (let matched = 0; matched < delivered.length; matched += 1) {
|
|
3023
|
+
if (delivered[matched] === handle) {
|
|
3024
|
+
seen = true;
|
|
3025
|
+
break;
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
if (seen === true) continue;
|
|
3029
|
+
appendOwn(delivered, handle);
|
|
3030
|
+
appendOwn(owed, carried);
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
const legOp = ownDataMember(one_, 'op');
|
|
3034
|
+
const triggeringAddress = legOp === null || typeof legOp !== 'object'
|
|
3035
|
+
? undefined
|
|
3036
|
+
: ownDataMember(legOp, 'address');
|
|
3037
|
+
deliver(state, owed, triggeringAddress);
|
|
3038
|
+
}
|
|
3039
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
3040
|
+
// **⟶ AND THE JUDGEMENT'S OWN LIST CROSSES FROM 2026-11-02 — `D-119`, `resolution-log.md` §3.3.** **THE
|
|
3041
|
+
// REVERSAL IS THE ARM `D-119`'s GROUND APPLIES TO MOST SHARPLY: `D-113` item 3 makes a judgement run your
|
|
3042
|
+
// pairs' repairs and `D-117` item 1 delivers the listeners those repairs' writes fire — so a `rollback` can
|
|
3043
|
+
// land an edit you did not ask for, which is exactly the downstream change the ruling exists to make
|
|
3044
|
+
// readable.** **THE LIST ANSWERED IS THIS FRAME'S OWN `judgementLog`, IN PLACE AND NOT COPIED**, so the answer
|
|
3045
|
+
// holds the very array this frame appended to — the `repair-run` entries and the entries the repairs' own
|
|
3046
|
+
// writes minted in this window, in append order (`D-65`'s ordinal, the array index).
|
|
3047
|
+
//
|
|
3048
|
+
// **IT IS FROZEN AT THIS FRAME'S END, BESIDE THE TWO CALLS THE `finally` OWES** — a freeze IN PLACE, on the
|
|
3049
|
+
// same array and not on a copy of it, exactly as `sealHandoff`'s freeze gives a `write` or a `delete` its
|
|
3050
|
+
// stable list. **AND THE FREEZE IS THE ANSWERING ARM'S ALONE** (`judgedList` below): a REFUSING judgement
|
|
3051
|
+
// crosses its OWN one-entry list (`reversalRefusal`), and no refusal byte is this row's to move (`D-41`).
|
|
3052
|
+
//
|
|
3053
|
+
// **A PASSING REVERSAL APPENDS NO `commit` ENTRY AND NONE IS INVENTED** (§4.1): a judgement mints no attempt,
|
|
3054
|
+
// so no passing arm of an attempt runs for it. **ITS `[]` ARMS ARE FOUR AND EACH IS TRUE** — the deferred
|
|
3055
|
+
// arm, the at-rest judgement over an empty watch, a compensating composition, and a judgement that ran and
|
|
3056
|
+
// appended nothing: the first three return above this frame's list and the last answers an empty list, which
|
|
3057
|
+
// the member's own helper hands on as the frozen constant.
|
|
3058
|
+
// ═══════════════════════════════════════════════════════════════════════════════════════════════════════
|
|
3059
|
+
judgedList = true;
|
|
3060
|
+
return judgementLog;
|
|
2580
3061
|
} finally {
|
|
3062
|
+
// **THE FREEZE IS IN PLACE AND AT THE FRAME'S END — `D-119`.** It runs before the frame's two releasing
|
|
3063
|
+
// calls and applies to the array the `return` above already named, so the answer is stable from the instant
|
|
3064
|
+
// it exists: no act of this package can append to it afterwards (`resolution-log.md` §5.1).
|
|
3065
|
+
if (judgedList === true) Object.freeze(judgementLog);
|
|
3066
|
+
leaveCommitFrame(kernel);
|
|
2581
3067
|
closeCommit(instance, opened);
|
|
2582
3068
|
}
|
|
2583
3069
|
}
|