@jsm-mit/tigi-sharded-package 0.23.0 → 0.23.2

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.
@@ -73,10 +73,6 @@ export declare function checkedDriverCanister(id: string | undefined): string |
73
73
  * for any other error.
74
74
  */
75
75
  export declare function refusalKeyOf(error: unknown): string | undefined;
76
- /**
77
- * The rider's side of the network: requests, offers, the ride. Built from the coordinator's
78
- * id; the identity is the rider (Internet Identity in the front).
79
- */
80
76
  export declare class RidesActor {
81
77
  private readonly identity;
82
78
  private readonly options;
@@ -165,6 +161,8 @@ export declare class RideRequest {
165
161
  private readonly notFree;
166
162
  private readonly refreshingUntilMs;
167
163
  private orderedOfferId;
164
+ /** ZO-N29: the end of the ordered offer's answer window, shown while a stale read is checked. */
165
+ private orderedAnswerByMs;
168
166
  /** @internal — made by `RidesActor`. */
169
167
  constructor(group: TigiGroup, identity: Identity, options: GroupOptions, state: RequestState, simulatorIdAsync: () => Promise<string | undefined>);
170
168
  get requestId(): string;
@@ -308,6 +306,7 @@ export declare class RideRequest {
308
306
  rateDriverAsyncUnsafe(stars: number): Promise<boolean>;
309
307
  /** U-42: the driver of this offer is busy — the entry is gone, and its place in the worker goes to the next driver (ZO-12, best-effort). */
310
308
  private markNotFree;
309
+ /** @returns the answers, and `fresh` when every one of them came through consensus now (ZO-N29). */
311
310
  private readAllAsyncUnsafe;
312
311
  private mergeAsync;
313
312
  /** ZO-15: the other workers close their copy (`otherOfferChosen`); tried again on the next poll if one fails. */
@@ -1 +1 @@
1
- {"version":3,"file":"rides-actor.d.ts","sourceRoot":"","sources":["../../src/actors/rides-actor.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKpD,OAAO,EAAgJ,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC7M,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAA2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;;;;;;;OASG;IACU,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAW1F;;;;;;;OAOG;IACU,uBAAuB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAW1E;;;;;;OAMG;IACU,sBAAsB,IAAI,OAAO,CAAC,WAAW,CAAC;IAqB3D;;;OAGG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/C;;;;;OAKG;IACU,kBAAkB,IAAI,OAAO,CAAC,QAAQ,CAAC;IAOpD;;;;;OAKG;IACU,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMnD;;;;;;;;;OASG;IACU,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAYrF;;;;OAIG;IACU,2BAA2B,IAAI,OAAO,CAAC,eAAe,CAAC;IAYpE;;;;OAIG;IACU,qBAAqB,IAAI,OAAO,CAAC,WAAW,CAAC;IAO1D;;;;;;;;;OASG;IACU,uBAAuB,IAAI,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAOtE;;;;;;OAMG;IACU,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASnE,4IAA4I;IAC5I,OAAO,CAAC,WAAW;IAMnB,oGAAoG;YACtF,kBAAkB;YAwBlB,UAAU;IAwExB,iHAAiH;YACnG,gBAAgB;IAS9B,qHAAqH;YACvG,UAAU;YASV,kBAAkB;YAalB,mBAAmB;YAOnB,WAAW;CAG5B"}
@@ -12,7 +12,7 @@ import { geohashesByWorker } from "../group/prefixes.js";
12
12
  import { cellsWithin, isValidGeo } from "../geo.js";
13
13
  import { driverChatPlaceAsyncUnsafe } from "../chat.js";
14
14
  import { ScheduledRide, SCHEDULED_MAX_AHEAD_MS, SCHEDULED_MIN_AHEAD_MS, SCHEDULED_RADIUS_METERS, scheduledStateOf } from "./scheduled-ride.js";
15
- import { cardOf, closeReasonOf, decodeToken, driverOfOfferId, encodeToken, fresherRide, freshViews, mergedPhase, mergeOffers, moneyOf, msOf, offerIdOf, offerOf, phaseOf, placeOffers, rideOfRideRef, rideMapOf, rideStatusOf, routeLineOf } from "../mappers.js";
15
+ import { cardOf, closeReasonOf, decodeToken, driverOfOfferId, encodeToken, fresherRide, freshViews, mergedPhase, mergeOffers, moneyOf, msOf, offerIdOf, offerOf, orderedOfferVerdict, phaseOf, placeOffers, rideOfRideRef, rideMapOf, rideStatusOf, routeLineOf } from "../mappers.js";
16
16
  /** U-29: the rider's radius, and the radius after `WIDEN_AFTER_MS` without offers. */
17
17
  export const SEARCH_RADIUS_METERS = 3_000;
18
18
  export const WIDE_RADIUS_METERS = 6_000;
@@ -74,6 +74,11 @@ async function workersForAsync(group, pickup, radiusMeters, fresh) {
74
74
  * The rider's side of the network: requests, offers, the ride. Built from the coordinator's
75
75
  * id; the identity is the rider (Internet Identity in the front).
76
76
  */
77
+ /** ZO-N30: an entry still shown (not gone, not being refreshed) that the workers no longer list. */
78
+ function unconfirmedAbsent(slots, live, refreshingUntilMs, nowMs) {
79
+ const listed = new Set(live.map((offer) => offer.offerId));
80
+ return slots.some((slot) => slot.gone === undefined && !listed.has(slot.offerId) && (refreshingUntilMs.get(slot.offerId) ?? 0) <= nowMs);
81
+ }
77
82
  export class RidesActor {
78
83
  identity;
79
84
  options;
@@ -246,6 +251,8 @@ export class RideRequest {
246
251
  notFree = new Set();
247
252
  refreshingUntilMs = new Map();
248
253
  orderedOfferId;
254
+ /** ZO-N29: the end of the ordered offer's answer window, shown while a stale read is checked. */
255
+ orderedAnswerByMs = 0;
249
256
  /** @internal — made by `RidesActor`. */
250
257
  constructor(group, identity, options, state, simulatorIdAsync) {
251
258
  this.group = group;
@@ -328,8 +335,11 @@ export class RideRequest {
328
335
  */
329
336
  async getAsyncUnsafe() {
330
337
  const workers = this.state.accepted ? [this.state.accepted.worker] : this.state.workers;
331
- const answers = await this.readAllAsyncUnsafe(workers);
332
- const snapshot = await this.mergeAsync(answers);
338
+ // ZO-25: the first read after the rider's own action goes through consensus.
339
+ const fresh = this.freshNext;
340
+ this.freshNext = false;
341
+ const read = await this.readAllAsyncUnsafe(workers, fresh);
342
+ const snapshot = await this.mergeAsync(read.answers, read.fresh);
333
343
  if (this.state.accepted && !this.state.othersClosed)
334
344
  await this.closeOthersAsync();
335
345
  if (snapshot.phase === "searching" && !this.state.widened && !this.state.sawOffer && Date.now() - this.state.createdMs >= WIDEN_AFTER_MS) {
@@ -364,9 +374,20 @@ export class RideRequest {
364
374
  * @throws Error with message `CriticalCanisterError` — the worker could not be reached
365
375
  */
366
376
  async refreshOfferAsyncUnsafe(offerId) {
367
- const asked = await this.onOfferAsyncUnsafe(offerId, (actor, ref) => actor.refreshOffer(ref));
368
- this.freshNext = true;
369
377
  // The offer is absent until its driver confirms again; its place waits (REFRESH_WAIT_MS).
378
+ // ZO-N30 (user 2026-11-22): marked BEFORE the call — the worker drops the old offer when
379
+ // the call commits, and a read made before its answer came saw the offer gone ("taken"
380
+ // flashed until the new offer came). A refusal or a still-fresh offer clears the mark.
381
+ this.refreshingUntilMs.set(offerId, Date.now() + REFRESH_WAIT_MS);
382
+ let asked = false;
383
+ try {
384
+ asked = await this.onOfferAsyncUnsafe(offerId, (actor, ref) => actor.refreshOffer(ref));
385
+ }
386
+ finally {
387
+ if (!asked)
388
+ this.refreshingUntilMs.delete(offerId);
389
+ this.freshNext = true;
390
+ }
370
391
  if (asked)
371
392
  this.refreshingUntilMs.set(offerId, Date.now() + REFRESH_WAIT_MS);
372
393
  return asked;
@@ -406,7 +427,8 @@ export class RideRequest {
406
427
  this.freshNext = true;
407
428
  if ("ordered" in outcome) {
408
429
  this.orderedOfferId = offerId;
409
- return { kind: "ordered", answerByMs: msOf(outcome.ordered.answerByNs) };
430
+ this.orderedAnswerByMs = msOf(outcome.ordered.answerByNs);
431
+ return { kind: "ordered", answerByMs: this.orderedAnswerByMs };
410
432
  }
411
433
  const kind = Object.keys(outcome)[0];
412
434
  if (kind === "driverNotFree")
@@ -606,10 +628,8 @@ export class RideRequest {
606
628
  this.slots = this.slots.map((slot) => (slot.offerId === offerId ? { ...slot, gone: "driverNotFree" } : slot));
607
629
  void this.onOfferAsyncUnsafe(offerId, (actor, ref) => actor.rejectOffer(ref)).catch(() => undefined);
608
630
  }
609
- async readAllAsyncUnsafe(workers) {
610
- // ZO-25: the first read after the rider's own action goes through consensus.
611
- const fresh = this.freshNext;
612
- this.freshNext = false;
631
+ /** @returns the answers, and `fresh` when every one of them came through consensus now (ZO-N29). */
632
+ async readAllAsyncUnsafe(workers, fresh) {
613
633
  const read = (worker) => (fresh ? this.group.onWorkerFreshAsyncUnsafe(worker, (actor) => actor.getRequest({ requestId: this.state.requestId })) : this.group.onWorkerAsyncUnsafe(worker, (actor) => actor.getRequest({ requestId: this.state.requestId })));
614
634
  const results = await Promise.allSettled(workers.map(async (worker) => ({ worker, view: await read(worker) })));
615
635
  const answers = [];
@@ -632,9 +652,9 @@ export class RideRequest {
632
652
  if (answers.length === 0 && notFound > 0)
633
653
  throw canisterError("NotFound", "no worker holds this request");
634
654
  // ZO-24: an older state than the held one, or a silent worker, keeps the held answer.
635
- return freshViews(this.heldViews, answers, failed, Date.now());
655
+ return { answers: freshViews(this.heldViews, answers, failed, Date.now()), fresh: fresh && failed.length === 0 };
636
656
  }
637
- async mergeAsync(answers) {
657
+ async mergeAsync(answers, fresh) {
638
658
  const simulator = await this.simulatorIdAsync();
639
659
  const host = this.options.host ?? MAINNET_HOST;
640
660
  const phases = answers.map((answer) => phaseOf(answer.view));
@@ -680,16 +700,28 @@ export class RideRequest {
680
700
  if (phase !== "closed")
681
701
  snapshot.closedReason = undefined;
682
702
  // U-42: the ordered offer came back to the list's phase without a ride — its driver
683
- // was busy (another rider was first) or did not answer.
684
- if (phase === "searching" && this.orderedOfferId !== undefined) {
703
+ // was busy (another rider was first) or did not answer. ZO-N29: only a read through
704
+ // consensus says so; a plain query may show the state before the order.
705
+ const verdict = orderedOfferVerdict(phase, this.orderedOfferId !== undefined, fresh);
706
+ if (verdict === "refused" && this.orderedOfferId !== undefined) {
685
707
  this.notFree.add(this.orderedOfferId);
686
708
  this.orderedOfferId = undefined;
687
709
  }
710
+ else if (verdict === "unsure" && this.orderedOfferId !== undefined) {
711
+ this.freshNext = true;
712
+ snapshot.phase = "waitingForDriver";
713
+ snapshot.waitingFor = { offerId: this.orderedOfferId, answerByMs: this.orderedAnswerByMs };
714
+ snapshot.lastOrderRefused = false;
715
+ }
688
716
  if (phase === "searching" || phase === "waitingForDriver" || phase === "closed") {
689
717
  const live = phase === "closed" ? [] : mergeOffers(lists);
690
- this.slots = placeOffers(this.slots, live, { rejected: this.rejected, notFree: this.notFree, refreshingUntilMs: this.refreshingUntilMs, nowMs: Date.now(), closed: phase === "closed" });
718
+ this.slots = placeOffers(this.slots, live, { rejected: this.rejected, notFree: this.notFree, refreshingUntilMs: this.refreshingUntilMs, nowMs: Date.now(), closed: phase === "closed", fresh });
691
719
  for (const offer of live)
692
720
  this.refreshingUntilMs.delete(offer.offerId);
721
+ // ZO-N30: an offer missing from a plain query stays as it was; the next read goes
722
+ // through consensus and says whether it is really gone.
723
+ if (!fresh && unconfirmedAbsent(this.slots, live, this.refreshingUntilMs, Date.now()))
724
+ this.freshNext = true;
693
725
  snapshot.offers = this.slots.map((offer) => ({ ...offer }));
694
726
  }
695
727
  if (snapshot.offers.length > 0)
package/dist/mappers.d.ts CHANGED
@@ -96,6 +96,12 @@ export interface OfferMarks {
96
96
  nowMs: number;
97
97
  /** The request closed: every entry is gone `closed`. */
98
98
  closed: boolean;
99
+ /**
100
+ * ZO-N30: the read came through consensus from every worker of the request. Only such a
101
+ * read turns an absent offer into `gone: "taken"`; a plain query (a replica a round
102
+ * behind, a read during the rider's own call) leaves the entry as it was.
103
+ */
104
+ fresh: boolean;
99
105
  }
100
106
  /**
101
107
  * U-42, ZO-11a: the rider's FIXED list. Every entry keeps its index; an offer present in
@@ -103,6 +109,15 @@ export interface OfferMarks {
103
109
  * with its last data; a new one goes at the end, by arrival. Pure: `previous` is not changed.
104
110
  */
105
111
  export declare function placeOffers(previous: readonly OfferView[], live: readonly OfferView[], marks: OfferMarks): OfferView[];
112
+ /**
113
+ * ZO-N29 (user 2026-11-20: "Kierowca zajęty", then the ride): what a "searching" phase says of
114
+ * the offer just ordered. A plain query may answer from the state before the order (a poll in
115
+ * flight during `chooseOffer`, or a replica a round behind) — it proves nothing: the order
116
+ * stays waiting and the next read goes through consensus. Only that read says it came back.
117
+ * @returns `refused` (the driver was busy or did not answer), `unsure` (read again through
118
+ * consensus), `none` (nothing to decide)
119
+ */
120
+ export declare function orderedOfferVerdict(phase: RequestPhase, ordered: boolean, fresh: boolean): "refused" | "unsure" | "none";
106
121
  export declare function phaseOf(view: CandidRequestView): RequestPhase;
107
122
  /**
108
123
  * The phase of the request over all its workers (ZO-14, ZO-15): accepted anywhere wins,
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../src/mappers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,WAAW,IAAI,iBAAiB,EAAE,UAAU,EAAE,KAAK,IAAI,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AACnM,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC3H,OAAO,KAAK,EAAE,eAAe,IAAI,qBAAqB,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAEhI,OAAO,KAAK,EAAa,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAW,gBAAgB,EAAkB,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG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;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,EAAE,CActM;AAID;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAalF"}
package/dist/mappers.js CHANGED
@@ -269,13 +269,28 @@ export function placeOffers(previous, live, marks) {
269
269
  return slot;
270
270
  if ((marks.refreshingUntilMs.get(slot.offerId) ?? 0) > marks.nowMs)
271
271
  return { ...slot, stale: true };
272
- return { ...slot, gone: marks.closed ? "closed" : "taken" };
272
+ if (marks.closed)
273
+ return { ...slot, gone: "closed" };
274
+ return marks.fresh ? { ...slot, gone: "taken" } : slot;
273
275
  });
274
276
  const known = new Set(previous.map((slot) => slot.offerId));
275
277
  const added = live.filter((offer) => !known.has(offer.offerId) && !marks.rejected.has(offer.offerId) && !marks.notFree.has(offer.offerId)).sort(compareArrival);
276
278
  const all = [...placed, ...added];
277
279
  return marks.closed ? all.map((offer) => (offer.gone === undefined ? { ...offer, gone: "closed" } : offer)) : all;
278
280
  }
281
+ /**
282
+ * ZO-N29 (user 2026-11-20: "Kierowca zajęty", then the ride): what a "searching" phase says of
283
+ * the offer just ordered. A plain query may answer from the state before the order (a poll in
284
+ * flight during `chooseOffer`, or a replica a round behind) — it proves nothing: the order
285
+ * stays waiting and the next read goes through consensus. Only that read says it came back.
286
+ * @returns `refused` (the driver was busy or did not answer), `unsure` (read again through
287
+ * consensus), `none` (nothing to decide)
288
+ */
289
+ export function orderedOfferVerdict(phase, ordered, fresh) {
290
+ if (!ordered || phase !== "searching")
291
+ return "none";
292
+ return fresh ? "refused" : "unsure";
293
+ }
279
294
  export function phaseOf(view) {
280
295
  return Object.keys(view.state)[0];
281
296
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsm-mit/tigi-sharded-package",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "description": "The one package of the Tigi network group: takes the coordinator's id and hides the coordinator, the core and the workers — for a consumer the group is one canister; plus the rider's few driver-canister endpoints (U-14).",
5
5
  "homepage": "https://github.com/JSM-Tigi/tigi-sharded/tree/master/package#readme",
6
6
  "repository": {
@@ -62,11 +62,11 @@
62
62
  "tigiSharded": {
63
63
  "repo": "tigi-sharded",
64
64
  "repoUrl": "https://github.com/JSM-Tigi/tigi-sharded",
65
- "commit": "77737199a17dc070109f7d523ecba8f2bea7e4ae"
65
+ "commit": "b944312c5f9c0d68762c0c8e55c77dfc22a5acfb"
66
66
  },
67
67
  "tigiDriverRust": {
68
68
  "repo": "tigi-driver-rust",
69
69
  "repoUrl": "https://github.com/JSM-Tigi/tigi-driver-rust",
70
- "commit": "4efee374ceb1193f164ccf625daed872b3988aed"
70
+ "commit": "aef2a19b1b31e470b908333b630f74151488d393"
71
71
  }
72
72
  }