@syncular/testkit 0.58.0 → 0.60.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/README.md CHANGED
@@ -37,9 +37,9 @@ test('two clients converge', async () => {
37
37
  const a = await sync.client('a');
38
38
  const b = await sync.client('b');
39
39
 
40
- const sub = { id: 's', table: 'todos', scopes: { list_id: ['groceries'] } };
41
- a.api.subscribe(sub);
42
- b.api.subscribe(sub);
40
+ const list = { list_id: 'groceries' };
41
+ a.api.subscribe(list);
42
+ b.api.subscribe(list);
43
43
 
44
44
  a.api.mutate([
45
45
  { table: 'todos', op: 'upsert', values: { id: 't1', list_id: 'groceries', title: 'hi' } },
@@ -90,7 +90,7 @@ client.actorId // the actor it authenticates as
90
90
  client.faults // transport-fault controller (below)
91
91
  client.offline // boolean
92
92
 
93
- client.goOffline() // cut the network — every hop rejects
93
+ client.goOffline() // dead network: every hop rejects (causeKind 'network')
94
94
  client.goOnline() // restore it (does NOT auto-sync; call sync())
95
95
  await client.sync() // syncUntilIdle: push the outbox, pull to idle
96
96
  await client.connectRealtime() // attach a live socket to the hub
@@ -108,6 +108,7 @@ a.api.mutate([{ table: 'todos', op: 'upsert', values: { id: 't1', list_id: 'l',
108
108
  expect(a.api.query('SELECT title FROM todos')).toEqual([{ title: 'draft' }]);
109
109
  expect(a.api.pendingCommits()).toHaveLength(1);
110
110
  await expect(a.api.sync()).rejects.toThrow(); // offline
111
+ a.api.diagnosticsSnapshot().host.connectivity; // 'offline', no retry scheduled
111
112
 
112
113
  a.goOnline();
113
114
  await sync.syncAll(); // the queue drains
@@ -116,9 +117,9 @@ expect(a.api.pendingCommits()).toHaveLength(0);
116
117
 
117
118
  ### Fault injection
118
119
 
119
- `client.faults` is the conformance harness's `TransportFaults` controller,
120
- **re-exported, not re-implemented** — the same vocabulary the reference
121
- pairing arms. Arm one flag; the next matching exchange misbehaves:
120
+ `client.faults` is the `TransportFaults` controller the conformance harness
121
+ extends, so both arm the same vocabulary. The kit's loopback honors every flag
122
+ on it. Arm one flag; the next matching exchange misbehaves:
122
123
 
123
124
  ```ts
124
125
  a.faults.dropNextRequests = 1; // lose the next request (outbox survives)
@@ -126,6 +127,8 @@ a.faults.dropNextResponses = 1; // server applies it, the ack is lost
126
127
  a.faults.duplicateNextRequest = true; // replay it — idempotency-cache test
127
128
  a.faults.truncateNextResponse = true; // cut the response short (decode error)
128
129
  a.faults.truncateNextSegmentDownload = true;
130
+ a.faults.dropNextSegmentRequests = 1;
131
+ a.faults.refuseNextRealtimeConnect = true; // connectRealtime() rejects once
129
132
  a.faults.corrupt(bytes); // flip a seeded byte (§5.1 tamper)
130
133
  ```
131
134
 
@@ -183,15 +186,15 @@ b.api.patch('todos', 't1', { title: 'B' }, { baseVersion: version });
183
186
  await a.sync(); // wins version + 1
184
187
  await b.sync(); // loses against the stale base
185
188
 
186
- expect(b.api.conflicts[0]?.serverRow.title).toBe('A');
189
+ expect(b.api.conflicts()[0]?.serverRow.title).toBe('A');
187
190
  expect(
188
- Object.keys(b.api.conflicts[0]?.operation?.values ?? {}),
191
+ Object.keys(b.api.conflicts()[0]?.operation?.values ?? {}),
189
192
  ).toContain('title');
190
193
  ```
191
194
 
192
195
  Pass `validators` to `createTestSync` to exercise the same business rules as
193
196
  production. A `ValidationRejection` with structured details reaches
194
- `client.api.rejections` through both loopback and socket sync rounds, so app
197
+ `client.api.rejections()` through both loopback and socket sync rounds, so app
195
198
  tests can assert field focus and correction routing without displaying server
196
199
  diagnostics.
197
200
 
@@ -215,11 +218,11 @@ import { syncWrapper } from '@syncular/testkit/react';
215
218
 
216
219
  const sync = await createTestSync({ schema });
217
220
  const client = await sync.client('a');
218
- client.api.subscribe({ id: 's', table: 'todos', scopes: { list_id: ['x'] } });
221
+ client.api.subscribe({ list_id: 'x' });
219
222
  await client.sync();
220
223
 
221
224
  const { result } = renderHook(
222
- () => useRawSql('SELECT * FROM todos'),
225
+ () => useRawSql('SELECT * FROM todos', [], { tables: ['todos'] }),
223
226
  { wrapper: syncWrapper(client) },
224
227
  );
225
228
 
package/dist/client.d.ts CHANGED
@@ -7,9 +7,8 @@
7
7
  * gate so an app test can drop / duplicate / corrupt individual exchanges,
8
8
  * and an offline flag that makes every hop reject like a lost network.
9
9
  *
10
- * The fault controller is the conformance harness's `TransportFaults`,
11
- * re-exported (see `index.ts`) — the SAME vocabulary the reference pairing
12
- * arms, not a parallel one.
10
+ * The fault controller is the `TransportFaults` the conformance harness
11
+ * extends; this loopback honors every flag on it.
13
12
  */
14
13
  import { type ClientSchema, SyncClient, type SyncClientConfig } from '@syncular/client';
15
14
  import type { VirtualClock } from './clock.js';
@@ -31,7 +30,12 @@ export interface TestClient {
31
30
  readonly faults: TransportFaults;
32
31
  /** True while the client is offline (every hop rejects). */
33
32
  readonly offline: boolean;
34
- /** Cut the network: sync / segment / realtime hops reject until online. */
33
+ /**
34
+ * Cut the network: sync / segment / realtime hops reject until online with
35
+ * the `sync.transport_failed` error a dead network raises
36
+ * (`details.causeKind: 'network'`), so the client reports connectivity
37
+ * `offline` and waits for a resume instead of scheduling a retry.
38
+ */
35
39
  goOffline(): void;
36
40
  /** Restore the network. Does NOT auto-sync — call `sync()` yourself. */
37
41
  goOnline(): void;
package/dist/client.js CHANGED
@@ -7,23 +7,15 @@
7
7
  * gate so an app test can drop / duplicate / corrupt individual exchanges,
8
8
  * and an offline flag that makes every hop reject like a lost network.
9
9
  *
10
- * The fault controller is the conformance harness's `TransportFaults`,
11
- * re-exported (see `index.ts`) — the SAME vocabulary the reference pairing
12
- * arms, not a parallel one.
10
+ * The fault controller is the `TransportFaults` the conformance harness
11
+ * extends; this loopback honors every flag on it.
13
12
  */
14
- import { SyncClient, } from '@syncular/client';
13
+ import { SyncClient, transportFailed, } from '@syncular/client';
15
14
  import { BunClientDatabase } from '@syncular/client/bun';
16
15
  import { handleSegmentDownload, handleSyncRequest } from '@syncular/server';
17
- import { seededRandom, TransportFault, TransportFaults } from './faults.js';
18
- /** A client-facing offline error: rejects a hop the way a dead network does. */
19
- class OfflineError extends Error {
20
- name = 'OfflineError';
21
- code = 'sync.transport_failed';
22
- retryable = true;
23
- constructor() {
24
- super('injected: client is offline');
25
- }
26
- }
16
+ import { seededRandom, seedFromName, TransportFault, TransportFaults, } from './faults.js';
17
+ /** Rejects a hop the way `httpSyncTransport` reports a dead network. */
18
+ const offline = () => transportFailed('injected: client is offline', { causeKind: 'network' });
27
19
  /**
28
20
  * Build a `TestClient`. The client is NOT started — the caller (or
29
21
  * `createTestSync`) awaits `api.start()`. Split out so `createTestSync` can
@@ -32,12 +24,12 @@ class OfflineError extends Error {
32
24
  export function buildTestClient(options) {
33
25
  const { server, schema, clock, id, actorId } = options;
34
26
  const db = new BunClientDatabase();
35
- const faults = new TransportFaults(seededRandom(hashSeed(id)));
27
+ const faults = new TransportFaults(seededRandom(seedFromName(id)));
36
28
  const state = { offline: false };
37
29
  const ctx = () => server.ctxFor(actorId);
38
30
  const transport = async (request) => {
39
31
  if (state.offline)
40
- throw new OfflineError();
32
+ throw offline();
41
33
  if (faults.dropNextRequests > 0) {
42
34
  faults.dropNextRequests -= 1;
43
35
  throw new TransportFault('injected: request lost');
@@ -61,7 +53,7 @@ export function buildTestClient(options) {
61
53
  };
62
54
  const segments = async (request) => {
63
55
  if (state.offline)
64
- throw new OfflineError();
56
+ throw offline();
65
57
  if (faults.dropNextSegmentRequests > 0) {
66
58
  faults.dropNextSegmentRequests -= 1;
67
59
  throw new TransportFault('injected: segment request lost');
@@ -78,7 +70,11 @@ export function buildTestClient(options) {
78
70
  };
79
71
  const realtime = async (handlers) => {
80
72
  if (state.offline)
81
- throw new OfflineError();
73
+ throw offline();
74
+ if (faults.refuseNextRealtimeConnect) {
75
+ faults.refuseNextRealtimeConnect = false;
76
+ throw new TransportFault('injected: realtime connect refused');
77
+ }
82
78
  const session = await server.hub.connect({
83
79
  partition: server.partition,
84
80
  actorId,
@@ -133,13 +129,3 @@ export function buildTestClient(options) {
133
129
  };
134
130
  return { client, start: () => api.start() };
135
131
  }
136
- /** Deterministic per-client fault seed from the client id (mirrors the
137
- * conformance harness's per-scenario seeding). */
138
- function hashSeed(name) {
139
- let hash = 2166136261;
140
- for (let i = 0; i < name.length; i++) {
141
- hash ^= name.charCodeAt(i);
142
- hash = Math.imul(hash, 16777619);
143
- }
144
- return hash >>> 0;
145
- }
@@ -8,15 +8,15 @@
8
8
  * const sync = await createTestSync({ schema });
9
9
  * const a = await sync.client('a');
10
10
  * const b = await sync.client('b');
11
- * a.api.subscribe({ id: 's', table: 'notes', scopes: { list_id: ['x'] } });
12
- * b.api.subscribe({ id: 's', table: 'notes', scopes: { list_id: ['x'] } });
11
+ * a.api.subscribe({ list_id: 'x' });
12
+ * b.api.subscribe({ list_id: 'x' });
13
13
  * a.api.mutate([{ table: 'notes', op: 'upsert', values: … }]);
14
14
  * await sync.syncAll(); // both converge
15
15
  * await sync.dispose();
16
16
  */
17
- import type { ClientSchema, SyncClientConfig } from '@syncular/client';
17
+ import type { ClientSchema } from '@syncular/client';
18
18
  import type { CommitValidator, ResolveScopes, ValidatorRegistry } from '@syncular/server';
19
- import { type TestClient } from './client.js';
19
+ import { type TestClient, type TestClientOptions } from './client.js';
20
20
  import { type VirtualClock } from './clock.js';
21
21
  import { type TestServer } from './server.js';
22
22
  export interface CreateTestSyncOptions {
@@ -48,7 +48,7 @@ export interface TestClientOverrides {
48
48
  /** Actor id for this client (defaults to the sync-wide actor). */
49
49
  readonly actorId?: string;
50
50
  /** Extra `SyncClient` config (e.g. `onConflict`, `limits`). */
51
- readonly clientConfig?: Partial<Omit<SyncClientConfig, 'database' | 'schema' | 'clientId' | 'now' | 'transport' | 'segments' | 'realtime'>>;
51
+ readonly clientConfig?: TestClientOptions['clientConfig'];
52
52
  }
53
53
  export interface TestSync {
54
54
  /** The shared virtual clock — server + every client read it. */
@@ -8,13 +8,13 @@
8
8
  * const sync = await createTestSync({ schema });
9
9
  * const a = await sync.client('a');
10
10
  * const b = await sync.client('b');
11
- * a.api.subscribe({ id: 's', table: 'notes', scopes: { list_id: ['x'] } });
12
- * b.api.subscribe({ id: 's', table: 'notes', scopes: { list_id: ['x'] } });
11
+ * a.api.subscribe({ list_id: 'x' });
12
+ * b.api.subscribe({ list_id: 'x' });
13
13
  * a.api.mutate([{ table: 'notes', op: 'upsert', values: … }]);
14
14
  * await sync.syncAll(); // both converge
15
15
  * await sync.dispose();
16
16
  */
17
- import { buildTestClient } from './client.js';
17
+ import { buildTestClient, } from './client.js';
18
18
  import { createVirtualClock } from './clock.js';
19
19
  import { createTestServer, DEFAULT_ACTOR, DEFAULT_PARTITION, } from './server.js';
20
20
  export async function createTestSync(options) {
package/dist/faults.d.ts CHANGED
@@ -2,9 +2,9 @@
2
2
  * Fault injection at the transport seam.
3
3
  *
4
4
  * Canonical home: the PUBLIC app test kit. The private conformance harness
5
- * re-exports from here so both arm the SAME fault vocabulary — one
6
- * implementation, publishable dependency direction (testkit ships to npm;
7
- * conformance stays private).
5
+ * extends `TransportFaults` with the faults only its loopback honors, so both
6
+ * arm the same base vocabulary (testkit ships to npm; conformance stays
7
+ * private). The kit's loopback honors every flag declared here.
8
8
  *
9
9
  * The harness owns the loopback between a ClientInstance and a
10
10
  * ServerInstance; scenarios arm faults on this controller and the next
@@ -35,8 +35,6 @@ export declare class TransportFaults {
35
35
  dropNextRequests: number;
36
36
  /** Deliver the next N sync requests, then lose their responses. */
37
37
  dropNextResponses: number;
38
- /** Return ACKs while withholding pull sections without advancing their cursors. */
39
- deferNextPulls: number;
40
38
  /** Deliver the next sync request twice; return the second response. */
41
39
  duplicateNextRequest: boolean;
42
40
  /** Truncate the next sync response at a seeded offset. */
@@ -45,10 +43,6 @@ export declare class TransportFaults {
45
43
  dropNextSegmentRequests: number;
46
44
  /** Truncate the next segment download at a seeded offset. */
47
45
  truncateNextSegmentDownload: boolean;
48
- /** Fail the next N signed-URL fetches (the CDN hop, §5.4). */
49
- dropNextUrlFetches: number;
50
- /** Corrupt the next signed-URL fetch's bytes (§5.1 tamper). */
51
- corruptNextUrlFetch: boolean;
52
46
  /** Refuse the next realtime connect (a refused §8.8 handshake). */
53
47
  refuseNextRealtimeConnect: boolean;
54
48
  constructor(random: () => number);
package/dist/faults.js CHANGED
@@ -2,9 +2,9 @@
2
2
  * Fault injection at the transport seam.
3
3
  *
4
4
  * Canonical home: the PUBLIC app test kit. The private conformance harness
5
- * re-exports from here so both arm the SAME fault vocabulary — one
6
- * implementation, publishable dependency direction (testkit ships to npm;
7
- * conformance stays private).
5
+ * extends `TransportFaults` with the faults only its loopback honors, so both
6
+ * arm the same base vocabulary (testkit ships to npm; conformance stays
7
+ * private). The kit's loopback honors every flag declared here.
8
8
  *
9
9
  * The harness owns the loopback between a ClientInstance and a
10
10
  * ServerInstance; scenarios arm faults on this controller and the next
@@ -50,8 +50,6 @@ export class TransportFaults {
50
50
  dropNextRequests = 0;
51
51
  /** Deliver the next N sync requests, then lose their responses. */
52
52
  dropNextResponses = 0;
53
- /** Return ACKs while withholding pull sections without advancing their cursors. */
54
- deferNextPulls = 0;
55
53
  /** Deliver the next sync request twice; return the second response. */
56
54
  duplicateNextRequest = false;
57
55
  /** Truncate the next sync response at a seeded offset. */
@@ -60,10 +58,6 @@ export class TransportFaults {
60
58
  dropNextSegmentRequests = 0;
61
59
  /** Truncate the next segment download at a seeded offset. */
62
60
  truncateNextSegmentDownload = false;
63
- /** Fail the next N signed-URL fetches (the CDN hop, §5.4). */
64
- dropNextUrlFetches = 0;
65
- /** Corrupt the next signed-URL fetch's bytes (§5.1 tamper). */
66
- corruptNextUrlFetch = false;
67
61
  /** Refuse the next realtime connect (a refused §8.8 handshake). */
68
62
  refuseNextRealtimeConnect = false;
69
63
  #random;
package/dist/index.js CHANGED
@@ -12,7 +12,6 @@
12
12
  */
13
13
  export { createVirtualClock, DEFAULT_EPOCH_MS, } from './clock.js';
14
14
  export { createTestSync, } from './create-test-sync.js';
15
- // The transport-fault controller, re-exported from the conformance harness
16
- // (never duplicated) — the SAME vocabulary the reference pairing arms.
15
+ // The transport-fault controller the conformance harness extends.
17
16
  export { seededRandom, seedFromName, TransportFault, TransportFaults, } from './faults.js';
18
17
  export { allowAllScopes, createTestServer, DEFAULT_ACTOR, DEFAULT_PARTITION, } from './server.js';
package/dist/react.js CHANGED
@@ -18,7 +18,7 @@
18
18
  * const sync = await createTestSync({ schema });
19
19
  * const client = await sync.client('a');
20
20
  * const { result } = renderHook(
21
- * () => useRawSql('SELECT * FROM notes'),
21
+ * () => useRawSql('SELECT * FROM notes', [], { tables: ['notes'] }),
22
22
  * { wrapper: syncWrapper(client) },
23
23
  * );
24
24
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/testkit",
3
- "version": "0.58.0",
3
+ "version": "0.60.0",
4
4
  "description": "Syncular test kit: in-process loopback server + clients for integration scenarios",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Benjamin Kniffler",
@@ -64,8 +64,8 @@
64
64
  "test": "bun test --preload ./test/setup.ts"
65
65
  },
66
66
  "dependencies": {
67
- "@syncular/server": "0.58.0",
68
- "@syncular/client": "0.58.0"
67
+ "@syncular/server": "0.60.0",
68
+ "@syncular/client": "0.60.0"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "react": ">=18.0.0"
@@ -77,7 +77,7 @@
77
77
  },
78
78
  "devDependencies": {
79
79
  "@happy-dom/global-registrator": "^20.0.0",
80
- "@syncular/react": "0.58.0",
80
+ "@syncular/react": "0.60.0",
81
81
  "@testing-library/react": "^16.1.0",
82
82
  "@types/react": "^18.3.0",
83
83
  "react": "^18.3.1",
package/src/client.ts CHANGED
@@ -7,9 +7,8 @@
7
7
  * gate so an app test can drop / duplicate / corrupt individual exchanges,
8
8
  * and an offline flag that makes every hop reject like a lost network.
9
9
  *
10
- * The fault controller is the conformance harness's `TransportFaults`,
11
- * re-exported (see `index.ts`) — the SAME vocabulary the reference pairing
12
- * arms, not a parallel one.
10
+ * The fault controller is the `TransportFaults` the conformance harness
11
+ * extends; this loopback honors every flag on it.
13
12
  */
14
13
 
15
14
  import {
@@ -20,22 +19,22 @@ import {
20
19
  SyncClient,
21
20
  type SyncClientConfig,
22
21
  type SyncTransport,
22
+ transportFailed,
23
23
  } from '@syncular/client';
24
24
  import { BunClientDatabase } from '@syncular/client/bun';
25
25
  import { handleSegmentDownload, handleSyncRequest } from '@syncular/server';
26
26
  import type { VirtualClock } from './clock';
27
- import { seededRandom, TransportFault, TransportFaults } from './faults';
27
+ import {
28
+ seededRandom,
29
+ seedFromName,
30
+ TransportFault,
31
+ TransportFaults,
32
+ } from './faults';
28
33
  import type { TestServer } from './server';
29
34
 
30
- /** A client-facing offline error: rejects a hop the way a dead network does. */
31
- class OfflineError extends Error {
32
- override readonly name = 'OfflineError';
33
- readonly code = 'sync.transport_failed';
34
- readonly retryable = true;
35
- constructor() {
36
- super('injected: client is offline');
37
- }
38
- }
35
+ /** Rejects a hop the way `httpSyncTransport` reports a dead network. */
36
+ const offline = () =>
37
+ transportFailed('injected: client is offline', { causeKind: 'network' });
39
38
 
40
39
  /**
41
40
  * A test client. Everything an app test needs to script a scenario:
@@ -53,7 +52,12 @@ export interface TestClient {
53
52
  readonly faults: TransportFaults;
54
53
  /** True while the client is offline (every hop rejects). */
55
54
  readonly offline: boolean;
56
- /** Cut the network: sync / segment / realtime hops reject until online. */
55
+ /**
56
+ * Cut the network: sync / segment / realtime hops reject until online with
57
+ * the `sync.transport_failed` error a dead network raises
58
+ * (`details.causeKind: 'network'`), so the client reports connectivity
59
+ * `offline` and waits for a resume instead of scheduling a retry.
60
+ */
57
61
  goOffline(): void;
58
62
  /** Restore the network. Does NOT auto-sync — call `sync()` yourself. */
59
63
  goOnline(): void;
@@ -103,12 +107,12 @@ export function buildTestClient(options: TestClientOptions): {
103
107
  } {
104
108
  const { server, schema, clock, id, actorId } = options;
105
109
  const db = new BunClientDatabase();
106
- const faults = new TransportFaults(seededRandom(hashSeed(id)));
110
+ const faults = new TransportFaults(seededRandom(seedFromName(id)));
107
111
  const state = { offline: false };
108
112
  const ctx = () => server.ctxFor(actorId);
109
113
 
110
114
  const transport: SyncTransport = async (request) => {
111
- if (state.offline) throw new OfflineError();
115
+ if (state.offline) throw offline();
112
116
  if (faults.dropNextRequests > 0) {
113
117
  faults.dropNextRequests -= 1;
114
118
  throw new TransportFault('injected: request lost');
@@ -132,7 +136,7 @@ export function buildTestClient(options: TestClientOptions): {
132
136
  };
133
137
 
134
138
  const segments: SegmentDownloader = async (request: SegmentFetchRequest) => {
135
- if (state.offline) throw new OfflineError();
139
+ if (state.offline) throw offline();
136
140
  if (faults.dropNextSegmentRequests > 0) {
137
141
  faults.dropNextSegmentRequests -= 1;
138
142
  throw new TransportFault('injected: segment request lost');
@@ -149,7 +153,11 @@ export function buildTestClient(options: TestClientOptions): {
149
153
  };
150
154
 
151
155
  const realtime: RealtimeConnector = async (handlers) => {
152
- if (state.offline) throw new OfflineError();
156
+ if (state.offline) throw offline();
157
+ if (faults.refuseNextRealtimeConnect) {
158
+ faults.refuseNextRealtimeConnect = false;
159
+ throw new TransportFault('injected: realtime connect refused');
160
+ }
153
161
  const session = await server.hub.connect({
154
162
  partition: server.partition,
155
163
  actorId,
@@ -205,14 +213,3 @@ export function buildTestClient(options: TestClientOptions): {
205
213
 
206
214
  return { client, start: () => api.start() };
207
215
  }
208
-
209
- /** Deterministic per-client fault seed from the client id (mirrors the
210
- * conformance harness's per-scenario seeding). */
211
- function hashSeed(name: string): number {
212
- let hash = 2166136261;
213
- for (let i = 0; i < name.length; i++) {
214
- hash ^= name.charCodeAt(i);
215
- hash = Math.imul(hash, 16777619);
216
- }
217
- return hash >>> 0;
218
- }
@@ -8,20 +8,24 @@
8
8
  * const sync = await createTestSync({ schema });
9
9
  * const a = await sync.client('a');
10
10
  * const b = await sync.client('b');
11
- * a.api.subscribe({ id: 's', table: 'notes', scopes: { list_id: ['x'] } });
12
- * b.api.subscribe({ id: 's', table: 'notes', scopes: { list_id: ['x'] } });
11
+ * a.api.subscribe({ list_id: 'x' });
12
+ * b.api.subscribe({ list_id: 'x' });
13
13
  * a.api.mutate([{ table: 'notes', op: 'upsert', values: … }]);
14
14
  * await sync.syncAll(); // both converge
15
15
  * await sync.dispose();
16
16
  */
17
17
 
18
- import type { ClientSchema, SyncClientConfig } from '@syncular/client';
18
+ import type { ClientSchema } from '@syncular/client';
19
19
  import type {
20
20
  CommitValidator,
21
21
  ResolveScopes,
22
22
  ValidatorRegistry,
23
23
  } from '@syncular/server';
24
- import { buildTestClient, type TestClient } from './client';
24
+ import {
25
+ buildTestClient,
26
+ type TestClient,
27
+ type TestClientOptions,
28
+ } from './client';
25
29
  import { createVirtualClock, type VirtualClock } from './clock';
26
30
  import {
27
31
  createTestServer,
@@ -60,18 +64,7 @@ export interface TestClientOverrides {
60
64
  /** Actor id for this client (defaults to the sync-wide actor). */
61
65
  readonly actorId?: string;
62
66
  /** Extra `SyncClient` config (e.g. `onConflict`, `limits`). */
63
- readonly clientConfig?: Partial<
64
- Omit<
65
- SyncClientConfig,
66
- | 'database'
67
- | 'schema'
68
- | 'clientId'
69
- | 'now'
70
- | 'transport'
71
- | 'segments'
72
- | 'realtime'
73
- >
74
- >;
67
+ readonly clientConfig?: TestClientOptions['clientConfig'];
75
68
  }
76
69
 
77
70
  export interface TestSync {
package/src/faults.ts CHANGED
@@ -2,9 +2,9 @@
2
2
  * Fault injection at the transport seam.
3
3
  *
4
4
  * Canonical home: the PUBLIC app test kit. The private conformance harness
5
- * re-exports from here so both arm the SAME fault vocabulary — one
6
- * implementation, publishable dependency direction (testkit ships to npm;
7
- * conformance stays private).
5
+ * extends `TransportFaults` with the faults only its loopback honors, so both
6
+ * arm the same base vocabulary (testkit ships to npm; conformance stays
7
+ * private). The kit's loopback honors every flag declared here.
8
8
  *
9
9
  * The harness owns the loopback between a ClientInstance and a
10
10
  * ServerInstance; scenarios arm faults on this controller and the next
@@ -54,8 +54,6 @@ export class TransportFaults {
54
54
  dropNextRequests = 0;
55
55
  /** Deliver the next N sync requests, then lose their responses. */
56
56
  dropNextResponses = 0;
57
- /** Return ACKs while withholding pull sections without advancing their cursors. */
58
- deferNextPulls = 0;
59
57
  /** Deliver the next sync request twice; return the second response. */
60
58
  duplicateNextRequest = false;
61
59
  /** Truncate the next sync response at a seeded offset. */
@@ -64,10 +62,6 @@ export class TransportFaults {
64
62
  dropNextSegmentRequests = 0;
65
63
  /** Truncate the next segment download at a seeded offset. */
66
64
  truncateNextSegmentDownload = false;
67
- /** Fail the next N signed-URL fetches (the CDN hop, §5.4). */
68
- dropNextUrlFetches = 0;
69
- /** Corrupt the next signed-URL fetch's bytes (§5.1 tamper). */
70
- corruptNextUrlFetch = false;
71
65
  /** Refuse the next realtime connect (a refused §8.8 handshake). */
72
66
  refuseNextRealtimeConnect = false;
73
67
 
package/src/index.ts CHANGED
@@ -23,8 +23,7 @@ export {
23
23
  type TestClientOverrides,
24
24
  type TestSync,
25
25
  } from './create-test-sync';
26
- // The transport-fault controller, re-exported from the conformance harness
27
- // (never duplicated) — the SAME vocabulary the reference pairing arms.
26
+ // The transport-fault controller the conformance harness extends.
28
27
  export {
29
28
  seededRandom,
30
29
  seedFromName,
package/src/react.ts CHANGED
@@ -18,7 +18,7 @@
18
18
  * const sync = await createTestSync({ schema });
19
19
  * const client = await sync.client('a');
20
20
  * const { result } = renderHook(
21
- * () => useRawSql('SELECT * FROM notes'),
21
+ * () => useRawSql('SELECT * FROM notes', [], { tables: ['notes'] }),
22
22
  * { wrapper: syncWrapper(client) },
23
23
  * );
24
24
  *