instar 1.3.503 → 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.
@@ -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;AAyG7D,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;AAyzCD,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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E,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,CAynYtE;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"}
@@ -384,6 +384,9 @@ let _inboundQueueStop = null;
384
384
  * (forward/spawn on another machine → must NOT also dispatch locally) from a
385
385
  * self placement. Set once in startServer()'s mesh block. */
386
386
  let _meshSelfId = null;
387
+ /** WS1.1: read-only ownership lookup for the drain's spawn-boundary re-check
388
+ * (the registry is constructed later in startServer's pool block). */
389
+ let _ownershipReadForDrain = null;
387
390
  /** Resolve the current router (Telegram-owning lease holder)'s base URL, or null if
388
391
  * this machine IS the router / none is known. Used by the owner-side resume to fetch
389
392
  * a moved topic's prior history from the router (bug #2). Set in the mesh block where
@@ -2014,6 +2017,22 @@ getAttentionTopicId) {
2014
2017
  return { kind: 'local-delivered', injectError: err instanceof Error ? err.message : String(err) };
2015
2018
  }
2016
2019
  }
2020
+ // WS1.1 (MULTI-MACHINE-SEAMLESSNESS-SPEC): ownership re-check at the SPAWN
2021
+ // boundary. route() consulted ownership above, but ownership can move in
2022
+ // the window between that verdict and this spawn (entry queued under owner
2023
+ // A, transferred to B mid-queue, drained on A) — a non-owner spawn is the
2024
+ // double-session bug (audit F20). Bounce to un-routable: the entry
2025
+ // re-queues and the next drain pass re-routes against FRESH ownership
2026
+ // (forward to the real owner / queue). Direct-inject into an EXISTING
2027
+ // local session above is not gated — a live local session for the topic is
2028
+ // itself the strongest local-serving signal, and the reconciler/closeout
2029
+ // own its lifecycle.
2030
+ if (_ownershipReadForDrain && _meshSelfId) {
2031
+ const ownRec = _ownershipReadForDrain(dmsg.sessionKey);
2032
+ if (ownRec && ownRec.status === 'active' && ownRec.ownerMachineId !== _meshSelfId) {
2033
+ return { kind: 'un-routable', reason: 'ownership-moved-before-spawn' };
2034
+ }
2035
+ }
2017
2036
  // Respawn / auto-spawn path. The spawn-in-progress guard maps to
2018
2037
  // un-routable (§3.1) — never a silent skip.
2019
2038
  if (spawningTopics.has(topicId)) {
@@ -11892,6 +11911,10 @@ export async function startServer(options) {
11892
11911
  loadAvg: osMod.loadavg()[0],
11893
11912
  quotaState: selfQuotaState(),
11894
11913
  guardPosture: selfGuardPosture(),
11914
+ // WS1.1 capability advertisement (spec invariant 5): a bounded
11915
+ // fixed-size summary, never an inventory. Reported live each
11916
+ // heartbeat so a queue going dark withdraws the capability.
11917
+ seamlessnessFlags: { ws11DeliverReceive: !!_inboundQueue },
11895
11918
  // Durable Inbound Message Queue §5.1: depth + oldest + tenure +
11896
11919
  // bounded top-K — the survivor's loss-SUSPECTED item, capped
11897
11920
  // re-placement arm, and supersede-dedupe key all read these.
@@ -11984,6 +12007,10 @@ export async function startServer(options) {
11984
12007
  logger: (m) => console.log(pc.dim(` ${m}`)),
11985
12008
  });
11986
12009
  const ownReg = sessionOwnershipRegistry;
12010
+ // WS1.1: expose a read-only ownership lookup to the drain's
12011
+ // spawn-boundary re-check (module-scope; the drain closure is defined
12012
+ // before this block runs).
12013
+ _ownershipReadForDrain = (sk) => ownReg.read(sk);
11987
12014
  // ── WS3 one-voice: bind the election's late pool deps ──
11988
12015
  // From here on the SpeakerElection sees the real pool: online machine
11989
12016
  // ids from the capacity registry and live topic ownership from the
@@ -13147,6 +13174,17 @@ export async function startServer(options) {
13147
13174
  // sending its sessions down the existing failover re-place path
13148
13175
  // without each message re-paying the retry tax.
13149
13176
  isMachineAlive: (m) => m === meshSelfId || ((machinePoolRegistry?.getCapacity(m)?.online ?? false) && !ownerSuspectBreaker.isSuspect(m)),
13177
+ // WS1.1 skew gate: read the owner's advertised receive capability
13178
+ // from its last heartbeat. A peer with NO flags field is an older
13179
+ // version → false (the conservative side: queue, don't forward into
13180
+ // a 501→failover steal). A peer the registry doesn't know → null
13181
+ // (unknown; the alive-check upstream already filters those).
13182
+ ownerSupportsForward: (m) => {
13183
+ const cap = machinePoolRegistry?.getCapacity(m);
13184
+ if (!cap)
13185
+ return null;
13186
+ return cap.seamlessnessFlags?.ws11DeliverReceive === true;
13187
+ },
13150
13188
  markOwnerSuspect: (m) => ownerSuspectBreaker.markSuspect(m),
13151
13189
  onOwnerResponsive: (m) => ownerSuspectBreaker.recordSuccess(m),
13152
13190
  casClaimOwnership: (sk, machineId) => {