eutaxy 0.16.0 → 0.16.1

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.
@@ -3389,17 +3389,67 @@ function concurrencyAssumption(bounds) {
3389
3389
  if (bounds.maxConcurrentInvocations === 1) return "one invocation at a time (maxConcurrentInvocations = 1)";
3390
3390
  return `up to ${bounds.maxConcurrentInvocations} invocations in flight, interleaved only at asynchronous effects (proxied bindings, fetch): code between two such effects runs without interruption (except continuations of a promise it settles for another invocation, which run then and are still attributed to their own invocation), Web Crypto calls are waited for like I/O, other non-effect awaits (body reads included) settle within one turn of the event loop, synchronous effects are not interleaving points, an effect made by code another effect hosts (an object calling out during a call) is a turn of its own unless that code cannot be interrupted (an object inside blockConcurrencyWhile), when it runs within the hosting effect's turn, the next turn is a seeded pick among parked invocations, starting a new event while a slot is free, and firing the earliest timer already due (at or before the virtual now, which effects advance), timers firing in due order among themselves, and a timer not yet due fires (virtual time passing to it) only when nothing else can move`;
3391
3391
  }
3392
- /** The first record a replay recorded differently from the run, or how their lengths differ; null when the logs match. */
3392
+ /** Where two JSON values first differ, as a path into them (`.tables.audit[0].at`), with the two values there. */
3393
+ function firstDifference(a, b, path = "") {
3394
+ if (Array.isArray(a) && Array.isArray(b)) {
3395
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
3396
+ const d = firstDifference(a[i], b[i], `${path}[${i}]`);
3397
+ if (d) return d;
3398
+ }
3399
+ return null;
3400
+ }
3401
+ const record = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
3402
+ if (record(a) && record(b)) {
3403
+ for (const key of [.../* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])].sort()) {
3404
+ const d = firstDifference(a[key], b[key], `${path}.${key}`);
3405
+ if (d) return d;
3406
+ }
3407
+ return null;
3408
+ }
3409
+ return (a === void 0 || b === void 0 ? a === b : canonicalJson(a) === canonicalJson(b)) ? null : {
3410
+ path,
3411
+ a,
3412
+ b
3413
+ };
3414
+ }
3415
+ /**
3416
+ * The first record a replay recorded differently from the run, or how their
3417
+ * lengths differ; null when the logs match. Two records of the same effect
3418
+ * are told apart by the first value in their payloads that differs, with its
3419
+ * path: a snapshot of many tables that differs in one column says which.
3420
+ */
3393
3421
  function whatDiffered(run, replay) {
3394
- const show = (e) => {
3395
- const payload = canonicalJson(e.payload);
3396
- const shown = payload.length > 120 ? `${payload.slice(0, 117)}...` : payload;
3397
- return `${e.kind} ${e.target} ${e.op} in ${e.invocation} ${shown}`;
3422
+ const short = (v) => {
3423
+ if (v === void 0) return "nothing";
3424
+ const text = canonicalJson(v);
3425
+ return text.length > 120 ? `${text.slice(0, 117)}...` : text;
3398
3426
  };
3427
+ /** Two differing values, each cut to the stretch around where their texts part, so the excerpts differ too. */
3428
+ const apart = (x, y) => {
3429
+ if (x === void 0 || y === void 0) return [short(x), short(y)];
3430
+ const [s, t] = [canonicalJson(x), canonicalJson(y)];
3431
+ if (s.length <= 120 && t.length <= 120) return [s, t];
3432
+ let at = 0;
3433
+ while (at < s.length && at < t.length && s[at] === t[at]) at++;
3434
+ const from = Math.max(0, at - 40);
3435
+ const cut = (text) => `${from > 0 ? "..." : ""}${text.slice(from, from + 110)}${from + 110 < text.length ? "..." : ""}`;
3436
+ return [cut(s), cut(t)];
3437
+ };
3438
+ const head = (e) => `${e.kind} ${e.target} ${e.op} in ${e.invocation}`;
3399
3439
  const a = serializeLog(run).split("\n");
3400
3440
  const b = serializeLog(replay).split("\n");
3401
3441
  const n = Math.min(run.entries.length, replay.entries.length);
3402
- for (let i = 0; i < n; i++) if (a[i] !== b[i]) return `at seq ${i} the run recorded ${show(run.entries[i])} and the replay ${show(replay.entries[i])}`;
3442
+ for (let i = 0; i < n; i++) {
3443
+ if (a[i] === b[i]) continue;
3444
+ const ran = run.entries[i];
3445
+ const replayed = replay.entries[i];
3446
+ const within = head(ran) === head(replayed) && firstDifference(ran.payload, replayed.payload);
3447
+ if (within) {
3448
+ const [was, is] = apart(within.a, within.b);
3449
+ return `at seq ${i} the run recorded ${head(ran)} with ${was} at payload${within.path} and the replay with ${is}`;
3450
+ }
3451
+ return `at seq ${i} the run recorded ${head(ran)} ${short(ran.payload)} and the replay ${head(replayed)} ${short(replayed.payload)}`;
3452
+ }
3403
3453
  if (run.entries.length === replay.entries.length) return null;
3404
3454
  return `the run recorded ${run.entries.length} entries and the replay ${replay.entries.length}`;
3405
3455
  }
@@ -3861,4 +3911,4 @@ function observeCore(namespace, functions) {
3861
3911
  }
3862
3912
  export { writeFaults as A, toJson as C, checkInvariants as D, checkInvariant as E, getPath as F, invocationOf as I, redelivery as L, nextInt as M, nextU32 as N, decisionFaults as O, seedPrng as P, canonicalJson as R, patchProperty as S, validateScenario as T, replyOf as _, explore as a, realTick as b, decide as c, runInvocation as d, CrashSignal as f, parseBody as g, isRedirect as h, rawRun as i, nextFloat as j, readFaults as k, hostInvocation as l, findResponse as m, compareSides as n, replay as o, InjectedEffectError as p, proxiedSide as r, restrictSpec as s, observeCore as t, note as u, toResponse as v, defaultBounds as w, virtualEpoch as x, withoutNetwork as y };
3863
3913
 
3864
- //# sourceMappingURL=src-CmHdPsZy.mjs.map
3914
+ //# sourceMappingURL=src-dkn6Illb.mjs.map