instar 1.3.366 → 1.3.368

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.
Files changed (70) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +282 -2
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/config/ConfigDefaults.d.ts.map +1 -1
  5. package/dist/config/ConfigDefaults.js +29 -0
  6. package/dist/config/ConfigDefaults.js.map +1 -1
  7. package/dist/core/CommitmentsSync.d.ts +144 -0
  8. package/dist/core/CommitmentsSync.d.ts.map +1 -0
  9. package/dist/core/CommitmentsSync.js +293 -0
  10. package/dist/core/CommitmentsSync.js.map +1 -0
  11. package/dist/core/MeshRpc.d.ts +14 -0
  12. package/dist/core/MeshRpc.d.ts.map +1 -1
  13. package/dist/core/MeshRpc.js +7 -1
  14. package/dist/core/MeshRpc.js.map +1 -1
  15. package/dist/core/PeerPresencePuller.d.ts +25 -0
  16. package/dist/core/PeerPresencePuller.d.ts.map +1 -1
  17. package/dist/core/PeerPresencePuller.js +12 -0
  18. package/dist/core/PeerPresencePuller.js.map +1 -1
  19. package/dist/core/PeerVisibilityGuard.d.ts +83 -0
  20. package/dist/core/PeerVisibilityGuard.d.ts.map +1 -0
  21. package/dist/core/PeerVisibilityGuard.js +204 -0
  22. package/dist/core/PeerVisibilityGuard.js.map +1 -0
  23. package/dist/core/PendingPullLedger.d.ts +129 -0
  24. package/dist/core/PendingPullLedger.d.ts.map +1 -0
  25. package/dist/core/PendingPullLedger.js +239 -0
  26. package/dist/core/PendingPullLedger.js.map +1 -0
  27. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  28. package/dist/core/PostUpdateMigrator.js +20 -0
  29. package/dist/core/PostUpdateMigrator.js.map +1 -1
  30. package/dist/core/WorkingSetManifest.d.ts +2 -0
  31. package/dist/core/WorkingSetManifest.d.ts.map +1 -1
  32. package/dist/core/WorkingSetManifest.js +13 -1
  33. package/dist/core/WorkingSetManifest.js.map +1 -1
  34. package/dist/core/WorkingSetPull.d.ts +157 -0
  35. package/dist/core/WorkingSetPull.d.ts.map +1 -0
  36. package/dist/core/WorkingSetPull.js +546 -0
  37. package/dist/core/WorkingSetPull.js.map +1 -0
  38. package/dist/core/WorkingSetPullCoordinator.d.ts +134 -0
  39. package/dist/core/WorkingSetPullCoordinator.d.ts.map +1 -0
  40. package/dist/core/WorkingSetPullCoordinator.js +306 -0
  41. package/dist/core/WorkingSetPullCoordinator.js.map +1 -0
  42. package/dist/core/types.d.ts +39 -1
  43. package/dist/core/types.d.ts.map +1 -1
  44. package/dist/core/types.js.map +1 -1
  45. package/dist/monitoring/CommitmentTracker.d.ts +40 -0
  46. package/dist/monitoring/CommitmentTracker.d.ts.map +1 -1
  47. package/dist/monitoring/CommitmentTracker.js +95 -4
  48. package/dist/monitoring/CommitmentTracker.js.map +1 -1
  49. package/dist/scaffold/templates.d.ts.map +1 -1
  50. package/dist/scaffold/templates.js +4 -0
  51. package/dist/scaffold/templates.js.map +1 -1
  52. package/dist/server/AgentServer.d.ts +6 -0
  53. package/dist/server/AgentServer.d.ts.map +1 -1
  54. package/dist/server/AgentServer.js +2 -0
  55. package/dist/server/AgentServer.js.map +1 -1
  56. package/dist/server/routes.d.ts +9 -0
  57. package/dist/server/routes.d.ts.map +1 -1
  58. package/dist/server/routes.js +44 -1
  59. package/dist/server/routes.js.map +1 -1
  60. package/package.json +1 -1
  61. package/src/data/builtin-manifest.json +64 -64
  62. package/src/data/state-coherence-registry.json +61 -13
  63. package/src/scaffold/templates.ts +4 -0
  64. package/upgrades/1.3.367.md +134 -0
  65. package/upgrades/1.3.368.md +52 -0
  66. package/upgrades/side-effects/commitments-sync-p15a.md +93 -0
  67. package/upgrades/side-effects/working-set-ci-absorb.md +29 -0
  68. package/upgrades/side-effects/working-set-parity-absorb.md +35 -0
  69. package/upgrades/side-effects/working-set-pull-p22a.md +121 -0
  70. package/upgrades/side-effects/working-set-trigger-p22b.md +115 -0
@@ -0,0 +1,115 @@
1
+ # Side-Effects Review — Working-set trigger + reflex + drain + visibility guard (P2.2b)
2
+
3
+ **Version / slug:** `working-set-trigger-p22b`
4
+ **Date:** `2026-06-06`
5
+ **Author:** `echo`
6
+ **Second-pass reviewer:** `not required (implements §3.3/§3.4/§3.6 of the 4-round-converged spec; everything rides the explicit replication gate; e2e proves the EXO case end-to-end)`
7
+
8
+ ## Summary of the change
9
+
10
+ P2.2b — the working-set transfer now FIRES. Completes P2:
11
+
12
+ 1. `src/core/WorkingSetPullCoordinator.ts` — the orchestration layer: the
13
+ move trigger (receiver-side deliverMessage onAccepted seam), the reflex,
14
+ and the returning-peer staggered drain share ONE pipeline. Durable
15
+ (topic,epoch) op-key dedupe (restart-proof, `pull-opkeys.json`, bounded
16
+ window 200); skips not-owner / placing-confirm / prevOwner-self;
17
+ single-flight per topic; plural bounded nomination from journal evidence
18
+ (own + replicas, cap 3, cappedNominees named); pending-pulls filed with
19
+ busy-never-burns-an-attempt accounting; staggered drain (rearmConcurrency
20
+ 1) with stale-owner clear + epoch supersession; slow sweep tick = TTL +
21
+ live-source re-arm.
22
+ 2. `src/core/PeerVisibilityGuard.ts` — §3.6 rider: pure
23
+ `detectImproperRevocations` (NOT inside loadRegistry — it stays hot +
24
+ pure) + cross-boot-deduped notices (keyed on revokedAt); 30-min-grace
25
+ disappearance notice naming stranded pending-pull topics; flap bound
26
+ (3 episodes/24h → ONE collapse notice). All notices ride the
27
+ agent-health attention lane.
28
+ 3. `POST /coherence/fetch-working-set` (routes.ts) — the reflex. 503 dark,
29
+ 400 bad topic, 429 rate-limited, 200 outcome.
30
+ 4. `PeerPresencePuller.onPeerRecorded` seam — the §3.4 re-arm rides the
31
+ SAME 30s cadence journal-sync does (no new polling loop).
32
+ 5. server.ts wiring: coordinator + ledger + guard constructed ONLY when the
33
+ serve side exists (the explicit `replication.enabled === true` gate);
34
+ onAccepted hook fires BEFORE the session-pool stage gate
35
+ (fire-and-forget; the coordinator carries its own gates); ledger
36
+ onCorrupt/onExpired → agent-health attention items; 10-min sweep timer;
37
+ 5-min guard timer.
38
+ 6. Agent Awareness + Migration Parity: CLAUDE.md template gains the
39
+ fetch-reflex section with the proactive trigger ("user references
40
+ files/work not on this machine"); `migrateClaudeMd` adds it
41
+ content-sniffed for existing agents.
42
+ 7. State-Coherence Registry: `pull-opkeys` + `visibility-guard` categories.
43
+
44
+ ## Decision-point inventory
45
+
46
+ - **Trigger gates** (ordered): single-flight → ownership (live store, the
47
+ only authority) → epoch present → op-key dedupe (move only; the reflex
48
+ deliberately bypasses it — an explicit ask re-fetches) → prevOwner-self
49
+ skip → pressure defer (op-key NOT recorded, so the next accept
50
+ re-triggers — a defer is never a silent drop).
51
+ - **busy vs attempts**: only genuine failures (unreachable/throw) reach
52
+ `recordAttempt`; busyExhausted re-files the record attempt-free (§3.2).
53
+ - **Drain semantics**: per-record ownership recheck (stale-owner → clear,
54
+ newer epoch → supersede) so a drained record can never write onto a
55
+ topic this machine no longer owns.
56
+ - **Guard honesty**: hygiene signal only — populated revocation fields are
57
+ NOT authenticated; the notice text says so explicitly.
58
+
59
+ ## 1. Over-block
60
+
61
+ A reflex call within 30s of the last is 429'd (coalescing handles the
62
+ concurrent case). A move while under host pressure defers the pull until
63
+ the next trigger. The drain clears records for topics we no longer own —
64
+ deliberate: the current owner's own pull covers truth.
65
+
66
+ ## 2. Under-block
67
+
68
+ The op-key window is bounded at 200 — a topic moved 200+ epochs ago could
69
+ re-pull (idempotent via skippedExisting, harmless). The disappearance
70
+ notice depends on the pool registry's online view (a registry blind spot
71
+ is the §3.6 known limitation). The pressure-defer relies on the next
72
+ accept/reflex; a topic that never gets another message AND was deferred
73
+ falls to the reflex (named spec §3.3 behavior).
74
+
75
+ ## 3. Level-of-abstraction fit
76
+
77
+ The coordinator is transport-agnostic core (seam-injected like the puller);
78
+ server.ts only constructs + wires. The guard's detector is a pure function
79
+ per the integration-review finding (loadRegistry stays a hot dependency-free
80
+ read). The onAccepted hook lands in the existing createDeliverMessageHandler
81
+ seam — the exact place the spec's round-1 integration review corrected the
82
+ design to (ownAction/confirmClaim run on the ROUTER, the wrong machine).
83
+
84
+ ## 4. Blast radius
85
+
86
+ Dark everywhere except explicitly-replication-enabled pairs (today: the
87
+ echo Laptop+Mini). The onAccepted hook is one optional-chained call on a
88
+ coordinator that is undefined when dark. The reflex route 503s when dark.
89
+ The guard runs only inside the same gated block. Template/migration text
90
+ is awareness-only (the endpoint answers 503 until the layer is live).
91
+
92
+ ## Evidence
93
+
94
+ - `tests/unit/WorkingSetPullCoordinator.test.ts` — 12 passing: ownership
95
+ gating, DURABLE op-key dedupe across a coordinator restart,
96
+ pressure-defer-leaves-opkey-unburned, prevOwner-self skip, plural
97
+ nomination (newest-first, cap, cappedNominees, self excluded), genuine
98
+ vs busy attempt accounting, live-source clear-on-success, staggered
99
+ drain (sequential, stale-owner clear, drain gate), reflex rate-limit +
100
+ coalescing.
101
+ - `tests/unit/PeerVisibilityGuard.test.ts` — 5 passing: pure detector
102
+ matrix, cross-boot dedupe (crash-loop cannot re-spam), disappearance
103
+ episode lifecycle with stranded topics named + silent re-peer clear,
104
+ flap collapse to ONE notice.
105
+ - `tests/integration/working-set-reflex-route.test.ts` — 2 passing: 503
106
+ dark / 400 / 200-through-a-real-coordinator / 429.
107
+ - `tests/e2e/working-set-handoff-lifecycle.test.ts` — 2 passing,
108
+ production-shaped (REAL createDeliverMessageHandler + REAL signed
109
+ dispatcher/client + REAL journal streams): (1) a topic move lands the
110
+ file on the receiver, verified against the source's on-disk original +
111
+ re-delivery/op-key dedupe leaves it untouched; (2) THE EXO CASE —
112
+ producer offline at move, pending-pull survives a restart, re-fires on
113
+ the peer's return, file lands, record cleared.
114
+ - Full P2 sweep: 95 tests across 11 suites green; typecheck + lint chain
115
+ (69 registry categories) + docs-coverage clean.