@kumiai/rpc 0.5.0 → 0.7.0

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 (2) hide show
  1. package/lib/peer.js +18 -2
  2. package/package.json +14 -14
package/lib/peer.js CHANGED
@@ -413,8 +413,11 @@ export function createGroupPeer(params) {
413
413
  await buildEpoch();
414
414
  };
415
415
  /**
416
- * Set as `dispose()`'s FIRST statement, and the whole of the peer's post-dispose rule: a
417
- * disposed peer refuses everything.
416
+ * Set as `dispose()`'s FIRST statement. The peer's post-dispose rule has two forms and this is
417
+ * the host-facing one: everything a HOST asks of a disposed peer is refused, loudly. The inbound
418
+ * side is refused silently, where a delivery has no caller to tell: the commit lane
419
+ * (`onCommitDelivery`), and the two rendezvous responders, whose reply timers can fire before
420
+ * dispose and would otherwise land their publish after it.
418
421
  *
419
422
  * The check belongs immediately after each entry point's `await ready`, because that await is
420
423
  * where the race lives. `dispose()` awaits a promise DERIVED from `ready`, so a call queued
@@ -560,6 +563,10 @@ export function createGroupPeer(params) {
560
563
  // The port verifies the request and checks the requester's leaf against its own current
561
564
  // tree. A refused request raises, and this peer stays silent.
562
565
  const groupInfo = await port.sealGroupInfo(request.request);
566
+ // Same window as `handleLedgerRequest`'s guard: a timer that fired before dispose is
567
+ // gone from `pendingReplies` by the time the clear sweep runs, and is then an await
568
+ // away from here. Silent, for the same reason.
569
+ if (disposed) return;
563
570
  // Mailbox class, deliberately: a rendezvous frame must never move the commit topic's
564
571
  // head, and its reader — the requester — subscribed before it asked.
565
572
  await mux.publish({
@@ -625,6 +632,11 @@ export function createGroupPeer(params) {
625
632
  // The port verifies the request and checks the requester's leaf against its own current
626
633
  // tree. A refused request raises, and this peer stays silent.
627
634
  const sealed = await port.sealLedger(request.request);
635
+ // This timer fired before dispose()'s clear sweep, so it had already deleted itself
636
+ // from `pendingLedgerReplies` when the sweep walked it — too late by construction, not
637
+ // by race. Silent, like `onCommitDelivery`: there is no caller to tell, and the catch
638
+ // below would swallow a throw anyway.
639
+ if (disposed) return;
628
640
  await mux.publish({
629
641
  topicID,
630
642
  payload: encodeHandshakeFrame(HANDSHAKE_KIND.ledgerReply, encodeLedgerReply(request.requestID, sealed))
@@ -1001,6 +1013,10 @@ export function createGroupPeer(params) {
1001
1013
  ack();
1002
1014
  void runSerial(async ()=>{
1003
1015
  await ready;
1016
+ // A delivery queued here when `dispose()` ran is not on the path dispose waits for: it awaits
1017
+ // `settled`, never the mutex. Refused SILENTLY, unlike every host-facing entry point — there
1018
+ // is no caller to tell, and the catch below would swallow a throw anyway.
1019
+ if (disposed) return;
1004
1020
  // A wakeup is a lane operation: step 0, the ledger invariant, then the pull. No return
1005
1021
  // value, so anything found is stashed for the next call that has one.
1006
1022
  const replayed = await replayJournal();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumiai/rpc",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "High-level MLS-aware group RPC for Enkaku: bus broadcast/anycast/gather plus directed RPC over the pub/sub hub",
5
5
  "keywords": [
6
6
  "rpc",
@@ -26,25 +26,25 @@
26
26
  "lib/*"
27
27
  ],
28
28
  "dependencies": {
29
- "@enkaku/client": "^0.20.0",
30
- "@enkaku/protocol": "^0.20.0",
31
- "@enkaku/server": "^0.20.0",
32
- "@enkaku/transport": "^0.20.0",
33
- "@noble/hashes": "^2.2.0",
34
- "@sozai/codec": "^0.3.0",
29
+ "@enkaku/client": "^0.21.0",
30
+ "@enkaku/protocol": "^0.21.0",
31
+ "@enkaku/server": "^0.21.1",
32
+ "@enkaku/transport": "^0.21.0",
33
+ "@noble/hashes": "^2.3.0",
34
+ "@sozai/codec": "^0.4.0",
35
35
  "@sozai/event": "^0.1.3",
36
- "@sozai/log": "^0.3.0",
36
+ "@sozai/log": "^0.3.1",
37
37
  "@sozai/runtime": "^0.1.0",
38
38
  "@sozai/schema": "^0.1.1",
39
- "@kumiai/broadcast": "^0.5.0",
40
- "@kumiai/hub-protocol": "^0.5.0",
41
- "@kumiai/hub-tunnel": "^0.5.0"
39
+ "@kumiai/broadcast": "^0.7.0",
40
+ "@kumiai/hub-tunnel": "^0.7.0",
41
+ "@kumiai/hub-protocol": "^0.7.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@noble/curves": "^2.0.1",
44
+ "@noble/curves": "^2.3.0",
45
45
  "vitest": "^4.1.10",
46
- "@kumiai/hub-conformance": "^0.5.0",
47
- "@kumiai/rpc-conformance": "^0.5.0"
46
+ "@kumiai/rpc-conformance": "^0.7.0",
47
+ "@kumiai/hub-conformance": "^0.7.0"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"