Repository navigation
docs(adr): ADR-0161 — the knowledge platform boundary; knowledge_source becomes a governed metadata type - #37119
Conversation
…ource admission Proposed record. The platform owns document assembly, sync and reconcile, structural split and record-level return; adapters own embedding calls, hybrid retrieval, rerank and file parsing. knowledge_source is admitted as a governed metadata type under ADR-0088. The index row is regenerated by adr:index. No file outside docs/adr/ changes. Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
…d controls Bare symbol spans become path-qualified anchors or plain names, two paraphrases that stood in quotation marks are unquoted, the zero-reader counts name their controls, and the execution table says which open points wait on a ruling. Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
An open pull request holds 0160 for another record, so this record moves to the next free number: the file is renamed, the title line follows, and the index is regenerated by adr:index. The record's text is unchanged. Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL Final head for L1 (2026-11-24T20:34Z):
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: Read: card #37001 body and all 8 comments (incl. the cloud confirmation ① Derived judgmentsThe diff changes no accept-set and no published surface today; it commits the platform to the following, each judged against the rulings and the live tree.
② Semver levelClause-②: no — correct. The diff is two files under ③ Boundary flagsDev flags.
The four "Questions for the maintainer" — ESCALATED, all four are the maintainer's. This record's view of each recommendation and of whether the text takes either answer:
SQL push-down check (Prime Directive 5): the record prescribes an enumerate-then-diff purge (K8 item 1) and a per-hit re-read as the caller. Not a finding: the index is adapter-owned behind a contract and may sit in another store, so the anti-join cannot be pushed down in general. The record does not state that reason; row 2 and row 15 should (N3). ④ Design judgmentThe seven card items. All seven are present: 1 boundary and revised texts (K1, K2); 2 supersessions by name (K3); 3 ADR-0088 admission, v1 keys, Against the other records. No contradiction found with ADR-0087 (K6 uses conversion entry, ADR-0088 admission. Sound. Clause 1: a source has its own name, its own index and generations, and binds by M1 (must-fix) — K8's list does not match the maintainer's input on the card nor the phase-2 cards that read it, and K8 rule 5 with K10 rule 2 make that mismatch binding. Comment
S1 (should-fix) — the direct-push door is not in the design. S2 (should-fix) — the fingerprint rule is not complete.
S3 (should-fix) — two doors, one name. S4 (should-fix) — authoring a source is an egress and cost decision with no stated guard. K4 clause 2 opens runtime authoring through Studio and MCP; K5 says the listed fields leave the row store and #37099 says a first build sends the whole source to the provider. The record should bind row 3 to state which permission admits authoring and that PR #36850's source admission is evaluated for a newly authored item, not only at search. Nits. N1 Implemented-by: VERDICT: FAIL |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
The contract section answers the maintainer session's sixteen contract items in order, each accepted, deferred or refused, with its final shape and the card that first reads it, and says what counts as a member. The execution table follows the epic's current layout. The fingerprint rule gains the adapter-reported embedder, the applied split, a recipe hash as the trigger for repair inside a generation, and a refusal on the search side. The record states what the push door becomes, the one-name rule across the two doors, and the two guards on authoring a source. Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL Final head for delta review (2026-11-24T21:15Z):
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: Delta review of the record at head ① Derived judgmentsThe diff still changes no accept-set and no published surface. What moved since the prior head, each judged against the contract input, the phase-2 cards and the tree:
② Semver levelUnchanged and still correct. Clause-②: no; two files under ③ Boundary flagsThe zone's two points (comment
Dev flags (comment
The three "Questions for the maintainer" — ESCALATED, all three are the maintainer's, each with options and a recommendation, and the record takes either answer locally:
SQL push-down check (Prime Directive 5): the reason is now in K1 (the index may sit in another store; the adapter-side form returns as item 13 with its reader). No finding. The dev's two claims about other cards, verified. Outside the graded findings; both are the epic owner's card edits.
④ Design judgmentThe prior findings, by id.
New in the delta. S5 (should-fix) — the build lifecycle that item 8 adds is not complete. It is new contract text past the input's words, and K8 rule 5 closes the list, so a gap found by #37099, #37101 or #37107 costs a dated Tier H note.
Nits. N7 K7 rule 4 does not say what a search over several sources answers when one source is refused (the whole call refused, or the rest answered with the refusal reported); name the owner (#37100 or the service). N8 the recipe hash covers "withheld by the field-egress declaration" but is re-read only at boot and on a source reload, so a declaration changed at run time is not seen until then; the egress record should carry that trigger. N9 row 3 says how the service knows the deployment's adapter when several are mounted. M1: closed. S1: closed. S2: closed. S3: closed. S4: closed. S5: open (should-fix, new in this delta). No must-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
A build is opened by a call beside the one that ends it, never guessed from a write. The states that start a rebuild gain the index that holds no recipe hash and the adapter that reports no status. The index stamp, the status and the two build calls land in one change. A search over several sources answers from the ones it can search and names the rest. The record says where a run-time change of an egress declaration is picked up and how the deployment's adapter is known. Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL Final head for delta review (2026-11-24T21:49Z):
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: Second delta review, of the record at head ① Derived judgmentsThe diff still changes no accept-set and no published surface. What moved since the prior head:
② Semver levelUnchanged and correct. Clause-②: no; two files under ③ Boundary flagsDev flags (comment
The three "Questions for the maintainer" — ESCALATED, unchanged in text and in options; the prior record's reading of each recommendation (all three sound) stands. The body's ◆ table gained item 8's new wording and the row for a search over several sources. SQL push-down check (Prime Directive 5): the delta adds no id materialisation and no in-app join. No finding. ④ Design judgmentS5, by part.
S5: closed. N7 to N9. N7 closed (K7 rule 5; owner #37100, or a card split from it for the service's lane). N8 closed (seen at the next boot or source reload, and not before; the run-time trigger is asked of the field-egress record). N9 closed (the runtime that mounts a store for the No decided shape changed. Checked hunk by hunk: No new defect at must-fix or should-fix. Nits, none of which affects correctness of the contract:
Card-side, outside the graded findings; the zone's or triage's.
M1: closed. S1: closed. S2: closed. S3: closed. S4: closed. S5: closed. N1 to N9: closed. No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Contract reviewServed-tier: Second delta review, of the record at head ① Derived judgmentsThe diff still changes no accept-set and no published surface. What moved since the prior head:
② Semver levelUnchanged and correct. Clause-②: no; two files under ③ Boundary flagsDev flags (comment
The three "Questions for the maintainer" — ESCALATED, unchanged in text and in options; the prior record's reading of each recommendation (all three sound) stands. The body's ◆ table gained item 8's new wording and the row for a search over several sources. SQL push-down check (Prime Directive 5): the delta adds no id materialisation and no in-app join. No finding. ④ Design judgmentS5, by part.
S5: closed. N7 to N9. N7 closed (K7 rule 5; owner #37100, or a card split from it for the service's lane). N8 closed (seen at the next boot or source reload, and not before; the run-time trigger is asked of the field-egress record). N9 closed (the runtime that mounts a store for the No decided shape changed. Checked hunk by hunk: No new finding above nit. Nits, none of which affects correctness of the contract:
Card-side, outside the graded findings; the zone's or triage's.
M1: closed. S1: closed. S2: closed. S3: closed. S4: closed. S5: closed. N1 to N9: closed. No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 维护者速读
需要你裁决的三个问题(业务语言)
由这份记录直接定下的两点(合并即认可,不认可请先划掉)
Hand-off · 2026-11-24T22:00Z · @os-zhuang — PR #37119 (card #37001, ADR-0161, knowledge platform boundary) is ready for your rulings and approval. Docs only. Seat ACCEPT above at this head; contract review PASS 7145632759, Head-sha |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Landing · 2026-11-24T22:10Z · authorized approval in place: os-zhuang APPROVED at head The hand-off's brief said approval accepts the record as drafted unless a question is struck; none was struck, so the three questions stand at the draft's recommendation (A each), together with the two points the record decides itself. Check-runs at this head: 28 success, 33 expected skip, 0 failed. Ready and queued by the seat; |
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Ruling recorded · 2026-11-24T22:12Z · the three maintainer questions in this PR's body. The maintainer in seat repo:objectstack#4's session, verbatim: 「37119 三个建议我都同意」
This confirms the reading recorded at landing (7145908305). |
Resolve the docs/adr/README.md conflict with ADR-0160 (#37115) by regenerating the index with `pnpm adr:index`; no hand merge. Claude-Session: https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Re-landing · 2026-11-24T23:03Z · the merge queue removed this PR at 22:48Z on a
A merge-only head move keeps the approval (os-zhuang at |
…ne walk per source at a time (objectstack-ai#37129) Fixes objectstack-ai#36992 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:挂了知识检索的应用,管理员手动重建某个知识源时,系统改为每次读 100 条、写 100 条,大表不再一次全读进内存;同一知识源的两次重建会排队依次执行;文档和告警不再声称重建能清掉已删除记录的检索内容。 - 为什么做:知识检索平台化专题第一阶段的「数据多了也不能崩」——原来重建一次把整张表读进内存再一次性交给索引服务,数据量大时会撑爆内存或超时。 - 出错会怎样:只影响挂了知识检索服务的应用的手动重建;某一页失败时重建停在那一页并在结果里说明是哪一页,之前写入的不回退;已删除记录的旧内容仍要等「索引清理」那张卡落地才会被清掉;改动可直接撤回。 - 要你做的:无。 ## What changes `KnowledgeService.reindexSource` (`packages/services/service-knowledge/src/knowledge-service.ts`) for an `object` source, per card items 1-5: - **Keyset paging by id (item 1).** The walk reads at most `REINDEX_PAGE_SIZE` = 100 rows per `find(object, { where, orderBy: [{ field: 'id', order: 'asc' }], limit }, { context: system })`. Page 1 sends the source's `where` alone. Every later page sends `{ $and: [where, { id: { $gt: cursor } }] }` (or just the cursor condition when the source has no `where`), where the cursor is the previous page's last id, kept in its own type. Each page is upserted in its own `adapter.upsert(docs, { source, reason: 'reindex' })` before the next read. Every `find` carries a `limit`, and no `upsert` holds more than one page. Each row goes through the same `recordToDocument(source, objSource, row, this.schemaFor(object))` gate the event sync uses; no second builder was added. The system context now travels in the trailing options argument (the `IDataEngine` contract's position) and no longer inside the query behind an `as never` cast. - **Only an empty page ends the walk.** A page that comes back short of its `limit` is followed by the next read: `find` does not promise `min(limit, remaining)` rows, because an `afterFind` hook may drop rows from a page (`packages/objectql/src/engine-find.ts`). So a 101-row object takes three reads, the last one empty. - **Failure ends the run with `ok: false` and names the page (item 1).** A read, a document build or an upsert that throws returns `{ ok: false, object, discovered, indexed, message }`. The message reads `reindex of source 'S' stopped at page N (after id 'X'): ...` with the cause (an `Error`'s message, any other thrown value via `String(...)`), and the counts cover the pages done before it. Those pages stay in the index. Two further stops prevent an endless walk: a page whose last row has no id, and a last id that did not move past the cursor (an engine that ignored the id condition). Each returns `ok: false` and names its page. Before this change, a failure threw out of `reindexSource`. - **What is serialized, and what is not (item 1).** The record sync's per-document promise chain from objectstack-ai#37075 is now one module-level helper, `chainAfter(tails, key, task)`, which returns the task's own outcome while the chain itself never rejects. `serializeRecordSync` delegates to it unchanged in meaning, and `reindexSource` chains on a separate `reindexTails` map keyed by source id. So a second reindex of the same source waits for the first and their pages never interleave; different sources still run concurrently. Record events do NOT wait for a walk. A row updated or deleted between a page's read and that page's upsert is written back from the older read, and a deleted row's document then stays as a ghost until the index purge (objectstack-ai#37096). That race predates this PR, and paging narrows its window from the whole object to one page. The jsdoc and the changeset say exactly this. - **`limit` / `dryRun` (item 2).** `opts.limit` keeps its total-cap meaning: each read asks for `min(100, limit - discovered)`, and the walk stops at the cap without an extra read. A fractional `limit` is floored. A negative or non-finite one (`-1`, `NaN`, `Infinity`) is refused with `ok: false` and nothing is read; before this change such a value went straight to `find`. `dryRun` calls `count(object, { where }, { context })`, reads no rows, and reports `min(count, limit)`. - **Page size (item 3), my reading.** Item 3 said to match the embedder's per-request cap until the `embedder-openai` sibling landed, then follow it. That sibling (objectstack-ai#36995) landed as objectstack-ai#37037, and `OpenAIEmbedder` now splits a larger input set into requests of its own cap. So the page size is no longer an embedder-correctness bound; it bounds memory and the size of one adapter call. I kept 100 as a module constant and did not add an option: `KnowledgeReindexOptions` is a spec contract, and `KnowledgeServiceOptions` is not forwarded from any config a host writes. `REINDEX_PAGE_SIZE` is exported from the module for the tests only and is not re-exported from `index.ts`, so the published `dist/index.d.ts` export list is unchanged. - **Result shape (item 4).** `{ indexed, discovered, object?, ok, message? }` is unchanged. No fields were added, so no published type widens. - **No purge (item 5).** A reindex still removes no documents, and no adapter-contract member was added. The knowledge-platform ADR (objectstack-ai#37001 / objectstack-ai#37119) is not merged. - **No surface claims a reindex removes documents any more.** These sites are reworded; behaviour is unchanged. Each now says a reindex refreshes the rows that still exist and match, and that the documents of deleted (or no-longer-matching) rows wait for the index purge (objectstack-ai#37096): - `content/docs/protocol/knowledge.mdx`: the predicate-write callout ("Repair such an index with an explicit `reindexSource`") and the rolled-back-write passage (a document built from an insert that rolled back has no row left to repair it from). - The same rolled-back-write passage in `handleRecordUpsert`'s jsdoc. - The bulk-write warning in `knowledge-service-plugin.ts`. As a runtime string it names the purge in words, with no tracker number. Its existing pins in `event-sync-data-events.test.ts` still hold. ## Tests `src/__tests__/knowledge-service.test.ts` adds a new top-level `describe('KnowledgeService — the reindex walk pages by id')` (25 cases) in the existing harness file. Its engine double throws on any `find` without a positive `limit`, without `orderBy` id asc, or without the system context, and on any operator it does not implement. It orders numbers numerically and everything else by string. Rows are inserted in shuffled order, so the walk sees only the engine's ordering. - Boundaries: - 0 rows: one read, no upsert. - Exactly 100 rows: one upsert of 100, then a page-2 read of `{ id: { $gt: 'r099' } }` that comes back empty. - 101 rows: upserts of 100 then 1, each row exactly once, in id order, then a third, empty read of `{ id: { $gt: 'r100' } }`. Every read is limited to 100, every upsert holds at most 100, and the reason is `reindex`. - A short page is not the end: the first full page comes back with 99 of its 100 rows (the drop an `afterFind` hook can make), and every later row is still upserted (pages 99/100/50, 249 rows, 4 reads). - Numeric ids 1..150: the cursor keeps the number (`{ id: { $gt: 100 } }`, then `{ id: { $gt: 150 } }`), and the pages follow numeric order. - The source's `where` is ANDed with the cursor (the exact page-2 `where` is asserted). - `limit`: - 150 / 100 / 30 / 0 read `[100,50]` / `[100]` / `[30]` / nothing. - A `limit` above the row count reads to the end. - 150.7 is floored to 150. - -1, NaN and Infinity are refused with `ok: false` (plain and `dryRun`), with no `find`, no `count` and no upsert. - `dryRun` uses `count` under the `where`, capped by `limit`, with zero `find` calls. - Failures, each `ok: false` with the counts of the pages done before it: - A failed read on page 2 and a failed upsert on page 2: the message names `page 2` and `after id 'r099'`, the counts are 100/100, and the next walk after a failure runs (the lock is released). - A document build that throws on page 2. - A thrown non-`Error` is reported by its text, never as `undefined`. - An engine that ignores the cursor ends the walk at page 2 instead of looping. A last row with no id ends the walk after page 1. - A concurrent second reindex of the same source makes no read while the first one's read is held, and the upsert order is `r000+100, r100+50, r000+100, r100+50`. Walks of different sources do not wait for each other. The two older reindex tests were updated for the new call shape. The context is read from the trailing argument. `dryRun` asserts that `count` is called and `find` is not. Their doubles now answer an empty next page, as a cursor-honouring engine does: they used to return the same rows for every read, which this walk now correctly reports as a cursor that did not advance. ## Acceptance notes - **Cursor order on a SQL driver, checked once.** The zone confirmed that a single check is enough. `service-knowledge` cannot reach a SQL driver: its dependencies are `core`, `objectql`, `platform-objects`, `service-settings` and `spec`. A committed test would need `@objectstack/driver-sql` as a devDependency plus a `pnpm-lock.yaml` importer entry, and the lockfile is outside this PR's file surface. So the check is a scratch measurement against this branch's source, re-run on the current head (readings under Verification). - `KnowledgeReindexResult.ok`'s jsdoc in `packages/spec` ("an adapter / source check prevented the run") now also covers a failed page and a refused `limit`. That is outside this PR's file surface, and the wording is still broadly true. - `dryRun`'s `count` is not wrapped: a failing count still rejects, as the old `dryRun` read did. The card's `ok: false` rule is about pages. ## Verification Read first (risk order): 1. `knowledge-service.ts` `walkObjectSource`: the loop's exits (empty page, cap, and the two non-advance stops) and the cursor `where` composition. 2. `knowledge-service.ts` `chainAfter` and `serializeRecordSync`: the event-sync chain now goes through the shared helper. 3. `knowledge-service.test.ts` `pagedEngine`: the double's refusals are what make "every find has a limit" fail loudly. Two-minute check: run `pnpm --filter @objectstack/service-knowledge exec vitest run src/__tests__/knowledge-service.test.ts`. Expect 53 passing tests, 25 of them under `the reindex walk pages by id`. Every reading below was taken at head `9e24b96c`, the final commit. <details><summary>Package tests and typecheck</summary> ``` pnpm --filter @objectstack/service-knowledge test Test Files 8 passed (8) Tests 142 passed (142) pnpm --filter @objectstack/service-knowledge typecheck check:test-typecheck: OK — 0 file(s) / 0 error(s) / 0 pinned signature(s) ``` </details> <details><summary>Ablations (source-resolved subject: the test imports ../knowledge-service.js, so no dist is on the path; each mutation made by scripts/ablation-replace.mjs; each restore proven by blob == HEAD and an empty git diff HEAD)</summary> ``` A4 (9e24b96) restore `if (rows.length < want) break;` after the page upsert -> 3 failed (one page + 1, the short-page pin, numeric ids), 50 passed (a first attempt was refused by the tool before any test ran: its replacement contained the anchor, so the anchor count could not drop) A1-A3 (99518e6, before this round; the code they mutate is unchanged) A1 delete `limit: want,` from the page read -> 12 failed (the double refuses an unbounded find) A2 bypass chainAfter on reindexTails -> 1 failed (the never-interleave pin) A3 drop the `id > cursor` condition -> 7 failed; the walk still terminated (the non-advance stop held) ``` </details> <details><summary>SQL driver: one scratch run of ObjectQL + SqlDriver (better-sqlite3, :memory:) against this branch's source at 9e24b96</summary> The run used 250 rows of a `kb_note` object, inserted in shuffled order: 16 explicit ids chosen to stress ordering (`a A b B r9 r10 r100 Z z 0 9 10 _x -y r_1 r-1`) plus 234 engine-generated ids. 191 rows have `status = 'open'`. The fourth read is the empty one that ends the walk. ``` rows 250 result {"ok":true,"object":"kb_note","discovered":250,"indexed":250} pages 100,100,50 finds 4 maxPage 100 pageSize 100 each row once true walk order == engine id order true every find limited true page2 query {"where":{"id":{"$gt":"MutQpGXcbru5V4DJ"}},"orderBy":[{"field":"id","order":"asc"}],"limit":100} open: rows 191 result {"ok":true,"object":"kb_note","discovered":191,"indexed":191} once true page2 query {"where":{"$and":[{"status":"open"},{"id":{"$gt":"XhVtf05MZ_zLLW3V"}}]},"orderBy":[{"field":"id","order":"asc"}],"limit":100} limit 150 {"ok":true,"object":"kb_note","discovered":150,"indexed":150} reads 100,50 dryRun {"ok":true,"object":"kb_note","discovered":191,"indexed":0,"message":"dryRun=true; no documents pushed."} ``` </details> <details><summary>Local gate subset (dispatch-gates --commands, derived from merge base eec6fb3, 5 paths): 100 derived, 98 exit 0, 2 NOT MEASURED</summary> ``` dispatch-gates --ran: 100 derived famil(ies) accounted for — 98 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3) NOT MEASURED: pnpm check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET (64 packages have no dist/; reads the whole monorepo's built output) NOT MEASURED: pnpm --filter @objectstack/spec run check:skill-examples, reason: PREREQUISITE NOT MET (client / client-react have no dist/; selected by the docs page) doc authoring guard: 23493 customer-facing string(s) ... clean — no internal issue-id references check-nul-bytes: OK (no raw ASCII control bytes) eslint --no-inline-config on the three changed source files: exit 0 ``` CI runs both NOT MEASURED families on a full build. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYpRrYuqSLCvbSk9zrL)_ <!-- signed: repo:objectstack#4 · os-justin · session_01QSeKYpRrYuqSLCvbSk9zrL --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #37001
Clause-②: no
Metadata-protocol: none
This PR is one decision record and its index row. It changes no file outside
docs/adr/, and no schema, contract member or behaviour.Sequencing: draft PR #37115 holds record number 0160 and also regenerates
docs/adr/README.md, so the two pull requests conflict on that one generated file and on nothing else. Whichever of the two lands second mergesmainand re-runspnpm adr:index. This record takes 0161.维护者速读
4fa0cdc5710d645580d23a914f4d55e67ed3a5a4。What changes
docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md, Status Proposed, with a## Provenancesection naming objectstack-ai/cloud#4960 and the cloud record it produced.knowledge_sourceunder ADR-0088 with its v1 keys; the ADR-0087 dispositions for two renames and three removals; the index fingerprint and generations; the contract additions; onesearch_knowledgedefinition for every transport.docs/adr/README.mdis regenerated bypnpm adr:index(one row, three counts).Second round, after the contract review on this PR at head
7e71f545(verdict FAIL): K8 and Execution are rewritten against the contract input; K7 names whose embedder is hashed, hashes the applied split, adds the recipe hash as the trigger for repair inside a generation, and refuses a mismatched search; K1 says what the push door becomes; K4 gains the one-name rule across the two doors, the authoring permission and source admission at save, and makesadapteroptional from row 3 on the input's item 11.Third round, after the delta review at head
ccaf28f1(verdict PASS, one should-fix and three nits): a build is opened bybeginBuild, a call besidecompleteBuild; the states that start a rebuild gain the index with no recipe hash and the adapter with noindexStatus; item 8 lands whole in the first of #37099 and #37100 to merge; a search over several sources answers from the ones it can search and names the refused ones; the record says where a run-time change of an egress declaration is picked up and how the deployment's adapter is known.Read first, by risk:
adapter, and the two guards on authoring.Questions for the maintainer
The card's seven items, the maintainer's words, the contract input and the cloud record do not settle these three. The record marks each ▲ where it stands. They are the maintainer's to rule on in review; merging the record as written accepts what it writes.
Question 1. Record point 1: the fate of the runtime-registration
fileandhttpsource shapes, and of the push door (indexDocument,deleteDocument). The card asks for the fate and names the rule (one strict contract) but not the fate.Recommendation of the session that wrote the record: A. Ruling D2 (a type referencing objects), the v1-key rule (
prefix,mimeTypes,urls,userAgenthave 0 readers) and Prime Directive 12 leave no other consistent answer; C is a second contract. What A costs, in full: a corpus ingested outside the platform has no v1 form;indexDocumentanddeleteDocumentleaveIKnowledgeService(0 callers in this tree, tests aside); and the clauses that two phase-2 cards build for the two arms (#37103 item 3, #37097 item 1) are removed by row 3. Whatever the answer, the two push methods are refused on an object source.Question 2. Record point 2: what does "content recipe" cover in the index fingerprint? The card names the component without defining it.
contentlist and the assembly rule's version.whereandmetadataFieldsgo to a second hash, the recipe hash, whose change starts one complete rebuild inside the same generationmetadataFieldsin the fingerprintwherein the fingerprintRecommendation of the session that wrote the record: A. The fingerprint answers whether stored vectors can be ranked against new ones, and neither
wherenormetadataFieldschanges a vector. B or C needs no recipe hash for those keys, at the price of re-embedding the whole source on every such change.Question 3. Record point 3: after the type lands, does registration in code (the plugin's
sourcesoption andregisterSource) stay?Recommendation of the session that wrote the record: A. The epic's phase 2 registers sources in code, and tests and code plugins need the door; one strict contract is one shape, not one door. The record leaves the later closing open, so B needs no rewrite.
The earlier question on whether a source must name its adapter is no longer a question: the contract input (item 11) leaves it to the record, and the record decides it (optional from row 3; an omitted
adaptermeans the deployment's adapter).◆ These are decided here, on the contract input (comment
7142505760: "the ADR decides the final shapes"). They are listed so that the approver sees each choice in one place.id; the flag iscapabilities.chunksmodel,dimensions,maxInputTokens,variant), read at useindexStatus;beginBuildandcompleteBuild, the first of which is what opens a generation. All of it lands in one PR, the first of #37099 and #37100. Parts (b) and (c) and the recipe hash go past the input's wordssplitlives on the object arm, assource.splitadapterbecomes optional in row 3; an omitted one means the deployment's adapterindexDocumentanddeleteDocumentare refused on an object sourceTests
No code changes, so no test changes and no ablation. A docs-only record.
Acceptance notes
docs/adr/**refuses line anchors (check:adr-symbol-anchors), so the decision text cites files and symbols, and the positions are in the record's Readings table in words, repeated below.254e396a29, the rows added for the contract section atb49a264a10; no file in the table differs between the two commits.indexStatus,beginBuild,completeBuild) and in the recipe hash; the record says so in the table and in its list of decisions. With the status member, service-knowledge: a source that was never built gets built, and an operator can start a rebuild #37099 waits for this record, which itsBlocked-byline does not say today.scripts/adr-anchors/is added: the gate asks for none on a new record, and anchors belong to the implementing cards.embeddingandvectorStoreleave the source,EmbeddingModelSchemaandVectorStoreSchemahave no composer in the spec. The record names it as the type-admission card's finding.Verification
Two-minute check:
pnpm check:adr-symbol-anchors && pnpm check:adr-anchors && node scripts/check-adr-links.mjs && pnpm check:adr-index. Expected: four green verdict lines.Local gate readings at 4fa0cdc
node scripts/pm/dispatch-gates.mjs --commandsderived 21 commands for the two changed paths; all 21 were run and each exited 0;--ran: 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN.check-adr-symbol-anchors: 4079 anchors across 162 records resolve, 0 line anchors.check-adr-anchors: OK, 156 decision numbers.check-adr-links: 1204 relative link destinations resolve.adr-index --report: the index is current.overlap-check:origin/mainmerges cleanly; the one overlap isdocs/adr/README.mdagainst PR docs(adr): ADR-0160 — record-scoped AI inquiry: the ai_context type, get_record_context, conversation focus, ask_ai, skill context, citation shape #37115, as stated under Sequencing.Readings, taken at 254e396 and b49a264
Each text this record quotes was read on
objectstack-ai/objectstackmainat254e396a29. The rows added for the contract section (the last eight) were read atb49a264a10, themainthis record's branch has merged; no file in this table differs between the two commits. The numbers are a dated reading for the card, not anchors; the decision text cites symbols and files.254e396a29content/docs/protocol/knowledge.mdx'*'member "meaning every field the object declares exceptid"objectsource calls for it"knowledge-pgvectorrow; §8,KnowledgeSource.embeddingcontent/docs/ai/knowledge-rag.mdxpackages/spec/src/ai/knowledge-source.zod.tscontentFieldsand its*note; thefilearm; thehttparmcronnote, "this slot is parsed and reaches no engine";id;embedding;vectorStore;aiExposedpackages/spec/src/ai/embedding.zod.tspackages/spec/src/contracts/knowledge-adapter.tspackages/spec/src/ai/knowledge-document.zod.tspermissionspackages/spec/src/contracts/embedder.tsIEmbedderpackages/spec/authorable-surface/ai.jsonpackages/spec/src/data/ai-read-exposure.tspackages/services/service-knowledge/src/knowledge-service.tsregisterSource, no parse;reindexSource, with itsfileandhttpanswer, its onefindand its oneupsertsearch;handleRecordUpsert;objectSourcesFor;documentIdForrecordToDocument, with the'*'branch and the titlepackages/services/service-knowledge/src/knowledge-service-plugin.tspackages/services/service-knowledge/src/knowledge-tools.tsaiExposednote; the definition; the executorpackages/services/service-knowledge/src/knowledge-source-admission.tsadmitSourceFieldspackages/plugins/knowledge-memory/src/index.tspackages/plugins/knowledge-ragflow/src/index.tsextractRagflowOptions; one chunk per documentpackages/mcp/src/mcp-http-tools.tsregisterKnowledgeToolsand its callpackages/runtime/src/domains/mcp.tsdata:readpackages/spec/src/contracts/knowledge-service.tsindexDocumentanddeleteDocumentonIKnowledgeServicepackages/services/service-knowledge/src/knowledge-service.tsindexDocumentanddeleteDocumenthand the caller's document to the adaptersearch, an adapter failure is logged and the search goes onisNonObjectSourceHit, and the two places that pass such a hit without a re-readpackages/spec/src/contracts/knowledge-adapter.tsAdapterContext;AdapterSearchOptionswith its opaquefilterfilterat 47packages/spec/src/ai/knowledge-document.zod.tsKnowledgeChunkSchema:id,documentId,index,content,metadatapackages/plugins/knowledge-ragflow/src/index.tsadapterConfigkeys the adapter readspackages/spec/src/kernel/platform-capabilities.ts;packages/services/service-settings/src/manifests/knowledge.manifest.ts;examples/app-showcase/src/coverage.tsPLATFORM_CAPABILITY_TOKENS; thechunk_targetandchunk_overlapsettings;KIND_COVERAGEReadings that are counts: no file under
packages/services/service-knowledge/src,packages/plugins/knowledge-memory/srcorpackages/plugins/knowledge-ragflow/src, tests aside, readsprefix,mimeTypes,urls,userAgent, a source'sembeddingorvectorStore,refresh.cron, or a document'spermissions(0 matches each; the controlsadapterConfigandcontentFieldsmatch 3 and 6 times in the same three directories).indexDocumentanddeleteDocumenthave no caller outside their declaration and their implementation, tests aside (0 matches), andKnowledgeChunkSchemahas no reader (its one other mention is a type-alias pin). Nothing underexamples/registers a knowledge source: 0 matches forKnowledgeServicePlugin, against 38 files that match the controldefineStack;examples/app-todolists the two knowledge packages as dependencies and imports neither.Readings from the tracker: the contract input is comment
7142505760on #37001, and the cards it names (#37096 to #37103 and #37107) were read in full, with the epic's body as it stands after its phase-2 rewrite. The retirement ofknowledge-ragflowis card #37004 and ruling7134290286on #36839. #4606 has no comment, and its judgements are in its body. The ruling on #4672 is comment5194621834; it was relayed by the services lane's PM and names the maintainer. The 2026-11-15 words are in the body of #33933 and are restated in comment7134104071.Generated by Claude Code