@ultimat3/testing 20.2.0 → 21.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/testing",
3
- "version": "20.2.0",
3
+ "version": "21.0.0",
4
4
  "description": "Test harness: cloned template DBs per worker, frozen clock, sealed network, 6 test types",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -33,16 +33,16 @@
33
33
  "test": "bun test"
34
34
  },
35
35
  "dependencies": {
36
- "@ultimat3/cache": "20.2.0",
37
- "@ultimat3/core": "20.2.0",
38
- "@ultimat3/db": "20.2.0",
39
- "@ultimat3/entity": "20.2.0",
40
- "@ultimat3/i18n": "20.2.0",
41
- "@ultimat3/jobs": "20.2.0",
42
- "@ultimat3/mail": "20.2.0",
43
- "@ultimat3/policy": "20.2.0",
44
- "@ultimat3/query": "20.2.0",
45
- "@ultimat3/realtime": "20.2.0",
46
- "@ultimat3/time": "20.2.0"
36
+ "@ultimat3/cache": "21.0.0",
37
+ "@ultimat3/core": "21.0.0",
38
+ "@ultimat3/db": "21.0.0",
39
+ "@ultimat3/entity": "21.0.0",
40
+ "@ultimat3/i18n": "21.0.0",
41
+ "@ultimat3/jobs": "21.0.0",
42
+ "@ultimat3/mail": "21.0.0",
43
+ "@ultimat3/policy": "21.0.0",
44
+ "@ultimat3/query": "21.0.0",
45
+ "@ultimat3/realtime": "21.0.0",
46
+ "@ultimat3/time": "21.0.0"
47
47
  }
48
48
  }
package/src/live-node.ts CHANGED
@@ -77,11 +77,8 @@ export interface LiveNodeOptions {
77
77
  readonly buildId?: string;
78
78
  /** Pins the reconnect epoch, so a test can force a refetch by changing it. */
79
79
  readonly epoch?: string;
80
- // No `onMutate`. `SyncNodeOptions` takes one — `{ socket, name, key, seq, input }`, the actor
81
- // read off the socket — and nothing here needs it: the mutation half of a live subscription is
82
- // the CLIENT's local store and offline queue, which this driver deliberately does not hold. A
83
- // forwarded option no test passes is a declaration nothing reads, which is what 4.0.0 spent a
84
- // major deleting. It arrives with its first caller, in that caller's shape.
80
+ // No `onMutate`: the socket carries no writes any more (plan 101, decision 2) — a mutation goes
81
+ // over HTTP as an action, and `createSyncNode` takes no mutation hook to forward.
85
82
  }
86
83
 
87
84
  export interface LiveNodeHandle {
@@ -25,6 +25,12 @@ import type { ChangeEvent, ChangeOp, LiveQueryRegistry } from '@ultimat3/realtim
25
25
  /** What a caller does with a change nobody could deliver. */
26
26
  export interface LiveReplicatorOptions {
27
27
  readonly registry: LiveQueryRegistry;
28
+ /**
29
+ * The node's declared channels, fed the same `ChangeEvent` — what a real node's change
30
+ * subscription does beside `registry.deliver` (`sync-node.ts`). Without it a channel's `records`
31
+ * frames never carried a write made under `x dev`, and every other tab stayed on the old row.
32
+ */
33
+ readonly channels?: { deliverChange(change: ChangeEvent): unknown };
28
34
  /** Tenant column, hoisted out of the row so fanout filters without parsing it. */
29
35
  readonly tenantColumn?: string;
30
36
  readonly onError?: (error: unknown) => void;
@@ -104,8 +110,14 @@ export async function startLiveReplicator(options: LiveReplicatorOptions): Promi
104
110
  // Deliberately not a clock read: the preload freezes `Date.now()`, and a change's commit
105
111
  // time is not something any assertion in this repo reads. `at` keeps it monotonic anyway.
106
112
  at,
113
+ // The keyed write it belongs to, read off the request scope — what the WAL decoder reads
114
+ // off the transaction's opening message — so a channel frame names it here as it would there.
115
+ ...(change.write === undefined ? {} : { write: change.write }),
107
116
  };
108
117
  enqueue(async () => {
118
+ // Channels first, as the node does: a live query's fanout that throws must not also cost
119
+ // every declared channel the change.
120
+ options.channels?.deliverChange(event);
109
121
  delivered += await registry.deliver(event);
110
122
  });
111
123
  },