instar 1.3.502 → 1.3.504
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/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +117 -0
- package/dist/commands/server.js.map +1 -1
- package/dist/config/ConfigDefaults.d.ts.map +1 -1
- package/dist/config/ConfigDefaults.js +7 -0
- package/dist/config/ConfigDefaults.js.map +1 -1
- package/dist/core/CoherenceJournal.d.ts +1 -1
- package/dist/core/CoherenceJournal.d.ts.map +1 -1
- package/dist/core/CoherenceJournal.js +5 -1
- package/dist/core/CoherenceJournal.js.map +1 -1
- package/dist/core/MachinePoolRegistry.d.ts +4 -0
- package/dist/core/MachinePoolRegistry.d.ts.map +1 -1
- package/dist/core/MachinePoolRegistry.js +4 -0
- package/dist/core/MachinePoolRegistry.js.map +1 -1
- package/dist/core/OwnershipReconciler.d.ts +102 -0
- package/dist/core/OwnershipReconciler.d.ts.map +1 -0
- package/dist/core/OwnershipReconciler.js +185 -0
- package/dist/core/OwnershipReconciler.js.map +1 -0
- package/dist/core/SessionOwnership.d.ts +16 -1
- package/dist/core/SessionOwnership.d.ts.map +1 -1
- package/dist/core/SessionOwnership.js +14 -0
- package/dist/core/SessionOwnership.js.map +1 -1
- package/dist/core/SessionRouter.d.ts +11 -0
- package/dist/core/SessionRouter.d.ts.map +1 -1
- package/dist/core/SessionRouter.js +10 -0
- package/dist/core/SessionRouter.js.map +1 -1
- package/dist/core/types.d.ts +13 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/monitoring/SessionReaper.d.ts +5 -0
- package/dist/monitoring/SessionReaper.d.ts.map +1 -1
- package/dist/monitoring/SessionReaper.js +22 -2
- package/dist/monitoring/SessionReaper.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +12 -1
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +46 -46
- package/upgrades/1.3.503.md +61 -0
- package/upgrades/1.3.504.md +51 -0
- package/upgrades/side-effects/multi-machine-seamlessness-ws11.md +105 -0
- package/upgrades/side-effects/multi-machine-seamlessness-ws13.md +122 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Side-Effects Review — WS1.3 ownership reconcile + honest pending state
|
|
2
|
+
|
|
3
|
+
**Spec:** docs/specs/MULTI-MACHINE-SEAMLESSNESS-SPEC.md §WS1.3 (converged + approved, on main)
|
|
4
|
+
**Change:** (1) FSM gains `force-claim` (fenced epoch takeover; caller-validated death
|
|
5
|
+
evidence; rejects self-claim and missing records); (2) new `OwnershipReconciler` —
|
|
6
|
+
per-machine tick that converges pin/owner divergence: cooperative transfer→claim while
|
|
7
|
+
the owner lives (flap debounce + bounded safe point), adoption of unowned pinned
|
|
8
|
+
topics, force-claim ONLY with owner-death evidence (offline + last-seen past bound) AND
|
|
9
|
+
quorum membership; (3) `GET /pool/placement` surfaces `pendingReplacement` +
|
|
10
|
+
`pendingSince`; (4) SessionReaper closeout holds (do-not-act, audited once per episode)
|
|
11
|
+
when the topic's pin names THIS machine — the divergence is reconciling toward us;
|
|
12
|
+
(5) journal `PlacementReason` gains `'reconcile'` (additive); (6) dark flags
|
|
13
|
+
`multiMachine.seamlessness.ws13Reconcile` (false) + `ws13DryRun` (true) + `ws13TickMs`.
|
|
14
|
+
|
|
15
|
+
## 1. Over-block
|
|
16
|
+
The reconciler never blocks user actions. The closeout hold is the inverse of a block:
|
|
17
|
+
it STOPS an aggressive kill (the 2026-06-12 incident: 2-minute swings at a working
|
|
18
|
+
session for hours). Risk inverted: could the hold protect a session that genuinely
|
|
19
|
+
should close? Only when a pin actively names this machine — a deliberate, operator-set
|
|
20
|
+
state — and it self-clears the moment the pin converges or moves. The hold cannot leak
|
|
21
|
+
to unpinned topics.
|
|
22
|
+
|
|
23
|
+
## 2. Under-block
|
|
24
|
+
- Force-claim evidence is heartbeat-derived (capacity view). A partitioned-but-alive
|
|
25
|
+
owner that cannot heartbeat LOOKS dead after the bound; force-claim then fences it
|
|
26
|
+
out. This is the designed direction (the lease has the same property — clock-proof
|
|
27
|
+
epochs mean the returning machine cannot double-run; it observes the higher epoch
|
|
28
|
+
and stands down), and quorum membership prevents the minority side from acting.
|
|
29
|
+
- The cooperative path's CAS can lose races indefinitely under pathological churn;
|
|
30
|
+
each tick re-evaluates — bounded per tick, eventually consistent, never spinning
|
|
31
|
+
(one action attempt per topic per tick).
|
|
32
|
+
|
|
33
|
+
## 3. Level-of-abstraction fit
|
|
34
|
+
The FSM stays pure (sequencing + epochs); evidence/quorum live in the reconciler;
|
|
35
|
+
surfaces stay read-only. Matches the existing place/claim/transfer architecture —
|
|
36
|
+
no parallel ownership mechanism.
|
|
37
|
+
|
|
38
|
+
## 4. Signal vs authority compliance
|
|
39
|
+
The reconciler holds narrow, evidence-gated authority over ownership RECORDS (not
|
|
40
|
+
messages, not sessions, not user actions) — the same authority class as the existing
|
|
41
|
+
router placement, sharing its CAS arbiter. Force-claim's brittle half (the death
|
|
42
|
+
bound) is fenced by the quorum check and the epoch CAS: a wrong call cannot double-run
|
|
43
|
+
(stale owner is fenced) and cannot orphan (the record stays active under the claimer).
|
|
44
|
+
The closeout hold removes authority rather than adding it. Dry-run default ships the
|
|
45
|
+
whole engine observe-only.
|
|
46
|
+
|
|
47
|
+
## 5. Interactions
|
|
48
|
+
- The router's own place/claim on inbound messages composes: both go through the same
|
|
49
|
+
CAS; a reconciler action and a router action race safely (one wins, the loser
|
|
50
|
+
re-evaluates).
|
|
51
|
+
- The transfer route's existing place-half (quiet-topic repair) is untouched; the
|
|
52
|
+
reconciler covers the ACTIVE-record case that path deliberately refuses.
|
|
53
|
+
- The closeout's genuine-move path is unchanged for unpinned/pin-elsewhere topics;
|
|
54
|
+
the -1 sentinel resets cleanly so a future genuine move dwells normally.
|
|
55
|
+
- The cas-pairing discipline (§3.3) holds: every landed reconciler CAS emits a
|
|
56
|
+
journal placement entry with the new 'reconcile' reason (additive; old readers
|
|
57
|
+
ignore unknown reasons per the journal's forward-compat contract).
|
|
58
|
+
- WS3's SpeakerElection reads ownership via the same registry — faster convergence
|
|
59
|
+
directly improves one-voice accuracy. No new coupling.
|
|
60
|
+
|
|
61
|
+
## 6. External surfaces
|
|
62
|
+
`pendingReplacement`/`pendingSince` on an existing authenticated route. No new mesh
|
|
63
|
+
verbs: force-claim is NOT remotely invokable — each machine force-claims only for
|
|
64
|
+
itself, locally, with its own evidence (L15: a peer cannot drive a takeover).
|
|
65
|
+
|
|
66
|
+
## 7. Multi-machine posture (Cross-Machine Coherence)
|
|
67
|
+
**This IS the multi-machine feature.** Reconciler: per-machine by design — each
|
|
68
|
+
machine reconciles its own pin view against the shared CAS registry (the arbiter).
|
|
69
|
+
Pin stores are machine-local router-write-only by design (provenance). The
|
|
70
|
+
pendingReplacement surface is proxied-on-read via the existing holder-proxy on
|
|
71
|
+
/pool/placement. Phase C: quorum is N-machine from day one (online > total/2; the
|
|
72
|
+
2-machine degradation to surviving-machine-vs-provably-dark-peer is explicit and
|
|
73
|
+
documented because majority-of-2 cannot lose a member); no LAN assumption (all reads
|
|
74
|
+
local/replicated; evidence from the heartbeat registry that already works over the
|
|
75
|
+
public internet); no per-machine interactive steps (headless-VM compatible).
|
|
76
|
+
|
|
77
|
+
## 8. Rollback cost
|
|
78
|
+
Flag-flip (`ws13Reconcile: false` — the default) stops the engine instantly (read
|
|
79
|
+
live per tick). Records already converged by the reconciler are ordinary valid
|
|
80
|
+
ownership records — no data rollback. The closeout hold de-activates with no pin
|
|
81
|
+
conflicts present. PlacementReason 'reconcile' entries are inert history.
|
|
82
|
+
|
|
83
|
+
## Second-pass review
|
|
84
|
+
REQUIRED (ownership lifecycle + reaper surface). Independent reviewer response
|
|
85
|
+
appended below.
|
|
86
|
+
|
|
87
|
+
<!-- second-pass reviewer response appended below by the independent reviewer -->
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Second-pass reviewer response (independent subagent, 2026-06-12)
|
|
92
|
+
|
|
93
|
+
**Concern raised: the journal validator silently drops every `'reconcile'` placement entry — the §3.3 CAS-pairing the artifact (§5) and the OwnershipReconciler doc-comment both claim never actually lands.**
|
|
94
|
+
|
|
95
|
+
Code evidence: `src/core/CoherenceJournal.ts:591` — the `topic-placement` validator hardcodes its accepted reasons (`['user-move','placed','failover','released','quota-block-move']`); `'reconcile'` was absent. Only the `PlacementReason` TYPE was extended; the annotation `: PlacementReason[]` compiles because a subset of the union is type-legal, so the gap is silent at build time. `validate()` runs on the LOCAL emit path, so the entry is rejected at the source (counted only as `degradation.schemaRejects`). No test caught it because the reconciler unit tests assert against a FAKE emitPlacement and the integration cases only cover the route. Impact: every landed reconciler CAS would have produced NO durable placement evidence — falsifying artifact §5 and the §3.3 pairing invariant.
|
|
96
|
+
|
|
97
|
+
The reviewer's verification notes on everything else (all confirmed, no further concerns):
|
|
98
|
+
|
|
99
|
+
1. **Force-claim can NOT fire against a reachable-but-slow owner** — the gate requires `!online` AND last-seen past the 180s bound AND quorum; a slow-but-online owner falls to `deferredNoEvidence`. Dark + dry-run defaults verified at the wiring (`ws13Reconcile === true` gate; dry-run unless explicitly false; `act()` returns without CAS in dry-run).
|
|
100
|
+
2. **No two-active-owner / no-owner race** — the CAS store accepts only strictly-monotonic epochs; reconciler and router compute epoch+1 from the same observed record, the loser re-evaluates; release-during-transferring was already rejected by the FSM.
|
|
101
|
+
3. **The -1 closeout sentinel cannot leak to an unpinned topic and never permanently blocks a genuine move** — hold requires `otherOwner && pinnedHere`; convergence resets -1→0; a direct held→genuine-move transition costs one extra dwell tick (recovers; slightly imprecise in §5's "resets cleanly" but not a defect).
|
|
102
|
+
4. **Tick loop bounded; no spin/flood; no unbounded memory** — one act per topic per tick; `conflictSince` deleted on convergence and on landed CAS; `isTopicBusy` is a sound conservative signal because the 120s `pastDeadline` bound guarantees progress.
|
|
103
|
+
5. **Phase C quorum matches the artifact exactly** — `online * 2 > machines.length` for N>2 with the documented ≤2 degradation.
|
|
104
|
+
|
|
105
|
+
## Fix addendum (same change, before commit)
|
|
106
|
+
|
|
107
|
+
The reviewer's concern is fixed in this same PR: `'reconcile'` added to the runtime
|
|
108
|
+
allowlist (`CoherenceJournal.ts`, with a KEEP-IN-SYNC comment naming this exact
|
|
109
|
+
failure shape), plus the missing semantic-correctness test — the REAL
|
|
110
|
+
`CoherenceJournal` accepts `reason:'reconcile'` with zero schemaRejects and the
|
|
111
|
+
persisted entry carries the reason (`tests/unit/CoherenceJournal.test.ts`), proven
|
|
112
|
+
failing with the allowlist fix reverted and passing with it. Reviewer re-verification
|
|
113
|
+
of the fix appended below.
|
|
114
|
+
|
|
115
|
+
## Reviewer re-verification of the fix (same independent reviewer, 2026-06-12)
|
|
116
|
+
|
|
117
|
+
Fix verified — concern resolved. Concur with the review.
|
|
118
|
+
|
|
119
|
+
Notes:
|
|
120
|
+
1. The runtime allowlist now includes `'reconcile'` and carries a KEEP-IN-SYNC comment that names the exact failure shape — a type-legal subset silently schema-rejecting at the source. This addresses the structural root, not just the symptom.
|
|
121
|
+
2. The new test drives the REAL `CoherenceJournal` (no mock) and verifies both the zero-`schemaRejects`-delta AND the persisted-on-disk `data.reason === 'reconcile'`, genuinely exercising the validator and serialization path — the correct semantic-correctness coverage for reconciler-driven CAS journal pairing.
|
|
122
|
+
3. Full suite green: 39/39 pass.
|