Repository navigation
Labels
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivesdomain:serverDomain lane — seat card indexed by label:pm:seatpriority:p2Medium: important, M3
Description
maintainer · os-bob · session_012dn2AecKpLaYkUtNRiqtby
Filing gate: ③ maintainer-directed (topic child). Source: topic #37000 (phase 2 row 2); maintainer 2026-11-24 「用fable评审,并分拆第二阶段的任务」. Reviewed by an independent Fable pass before filing.
Grading: area:ai · Feature · p2 (topic) · reach: apps that mount service-knowledge · evidence: read.
维护者速读
- 做什么:向量存储能列出自己存了哪些文档;全量重建时,内容没变的文档跳过,源数据里已经没有的文档清掉;写一套所有存储都要跑的契约测试。
- 谁受益:事件同步漏掉的失效内容,会在全量重建时被清掉;重建不再把没变的内容重新发给嵌入服务;之后的 pgvector、turso 用同一套测试保证行为一致。
- 需要你做的:无。
What
- Contract, shape per ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return;
knowledge_sourcebecomes a governed type #37001 (all optional):IKnowledgeAdapter.listDocuments?(ctx, { cursor?, limit })→{ documentId, docHash }[]plus a next cursor (packages/spec/src/contracts/knowledge-adapter.ts).KnowledgeDocument.docHash?(packages/spec/src/ai/knowledge-document.zod.ts): a hash of the assembled document (content, title, metadata; stable key order; version prefix), computed by the service, stored by the adapter, returned as stored.
knowledge-service.tsreindexSource: before the walk, list the adapter's documents (id → docHash). A row whose computed docHash equals the listed one is not upserted (this is docHash's reader).- Purge, one exported function (row 15's reconcile reuses it). It runs only on a complete walk: not with
limit, not withdryRun, not when any page failed. Candidates = documents listed before the walk − documents seen in it. Each candidate is confirmed by service-knowledge: record-change sync ignores the sourcewhere, and a restored record never re-enters the index #36991's re-read (where+ id) before it is deleted, so a document created by event sync during the walk is kept. A source withrefresh.onRecordChange: false(an external indexer owns the index) is not purged. An adapter withoutlistDocuments: no skip, no purge, result sayspurged: null; today's behaviour otherwise. - Result gains
skippedandpurged(fields only added). knowledge-memoryimplementslistDocuments(reference implementation).- A contract test suite exported from
service-knowledge(test-only entry): upsert / search / delete / list / skip / purge cases any adapter runs with its own factory.knowledge-memoryruns it here. - API surface baseline and
content/docs/protocol/knowledge.mdxupdated.
Acceptance
- After one complete reindex: a row deleted in the source and a row that stopped matching
whereare gone; an unchanged row is not upserted (stub adapter counts calls). - With
limit, withdryRun, or with a failed page: nothing is purged. - A document created by event sync during the walk survives the purge.
- A stub adapter with no
listDocumentsbehaves exactly as today. - The suite passes on
knowledge-memory;listDocumentspage boundaries (0, one page, page+1). - Container run per AGENTS.md.
Out of scope
dropSource(lands with its first reader, row 3's source removal, per ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return;knowledge_sourcebecomes a governed type #37001's list).- Running the purge on a schedule (row 15).
knowledge-ragflow(being retired by Retire @objectstack/knowledge-ragflow: package, settings option, docs and skill mentions #37004).
Blocked-by: #37001 (contract members), #36992 (same function, paged reindex).
Parent: #37000. Reader: domain:server lane (packages/services/service-knowledge, packages/plugins/knowledge-*; spec edits per spec.md).
Dedupe: listDocuments 0 · purge stale knowledge 29 (open 5: #36992 paging only, #37000, others unrelated) · reindexSource 8 (open: #36991, #36992, #37000, a seat post).
Metadata
Metadata
Assignees
Labels
area:aiAI-native — agent / tool / skill metadata, and the MCP surface an agent drivesdomain:serverDomain lane — seat card indexed by label:pm:seatpriority:p2Medium: important, M3
Activity
objectstack-fleet commentedon Nov 24, 2026
triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE
Triage: first touch 2026-11-24T20:32Z
pm:blockedanddomain:serveradded. The card has no state yet, and itsBlocked-by:cards (ADR: knowledge platform boundary — the platform owns document assembly, sync and reconcile, structural split and record-level return;knowledge_sourcebecomes a governed type #37001, service-knowledge: reindexSource reads the whole object in one unbounded find and upserts it in one call #36992) are still open.knowledge_sourcebecomes a governed type #37001). Triage's unlock scan moves the card when every blocker closes.objectstack-fleet commentedon Nov 24, 2026
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL
Claim: PM loop round 1
Session:
session_01QSeKYpRrYuqSLCvbSk9zrLAccount:
os-justinBranch:
claude/issue-37096-knowledge-list-purgeWorktree:
objectstack-issue-37096Domain:
domain:serverSeat:
repo:objectstack#4Area: a4-K
File surface:
packages/spec/src/contracts/knowledge-adapter.ts,packages/spec/src/ai/knowledge-document.zod.tsand the spec artifacts they regenerate (api-surface, schema),packages/services/service-knowledge/**(incl. a test-only entry for the contract suite),packages/plugins/knowledge-memory/**,content/docs/protocol/knowledge.mdx,.changeset/*(stop on breach; explain in the report)Container & model:
M,mode:cloud,model: default (dispatch-gates --repo objectstack-ai/objectstack --tier: "no path-derived mandate"; Clause-② review owed at CONTRACT_REVIEW_TIER by surface),effort: highClause-②: yes
Metadata-protocol: none
Responsibility: n/a — not a defect card
Thread-read: 7143730265
Premise: holds — on origin/main 6f3a8da
IKnowledgeAdapterhas nolistDocumentsandKnowledgeDocumentnodocHash;reindexSourcepages (PR #37129) and never purges.Serial constraints cleared:
Blocked-by: #37001(PR #37119 merged as 6f3a8da) and#36992(PR #37129 merged as bee9b68) — both closed. Open PRs on these paths: none (#37155 is.github/workflows/ci.yml+ a driver-sql test).Pre-claim lane:
packages/services/service-knowledge,packages/plugins/knowledge-*(domain:server), andpackages/spec/src/contracts/knowledge-*/packages/spec/src/ai/knowledge-*— all inside this zone's lease roots; the spec edits stay in this lane (area-lease 留道), reviewed percontract-review.md.Pre-claim deps: both
Blocked-by:targets closed.Prior rulings read: ADR-0161 (merged): K8 items 1–2 are this card's members, shapes as the card states; K8 "What counts as a member"; the maintainer's rulings on #37119 (7145942375).
check-prior-rulings.mjs: 12 hit lines in 4 files, read by the dev against the diff.State:
pm:blocked→pm:dispatchedin this stroke; everyBlocked-by:target is closed.objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#4 · os-justin · session_01QSeKYmGV9ehU2Bfmw95h7E
os-dev-report
{ "issue": 37096, "status": "blocked", "branch": "claude/issue-37096-knowledge-list-purge", "pr": "https://github.com/objectstack-ai/objectstack/pull/37164", "session": "session_01QSeKYmGV9ehU2Bfmw95h7E", "premise_still_valid": true, "summary": "Implemented in-surface (draft PR #37164, head c6e78ea5): IKnowledgeAdapter.listDocuments? and KnowledgeDocument.docHash? (ADR-0161 K8 items 1-2, K8's shapes: { documents, nextCursor? } with docHash? per entry); computeDocHash (v1: + sha256 over content/title/metadata, keys sorted); reindexSource lists before the walk and skips unchanged docs; exported purgeDocuments runs only after a complete walk, confirms each candidate with the event sync's re-read (extracted unchanged into one helper rereadRow, now shared) on the per-document sync chain; knowledge-memory implements listDocuments; contract suite at @objectstack/service-knowledge/testing (ESM-only ./testing, service-cluster precedent) run by knowledge-memory; protocol doc and regenerated spec artifacts. BLOCKED on two paths outside the dispatched file surface, asked of the PM by send_message twice, unanswered: (1) packages/spec/src/contracts/knowledge-service.ts — KnowledgeReindexResult needs skipped?/purged? (card What 4, K8 'results of IKnowledgeService'); without it service-knowledge does not compile (TS2353 x9), so build/typecheck/dts-closure are red; (2) packages/plugins/knowledge-ragflow/vitest.config.ts — one anchored ./testing alias line, else check:test-source-alias is red. Not blocked: everything else is written, tested and pushed; on a yes both edits are small and the PR completes on the same branch.", "tests": "head c6e78ea5, under os-verify-lock: `pnpm --filter @objectstack/service-knowledge exec vitest run` Test Files 8 passed (8), Tests 164 passed (164); `pnpm --filter @objectstack/knowledge-memory exec vitest run` Test Files 2 passed (2), Tests 20 passed (20) (the contract suite is 12 of them). Ablations, committed first, via ablation-replace (anchor 1->0, blob verified, restored to HEAD blob, git diff HEAD empty): purge re-read removed -> 3 failed | 72 passed in knowledge-service.test.ts; skip removed -> 5 failed | 70 passed in knowledge-service.test.ts, and 1 failed | 11 passed in the knowledge-memory contract suite. Tests import src (relative / vitest alias), so no dist rebuild was involved. typecheck NOT run for service-knowledge/knowledge-memory: blocked item 1 makes it fail by construction (spec build dts passed).", "gates": "dispatch-gates --ran at c6e78ea5: 131 derived, 124 run, 7 NOT-MEASURED, 0 UNRUN (exit codes recorded before any pipe). Red: check:test-source-alias exit 1 (blocked item 2); check:dts-closure exit 1 (service-knowledge has no dist; blocked item 1). NOT MEASURED: check-plugin-teardown-shape --self-test exit 3 (pinned fixture commit not in this shallow clone); spec check:skill-examples, check:dual-build-cjs-loads, check:published-readme-exports exit 3 (need built packages; service-knowledge cannot build); check:query-options-erasure, check:slot-lookup, check:type-check-debt exit 124 (local per-command cap). All others exit 0, incl. spec check:generated after --fix of exactly the 3 proved stale (api-surface, export-origins, docs), check:tenant-audit-census after typing the suite's receivers (c6e78ea5). Local-only: check:skill-frame-freshness 0; check:dev-prereqs 1 (workspace not fully built). CI check-runs on #37164: not yet read (in_progress at report time).", "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm", "mcp_calls": "3 — mcp__github__issue_read get #37096, mcp__github__issue_read get_comments #37096, mcp__github__pull_request_read get_comments #37119 (reads only)", "api_writes": "2 relay dispatches (POST /repos/objectstack-ai/objectstack/dispatches): pr_create #37164 with its assignees leg (os-justin); this os-dev-report comment via post-stamped.mjs. Plus git pushes to the branch (not REST).", "open_questions": [ { "question": "May the file surface grow by packages/spec/src/contracts/knowledge-service.ts (KnowledgeReindexResult gains optional skipped?: number and purged?: number | null, plus the api-surface regeneration)?", "options": [ "A — yes: two optional fields on the contract result, as the card's What 4 and ADR-0161 K8 place them", "B — no: the service declares a widened return type locally (a second dialect of the contract result)", "C — split What 4 into its own card (the PR stays red until it lands)" ], "recommendation": "A, because K8 names the reindex result of IKnowledgeService as the fields' home, and B/C leave either a forked type or a PR that cannot compile" }, { "question": "May the file surface grow by packages/plugins/knowledge-ragflow/vitest.config.ts (one anchored @objectstack/service-knowledge/testing alias before the bare entry)?", "options": [ "A — yes: the gate's own printed fix, test config only", "B — publish the suite without an exports entry (breaks the card's 'exported from service-knowledge' and the precedent)" ], "recommendation": "A, because it is a one-line test-config change the gate prescribes; ragflow's adapter code is untouched" } ], "security_findings": "none", "out_of_scope_findings": [ "carrier: none · noted, not filed — the purge re-reads by the record id text recovered from the document id; an engine that does not match '5' against numeric 5 could purge a document whose row was restored during the walk (in PR acceptance notes)", "carrier: none · noted, not filed — knowledge-memory stores no chunk for empty-content documents, so they are never listed (safe direction)" ] }objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#4 · os-justin · session_01QSeKYmGV9ehU2Bfmw95h7E
os-dev-report
{ "issue": 37096, "status": "done", "branch": "claude/issue-37096-knowledge-list-purge", "pr": "https://github.com/objectstack-ai/objectstack/pull/37164", "session": "session_01QSeKYmGV9ehU2Bfmw95h7E", "head_sha": "ffc6bff4", "premise_still_valid": true, "summary": "Patch round on L1 REWORK 7151268664 and contract review 7151166003. S1: a walk page that answers no list now goes through stopped() (ok:false, purged:null) and rereadRow throws on a non-list answer, so the purge stops with ok:false instead of deleting every candidate. S2: a test holds the purge between its re-read and its delete while a restore's event sync arrives, and asserts the document is present (red when serialize is a direct call). S4 fixed inside service-knowledge, no driver or spec-shape change: when the re-read by the id text finds nothing and the text is a canonical safe integer, the purge asks again by the number, so a caller-supplied numeric id on driver-mongodb / driver-memory is found; the event sync path is unchanged. S3: 维护者速读 says the skip and the purge happen only over adapters with listDocuments (knowledge-memory today; ragflow unchanged) and that a failed purge answers failure. N1/N2: changeset in plain wording, the purgeDocuments sentence dropped, purged TSDoc lists every null case and what an absent key means; protocol doc says indexDocument refuses a carried docHash, how a numeric id is confirmed, and that a non-list answer stops the walk or the purge. Earlier rounds: indexDocument refuses a caller-supplied docHash (58478caf); changeset spec minor + Metadata-protocol: added + Skills-docs (eddd9a64); KnowledgeReindexResult fields and the ragflow alias line under the zone's surface grant (cf8b70ae).", "tests": "ffc6bff4 under os-verify-lock: build spec, service-knowledge, knowledge-memory, knowledge-ragflow exit 0; typecheck of the three packages exit 0 (tsc --noEmit + check:test-typecheck, each echoed); vitest service-knowledge 8/8 files 169/169 tests, knowledge-memory 2/2 files 20/20, knowledge-ragflow 1/1 files 10/10. Ablations via ablation-replace on the committed head, each 'ok mutation landed' then 'ok restored: blob == HEAD, git diff HEAD empty': page guard -> break: 1 failed | 79 passed (the page test); re-read guard -> return undefined: 1 failed | 79 (the re-read test); serialize -> direct task(): 1 failed | 79 (the chain test); numeric re-ask deleted: 1 failed | 79 (the numeric test). Earlier ablations (purge confirm, skip, indexDocument refusal) stand.", "gates": "dispatch-gates --ran at ffc6bff4: 131 derived, 127 run, 4 NOT-MEASURED, 0 UNRUN, exit codes recorded before any pipe. NOT MEASURED (exit 3): check-plugin-teardown-shape --self-test (pinned fixture commit 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). check:dts-closure exit 0. check-comment-mask-corpus, check:query-options-erasure, check:slot-lookup, check:type-check-debt hit my 100s local cap and reran exit 0 with a longer one. spec check:generated exit 0 (all 14 up to date). Changeset gates against the PR body as the event: check-changeset-no-major exit 0, check-empty-changeset exit 0, check-adr-0087-registration exit 0; check:nul-bytes exit 0. overlap-check before the push: VERDICT clean. CI check-runs at ffc6bff4: not read (in progress at report time).", "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm", "mcp_calls": "5 total, reads only: issue_read get + get_comments #37096, pull_request_read get_comments #37119, pull_request_read get_comments #37164 (this round)", "api_writes": "7 relay dispatches total: pr_create #37164 (+assignees), os-dev-report 7148521174, issue_patch #37164 x4 (rounds 2-5), and this os-dev-report. Plus git pushes.", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "carrier: none · noted, not filed — knowledge-memory stores no chunk for an empty-content document, so it is never listed: rewritten on every reindex, never purged (safe direction; accepted in L1 N3)" ] }objectstack-fleet commentedon Nov 25, 2026
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL
Delivered · PR #37164 merged as
d7f299c0b1, through the merge queue. Not Tier H.KnowledgeAdapter.listDocuments?,KnowledgeDocument.docHash?(computed by the service; a caller-supplied value is refused byindexDocument), andskipped?/purged?on the reindex result. Spec minor,Metadata-protocol: added.service-knowledge: a complete reindex skips documents whose hash is unchanged, and purges documents its source no longer has. The purge runs only after a complete walk, and it confirms each candidate with the existing re-read before it deletes../testingexportsrunKnowledgeAdapterContract.knowledge-memoryimplementslistDocumentsas the first reader.content/docs/protocol/knowledge.mdx.48ed4f12. The landing merge8ba26077changed only the generatedauthorable-surface/ai.json. Landing record: comment 7154527055.pm:dispatchedremoved. Zone a4-K closes out this card.