Skip to content

feat(service-knowledge): adapters list their documents; a complete reindex skips unchanged documents and purges stale ones; adapter contract suite - #37164

Merged
objectstack-fleet[bot] merged 14 commits into
mainfrom
claude/issue-37096-knowledge-list-purge
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 14 commits into
mainfrom
claude/issue-37096-knowledge-list-purge

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #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

build, typecheck and vitest (head 48ed4f1)
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
Ablations (committed first; ablation-replace, restored to the HEAD blob each time)
  • 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.

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 wheres, 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 service-knowledge: the purge re-read confirms by id text only, so a caller-supplied numeric id restored mid-walk on driver-mongodb / driver-memory loses its document until its next event #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".

Local gates (head cf8b70a)

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 (fix(service-knowledge): reindexSource pages an object source by id, one walk per source at a time #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.

Generated by Claude Code

…e, adapter contract suite

Claude-Session: https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E
Co-authored-by: Claude <noreply@anthropic.com>
…ce and reference docs for the knowledge members

Claude-Session: https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E
Co-authored-by: Claude <noreply@anthropic.com>
…o the tenant-audit census can place them

Claude-Session: https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation protocol:ai tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/knowledge-memory, @objectstack/knowledge-ragflow, @objectstack/service-knowledge, @objectstack/spec, touching 44 documentable anchor(s). ⚠️ 6 changed file(s) yielded no anchor (packages/plugins/knowledge-memory/vitest.config.ts, packages/plugins/knowledge-ragflow/vitest.config.ts, packages/services/service-knowledge/package.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/knowledge-rag.mdx (via KnowledgeService (symbol, a top-level class), documentId (symbol, a field of interface AdapterListedDocument))
  • content/docs/automation/connectors.mdx (via nextCursor (symbol, a field of interface AdapterListDocumentsPage))
  • content/docs/protocol/knowledge.mdx (via IKnowledgeAdapter (symbol, a top-level interface), KnowledgeDocumentSchema (symbol, a top-level const), KnowledgeReindexResult (symbol, a top-level interface), KnowledgeService (symbol, a top-level class), docHash (symbol, a field of interface AdapterListedDocument; a field of interface ChunkRecord), documentId (symbol, a field of interface AdapterListedDocument), indexDocument (symbol, a method of class KnowledgeService), listDocuments (symbol, a field of interface KnowledgeAdapterContractOptions; a method of class KnowledgeMemoryAdapter; a method of interface IKnowledgeAdapter), makeAdapter (symbol, a field of interface KnowledgeAdapterContractOptions), nextCursor (symbol, a field of interface AdapterListDocumentsPage), reindexSource (symbol, a method of class KnowledgeService), runKnowledgeAdapterContract (symbol, a top-level function), listDocuments (literal, a string literal in runKnowledgeAdapterContract))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v18/18-3.mdx (via nextCursor (symbol, a field of interface AdapterListDocumentsPage))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 6 changed file(s) yielded no anchor (packages/plugins/knowledge-memory/vitest.config.ts, packages/plugins/knowledge-ragflow/vitest.config.ts, packages/services/service-knowledge/package.json, …) — pages documenting those are invisible to this run
  • 20 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 176 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 0a1b69c0b196ae3785c7c6b8027e80fe774d0165 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 164927445888f8160ba55bff05a7c6a1671a4285 — the merge of head 8ba26077dea4ad94150c04d21ccf32190ee001dc into base 0a1b69c0b196ae3785c7c6b8027e80fe774d0165, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 164927445888f8160ba55bff05a7c6a1671a4285 && git checkout 164927445888f8160ba55bff05a7c6a1671a4285
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0a1b69c0b196ae3785c7c6b8027e80fe774d0165 8ba26077dea4ad94150c04d21ccf32190ee001dc && git checkout -B drift-repro 0a1b69c0b196ae3785c7c6b8027e80fe774d0165 && git merge --no-ff 8ba26077dea4ad94150c04d21ccf32190ee001dc

node scripts/docs-audit/affected-docs.mjs --json 0a1b69c0b196ae3785c7c6b8027e80fe774d0165

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 0a1b69c0b196ae3785c7c6b8027e80fe774d0165 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…e-ragflow aliases the ./testing subpath

File surface extended by the dispatching zone (card What 4; check:test-source-alias).

Claude-Session: https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E
Co-authored-by: Claude <noreply@anthropic.com>
…sh instead of replacing it

Claude-Session: https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 58478cafac5ea4348b684bb80ee2a60a9efae38c
Local-runs: none
Scope: packages/spec/src/ai/knowledge-document.zod.ts, packages/spec/src/contracts/knowledge-adapter.ts, packages/spec/src/contracts/knowledge-service.ts + packages/services/service-knowledge/src/knowledge-service.ts, packages/services/service-knowledge/src/testing.ts, packages/services/service-knowledge/src/knowledge-service-plugin.ts, packages/services/service-knowledge/package.json, packages/services/service-knowledge/tsup.config.ts, packages/services/service-knowledge/src/__tests__/knowledge-service.test.ts, packages/plugins/knowledge-memory/src/index.ts, packages/plugins/knowledge-memory/src/__tests__/contract.test.ts, packages/plugins/knowledge-memory/vitest.config.ts, packages/plugins/knowledge-ragflow/vitest.config.ts, packages/spec/api-surface/contracts.json, packages/spec/export-origins/contracts.json, packages/spec/authorable-surface/ai.json, .changeset/37096-knowledge-list-skip-purge.md + read, not reviewed: docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md, packages/services/service-knowledge/src/index.ts, packages/services/service-cluster/package.json, packages/drivers/driver-sql/src/**, packages/drivers/driver-mongodb/src/mongodb-driver.ts, packages/drivers/driver-memory/src/memory-driver.ts, .changeset/config.json

First review of this PR. Inputs read: card #37096 (body and its three comments: triage 7143730265, claim 7147400808, dev report 7148521174), the PR body at this head, the full diff from the merge base 6f3a8da2 (19 files), the files at this head, ADR-0161 K7 and K8 on this tree, and the 75 check-runs on this head (62 success, 12 skipped, 1 cancelled; the cancelled one, PR-body guards, has a later success of the same name; Check Changeset success twice). The zone's conclusions were not taken as input; each claim below was read in the code.

① Derived judgments

Accept sets and published types, each read at this head:

  • IKnowledgeAdapter.listDocuments?(ctx, opts) (knowledge-adapter.ts): an optional method, so every adapter written before it still satisfies the interface. Shape is ADR-0161 K8 item 1 word for word: { cursor?, limit } in, { documents: { documentId, docHash? }[], nextCursor? } out. The three new exported interfaces are in api-surface/contracts.json and export-origins/contracts.json, and nowhere else is owed (both baselines are name-level; KnowledgeReindexResult and KnowledgeDocument were already listed).
  • KnowledgeDocument.docHash (knowledge-document.zod.ts): z.string().optional() with a .describe that says "Service-computed … stored and returned as stored by the adapter". Schema-optional, described as service-set. The object is not strict, so no input that parsed before is refused now.
  • KnowledgeReindexResult.skipped?: number and purged?: number | null (knowledge-service.ts in spec): two optional keys on a result type. K8's "What counts as a member" places both outside the member list ("land with their reader under ADR-0049"), and the reader lands here.
  • authorable-surface/ai.json gains exactly ai/KnowledgeDocument:docHash. One key added to the schema, one line added to the shard, in sort order. Matches.

Declared-and-enforced (ADR-0049), for docHash:

  • Producer: recordToDocument stamps it on every document it builds (the walk and the event sync both go through it), and indexDocument stamps computeDocHash(doc).
  • Refused on write, not replaced: indexDocument throws when doc.docHash !== undefined, before adapter.upsert, and the message names the document, the field and what to do ("docHash is computed by the knowledge service …; omit it"). requireSource and getAdapter run first, so an unknown source still answers its own error. indexDocument is the only door in packages/ where a caller hands the service a document (no route or tool calls it).
  • Readers: knowledge-memory stores it per chunk and lists it; walkObjectSource compares it. So the key is produced, stored and read in this PR.
  • This refusal is not a narrowing: the key did not exist on main, so no accepted input is taken away.

purged?: number | null:

  • null means no purge ran. Every return of reindexSource sets it explicitly: null on the two refusals before the walk, on a bad limit, on dryRun, on a stopped page, on a limit walk, on refresh.onRecordChange: false, on an adapter without listDocuments, and on a failed listing; a number after a purge, including the count reached before a purge that stopped (ok: false).
  • Documented in the spec JSDoc, the service JSDoc, the changeset and the protocol doc, and the four texts agree on the rule. See N1 for the two cases the spec JSDoc's list leaves out.
  • Consistent with K8 item 1 ("the result says purged: null") and rule 2 ("Nothing is skipped silently").

The ./testing subpath:

  • exports["./testing"] has an import condition only (types + default), no require; the CJS half of tsup.config.ts builds src/index.ts alone. vitest is external.
  • src/index.ts is not in the diff and imports nothing from testing.ts; testing.ts imports KnowledgeService from ./knowledge-service.js, the other direction. So nothing reachable from . imports vitest. The built chunk graph was not inspected here (no build run); the zone reports it, and no check-run on this head is red.
  • It is the service-cluster shape byte for byte (same export block, same build script, same split by format). See N4.

Behaviour that moves for an existing caller: over an adapter with listDocuments, indexed no longer equals discovered after an unchanged reindex, and a complete reindex now deletes documents. The only such adapter in the tree is knowledge-memory. Adapters without the method take the listed === undefined arm, which is the old walk plus two result keys; the thirteen older exact-result assertions gained only skipped: 0, purged: null.

② Semver level

  • Clause-②: yes: right, and present line-initial in the changeset and the PR body. Every spec edit adds an optional member; nothing is removed, retyped or made required.
  • Metadata-protocol: added: right by the gate's rule. The authorable-surface shard moved by one key, and the zone's note (no metadata author writes KnowledgeDocument; the shard lists every exported ai/ schema) is true to the tree. The claim comment said none; the changeset and the body are the governing texts and both say added.
  • Skills-docs: none — …: present in both places, with a reason. It holds: git grep over skills/ at this head for KnowledgeDocument, listDocuments, reindexSource, docHash and indexDocument finds one line, skills/objectstack-ai/SKILL.md:233, which names IKnowledgeAdapter in passing and teaches none of its members.
  • Levels: @objectstack/spec minor (a protocol addition takes minor, AGENTS.md), service-knowledge and knowledge-memory patch. All three sit in the one fixed group of .changeset/config.json, so they release together at the highest level. knowledge-ragflow has no entry and owes none: its only change is a test config.

③ Boundary flags

  • File surface: the two paths outside the claim (contracts/knowledge-service.ts, knowledge-ragflow/vitest.config.ts) were asked for in the dev report's open_questions and are recorded as granted under Deviations. The first is card What 4 and K8's stated home for the fields. The second is one anchored alias line; no ragflow source moves.
  • Both open_questions are answered by the head (option A each).
  • out_of_scope_findings, first entry (the purge's id text): answered as S2 below. Second entry (knowledge-memory lists no empty-content document): read and agreed as the safe direction. Such a document has no chunk, so there is nothing to purge and nothing to serve; it is rebuilt each reindex.
  • SQL push-down: the walk materialises every listed document id (Map) and every seen id (Set), and the purge re-reads one row per candidate. A reason is given and it holds: ADR-0161 K1 ("Why the purge and the grouping run in the service, not in SQL") — the index sits behind the adapter contract and may live in another store, so the anti-join cannot be pushed down in general; K8 item 13 keeps the in-store form for a later reader. The per-candidate re-read is what lets each confirm run on that document's sync chain.
  • Author: objectstack-fleet[bot].
  • K at this head is 22. Size: 1213 additions, 60 deletions, 19 files.
  • No security finding.

④ Design judgment

knowledge-adapter.ts against ADR-0161 K8 and its first consumer: holds. The service reads the listing once before the walk, treats an entry without a hash as changed, refuses a repeated cursor and a malformed page, and a failed listing costs the skip and the purge but not the walk. knowledge-memory implements it in id order with the last id as cursor, and the suite pins 0, one page and one page + 1.

knowledge-document.zod.ts: holds, as in ①.

contracts/knowledge-service.ts: holds; N1.

The purge against the card's acceptance: candidates are listed-before minus seen; the purge is skipped on cap !== undefined, on dryRun (returned earlier), on any stopped page (returned earlier), on onRecordChange: false and without a listing. Each candidate goes through rereadRow, which is the event sync's read lifted out unchanged (where AND { id }, limit: 1, system context), now called from both places.

S1 (should-fix) — the per-document chain around the purge has no pin. purgeDocuments runs each confirm-and-delete through serialize, which the service binds to recordSyncTails, and the JSDoc, the protocol doc and the PR body all state the guarantee: an event sync of the same row cannot land between the re-read and the delete. Reading the tests, no case holds the purge's re-read open while an event sync of that document arrives. The one race test ("a document written by the event sync during the walk survives the purge") awaits handleRecordUpsert to completion before the walk is released, so it passes with serialize replaced by a direct call. Without the chain the order re-read (no row) → restore and its sync (upsert) → delete leaves a live row with no document. A case that holds the limit: 1 find of the purge, fires handleRecordUpsert for the restored row, releases, and asserts the document is present closes it.

S2 (should-fix) — the purge's re-read compares the id as text, and that is a real miss on two shipped drivers. Read through:

  • The document id is ${source.id}:${String(record.id)}; the purge recovers '5' from SRC:5 and re-reads { id: '5' }. The event sync re-reads with the typed id it was handed.
  • driver-sql, driver-sqlite-wasm, driver-turso: id is table.string('id').primary(), varchar(255), minted as a nanoid. A row's id reads back as text, so the text compare is exact. No miss.
  • driver-mongodb: create keeps a caller-supplied id as given and mints a nanoid only when none is given; find hands the filter to MongoDB, which does not equate '5' with 5. driver-memory: create keeps data.id as given; find runs through mingo, which does not either. Platform-minted ids are strings on both, so the miss needs a caller-supplied numeric id. isRecordId and the walk's cursor: string | number both admit one.
  • Effect: on those two drivers a numeric-id row that the complete walk did not see but that exists at purge time (restored, or brought back into where, after its page was read) is not found by the re-read, and its document is deleted. The restore's own event sync does not save it when it ran before the purge task. The row itself is untouched; the document comes back at the row's next event or the next complete reindex, which no longer lists it and so writes it.
  • That is a wrong deletion from a derived index, narrow and self-healing, not a loss of source data. It is also the one place where the purge and the event sync answer the membership question differently, which rereadRow's own note says a shared helper exists to prevent.
  • Today the limit is written only in the PR body and the dev report ("noted, not filed", no carrier). Closing it takes one of: the purge's confirm also matches the number the text spells, with a pin on a numeric-id row restored during the walk; or the limit stated in purgeDocuments' TSDoc and the protocol doc's purge section, with a follow-up card filed and named there.

Nits:

N1 (nit) — the spec JSDoc on purged lists four causes of null and leaves out a failed listing and the two refusals before the walk (non-object source, no engine bound). The sentence "null when no purge ran" covers them; the list reads as complete and is not. It also does not say what an absent key means (a service implementation that predates the field).

N2 (nit) — rereadRow answers undefined when find returns a non-array, and the walk ends on a non-array page as if it were empty. Before this PR both were harmless. Now an engine answering a non-array gives a "complete" walk of zero rows and a purge whose every confirm reads "no row". The IDataEngine contract promises an array and the shipped engine keeps it, so this is a defensive arm pointing the unsafe way, not a reachable defect.

N3 (nit) — content/docs/protocol/knowledge.mdx says the service computes docHash on every document, and does not say indexDocument refuses a caller-supplied one; the changeset and the schema note do. The changeset's "the exported purgeDocuments function of the service module" is exported from knowledge-service.ts and not from the package entry, so it cannot be imported from @objectstack/service-knowledge; row 15's reconcile, if it lives in this package, needs nothing more.

N4 (nit) — ./testing imports vitest, which the package lists under devDependencies only. A consumer outside this workspace on a strict installer resolves vitest from the package's own tree and may not find it. service-cluster and metadata-core ship the same shape; an optional peer dependency would state it. Accepted as the precedent's deviation.

N5 (nit) — the skip keys on content, title and metadata. A change of embedder or split leaves every docHash equal, so a reindex over a listing adapter rewrites nothing. ADR-0161 K7 answers that with the index fingerprint and generations (K8 item 8), which land with #37099 or #37100; knowledge-memory is deterministic and in-process, so nothing is wrong at this head. The first persistent adapter to implement listDocuments should not land ahead of item 8.

Tests that pin the new behaviour, read for ablation:

  • indexDocument refusal: one case asserts the throw by message and upsert not called. Removing the refusal turns it red.
  • Skip: exact results (indexed: 0, skipped: 150) and upsert not called; removing the filter turns five cases red, and one in the contract suite.
  • Purge confirm: the exact re-read wheres are asserted, and the restored-row case asserts no delete; removing rereadRow turns three red.
  • No purge under limit, limit: 0, dryRun, a failed page, onRecordChange: false, a failed listing, a repeated cursor: each asserts purged: null and no delete.
  • A failed re-read: ok: false, purged: 0, the document kept. Foreign ids: kept, counted in message.
  • Not pinned: the chain (S1) and a numeric id (S2).

Implemented-by: claude/issue-37096-knowledge-list-purge
Reviewed-by: fresh subagent of session_01QSeKYpEsWWE9Y5YtSsDgqZ

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — REWORK · L1 · head 58478cafac5ea4348b684bb80ee2a60a9efae38c · 2026-11-25T02:50Z

  • Shape: open, draft, base main, first line Fixes #37096. Every card What item (1–7) and every Acceptance line maps to code and a test, so Fixes is right. No closing keyword sits next to another card. Nothing under content/docs/releases/. 19 files, +1213/−60, not governed (check-governed-merges.mjs).
  • Changeset per published package: spec minor, service-knowledge patch, knowledge-memory patch. l1-face flags @objectstack/knowledge-ragflow. That is a false positive: its only change is vitest.config.ts, and its files[] ships only dist, README.md and CHANGELOG.md.
  • Premises measured on merge base 6f3a8da2ac: no listDocuments, no docHash, no purge. Both blockers are ancestors. The shapes match ADR-0161 K8 items 1–2 word for word, and ruling 7145942375 (items 1–2) agrees with the skip and the purge.
  • Reindex logic, read:
    • Skip (knowledge-service.ts:384-402) only refrains from writes, so it can never write stale data.
    • The purge gate (:420-422) excludes limit (limit: 0 included), dryRun, a failed listing and onRecordChange: false. Every failure inside the walk returns through stopped() with purged: null.
    • Candidates are the listed documents minus every document the walk built, skipped ones included.
    • The re-read is extracted unchanged into rereadRow (:960-972), shared with the event sync.
    • Each confirm-and-delete runs on the event sync's per-document chain, under the same key (:431 / :579). It cannot deadlock against the reindex chain.
  • Memory listDocuments (knowledge-memory/src/index.ts:65-86): ids in sorted order, cursor exclusive. nextCursor appears only when ids remain, so 0, exactly limit and limit + 1 documents give 1, 1 and 2 pages with no trailing empty page. A non-integer or < 1 limit is refused. Edges are correct.
  • Tests that go red on revert, by reading:
    • Skip off: knowledge-service.test.ts:893/903/914 and contract testing.ts:271.
    • Purge or re-read off: :937/:991/:1048.
    • Limit or dryRun gate off: :959. Failed page made a break: :974. onRecordChange clause off: :1014. indexDocument refusal off: :94.
    • The :991 double reads at call time, so r001 is a real candidate that only the re-read keeps.
  • Gate check-runs at head: 75 runs, 62 success, 12 skipped (all expected), 1 cancelled, 0 failed, 0 pending. The cancelled run is PR-body guards; a second run of the same name at the same head succeeded, so it needs no action. Lint & Repo Gates and TypeScript Type Check both succeeded, as did Check Changeset, Test Core 10/10, Test UI 16/16, every Type Check job and Build Core. Dogfood is not owed.
  • K and staleness:
    • K from the merge base is 22 (6f3a8da2..3b4f0b98). The landing K on PRBASE a10345abff is 3, under the hold of 15.
    • No main commit since the merge base touches the PR's 19 files, and merge-tree is clean.
    • The PR carries merge=os-regen paths (api-surface, export-origins, authorable-surface, references), so section A applies at arming.
  • Accepted deviations, to record at ACCEPT:
    • The file surface grew by packages/spec/src/contracts/knowledge-service.ts (two optional result fields) and packages/plugins/knowledge-ragflow/vitest.config.ts (one alias line), exactly as described. The grant is on neither the card nor the PR, so this comment records it.
    • Claim Metadata-protocol: none became added. The reason is in § Acceptance notes, and Check Changeset succeeded.
    • The local pnpm test was scoped to the touched packages. CI at head covers the full set.
  • Declarations and docs:
    • Clause-②: yes is correct (contract path and claim), so an L2 contract-tier PASS at head is owed before ready.
    • The Skills-docs: line is true: skills/** never names KnowledgeDocument, listDocuments, docHash or reindexSource, and skills/objectstack-ai/SKILL.md:229-262 teaches KnowledgeSource only.
    • content/docs/protocol/knowledge.mdx is accurate sentence by sentence, apart from the complete-walk sentence, which S1 makes true.
  • S1 (should-fix) — knowledge-service.ts:376 reads a non-array page as the end of the walk, and that now arms the purge. On page 1 every listed document becomes a candidate, and rereadRow (:971) reads a non-array as "no row", so every candidate is deleted. Send a non-array page through stopped(...), make a non-array re-read throw so the purge stops with ok: false, and add a case with a listing adapter for each.
  • S2 (should-fix) — No test pins the serialization of the purge's re-read and delete against an event sync of the same document. serialize: (id, task) => task() stays green, yet the PR body and knowledge.mdx state the property. Add a case that holds an event sync in flight on a candidate and asserts that the purge waits for it.
  • S3 (should-fix) — The 维护者速读 line "用户能看到什么变化" overstates the change. The skip and the purge happen only over an adapter that implements listDocuments, and in this repo that is only the dev/test knowledge-memory. knowledge-ragflow reindexes as before (purged: null). Say so, drop "内部工具层面用户无感", and note that a failed purge step now returns ok: false.
  • S4 (should-fix) — Out-of-scope destination: the numeric-id re-read case ("noted, not filed") sits in code this PR adds (purgeDocuments, :1067/:1074). Give it a carrier: a follow-up card cited as #N in § Acceptance notes, or a fix here.
  • N1 — The changeset body cites ADR-0161 K8, items 1 and 2 and uses "walk" and "the event sync's own re-read". That is internal shorthand in a CHANGELOG; a plain wording reads better.
  • N2 — Changeset :18: "The purge is the exported purgeDocuments function of the service module". It is a module export only; src/index.ts does not re-export it, so a CHANGELOG reader cannot import it. Reword or drop the sentence. The purged TSDoc (packages/spec/src/contracts/knowledge-service.ts:72-78) omits "a failed listing" from its null cases.
  • N3 — In knowledge-memory, a document with empty content is never listed: it is rewritten on every reindex and never purged. That is the safe direction; record it and file no card.
  • N4 — The card's only os-dev-report is the blocked one at c6e78ea5. The later rounds' evidence is only in the PR body, on mixed heads. Close the patch round with a report at its head.
  • Contract review at this head: 7151166003 (CONTRACT_REVIEW_TIER), PASS with two open items. Its S1 is this L1's S2. Its S2 is this L1's S4, and it makes the numeric-id miss concrete: on driver-mongodb and driver-memory, a row with a caller-supplied numeric id that is restored mid-walk loses its document until its next event or the next full reindex. A type-tolerant confirm plus a pin closes it here; if not, TSDoc and protocol-doc wording plus a filed card.
  • Next: one patch round to the original dev covers S1–S4 and N1–N4, plus a report at the new head. The seat then reads the delta, and a delta contract review follows. Not Tier H, so the zone lands it after both pass.

…er, finds numeric ids by number; pin its sync chain

Claude-Session: https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: ffc6bff41d23f5d9418a5029ed4a392eb0a072d7
Local-runs: none
Scope: packages/spec/src/contracts/knowledge-service.ts, packages/services/service-knowledge/src/knowledge-service.ts, packages/services/service-knowledge/src/__tests__/knowledge-service.test.ts, content/docs/protocol/knowledge.mdx, .changeset/37096-knowledge-list-skip-purge.md + read, not reviewed: packages/drivers/driver-sql/src/sql-driver-filter-helpers.ts, packages/drivers/driver-sql/src/sql-driver-crud.ts, packages/drivers/driver-sql/package.json

Delta review. Prior record: 7151166003 at 58478cafac5ea4348b684bb80ee2a60a9efae38c (PASS, S1 and S2 open, N1–N5). Inputs read: the diff 58478caf..ffc6bff4 (2 commits, 5 files, +161/−21, no merge commit), the five files at this head, the PR body at this head, dev report 7152232419, seat L1 7151268664, and the 75 check-runs on this head (63 success, 12 skipped, none failed or pending). The zone's conclusions were not taken as input; each claim below was read in the code.

① Derived judgments

Accept sets and published types against the prior record:

  • packages/spec/src/contracts/knowledge-service.ts moves in comments only. skipped?: number and purged?: number | null are as they were. No other spec file is in the delta, and neither are api-surface/, export-origins/, authorable-surface/ or any package.json. Nothing was added to or taken from an accept set or the public surface since 58478caf.
  • purgeDocuments, PurgeDocumentsInput and PurgeDocumentsOutcome keep their shapes. The two new helpers (describeValue, canonicalSafeInteger) are module-private.

Behaviour that moves in the delta, each read at this head:

  • A walk page that is not an array returns through stopped(...): ok: false, purged: null, the counts reached so far, and the message names the page and what was answered. An empty array still ends the walk.
  • rereadRow throws when find answers a non-array. In the purge the throw is caught per candidate: the purge stops, failure names the document, and the result is ok: false with purged at the count before it. Nothing is deleted on an unreadable answer.
  • rereadRow has two readers, so the same throw reaches the event sync. Before this head a non-array answer there read as "no row" and deleted the document; now syncRecord catches it, logs a warning and leaves the document. That is the safe direction, and it is a change on the event-sync path. See N1.
  • The numeric re-ask, in purgeDocuments only (one call site; handleRecordUpsert, syncRecord and handleRecordDelete are not touched by it): when the re-read by the id text finds no row and canonicalSafeInteger(text) answers a number, the row is asked for again with that number, inside the same serialize task and before the delete.

Is the numeric re-ask safe:

  • It can only keep. The delete runs when both reads find no row; the second read never removes a row from consideration. A document whose row exists under either spelling is not purged.
  • A string id '5' and a number id 5 as two rows (possible on driver-mongodb and driver-memory): both derive the one document id SRC:5 (String(record.id)), on the walk and on the event sync alike, and did before this PR. Either row backs that document, so keeping it when either exists is the right answer. The re-ask does not create the collision and does not widen it.
  • canonicalSafeInteger is tight: /^(0|-?[1-9][0-9]*)$/ and then Number.isSafeInteger. Refused: '05', '-0', '+5', '1e3', '5.0', ' 5', '5\n' (a JavaScript $ without the m flag matches at the very end only), the empty text, and any integer past 2^53 − 1. Every accepted text satisfies String(Number(text)) === text, so the number asked for is one whose document id is the candidate's.
  • Left out by that definition: a caller-supplied numeric id that is not a safe integer (1.5, or one past 2^53). Such a row still misses on the two drivers, as at the prior head. The protocol doc says "a whole number", so the limit is stated.

purged in the four texts: the spec TSDoc now lists a non-object source, no engine bound, a refused limit, limit, dryRun, a failed walk, onRecordChange: false, no listDocuments, and a failed listing; it says a number with ok: false is a purge that stopped part-way, and that an absent key is an implementation that predates the field. The service JSDoc, the changeset and the protocol doc agree with it.

② Semver level

  • Clause-②: yes, Metadata-protocol: added and the Skills-docs: line stand, line-initial in the changeset and in the PR body. The changeset's front matter is byte-identical to the prior head: @objectstack/spec minor, service-knowledge and knowledge-memory patch.
  • The delta adds no schema key and no exported name, so added is still exact: one key on one shard, from the earlier rounds.
  • The changeset body is reworded and now ends "A caller of indexDocument stops setting docHash", which is the one thing a consumer has to do. Check Changeset succeeded on this head.

③ Boundary flags

  • Merges in the delta: none (git rev-list --merges 58478caf..ffc6bff4 is empty), so there is no merge tree to compare with git merge-tree --write-tree. Both commits are single-parent, authored by the dev seat.
  • File surface: the five delta files are all inside the 19 of the prior record. The PR is still 19 files; +1354/−61 from the merge base.
  • K at this head: 28 from the merge base 6f3a8da2 (it was 22), 24 from the PR's recorded base 49c8e0f0.
  • New since the prior head: main now carries feat(ai): ai_context context packs and the get_record_context tool over MCP (ADR-0160 row 5) #37173, which adds keys to packages/spec/authorable-surface/ai.json. git merge-tree --write-tree origin/main ffc6bff4 exits 0 and the os-regen driver marks that shard "not text-merged — it is generated". The landing merge needs pnpm --filter @objectstack/spec gen:schema on the merged tree; the prior L1's "merge-tree is clean" no longer describes this head.
  • open_questions in the dev report is empty. Its one out_of_scope_findings entry (an empty-content document is never listed by knowledge-memory) was read and agreed in the prior record.
  • No security finding.

④ Design judgment

Prior S1 (the chain around the purge had no pin): closed. The new case holds the purge's limit: 1 find after it has read "no row", restores the row, fires handleRecordUpsert for it, releases, and asserts the document is present. Read against serialize replaced by a direct call: the event sync finds no tail for the document, re-reads, upserts, and the released purge then deletes, so the assertion fails. On the chain the sync queues behind the purge's task and writes the document back after the delete. The purge and the event sync use one map (recordSyncTails) and one key (documentIdFor(source.id, String(recordId))).

Prior S2 (the id compared as text missed on driver-mongodb and driver-memory): closed for those two drivers, by the first of the two ways the record offered. The new case uses rows with numeric ids over an engine double that compares with !==, restores row 2 between the walk's read and the purge, removes row 4 for good, and asserts purged: 1, only s1:4 deleted, and both spellings asked for each. With the re-ask deleted the double misses { id: '2' } and s1:2 is deleted, so the case fails. One new item follows from how the fix was made:

S1 (should-fix) — the number re-ask runs on every driver, and on the SQL dialects that compare a text column with a number numerically it has not been looked at. Read, not run:

  • purgeDocuments cannot tell which driver is under the engine, so { id: 5 } is also sent to driver-sql whenever a candidate's id text is all digits and the text read found no row. driver-sql keeps a caller-supplied id (sql-driver-crud.ts), the id column is varchar(255), and coerceFilterValue has no arm for a number against a text column: the comparand is bound as the number.
  • PostgreSQL types the parameter by the column and SQLite applies the column's text affinity, so both answer what the text read answered. No effect.
  • MySQL converts the column: id = 5 matches '5', '05', '5.0' and ' 5'. A document whose row '5' is gone is kept while a row '05' exists. That is a different row confirming the document, in the keep direction only.
  • SQL Server and Oracle convert the column too and raise on the first row whose id is not a number (Conversion failed…, ORA-01722). In a table that mixes digit-only ids with minted ones, the re-ask of a gone digit-only candidate throws, the purge stops with ok: false, and it stops there again on every complete reindex, so no later candidate is ever purged.
  • None of this deletes a document whose row exists. It needs a listing adapter (only knowledge-memory today), a caller-supplied digit-only id, and a missed delete event. The event sync is not affected: it passes the id it was handed.
  • The PR body says "no driver change" and the TSDoc says the re-ask exists "so the purge and the event sync give one answer for one row"; on those dialects the second read can give a different answer or none. Closing it takes one of: a live MySQL and SQL Server cell that pins what { id: <number> } answers on a text id column, with the driver or the re-ask adjusted to match; or the limit stated in purgeDocuments' TSDoc and in the protocol doc's purge paragraph, with a follow-up card filed and named there.

Prior nits:

  • Prior N1: closed. The purged TSDoc lists every null case and what an absent key means (①).
  • Prior N2: closed. A non-array page stops the walk, a non-array re-read throws, and each has a case that asserts ok: false, no delete, and the document still stored.
  • Prior N3: closed. The protocol doc says indexDocument refuses a document that already carries a docHash; the changeset no longer names purgeDocuments as something a consumer imports.
  • Prior N4 (./testing imports vitest, a devDependencies entry): unchanged, and still accepted as the service-cluster / metadata-core precedent.
  • Prior N5 (the skip does not see a change of embedder or split): unchanged, and still for the first persistent adapter that implements listDocuments; nothing is wrong at this head.

New nits:

N1 (nit) — the event sync's new arm has no pin and no line in the protocol doc. A non-array answer to its re-read used to delete the document and now warns and keeps it (①). The dev's ablation of the re-read guard turned one case red, the purge one, so the event-sync half is held by nothing. One case on handleRecordUpsert (a find that answers undefined; assert no delete and one warning) would hold it.

N2 (nit) — the chain case and the numeric case each wait on setTimeout(r, 5) for the other side to reach its hold. Both hold on a gate promise as well, so a slow runner changes neither outcome; the delay only decides how far the queued side has run. Awaiting the reached promise the chain case already has, in both, would remove the clock.

Tests that pin the delta, read for ablation:

  • Page guard made break: the walk completes over zero rows, the purge runs, and "a walk page that answers no list" fails on ok: false and on deleteSpy.
  • Re-read guard made return undefined: s1:r000 is deleted and "a purge re-read that answers no list" fails.
  • serialize made a direct call: the chain case fails, as read above.
  • Numeric re-ask deleted: the numeric case fails, as read above.
  • Not pinned: the event sync's keep on a non-array answer (N1), and the number re-ask on a SQL dialect (S1).

Implemented-by: claude/issue-37096-knowledge-list-purge
Reviewed-by: fresh subagent of session_01QSeKYpEsWWE9Y5YtSsDgqZ

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head ffc6bff41d23f5d9418a5029ed4a392eb0a072d7 · 2026-11-25T04:00Z

  • Delta read: 58478caf..ffc6bff4 is two single-parent commits and 5 files, +161/−21. There are no merges in the delta, so no merge-tree replay is owed. The PR as a whole is 19 files, +1354/−61. check-governed-merges.mjs reads it as NOT governed (0 of 19 paths, 1415 lines).

  • S1 closed:

    • A walk page that is not an array now returns through stopped(...) (knowledge-service.ts:379-382), with ok: false and purged: null.
    • rereadRow throws on a non-array answer (:978-980), so the purge stops with ok: false and keeps the document.
    • Two new cases use a listing adapter (knowledge-service.test.ts:1076, :1089).
  • S2 closed: the chain case (:1103) holds the purge between its re-read and its delete while a restore's event sync arrives. It asserts that the document survives. On the chain the outcome does not depend on timing.

  • S3 closed: the new 维护者速读 is accurate.

    • The skip and the purge apply only to adapters that implement listDocuments. Today that is only the dev/test memory store.
    • RAGFlow reindexes as before. It has no listDocuments, and its upsert sends only doc.metadata, so the new docHash never reaches it.
    • Each deletion is confirmed by a re-read. An unreadable answer stops the purge. A failed purge step reports failure.
    • "内部工具层面用户无感" is gone.
  • S4 closed in-service:

    • If the text re-read finds no row and the id text is a canonical safe integer, the purge re-reads by that number (:1094-1095, canonicalSafeInteger :1147).
    • The test double matches with strict !==, so the numeric case (:1138) proves the fallback. It shows a restored 2 is kept and a gone 4 is purged, and it asserts both re-read forms.
    • No card is needed. This also closes the contract review's S2 (7151166003).
  • Ablations, re-run here in a throwaway worktree at head (file knowledge-service.test.ts, baseline 80/80 passed). Each of the four mutations gives exactly 1 failed | 79 passed (80), and the failing case is the one aimed at it:

    • page guard → break;
    • re-read guard → return undefined;
    • serialize → direct task();
    • numeric re-ask deleted.

    This matches the dev report 7152232419 (2026-11-25T03:46Z).

  • N1–N4 closed:

    • N1: the changeset is now in plain words. "ADR-0161 K8", "walk" and "the event sync's own re-read" are gone. Each sentence matches the diff, including the new line "A caller of indexDocument stops setting docHash".
    • N2: the purgeDocuments sentence is dropped. The purged TSDoc now lists every null return (each checked against reindexSource), including a failed listing. It also says what an absent key means.
    • N3: recorded below.
    • N4: a done os-dev-report exists at ffc6bff4.
  • Protocol doc delta (knowledge.mdx): read sentence by sentence and accurate. It covers the indexDocument refusal, the numeric re-ask, and that a non-list answer stops the walk (purged: null) or the purge (ok: false). The complete-walk sentence is now true.

  • Check-runs at head: 75 runs, 63 success, 12 skipped, 0 failed, 0 pending. The last run completed at 2026-11-25T03:48Z.

    • The skips are the expected set, plus one duplicate skipped run each of Auto Label and Check PR Size, both of which also have a success run.
    • Lint & Repo Gates, TypeScript Type Check, Check Changeset ×2, Spec property liveness, Test Core 10/10, Test UI 16/16 and Build Core all succeeded.
    • Dogfood is not owed.
  • K and staleness:

    • K = 29 (git rev-list --first-parent --count 6f3a8da2..origin/main, origin/main 15d2766157 at 2026-11-25T03:57Z).
    • landing-k.mjs reads PRBASE 3b4f0b98, which gives K = 7 < 15: OK. It found no new locale pack and no shared book.
    • New since the prior L1: feat(ai): ai_context context packs and the get_record_context tool over MCP (ADR-0160 row 5) #37173 (2a6f26a4, after PRBASE) touches packages/spec/authorable-surface/ai.json. That is a merge=os-regen path, and both merge-tree and a 3-way merge-file of it are clean.
    • The PR carries four merge=os-regen paths: api-surface/contracts.json, export-origins/contracts.json, authorable-surface/ai.json and references/ai/knowledge-document.mdx. Section A applies at arming: run os-regen-merge.sh and re-measure the regen.
  • Accepted deviations, recorded at this ACCEPT:

    • The file surface grew by packages/spec/src/contracts/knowledge-service.ts (optional skipped and purged, plus TSDoc) and packages/plugins/knowledge-ragflow/vitest.config.ts (one anchored test-source alias). The zone granted both after the first report; that grant appears on neither the card nor the PR except here. Both edits are exactly as described.
    • The claim's Metadata-protocol: none became added. The authorable-surface/ai.json shard moves, so spec takes minor. The reason is in § Acceptance notes, and Check Changeset succeeded.
    • The local pnpm test was scoped to the touched packages. CI at head covers the full set.
    • N3, recorded with no card filed: in knowledge-memory, an empty-content document is never listed. It is rewritten on every reindex and never purged, which is the safe direction.
  • Owed before ready: an L2 contract-tier PASS at ffc6bff4 (Clause-②: yes), from the parallel delta contract review.

  • N1 — rereadRow now throws on a non-array answer in the event sync as well. Before, such an answer deleted the document; now syncRecord logs a warning and leaves it. That is the safe direction, but it contradicts "the event sync … is unchanged" (PR body § Purge, dev report), and no case pins it. A clause in the body would do.

  • N2 — PR body § Tests still heads its summary "head cf8b70a", with 164 tests. The current numbers (169/169, plus the four ablations) are only under § Verification "Round at ffc6bff".

No must-fix, no should-fix.

  • Before landing (contract review 7152394541 at this head): the contract review's S1 is still open. The numeric re-ask also reaches driver-sql, where a number is bound against the varchar id:

    • MySQL matches '05' for 5, so a stale document is kept.
    • SQL Server and Oracle raise on non-numeric ids, so the purge stops ok:false on every full reindex.

    Close it in one small round, either way:

    • limit the numeric fallback to drivers whose id column is not text, and pin that with a live-dialect case; or
    • state the limit in knowledge.mdx and the TSDoc, and file a follow-up card.

    Fold in this L1's N1 and N2 and the contract review's new nits in the same round. Then a delta contract review follows, and a4-K lands it with os-regen-merge.sh plus a regen re-measure (authorable-surface/ai.json moved on main via feat(ai): ai_context context packs and the get_record_context tool over MCP (ADR-0160 row 5) #37173).

… limit; pin the event sync's keep; no clock in the purge tests

Claude-Session: https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 48ed4f12aefa95cb1def5a3ff57a13c5d52e2ad6
Local-runs: none
Scope: packages/services/service-knowledge/src/knowledge-service.ts, packages/services/service-knowledge/src/__tests__/knowledge-service.test.ts, content/docs/protocol/knowledge.mdx, .changeset/37096-knowledge-list-skip-purge.md + read, not reviewed: packages/drivers/driver-mongodb/src/mongodb-driver.ts, packages/drivers/driver-memory/src/memory-driver.ts

Delta review. Prior record: 7152394541 at ffc6bff41d23f5d9418a5029ed4a392eb0a072d7 (PASS, S1 open, N1–N2). Inputs read: the diff ffc6bff4..48ed4f12 (1 commit, 4 files, +75/−41, no merge commit), the four files at this head, the PR body at this head, seat L1 7152441226, card #37221, and the 79 check-runs on this head (65 success, 14 skipped, none failed or pending; the last completed at 2026-11-25T04:48Z). The zone's account of the round was not taken as input; each claim below was read in the code.

① Derived judgments

Accept sets and published types against the prior record:

  • No file under packages/spec/ is in the delta, and neither are api-surface/, export-origins/, authorable-surface/ or any package.json. skipped?: number and purged?: number | null are as they were. Nothing was added to or taken from an accept set or the public surface since ffc6bff4.
  • purgeDocuments, PurgeDocumentsInput and PurgeDocumentsOutcome keep their shapes. canonicalSafeInteger (module-private) is deleted; no other reference to it is left at this head.

Behaviour that moves in the delta, each read at this head:

  • purgeDocuments makes one re-read per candidate, by the id text recovered from the document id, and deletes when that finds no row. The second read by the number is gone, and with it every path the prior S1 described on driver-sql: no number is bound against the text id column.
  • What that removal costs, read in the code: on a driver whose filter does not equate '5' with 5, a row stored under a caller-supplied numeric id is not found by the purge's re-read. If its document is a candidate while the row exists (the row was restored, or came back into where, after the walk read past its place), the document is deleted. The row is not touched.
  • A numeric-id row that exists for the whole walk is not affected: the walk derives SRC:<String(id)> for it, so its document is seen and is never a candidate.
  • The document returns. The event sync passes the id it was handed (the number), so rereadRow finds the row and upserts at the row's next event; the next complete walk regenerates it as well. If the restore's own event sync is in flight when the purge reaches the document, it queues behind the purge on the document's chain and writes the document back after the delete, so the loss needs that sync to have finished before the purge, or the event to have been missed.
  • Event sync: syncRecord's code is byte-identical to the prior head. The keep on a non-list re-read was already there; this round states it and pins it.

Is the purge direction stated truly, as a deletion, in each text:

  • purgeDocuments TSDoc: "the document is deleted. The row is untouched; its document returns at the row's next event or the next complete reindex." It also says why the number is not asked for.
  • knowledge.mdx, a bullet of its own, "Known limit: numeric record ids": "its document is deleted. The row itself is untouched".
  • Changeset: "its document is deleted until the record's next change or the next full reindex."
  • PR body § Acceptance notes: "its document is deleted; the row is untouched", with the card number. § Purge points at it. 维护者速读 already gives the worst case as a wrongly removed entry that the next reindex or record change restores.
  • No text at this head says a numeric id is kept. The strings "a numeric record id included" (changeset) and "asked for again by the number" (TSDoc, mdx) are gone.

The limit against the drivers it names, read, not run:

  • driver-mongodb keeps a caller-supplied id on insert as given and mints nanoid text otherwise; driver-memory keeps data.id and mints text otherwise. "Platform-minted ids are text" holds for both, so the limit does need a caller-supplied number.
  • driver-mongodb's own update and delete filter by { id: String(id) }, so a numeric-id row there is already not addressable by id through the driver. The purge's miss is the same miss, not a new class of one.

② Semver level

  • Clause-②: yes, Metadata-protocol: added and the Skills-docs: line stand, line-initial in the changeset and in the PR body. The changeset's front matter is byte-identical to the prior head: @objectstack/spec minor, service-knowledge and knowledge-memory patch.
  • The delta adds no schema key and no exported name. The changeset gains two sentences (the limit; the event sync's keep) and loses one clause; both new sentences match the code.
  • The event sync's keep on a non-list answer is a behaviour change on a path that was not this card's subject. It turns a deletion on a malformed engine answer into a warning; no caller receives a different value (handleRecordUpsert resolves undefined either way). Patch on service-knowledge covers it, and the changeset now says it in its own paragraph. Check Changeset succeeded on this head.

③ Boundary flags

④ Design judgment

Prior S1 (the number re-ask reached driver-sql, unexamined on MySQL, SQL Server and Oracle): closed, by the second of the two ways the record offered, and more thoroughly than that way asked: the re-ask is removed, not kept with a caveat. What is left is a limit on two drivers, in the opposite direction (a deletion where the prior head kept), and it is stated as a deletion in the TSDoc, the protocol doc, the changeset and the PR body, with #37221 filed.

Is the stated limit enough at this head, or does it need more before landing:

  • What can be lost is an index entry, never a row, and it is rebuilt by the row's next event or the next complete reindex with no operator step.
  • It needs all of: an adapter with listDocuments (only knowledge-memory, the dev and test store, today); driver-mongodb or driver-memory; a caller-supplied numeric id; a restore or a return into where after the walk passed the row's place and before the purge; and that row's event sync already finished or missed.
  • The alternative at the prior head was worse on a production driver: a purge on SQL Server or Oracle that stops with ok: false on every complete reindex.
  • A real fix needs the id's type carried through the document or exposed by the driver contract (service-knowledge: the purge re-read confirms by id text only, so a caller-supplied numeric id restored mid-walk on driver-mongodb / driver-memory loses its document until its next event #37221's first two options). That is a contract decision and is rightly not made inside this PR.
  • So the limit plus the card is enough here. The card has to be decided before the first persistent adapter implements listDocuments over driver-mongodb; that is the same moment the prior N5 waits for.

Does the event sync's warn-and-keep contradict anything:

  • Code: rereadRow throws on a non-array answer; syncRecord catches, warns event-sync failed for source '…': the re-read of record '…' answered … instead of a list of rows, and neither upserts nor deletes. The purge catches the same throw per candidate and stops. Both readers treat an unreadable answer as "do not delete"; they agree.
  • Texts: the PR body § Purge now says the event sync "now warns and keeps the document where it used to delete it"; the sentence "the event sync … is unchanged" is gone from the body. The mdx and the changeset say the same. No sentence in the four texts says the event sync deletes on such an answer.
  • § Purge still says the re-read was "extracted unchanged into one helper"; the next sentences give the one difference (the non-list guard), so the paragraph reads true as a whole.

Prior nits:

  • Prior N1 (the event sync's keep had no pin and no line in the protocol doc): closed. The new case builds a service over a find that answers undefined, fires handleRecordUpsert, and asserts one find, no delete, no upsert, one warning, and the warning's text. The mdx has the sentence.
  • Prior N2 (two cases waited on setTimeout(r, 5)): closed. The two walk cases await holdNextFind().reached, which resolves when the held find is entered. The chain case awaits one setImmediate turn; every path it races awaits promises only, so the turn drains them without a clock. The one setTimeout(r, 5) left in the file is in a case from fix(service-knowledge): reindexSource pages an object source by id, one walk per source at a time #37129 that this PR does not touch.
  • Seat L1 7152441226 N2 (§ Tests headed "head cf8b70a"): § Tests now reads "head 48ed4f1", 170/170.

New nits:

N1 (nit) — the general sentences still read without exception. knowledge.mdx: "A row created or restored during the walk keeps its document: if it was listed, the re-read finds it"; the TSDoc: "… is kept"; the changeset: "a record that exists at that moment keeps its document". Each is followed at once by the limit, so nothing false is left standing, but a reader who stops at the first sentence has the wrong answer for a numeric id. "(one exception follows)" in the mdx sentence would do.

N2 (nit) — #37221 is named only in the PR body. The TSDoc, the mdx and the changeset state the limit in full and do not need the number, but the card has no label, so nothing but this PR's body leads to it. A label that puts it in the K8 backlog (epic #37000) would hold it.

Tests that pin the delta, read for ablation:

  • Number re-ask put back: { id: 2 } is asked and finds the restored row, so purged is 1, s1:2 is not deleted, and the re-read list is longer; the limit case fails on all three assertions. Its last assertion is an exact toEqual([{ id: '2' }, { id: '4' }]), so any second read per candidate turns it red.
  • Re-read guard made return undefined: the event sync reads "no row" and deletes, so the new event-sync case fails on deleteSpy and on the warning count; the purge re-read case fails as before.
  • serialize made a direct call: within the setImmediate turn the sync upserts, the released purge then deletes, and the chain case fails on stored.has('s1:r001').
  • Not pinned: nothing in the delta. Not run here: all of the above (Local-runs: none); the dev's report of the three ablations (2 failed, 1 failed, 1 failed) matches what the code reads as.

No must-fix, no should-fix.

Implemented-by: claude/issue-37096-knowledge-list-purge
Reviewed-by: fresh subagent of session_01QSeKYpEsWWE9Y5YtSsDgqZ

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head 48ed4f12aefa95cb1def5a3ff57a13c5d52e2ad6 · 2026-11-25T05:27Z

Delta L1 over the ACCEPT 7152441226 at ffc6bff4. The delta contract review is PASS (7153786247, CONTRACT_REVIEW_TIER) with nothing open.

  • Delta shape. One single-parent commit: 4 files, +75/−41. No merge. No change to spec, the accept-set or the public surface.
  • Contract review S1 is closed by route (b). The numeric re-ask is removed. The TSDoc, knowledge.mdx, the changeset and the PR body all state the limit truthfully: on mongodb or memory, if a row with a caller-supplied numeric id is restored mid-walk, its document is deleted. The row itself is untouched, and the document returns on the row's next event or at the next full reindex. A pin and an ablation cover it. The follow-up is service-knowledge: the purge re-read confirms by id text only, so a caller-supplied numeric id restored mid-walk on driver-mongodb / driver-memory loses its document until its next event #37221; triage still owes it a first touch, and the seat requests that touch.
  • L1 N1 is closed. On a non-list re-read, the event sync warns once and keeps the document. The body, the mdx and the changeset say so, and a pin covers it.
  • L1 N2 is closed. § Tests now reads at this head: 170/20/10.
  • Contract-review nits are closed. The three setTimeout(5) waits are now deterministic.
  • Gates. Check-runs at this head: 79 runs, 65 success, 14 skipped, 0 failed.
  • Landing. The PR touches merge=os-regen paths, and main's feat(ai): ai_context context packs and the get_record_context tool over MCP (ADR-0160 row 5) #37173 moved authorable-surface/ai.json. So run os-regen-merge.sh with a gen:schema re-measure at arming. If that merge-only move regenerates cleanly, it keeps this ACCEPT. After that, the zone lands the PR with landing-k and check-governed-merges.
  • Optional nit, open: the delta contract review's N1 — the general "keeps its document" sentences read without an exception just before the limit.

No must-fix, no should-fix.

The os-regen driver kept the branch's side of the shard in the merge commit
and step 2 took main's; gen:schema on the merged HEAD yields both: main's 56
entries (#37173) and this branch's ai/KnowledgeDocument:docHash.

Claude-Session: https://claude.ai/code/session_01QSeKYmGV9ehU2Bfmw95h7E
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL

Landing · zone a4-K · head 8ba26077dea4ad94150c04d21ccf32190ee001dc

  • Seat delta L1: ACCEPT, comment 7153799023. Delta contract review (CONTRACT_REVIEW_TIER): PASS, comment 7153786247. Both were read at 48ed4f12.
  • The two commits after 48ed4f12 come from os-regen-merge.sh. 1e0558d0 merges origin/main with no rebase or force-push. 8ba26077 is the step-3 hand-off commit: it regenerates packages/spec/authorable-surface/ai.json with gen:schema on the merged tree.
  • Over the PR's 19 files, git diff 48ed4f12 8ba26077 touches one file, authorable-surface/ai.json, +56/−0. Those 56 lines are main's feat(ai): ai_context context packs and the get_record_context tool over MCP (ADR-0160 row 5) #37173 entries, generated. No hand-written content changed, so the reviewed content is unchanged.
  • Section A regen: the merge step kept the branch side of ai.json, which dropped main's 56 keys. The regenerated file is the merge base plus both sides' additions (main's 56, and this PR's ai/KnowledgeDocument:docHash), checked as key sets. The new contract exports are present in api-surface/contracts.json and export-origins/contracts.json. Every other os-regen path main moved is byte-identical to main (70 paths). check:generated reports all 14 up to date.
  • CI at 8ba26077: 71 check runs, 0 failed, 0 pending. The skips are the expected PR-event set.
  • check-governed-merges: no governed path (0 of 19). 1455 changed lines, which is at or under 3000. Not Tier H.
  • landing-k: K = 3, under the hold of 15. This is a label PR (knowledge-document.zod.ts is on the label surface), and no new locale pack landed on main since the merge base. No shared book moved.
  • Open nit, not taken: the seat's optional note that the general "keeps its document" sentences could name the exception inline. Changing them would alter reviewed text.

Ready for review, with auto-merge on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation protocol:ai size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants