Repository navigation
fix(service-knowledge): reindexSource pages an object source by id, one walk per source at a time - #37129
Conversation
…ks per source Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
…ource's doc Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 0240378548e98d5fe7b276005a1c411963f38033 && git checkout 0240378548e98d5fe7b276005a1c411963f38033
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 517e4153c6e8e68cd194c3a2321476da9bb9b332 9e24b96c22ad3f8ea1707543939338489f7af2a5 && git checkout -B drift-repro 517e4153c6e8e68cd194c3a2321476da9bb9b332 && git merge --no-ff 9e24b96c22ad3f8ea1707543939338489f7af2a5
node scripts/docs-audit/affected-docs.mjs --json 517e4153c6e8e68cd194c3a2321476da9bb9b332
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL Final head for L1 (2026-11-24T22:00Z):
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
…imit normalised; docs no longer claim a reindex removes documents Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
…age; changeset states what is serialized Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL Final head for delta L1 (2026-11-24T22:47Z):
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL Landing — PR #37129 at head
State: ready + auto-merge; #36992 closes on merge via |
…index skips unchanged documents and purges stale ones; adapter contract suite (objectstack-ai#37164) Fixes objectstack-ai#37096 Clause-②: yes Metadata-protocol: added Skills-docs: none — no skill under `skills/**` teaches `KnowledgeDocument`, the adapter contract or reindex; `skills/objectstack-ai/SKILL.md` teaches `KnowledgeSource` authoring only. `content/docs/protocol/knowledge.mdx` gains the members, the skip and the purge in this change. ## 维护者速读 - 用户能看到什么变化:知识检索全量重建时,只有实现了“列出已存文档”能力的存储才会跳过没变的内容、清掉源数据里已删除或不再符合筛选条件的内容;本仓库里目前只有开发测试用的内存存储实现了它,RAGFlow 存储的重建和以前完全一样。 - 为什么做:知识检索平台化专题的第二阶段(让向量存储能列出自己存了什么,并有一套所有存储都要跑的契约测试)。 - 出错会怎样:最坏是重建时误删一条仍有效的内容,或漏删一条失效内容;每条删除前都会按源条件重读一次确认,读不出结果就停下不删,清理中途失败时重建结果会报失败;下次重建或记录变更即可恢复,可直接撤回。 - 要你做什么:无。 ## What changes ADR-0161 K8 items 1 and 2, each landing with its reader (ADR-0049): - **Contract (`@objectstack/spec`).** `IKnowledgeAdapter.listDocuments?(ctx, { cursor?, limit })` → `{ documents: { documentId, docHash? }[], nextCursor? }` (new exported interfaces `AdapterListDocumentsOptions`, `AdapterListedDocument`, `AdapterListDocumentsPage`), and `KnowledgeDocument.docHash?`. Both optional; shapes exactly as K8's table. - **`docHash` (service).** `computeDocHash` = `v1:` + SHA-256 over `{ content, title, metadata }` serialized with every plain object's keys sorted. Stamped by `recordToDocument` (walk and event sync) and by `indexDocument`, which refuses a caller-supplied `docHash` (it throws, naming `docHash` and that the service computes it) instead of replacing it. - **Skip (its reader).** `reindexSource` lists the adapter's documents before the walk (paged, `LIST_DOCUMENTS_PAGE_SIZE` = 500, a repeated cursor refused); a document whose computed hash equals the listed one is not upserted (`skipped`). A listed entry with no hash reads as changed. - **Purge.** One function, `purgeDocuments`, exported from the service module for row 15's reconcile in this package (not re-exported from the package entry). It runs only after a complete walk (no `limit`, no `dryRun`, no failed page), never for `refresh.onRecordChange: false`, never without `listDocuments`. Candidates = listed before the walk − seen in it. Each candidate is confirmed by the event sync's own re-read — extracted unchanged into one helper, `rereadRow` (`where` AND id, `limit: 1`, system context), now called by both — and runs on the per-document record-sync chain, so an event sync of the same row cannot interleave between the re-read and the delete. A listed id the source does not derive (`SOURCE:RECORD`) is kept and counted in `message`. A walk page or a re-read that answers no list of rows is a failure, never "empty" or "no row": the walk stops (`purged: null`) or the purge stops (`ok: false`). The event sync shares `rereadRow`, so on a non-list answer it now warns and keeps the document where it used to delete it (pinned). The re-read asks by the id text only; see the numeric-id limit in Acceptance notes. - **Result.** `skipped` and `purged` on every return of `reindexSource`; `purged: null` = no purge ran. A failed listing: everything written, nothing purged, `message` says why, still `ok: true`. A failed purge step: `ok: false`, `purged` = deletions before it. - **`knowledge-memory`** implements `listDocuments` (id order, cursor = last id of the page before; `docHash` stored as given) — the reference implementation. - **Contract suite.** `@objectstack/service-knowledge/testing` → `runKnowledgeAdapterContract({ name, makeAdapter, implements: { listDocuments } })`: upsert / search / delete; `listDocuments` at 0, one page, one page + 1, `docHash` as stored, source scoping; skip, purge, and no purge under `limit`/`dryRun` through a real `KnowledgeService` over an engine double. `implements` is asserted against the adapter, and an adapter without `listDocuments` runs the `purged: null` case instead. Entry follows the `service-cluster` / `metadata-core` precedent: own `tsup.config.ts`, ESM-only `./testing` export (no `require`), `vitest` external, not reachable from `.`. `knowledge-memory` runs it. - **Docs.** `content/docs/protocol/knowledge.mdx` (§3.2, §3.3, §3.4 with the suite, a new "Reindex: skip and purge" section, the stale-index callout and the predicate-write paragraph); the plugin's predicate-write warning text says the same. Regenerated: `api-surface/contracts.json`, `export-origins/contracts.json`, `authorable-surface/ai.json`, `content/docs/references/ai/knowledge-document.mdx`. - **`KnowledgeReindexResult` (`@objectstack/spec`)** gains optional `skipped?: number` and `purged?: number | null` (fields only added; `null` = no purge ran). - **`knowledge-ragflow` test config** gains the one anchored `@objectstack/service-knowledge/testing` alias ahead of its bare entry, as `check:test-source-alias` prescribes; nothing else in that package. ### Deviations - File surface extended by the dispatching zone (card What 4; check:test-source-alias): `packages/spec/src/contracts/knowledge-service.ts` and `packages/plugins/knowledge-ragflow/vitest.config.ts`, granted by the dispatching zone after the first report; both edits are exactly the two described above. - The full-workspace `pnpm test` before opening was scoped to the three touched packages' builds, typechecks and suites plus the 131 derived gate families (below). ## Tests <details><summary>build, typecheck and vitest (head 48ed4f1)</summary> ``` build (closure of knowledge-memory + knowledge-ragflow) exit 0 typecheck service-knowledge, knowledge-memory, knowledge-ragflow (tsc --noEmit + check:test-typecheck) exit 0 @objectstack/service-knowledge Test Files 8 passed (8) Tests 170 passed (170) @objectstack/knowledge-memory Test Files 2 passed (2) Tests 20 passed (20) @objectstack/knowledge-ragflow Test Files 1 passed (1) Tests 10 passed (10) dist: testing.js / testing.d.ts emitted ESM-only; no file reachable from index.js imports vitest ``` </details> <details><summary>Ablations (committed first; ablation-replace, restored to the HEAD blob each time)</summary> - Purge confirm removed (`rereadRow` line deleted): 3 red — "purges … each confirmed by a re-read", "a document written by the event sync during the walk survives the purge", "a purge whose re-read fails stops…". Restored: blob == HEAD, `git diff HEAD` empty. - Skip removed (every document treated as changed): 5 red in `knowledge-service.test.ts`; 1 red in the contract suite on `knowledge-memory` ("a second complete reindex skips every unchanged document…"). Restored both times. </details> New cases: `computeDocHash` (prefix, key-order stability at depth, sensitivity to content / title / metadata / array order), skip (all unchanged; only the changed row; entry without hash), listing paged to its end, purge of a deleted row and of a row that left `where` with the exact re-read `where`s, no purge under `limit` / `limit: 0` / `dryRun` / failed page, event-sync-created and restored documents survive, `onRecordChange: false`, failed listing, repeated cursor, failed re-read, foreign ids. Thirteen existing exact-result assertions gained `skipped: 0, purged: null` (stub adapters without `listDocuments`; otherwise unchanged). ## Acceptance notes - **Known limit — numeric record ids** (contract review 7152394541 S1; follow-up card objectstack-ai#37221). The purge re-reads by the record id text recovered from the document id. On driver-mongodb and driver-memory a row stored under a caller-supplied numeric id is not found by that re-read, so if it was restored, or came back into `where`, after the walk read past it, its document is deleted; the row is untouched and its document returns at its next event or the next complete reindex. A second re-read by the number was tried and removed: on driver-sql it binds a number against the text `id` column, which MySQL compares numerically (`'05'` matches `5`) and SQL Server and Oracle reject, and no object schema types its `id`, so the service cannot tell which objects have numeric ids. Stated in `purgeDocuments`' TSDoc, the protocol doc and the changeset, and pinned by "the purge re-reads by the id text only". - `docHash` and the metadata protocol: `KnowledgeDocument` is referenced by no metadata-type schema, only by the adapter and service contracts, so no metadata author writes it; it shows on the `authorable-surface` shard because that shard records the keys of every exported `ai/` schema (`KnowledgeHit`, equally runtime-only, is there too), and `Check Changeset` reads any shard move as a protocol change, hence `Metadata-protocol: added` and spec at `minor`. The key has its producer (the service) and its readers (the adapter stores and lists it; the reindex compares it), so it is not declared-but-unenforced. - `knowledge-memory` stores no chunk for a document with empty content, so such a document is never listed: it is re-written on every reindex and never purged (the safe direction). ## Verification Read first (risk order): `packages/services/service-knowledge/src/knowledge-service.ts` (`walkObjectSource` end, `purgeDocuments`, `rereadRow`); `packages/services/service-knowledge/src/testing.ts`; `packages/services/service-knowledge/package.json` + `tsup.config.ts`. Two minutes: `pnpm --filter @objectstack/knowledge-memory exec vitest run src/__tests__/contract.test.ts` — expect 12 passed, the suite named "IKnowledgeAdapter contract — knowledge-memory". <details><summary>Local gates (head cf8b70a)</summary> `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran` at cf8b70a: 131 derived, 126 run, 5 NOT-MEASURED, 0 UNRUN (exit codes recorded before any pipe; the derived list is unchanged from c6e78ea). NOT MEASURED: - `check-plugin-teardown-shape --self-test` :: exit 3 — its pinned fixture commit is not in this shallow clone. - `spec check:skill-examples`, `check:dual-build-cjs-loads`, `check:published-readme-exports` :: exit 3 — they read built output of packages this worktree did not build. - `check:dts-closure` :: exit 1 — each run names the next package this worktree never built (`service-cluster-redis`, then `service-i18n`); the three touched packages' declarations are present and not listed. Everything else exit 0, including `check:test-source-alias`, `spec check:generated` (all 14 up to date), `check:tenant-audit-census`, `check:type-check-debt`, `check:query-options-erasure`, `check:slot-lookup` and `check-comment-mask-corpus` (the last four rerun with a longer local time cap after the first sweep's cap fired), `check:engine-double-contract`, `check:nul-bytes`, `check:doc-authoring`. Local-only: `check:skill-frame-freshness` exit 0. Patch round at eddd9a6 (changeset only: `@objectstack/spec` to `minor`, `Metadata-protocol: added`, `Skills-docs:` line): `check-changeset-no-major --base MERGE_BASE` against this body as the PR event exit 0 (level axis ✓); `check-empty-changeset` (self-test and base) exit 0; `check-adr-0087-registration` (self-test and base) exit 0; `check:changeset-gate-self-tests` exit 0; spec `check:generated` after a spec build exit 0, all 14 up to date. Round at 58478ca (`indexDocument` refuses a caller-supplied `docHash`; TSDoc and changeset wording to match): typecheck service-knowledge and knowledge-memory exit 0; service-knowledge 8/8 files 165/165 tests, knowledge-memory 2/2 files 20/20; ablation (refusal disabled through ablation-replace): 1 failed, exactly "indexDocument refuses a caller-supplied docHash, naming it, and writes nothing", 75 passed, restored to the HEAD blob (a first attempt was void: the suite could not load before the closure was built in the fresh worktree); spec `check:generated` exit 0; `check-changeset-no-major` against this body exit 0; `check-empty-changeset`, `check-adr-0087-registration`, `check:nul-bytes` exit 0; overlap-check clean. Round at ffc6bff (L1 REWORK 7151268664 S1–S4 and N1–N4; contract review 7151166003 S1–S2, N1–N3): - Code: a walk page that answers no list goes through `stopped(...)`; `rereadRow` throws on a non-list answer; the purge asks for a canonical-integer id again by the number. - Tests: four new — "a walk page that answers no list stops the walk", "a purge re-read that answers no list stops the purge", "the purge's re-read and delete run on the document's sync chain" (holds the purge between its re-read and its delete while a restore's event sync arrives), "a numeric record id restored during the walk is found by its number and kept; a gone one is purged". - Ablations via ablation-replace, each restored to the HEAD blob with `git diff HEAD` empty: page guard made `break` → 1 failed | 79 passed (the page test); re-read guard made `return undefined` → 1 failed (the re-read test); `serialize` made a direct call → 1 failed (the chain test); numeric re-ask deleted → 1 failed (the numeric test). - Build of spec, service-knowledge, knowledge-memory, knowledge-ragflow exit 0; typecheck of the three packages exit 0; vitest service-knowledge 8/8 files 169/169, knowledge-memory 2/2 files 20/20, knowledge-ragflow 1/1 files 10/10; spec `check:generated` exit 0 (all 14 up to date). - `dispatch-gates --ran` at ffc6bff: 131 derived, 127 run, 4 NOT-MEASURED (exit 3: `check-plugin-teardown-shape --self-test`, pinned fixture not in this shallow clone; `spec check:skill-examples`, `check:dual-build-cjs-loads`, `check:published-readme-exports`, built output of packages this worktree did not build), 0 UNRUN; `check:dts-closure` exit 0; four commands that hit the local 100 s cap reran green with a longer one. Changeset gates against this body: `check-changeset-no-major` exit 0, `check-empty-changeset` exit 0, `check-adr-0087-registration` exit 0. - Docs: `content/docs/protocol/knowledge.mdx` now says `indexDocument` refuses a carried `docHash`, and that a non-list answer stops the walk or the purge. Changeset reworded in plain terms; `purged` TSDoc lists every `null` case and what an absent key means. Round at 48ed4f1 (L1 ACCEPT 7152441226 N1–N2; contract review 7152394541 S1 and N1–N2): - S1: the numeric re-ask is removed (option b — no object schema types its `id`, so the service cannot restrict it to numeric-id objects without new spec surface); the limit is stated in `purgeDocuments`' TSDoc, `knowledge.mdx` and the changeset, and pinned by "the purge re-reads by the id text only: a numeric id restored mid-walk is not found (the stated limit)". - L1 N1 / L2 N1: the event sync's new keep on a non-list re-read is stated here, in `knowledge.mdx` and in the changeset, and pinned by "a re-read that answers no list leaves the document and warns once; it does not delete". - L2 N2: the three waits on `setTimeout(5)` in this PR's tests are gone. Two wait on the held `find` being entered (`holdNextFind().reached`). The chain case waits one `setImmediate` turn, which lets every pending promise run with no clock involved. The remaining `setTimeout(5)` is in the pre-existing "a second reindex of the same source waits" case (objectstack-ai#37129), which this PR does not touch. - Tests: service-knowledge 8/8 files 170/170, knowledge-memory 2/2 files 20/20, knowledge-ragflow 1/1 files 10/10; typecheck of the three exit 0; build exit 0; spec `check:generated` exit 0. - Ablations via ablation-replace, each restored to the HEAD blob with `git diff HEAD` empty. Re-read guard made `return undefined`: 2 failed | 79 (the purge re-read case and the event-sync case). `serialize` made a direct call: 1 failed | 80 (the chain case, with the clock-free wait). Numeric re-ask re-added: 1 failed | 80 (the limit pin). A first numeric attempt was void because the replacement kept the anchor text; the tool refused it and restored the file. - `dispatch-gates --ran` at 48ed4f1: 131 derived, 127 run, 4 NOT-MEASURED, 0 UNRUN. The same four exit-3 prerequisites as before. Three commands that hit the 100 s local cap reran exit 0. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E)_ <!-- signed: repo:objectstack#4 · os-justin · session_01QSeKYmGV9ehU2Bfmw95h7E --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #36992
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
KnowledgeService.reindexSource(packages/services/service-knowledge/src/knowledge-service.ts) for anobjectsource, per card items 1-5:REINDEX_PAGE_SIZE= 100 rows perfind(object, { where, orderBy: [{ field: 'id', order: 'asc' }], limit }, { context: system }). Page 1 sends the source'swherealone. Every later page sends{ $and: [where, { id: { $gt: cursor } }] }(or just the cursor condition when the source has nowhere), where the cursor is the previous page's last id, kept in its own type. Each page is upserted in its ownadapter.upsert(docs, { source, reason: 'reindex' })before the next read. Everyfindcarries alimit, and noupsertholds more than one page. Each row goes through the samerecordToDocument(source, objSource, row, this.schemaFor(object))gate the event sync uses; no second builder was added. The system context now travels in the trailing options argument (theIDataEnginecontract's position) and no longer inside the query behind anas nevercast.limitis followed by the next read:finddoes not promisemin(limit, remaining)rows, because anafterFindhook may drop rows from a page (packages/objectql/src/engine-find.ts). So a 101-row object takes three reads, the last one empty.ok: falseand names the page (item 1). A read, a document build or an upsert that throws returns{ ok: false, object, discovered, indexed, message }. The message readsreindex of source 'S' stopped at page N (after id 'X'): ...with the cause (anError's message, any other thrown value viaString(...)), and the counts cover the pages done before it. Those pages stay in the index. Two further stops prevent an endless walk: a page whose last row has no id, and a last id that did not move past the cursor (an engine that ignored the id condition). Each returnsok: falseand names its page. Before this change, a failure threw out ofreindexSource.chainAfter(tails, key, task), which returns the task's own outcome while the chain itself never rejects.serializeRecordSyncdelegates to it unchanged in meaning, andreindexSourcechains on a separatereindexTailsmap keyed by source id. So a second reindex of the same source waits for the first and their pages never interleave; different sources still run concurrently. Record events do NOT wait for a walk. A row updated or deleted between a page's read and that page's upsert is written back from the older read, and a deleted row's document then stays as a ghost until the index purge (service-knowledge: adapters list their documents; a complete reindex skips unchanged documents and purges the ones its source no longer has; one contract test suite #37096). That race predates this PR, and paging narrows its window from the whole object to one page. The jsdoc and the changeset say exactly this.limit/dryRun(item 2).opts.limitkeeps its total-cap meaning: each read asks formin(100, limit - discovered), and the walk stops at the cap without an extra read. A fractionallimitis floored. A negative or non-finite one (-1,NaN,Infinity) is refused withok: falseand nothing is read; before this change such a value went straight tofind.dryRuncallscount(object, { where }, { context }), reads no rows, and reportsmin(count, limit).embedder-openaisibling landed, then follow it. That sibling (embedder-openai: embed() sends every input in one request; providers with a per-request cap reject a reindex #36995) landed as fix(embedder-openai): batch embed() input at the provider's per-request cap #37037, andOpenAIEmbeddernow splits a larger input set into requests of its own cap. So the page size is no longer an embedder-correctness bound; it bounds memory and the size of one adapter call. I kept 100 as a module constant and did not add an option:KnowledgeReindexOptionsis a spec contract, andKnowledgeServiceOptionsis not forwarded from any config a host writes.REINDEX_PAGE_SIZEis exported from the module for the tests only and is not re-exported fromindex.ts, so the publisheddist/index.d.tsexport list is unchanged.{ indexed, discovered, object?, ok, message? }is unchanged. No fields were added, so no published type widens.knowledge_sourcebecomes a governed type #37001 / docs(adr): ADR-0161 — the knowledge platform boundary; knowledge_source becomes a governed metadata type #37119) is not merged.content/docs/protocol/knowledge.mdx: the predicate-write callout ("Repair such an index with an explicitreindexSource") and the rolled-back-write passage (a document built from an insert that rolled back has no row left to repair it from).handleRecordUpsert's jsdoc.knowledge-service-plugin.ts. As a runtime string it names the purge in words, with no tracker number. Its existing pins inevent-sync-data-events.test.tsstill hold.Tests
src/__tests__/knowledge-service.test.tsadds a new top-leveldescribe('KnowledgeService — the reindex walk pages by id')(25 cases) in the existing harness file. Its engine double throws on anyfindwithout a positivelimit, withoutorderByid asc, or without the system context, and on any operator it does not implement. It orders numbers numerically and everything else by string. Rows are inserted in shuffled order, so the walk sees only the engine's ordering.{ id: { $gt: 'r099' } }that comes back empty.{ id: { $gt: 'r100' } }. Every read is limited to 100, every upsert holds at most 100, and the reason isreindex.afterFindhook can make), and every later row is still upserted (pages 99/100/50, 249 rows, 4 reads).{ id: { $gt: 100 } }, then{ id: { $gt: 150 } }), and the pages follow numeric order.whereis ANDed with the cursor (the exact page-2whereis asserted).limit:[100,50]/[100]/[30]/ nothing.limitabove the row count reads to the end.ok: false(plain anddryRun), with nofind, nocountand no upsert.dryRunusescountunder thewhere, capped bylimit, with zerofindcalls.ok: falsewith the counts of the pages done before it:page 2andafter id 'r099', the counts are 100/100, and the next walk after a failure runs (the lock is released).Erroris reported by its text, never asundefined.r000+100, r100+50, r000+100, r100+50. Walks of different sources do not wait for each other.The two older reindex tests were updated for the new call shape. The context is read from the trailing argument.
dryRunasserts thatcountis called andfindis not. Their doubles now answer an empty next page, as a cursor-honouring engine does: they used to return the same rows for every read, which this walk now correctly reports as a cursor that did not advance.Acceptance notes
service-knowledgecannot reach a SQL driver: its dependencies arecore,objectql,platform-objects,service-settingsandspec. A committed test would need@objectstack/driver-sqlas a devDependency plus apnpm-lock.yamlimporter entry, and the lockfile is outside this PR's file surface. So the check is a scratch measurement against this branch's source, re-run on the current head (readings under Verification).KnowledgeReindexResult.ok's jsdoc inpackages/spec("an adapter / source check prevented the run") now also covers a failed page and a refusedlimit. That is outside this PR's file surface, and the wording is still broadly true.dryRun'scountis not wrapped: a failing count still rejects, as the olddryRunread did. The card'sok: falserule is about pages.Verification
Read first (risk order):
knowledge-service.tswalkObjectSource: the loop's exits (empty page, cap, and the two non-advance stops) and the cursorwherecomposition.knowledge-service.tschainAfterandserializeRecordSync: the event-sync chain now goes through the shared helper.knowledge-service.test.tspagedEngine: the double's refusals are what make "every find has a limit" fail loudly.Two-minute check: run
pnpm --filter @objectstack/service-knowledge exec vitest run src/__tests__/knowledge-service.test.ts. Expect 53 passing tests, 25 of them underthe reindex walk pages by id.Every reading below was taken at head
9e24b96c, the final commit.Package tests and typecheck
Ablations (source-resolved subject: the test imports ../knowledge-service.js, so no dist is on the path; each mutation made by scripts/ablation-replace.mjs; each restore proven by blob == HEAD and an empty git diff HEAD)
SQL driver: one scratch run of ObjectQL + SqlDriver (better-sqlite3, :memory:) against this branch's source at 9e24b96
The run used 250 rows of a
kb_noteobject, inserted in shuffled order: 16 explicit ids chosen to stress ordering (a A b B r9 r10 r100 Z z 0 9 10 _x -y r_1 r-1) plus 234 engine-generated ids. 191 rows havestatus = 'open'. The fourth read is the empty one that ends the walk.Local gate subset (dispatch-gates --commands, derived from merge base eec6fb3, 5 paths): 100 derived, 98 exit 0, 2 NOT MEASURED
CI runs both NOT MEASURED families on a full build.
Generated by Claude Code