instar 1.3.520 → 1.3.521

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgCH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA4G7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAsBtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAyID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAm1CD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,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AE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,GACpD,IAAI,CA8eN;AA2lBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6yZtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -85,6 +85,8 @@ import { GitSyncManager } from '../core/GitSync.js';
85
85
  import { RegistrySyncDebouncer } from '../core/RegistrySyncDebouncer.js';
86
86
  import { wireRegistrySync } from '../core/wireRegistrySync.js';
87
87
  import { assertSeamlessnessInvariants } from '../core/seamlessnessConfig.js';
88
+ import { assertStateSyncInvariants } from '../core/stateSyncConfig.js';
89
+ import { ReplicatedKindRegistry, checkPoolFlagCoherence } from '../core/ReplicatedRecordEnvelope.js';
88
90
  import { FencedLease } from '../core/FencedLease.js';
89
91
  import { GitLeaseStore } from '../core/GitLeaseStore.js';
90
92
  import { LocalLeaseStore } from '../core/LocalLeaseStore.js';
@@ -3271,6 +3273,38 @@ export async function startServer(options) {
3271
3273
  // that breaks the RPO bound) is REJECTED here with a clear message rather
3272
3274
  // than degrading silently. Default/absent config resolves to valid values.
3273
3275
  const seamlessness = assertSeamlessnessInvariants(config.multiMachine);
3276
+ // Replicated-store foundation (multi-machine-replicated-store-foundation §10.2)
3277
+ // — resolve + validate the FOUNDATION-LEVEL stateSync knobs at startup. An
3278
+ // out-of-range value (e.g. a maxDriftMs below the 60s floor that would start
3279
+ // quarantining ordinary NTP jitter, or a non-positive journal budget) is
3280
+ // REJECTED here with a clear message rather than silently coerced (§10.2:
3281
+ // "a bad config is REJECTED, not silently degraded"). Default/absent config
3282
+ // resolves to valid values. The per-store on-switches are dark by default and
3283
+ // not range-validated; with none on, the foundation is inert.
3284
+ const stateSync = assertStateSyncInvariants(config.multiMachine);
3285
+ void stateSync; // foundation knobs are consumed by the store PRs (WS2.1+)
3286
+ // The replicated-kind registry (Component 2). Ships EMPTY in this step — the
3287
+ // first concrete store (WS2.1) registers its kind onto it. Constructed here so
3288
+ // the substrate is wired and the per-store stateSyncReceive advert can be
3289
+ // self-reported from the set of registered+enabled stores (machinery presence,
3290
+ // never a hardcoded true). A machine advertises a store's receive capability
3291
+ // ONLY when that store's kind is registered here AND emission is enabled in
3292
+ // config — i.e. it can both validate AND apply that kind. With an empty
3293
+ // registry the advert is `{}` (non-participant for every store): the correct
3294
+ // single-machine / no-store-yet behavior (a strict no-op).
3295
+ const replicatedKindRegistry = new ReplicatedKindRegistry();
3296
+ const selfStateSyncReceive = () => {
3297
+ const out = {};
3298
+ const stores = config.multiMachine?.stateSync;
3299
+ for (const store of replicatedKindRegistry.stores()) {
3300
+ // Advertise the receive capability iff the machinery exists (kind
3301
+ // registered) AND the store is enabled here — so a peer never forwards a
3302
+ // kind we'd silently drop (the named skew-failure mode).
3303
+ if (stores?.[store]?.enabled === true)
3304
+ out[store] = true;
3305
+ }
3306
+ return out;
3307
+ };
3274
3308
  // Read local signing key for machine route authentication
3275
3309
  let localSigningKeyPem = '';
3276
3310
  if (coordinator.enabled && coordinator.identity) {
@@ -12150,7 +12184,7 @@ export async function startServer(options) {
12150
12184
  // WS1.1 capability advertisement (spec invariant 5): a bounded
12151
12185
  // fixed-size summary, never an inventory. Reported live each
12152
12186
  // heartbeat so a queue going dark withdraws the capability.
12153
- seamlessnessFlags: { ws11DeliverReceive: !!_inboundQueue, ws12DrainReceive: !!_drainRunner, ws44PoolLinks: !!_poolLink },
12187
+ seamlessnessFlags: { ws11DeliverReceive: !!_inboundQueue, ws12DrainReceive: !!_drainRunner, ws44PoolLinks: !!_poolLink, stateSyncReceive: selfStateSyncReceive() },
12154
12188
  // Durable Inbound Message Queue §5.1: depth + oldest + tenure +
12155
12189
  // bounded top-K — the survivor's loss-SUSPECTED item, capped
12156
12190
  // re-placement arm, and supersede-dedupe key all read these.
@@ -12189,6 +12223,46 @@ export async function startServer(options) {
12189
12223
  const poolTimer = setInterval(refreshPool, 30_000);
12190
12224
  if (typeof poolTimer.unref === 'function')
12191
12225
  poolTimer.unref();
12226
+ // Boot-time pool-flag-coherence check (multi-machine-replicated-store-
12227
+ // foundation §4). For each LOCALLY-ENABLED replicated store, surface
12228
+ // ONCE (coalesced — never per-peer-per-tick) any peer that does NOT
12229
+ // advertise the matching stateSyncReceive capability: that peer would
12230
+ // SILENTLY DROP our kind (the journal applier drops unknown kinds), the
12231
+ // NAMED data-loss skew mode. Correct for N peers — checkPoolFlagCoherence
12232
+ // iterates ALL advertising peers. With an EMPTY registry (the Step-2
12233
+ // substrate-only state) this is a strict no-op (no registered stores →
12234
+ // empty verdict → nothing surfaced). The first concrete store (WS2.1)
12235
+ // registers its kind and this check starts doing real work automatically.
12236
+ let stateSyncCoherenceSurfaced = false;
12237
+ const checkStateSyncCoherence = () => {
12238
+ if (stateSyncCoherenceSurfaced)
12239
+ return;
12240
+ if (replicatedKindRegistry.size === 0)
12241
+ return; // no concrete store yet
12242
+ const peers = machinePoolRegistry
12243
+ .getCapacities()
12244
+ .filter((c) => c.machineId !== poolSelfId)
12245
+ .map((c) => ({
12246
+ machineId: c.machineId,
12247
+ online: c.online,
12248
+ stateSyncReceive: c.seamlessnessFlags?.stateSyncReceive,
12249
+ }));
12250
+ const stores = config.multiMachine?.stateSync;
12251
+ const verdict = checkPoolFlagCoherence(replicatedKindRegistry, stores, peers);
12252
+ if (verdict.mixedStores.length > 0) {
12253
+ // Surface ONCE (coalesced): one log line listing every mixed store.
12254
+ // A richer surface (one Attention item) is the store PR's to add;
12255
+ // the substrate guarantees the single, deduped detection here.
12256
+ stateSyncCoherenceSurfaced = true;
12257
+ console.log(pc.yellow(` [stateSync] pool-flag-coherence — mixed flag state across ${verdict.mixedStores.length} store(s):`));
12258
+ for (const line of verdict.summary)
12259
+ console.log(pc.yellow(` • ${line}`));
12260
+ }
12261
+ };
12262
+ checkStateSyncCoherence();
12263
+ const coherenceTimer = setInterval(checkStateSyncCoherence, 60_000);
12264
+ if (typeof coherenceTimer.unref === 'function')
12265
+ coherenceTimer.unref();
12192
12266
  }
12193
12267
  }
12194
12268
  }