Skip to content

Commit 95a49ad

Browse files
fix(service-knowledge): defer a backlog reconcile asked for during a bulk import until its record syncs drain (#38767)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9DAwBxBGNv4CexdUyBYJXSw)_ Fixes #38591 Clause-②: no Metadata-protocol: none repo:objectstack#3 · os-steve · session_01ADHkmPDtfMCw4FJfyFfQ7v ## 维护者速读 - 用户能看到什么变化:往知识库来源批量导入记录时,向量化请求和向量写入从约两倍降到与整体重建持平;代价是导入后检索追上的时间回到只走批量同步时的水平(真实向量服务上约为重建的 1.36 倍,本容器未实测)。 - 为什么做:知识库检索大项里,上一轮真实服务实测发现导入时“积压对账”和批量同步把每条记录都向量化、写入了两遍,每次导入花两倍的钱。 - 出错会怎样:导入期间的对账推迟到同步排空后才跑;判断失误时最坏是对账晚启动(至多一小时)或多做一遍同步;只改一个内部函数,可直接撤回。 - 要你做什么:无。 ## What changes `considerBacklogReconcile` (`knowledge-service-record-sync.ts`) still decides, as before, that a source's backlog is large enough for a reconcile (estimate at least `RECORD_SYNC_BACKLOG_THRESHOLD` and at least `RECORD_SYNC_BACKLOG_ROW_SHARE` of its rows). What it does next now depends on one comparison: - **Estimate no larger than the source's rows** (a bulk import or bulk update: about one message per record). The walk is **deferred until the backlog has drained** (new `backlogDrained`): the queue's waiting count is read afresh every `RECORD_SYNC_BACKLOG_READ_INTERVAL_MS`, and the walk starts once that count times the source's share of the scheduling batch is under one message. The drain embeds and writes each imported record once; the walk then skips every document the drain wrote (unchanged hash) and writes only the rows no message reached. A queue that never drains (other sources keep it busy) starts the walk after `RECORD_SYNC_BACKLOG_RETRY_MAX_MS` (60 min), so it is never held off for good. Builds stopped, the service held, or the source gone or no longer walked while it waits: nothing is walked, and a later backlog may ask again. - **Estimate larger than the source's rows** (repeated saves of the same records, rows deleted or moved out of `where`). Walked beside the drain, exactly as before: one walk costs at most one embed per row and covers the messages. This is #38413's case, pinned by the `knowledge-build.test.ts` #38413 suite, which is unchanged and green. An import cannot reach the second branch: each message is published after its row commits, and the rows are counted after the waiting count is read, so an import's estimate never exceeds its rows. No change to `coveredByBuild`, the cover margin, the batch path, `IQueueService`, any option, setting, error code or export. `knowledge-record-sync-queue.ts` is untouched. ### Choice: (b), and why not (a) - **(a) the walk skips a record whose message is queued or claimed** needs the walk to know which records have such a message. `IQueueService` exposes a count (`getQueueSize`, pending only) and the dead letters (`listFailed`), and no read of pending or claimed messages by source or record. Adding one is a contract change in `packages/spec` (a `needs_decision`), and the walk lives in `knowledge-service-indexing.ts`, outside this card's file surface. An in-process tracker would not see messages published on another node. - **(b) defer the walk until the backlog drains** is buildable inside the record-sync facet, and measured below: the import drain lands at 501 requests and 50,000 writes, against the rebuild's 500 and 50,000. ### The margin's own case (#38556) stays closed `coveredByBuild` and `RECORD_SYNC_COVER_MARGIN_MS` are untouched, so a message published inside the margin of a build's start is still synced. `knowledge-record-sync-cover-margin.test.ts` is unchanged and green. ## Premise check (origin/main acf3b33) - `considerBacklogReconcile` is at `knowledge-service-record-sync.ts:645`, called from the batch path at `:516`; it schedules the reconcile with `void this.enqueueReconcile(...)` beside the batch. - `coveredByBuild` (`:480`) covers a message only when `publishedAt < startedAt - RECORD_SYNC_COVER_MARGIN_MS`, and only after the build ended `done` with a purge; a build running now covers nothing. - The walk (`walkObjectSource`) lists the adapter's documents once, before its first page, and skips only documents whose hash it listed. During an import those documents do not exist yet, so the walk embeds every row, and the drain syncs every message it takes meanwhile. - The measurement commit `30141766` IS #38577's merge (margin `30_000` there), so the margin change does not retire the card. Even at the old 5 s margin, a reconcile that starts 6 s into a 34 s import covers almost none of it. - Reproduced on the base before the fix: table below, 0 messages `covered`. ## Measurement (counts) A real kernel: `ObjectQLPlugin` over `SqlDriver` (better-sqlite3, a file), `QueueServicePlugin({ adapter: 'db' })` with default options, `KnowledgeServicePlugin` with one object source, `buildAtBoot: false`. The store is a counting double that lists its documents: one `upsert` call is one embedding request, each document one write, with 100 ms per request. As in #38529: a complete build over the empty table first, then `ql.insert` of 50,000 records in arrays of 500, timed from the first insert until no record-sync message is pending or running and any reconcile has ended. The rebuild runs over the drained data file with a fresh store. The harness is not in the diff; it is a snippet in the details below. | run (50,000 records) | embedding requests | texts | document writes | outcomes | reconcile | |---|---|---|---|---|---| | before: `acf3b33e`, reconcile beside the drain | 1,001 | 99,976 | 99,976 | 50,000 synced, 0 covered | walked beside: 50,000 read, 49,976 written | | after: this branch | 501 | 50,000 | 50,000 | 50,000 synced, 0 covered | after the drain: 50,000 read, 0 written, 50,000 unchanged | | rebuild of the same records | 500 | 50,000 | 50,000 | n/a | n/a | - After against the rebuild: requests +0.2 %, writes 0 %; the acceptance asks for within 10 %. Before against the rebuild: 2.00x and 2.00x (#38529 measured 985 against 503, and 99,551 against 50,012, with a real provider). - Wall time on this shared box, with the fake embedder: import 36.5 s / 34.4 s; drain 108.6 s before, 105.5 s after; the deferred reconcile ended 21 s after the drain (126.8 s); rebuild 52.0 s / 51.8 s. These are shared-box seconds, not idle-box figures. - **Real-embedder timing: NOT MEASURED** (no AI gateway key in this container). The counts carry the acceptance. <details><summary>Harness (scratchpad only, not committed)</summary> The harness boots the kernel above with a counting store (`upsert` increments a request count and adds the batch length to writes, then waits `REQ_MS`), wraps `processRecordSyncBatch` to tally outcomes, inserts the records, waits until `sys_job_queue` holds no `pending` or `running` row of `knowledge-record-sync` and any reconcile has ended, then boots a second kernel over the same file with a fresh store and runs `rebuildSource('kb', { trigger: 'operator' })`. Run with `M38591_N=50000 M38591_REQ_MS=100`: 180 s before, 196 s after, under `os-verify-lock`. </details> ## Tests New `src/__tests__/reconcile-during-import-38591.test.ts` (an engine double and a store double that records each written document with its call's `reason`, fake timers): - a reconcile started during a pending import (6,000 messages for 6,000 rows) embeds no record that has a pending message, checked after every batch; once drained it walks, and every imported document was written exactly once, by its own sync; - a record with no sync message is still reconciled once the import has drained: the walk writes exactly that one document; - a queue that does not drain holds the walk off for `RECORD_SYNC_BACKLOG_RETRY_MAX_MS`, then it walks; - builds stopped while the walk waits: nothing is walked. <details><summary>Readings at 785fede</summary> - `pnpm --filter @objectstack/service-knowledge test`: Test Files 26 passed (26), Tests 840 passed (840). This includes the unchanged `knowledge-build.test.ts` #38413 suite and `knowledge-record-sync-cover-margin.test.ts`. - `pnpm --filter @objectstack/service-knowledge typecheck`: exit 0; `tsc --listFiles` names the new test once in `tsconfig.json` and once in `tsconfig.test.json`; `check:test-typecheck` OK. - Dependency closure `pnpm --filter '@objectstack/service-knowledge^...' build`: exit 0. - `dispatch-gates --commands --repo objectstack-ai/objectstack` at 785fede derives 68 families. 67 exit 0. `check:dual-build-cjs-loads` exits 3, PREREQUISITE NOT MET (it needs a whole-repo build): NOT MEASURED locally, and CI runs it. `--ran` reconciliation: 68 derived, 67 run, 1 NOT-MEASURED, 0 UNRUN. `check-plugin-teardown-shape --self-test` first exited 3 because this shallow checkout could not reach its pinned fixture commit; after a `--depth=1` fetch of that commit it exited 0. `check:query-options-erasure` (392 s) and `check:type-check-debt` (234 s) ran past a 150 s and a 300 s per-command timeout on this shared box, and both exited 0 when re-run with a longer one. `check:nul-bytes` exit 0. `overlap-check.mjs` before the push: `origin/main: merges cleanly`, `VERDICT clean exit 0`. </details> ## Ablation `node scripts/ablation-replace.mjs` turned `const deferred = estimate <= rows;` into `const deferred = false;` on disk (anchor 1 → 0, blob `8cdba5dc3e67` → `8ae94f8819d7`; the test imports the source directly, so no `dist/` is involved). Result: the new file goes 4 failed / 4. The card's pin fails with `expected [ 'kb:imp00100', …(5899) ] to deeply equal []`: the walk wrote 5,900 records whose messages were still waiting. Restored: the blob equals HEAD and `git diff HEAD` is empty. ## Acceptance notes - **Wall time moves to the batch path's rate.** In #38529 the default drain (568.6 s) beat the batch path alone (805.7 s) only because two embedding streams ran at once, paying twice. With this change an import drains at the batch-only rate, 1.36x the rebuild on that provider, which is inside #38413's "small multiple". Not re-measured here. - **Drained is judged on the pending count.** `getQueueSize` counts pending messages, not claimed ones, so the walk can begin while the last batch (at most `RECORD_SYNC_BATCH_SIZE` records) is still syncing; at most one batch is written twice. The 30 s read interval makes this rare. - **A row count cached from an earlier backlog** (`RECORD_SYNC_SOURCE_ROWS_TTL_MS`, 10 min) can be lower than the table's rows after a later import, which could send that import down the walk-beside branch. It is reached only by a second large backlog of the same source within 10 minutes of a failed reconcile (the 5 min retry); noted, not changed. - The 60 min bound reuses `RECORD_SYNC_BACKLOG_RETRY_MAX_MS`; no new constant. - AGENTS.md asks a new pin for a component with a shared harness file to go into that file (`knowledge-build.test.ts`). The claim's file surface names a new file, so the harness is duplicated in small; folding it in is a follow-up for whoever holds that file. - Not in scope, per the card: the cover margin's value, the batch size, a remote libSQL store. ## Verification (two minutes) `pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2 src/__tests__/reconcile-during-import-38591.test.ts` — expect 4 passed. Read first, by risk: 1. `knowledge-service-record-sync.ts` `considerBacklogReconcile`: the `deferred` branch and the rewritten completion chain (a dropped deferral must not count as a failed reconcile). 2. `knowledge-service-record-sync.ts` `backlogDrained`: the drained test, the 60 min bound and the stop conditions. 3. The new test's first case, the card's pin. --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmPDtfMCw4FJfyFfQ7v)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmPDtfMCw4FJfyFfQ7v <!-- signed: repo:objectstack#3 · os-steve · session_01ADHkmPDtfMCw4FJfyFfQ7v --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent f576dee commit 95a49ad

3 files changed

Lines changed: 377 additions & 24 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/service-knowledge': patch
3+
---
4+
5+
fix(service-knowledge): a backlog reconcile asked for during a bulk import waits until the import's record syncs have drained
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
When the record-sync backlog of a source is no larger than the source's rows (a bulk import or bulk update: about one message per record), the reconcile the batch worker schedules for it now starts only once that backlog has drained, and then writes only the rows no record sync reached. Before, it walked beside the drain, and since a message is covered only when it was published 30 s before the walk began, every imported record was embedded and written twice: about twice the embedding requests and twice the vector writes of a rebuild. A backlog that outnumbers the source's rows (repeated saves, rows deleted or moved out of `where`) is still walked beside the drain, as before. A queue that does not drain within an hour starts the walk anyway. No option, setting or error code changes.
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* [#38591] A backlog reconcile that starts during a bulk import is deferred
5+
* until the import's record syncs have drained.
6+
*
7+
* A message is covered by a build only when it was published
8+
* `RECORD_SYNC_COVER_MARGIN_MS` before the build began, and the drain syncs
9+
* every message it takes while a walk runs. So a walk beside an import
10+
* (about one message per record) embedded and wrote each record a second
11+
* time. A backlog no larger than the source's rows now waits for the drain,
12+
* and the walk then writes only the rows no message reached.
13+
*
14+
* What is pinned:
15+
*
16+
* - a reconcile asked for during a pending import embeds no record that has
17+
* a pending message, and each imported record is written once, by its sync;
18+
* - a record with no sync message at all is still reconciled, once the
19+
* import has drained;
20+
* - a queue that never drains does not hold the walk off for good;
21+
* - builds stopped while the walk waits: nothing is walked.
22+
*
23+
* A backlog that outnumbers the rows is still walked beside the drain: that
24+
* is pinned by the #38413 suite in `knowledge-build.test.ts`, unchanged.
25+
*/
26+
27+
import { afterEach, describe, it, expect, vi } from 'vitest';
28+
import type { AdapterContext, IDataEngine, IKnowledgeAdapter } from '@objectstack/spec/contracts';
29+
import type { KnowledgeDocument, KnowledgeSource } from '@objectstack/spec/ai';
30+
import { KnowledgeService } from '../knowledge-service.js';
31+
import {
32+
RECORD_SYNC_BACKLOG_READ_INTERVAL_MS,
33+
RECORD_SYNC_BACKLOG_RETRY_MAX_MS,
34+
RECORD_SYNC_BATCH_SIZE,
35+
} from '../knowledge-record-sync-queue.js';
36+
37+
type Row = Record<string, unknown>;
38+
39+
/** Rows of one object; `find` applies scalar equality, `$and`, `id: { $gt }` and `id: { $in }`, ordered by id. */
40+
function makeEngine() {
41+
const rows = new Map<string, Row>();
42+
const matches = (row: Row, where: Record<string, unknown> | undefined): boolean => {
43+
if (!where) return true;
44+
for (const [key, value] of Object.entries(where)) {
45+
if (key === '$and') {
46+
if (!(value as Array<Record<string, unknown>>).every((c) => matches(row, c))) return false;
47+
continue;
48+
}
49+
if (value !== null && typeof value === 'object') {
50+
const among = (value as { $in?: unknown[] }).$in;
51+
if (among !== undefined) {
52+
if (!among.includes(row[key])) return false;
53+
continue;
54+
}
55+
const gt = (value as { $gt?: unknown }).$gt;
56+
if (gt === undefined) throw new Error(`engine double: condition on '${key}' is not implemented`);
57+
if (!(String(row[key]) > String(gt))) return false;
58+
continue;
59+
}
60+
if (row[key] !== value) return false;
61+
}
62+
return true;
63+
};
64+
const select = (where?: Record<string, unknown>) =>
65+
[...rows.values()].filter((r) => matches(r, where)).sort((a, b) => String(a.id).localeCompare(String(b.id)));
66+
const engine = {
67+
find: async (_object: string, query?: { where?: Record<string, unknown>; limit?: number }) => {
68+
const all = select(query?.where);
69+
return (typeof query?.limit === 'number' ? all.slice(0, query.limit) : all).map((r) => ({ ...r }));
70+
},
71+
count: async (_object: string, query?: { where?: Record<string, unknown> }) => select(query?.where).length,
72+
} as unknown as IDataEngine;
73+
return { rows, engine };
74+
}
75+
76+
/**
77+
* A store that lists its documents (so a reconcile skips an unchanged one and
78+
* purges), and records every document it is asked to write with the reason
79+
* of the call: `reindex` for a walk, `event-sync` for a record sync.
80+
*/
81+
function makeAdapter() {
82+
const docs = new Map<string, KnowledgeDocument>();
83+
const held: { fingerprint?: string; recipeHash?: string } = {};
84+
const writes: Array<{ reason: string; id: string }> = [];
85+
const adapter: IKnowledgeAdapter = {
86+
id: 'memory',
87+
embedding: { model: 'model-a', dimensions: 3 },
88+
async upsert(batch: KnowledgeDocument[], ctx?: AdapterContext) {
89+
for (const doc of batch) {
90+
writes.push({ reason: String(ctx?.reason), id: doc.id });
91+
docs.set(doc.id, doc);
92+
}
93+
},
94+
async delete(ids: string[]) {
95+
for (const id of ids) docs.delete(id);
96+
},
97+
async search() {
98+
return [];
99+
},
100+
async listDocuments(_ctx: AdapterContext, page: { cursor?: string; limit: number }) {
101+
const all = [...docs.values()].map((d) => ({ documentId: d.id, ...(d.docHash ? { docHash: d.docHash } : {}) }));
102+
const start = page.cursor === undefined ? 0 : Number(page.cursor);
103+
const slice = all.slice(start, start + page.limit);
104+
return { documents: slice, ...(start + page.limit < all.length ? { nextCursor: String(start + page.limit) } : {}) };
105+
},
106+
async indexStatus() {
107+
return { ...held };
108+
},
109+
async beginBuild(ctx: AdapterContext) {
110+
if (held.fingerprint !== ctx.index!.fingerprint) {
111+
docs.clear();
112+
held.fingerprint = ctx.index!.fingerprint;
113+
delete held.recipeHash;
114+
}
115+
},
116+
async completeBuild(ctx: AdapterContext) {
117+
held.fingerprint = ctx.index!.fingerprint;
118+
held.recipeHash = ctx.index!.recipeHash;
119+
},
120+
};
121+
return { adapter, docs, writes };
122+
}
123+
124+
const SOURCE: KnowledgeSource = {
125+
name: 'kb',
126+
label: 'Knowledge base',
127+
adapter: 'memory',
128+
source: { kind: 'object', object: 'kb_article', content: ['title', 'body'] },
129+
};
130+
131+
/** Over the threshold (5,000) and no larger than the source's rows: an import's backlog. */
132+
const IMPORTED = 6_000;
133+
134+
const message = (recordId: string) => ({ source: 'kb', object: 'kb_article', recordId, reason: 'event' });
135+
136+
/**
137+
* An index made current over an empty table, then an import of
138+
* {@link IMPORTED} rows, each with one message waiting on the queue, plus
139+
* the `orphans`: rows written with no message (a publish that failed).
140+
*/
141+
async function importPending(orphans: string[] = []) {
142+
const db = makeEngine();
143+
const store = makeAdapter();
144+
const service = new KnowledgeService({
145+
dataEngine: db.engine,
146+
logger: { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() },
147+
});
148+
service.registerAdapter('memory', store.adapter);
149+
service.registerSource(SOURCE);
150+
expect(await service.rebuildSource('kb', { trigger: 'operator' })).toMatchObject({ status: 'done' });
151+
152+
const imported = Array.from({ length: IMPORTED }, (_, i) => `imp${String(i).padStart(5, '0')}`);
153+
for (const id of [...imported, ...orphans]) db.rows.set(id, { id, title: `Clause ${id}`, body: `Body of ${id}` });
154+
const queue = { pending: imported.length };
155+
service.useRecordSyncQueue({
156+
getQueueSize: async () => queue.pending,
157+
listFailed: async () => [],
158+
purgeFailed: async () => undefined,
159+
});
160+
/** Ids whose message has not been taken yet. */
161+
const waiting = new Set(imported);
162+
163+
/** The worker takes the next batch (it leaves the waiting count) and answers it; a second passes. */
164+
const drainOne = async (): Promise<void> => {
165+
const batch = [...waiting].slice(0, RECORD_SYNC_BATCH_SIZE);
166+
for (const id of batch) waiting.delete(id);
167+
queue.pending = waiting.size;
168+
const results = await service.processRecordSyncBatch(
169+
batch.map((id) => ({ data: message(id), publishedAt: Date.now() })),
170+
);
171+
expect(results.every((r) => r.ok && r.outcome === 'synced')).toBe(true);
172+
await vi.advanceTimersByTimeAsync(1_000);
173+
};
174+
const walked = () => store.writes.filter((w) => w.reason === 'reindex').map((w) => w.id);
175+
const reconciled = async () => {
176+
await vi.waitFor(() => {
177+
const record = service.buildRecord('kb');
178+
if (record?.trigger !== 'reconcile' || record.status === 'running') throw new Error('the reconcile has not ended');
179+
}, { timeout: 5_000, interval: 5 });
180+
expect(service.buildRecord('kb')).toMatchObject({ trigger: 'reconcile', status: 'done' });
181+
};
182+
return { service, store, queue, imported, waiting, drainOne, walked, reconciled };
183+
}
184+
185+
afterEach(() => {
186+
vi.useRealTimers();
187+
});
188+
189+
describe('backlog reconcile during a bulk import (#38591)', () => {
190+
it('a reconcile started during a pending import embeds no record that has a pending message', async () => {
191+
vi.useFakeTimers();
192+
const t = await importPending();
193+
194+
while (t.waiting.size > 0) {
195+
await t.drainOne();
196+
// No walk has written a record whose message is still waiting.
197+
expect(t.walked().filter((id) => t.waiting.has(id.slice('kb:'.length)))).toEqual([]);
198+
}
199+
200+
// Drained: the reconcile asked for during the import walks now.
201+
await vi.advanceTimersByTimeAsync(RECORD_SYNC_BACKLOG_READ_INTERVAL_MS);
202+
await t.reconciled();
203+
// Every imported record was embedded and written once, by its own sync.
204+
expect(t.walked()).toEqual([]);
205+
const perDocument = new Map<string, number>();
206+
for (const w of t.store.writes) perDocument.set(w.id, (perDocument.get(w.id) ?? 0) + 1);
207+
expect(perDocument.size).toBe(IMPORTED);
208+
expect([...perDocument.values()].every((n) => n === 1)).toBe(true);
209+
});
210+
211+
it('a record with no sync message is still reconciled, once the import has drained', async () => {
212+
vi.useFakeTimers();
213+
const t = await importPending(['orphan']);
214+
215+
while (t.waiting.size > 0) {
216+
// Not walked while the import's messages wait.
217+
expect(t.store.docs.has('kb:orphan')).toBe(false);
218+
await t.drainOne();
219+
}
220+
221+
await vi.advanceTimersByTimeAsync(RECORD_SYNC_BACKLOG_READ_INTERVAL_MS);
222+
await t.reconciled();
223+
expect(t.walked()).toEqual(['kb:orphan']);
224+
expect(t.store.docs.size).toBe(IMPORTED + 1);
225+
});
226+
227+
it('a queue that does not drain holds the walk off for a bounded time, not for good', async () => {
228+
vi.useFakeTimers();
229+
const t = await importPending(['orphan']);
230+
await t.drainOne();
231+
// Other syncs keep the queue busy: the waiting count never falls.
232+
t.queue.pending = 50_000;
233+
234+
await vi.advanceTimersByTimeAsync(RECORD_SYNC_BACKLOG_RETRY_MAX_MS - 2 * RECORD_SYNC_BACKLOG_READ_INTERVAL_MS);
235+
expect(t.walked()).toEqual([]);
236+
await vi.advanceTimersByTimeAsync(2 * RECORD_SYNC_BACKLOG_READ_INTERVAL_MS);
237+
await t.reconciled();
238+
expect(t.walked()).toContain('kb:orphan');
239+
});
240+
241+
it('builds stopped while the walk waits for the drain: nothing is walked', async () => {
242+
vi.useFakeTimers();
243+
const t = await importPending(['orphan']);
244+
await t.drainOne();
245+
t.service.stopBuilds();
246+
while (t.waiting.size > 0) await t.drainOne();
247+
248+
await vi.advanceTimersByTimeAsync(2 * RECORD_SYNC_BACKLOG_READ_INTERVAL_MS);
249+
expect(t.walked()).toEqual([]);
250+
expect(t.service.buildRecord('kb')?.trigger).toBe('operator');
251+
});
252+
});

0 commit comments

Comments
 (0)