Skip to content

Commit fd06b7a

Browse files
docs(knowledge): the 18 to 19 id row names the underscore exception and the dropSource cleanup (#38050)
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Fixes #38022 Clause-②: no Metadata-protocol: none ## 维护者速读 - 升级到 19 的运维读升级表时,会看到「以下划线开头的知识源 id 要改名并清理旧索引」这一例外,不再被告知「索引原样找回」。 - 为 AI 知识库(epic 37000)的 18 到 19 升级文档补上一处与升级条目不一致的说法。 - 只改文档与报错文案,不影响运行行为,可直接撤回。 - 无。 ## What changes - `content/docs/protocol/knowledge.mdx`: the `id` row of the 18 to 19 table names the underscore exception (`name` refuses it, the source is rebuilt under a new name) and the `dropSource` cleanup, in the words of the upgrade entry `knowledge-source-registration-governed`. It states the memory adapter holds nothing across a restart. The row does not touch `adapter`, which #38026 made optional (rows and prose near it re-read on current main; no contradiction). - N1: the upgrade entry's reason says the adapter keeps the old index only where its store outlives the process (Turso, pgvector); the memory adapter holds nothing across a restart. - N2: the `id` tombstone in `knowledge-source.zod.ts` says the entry's manual notices still apply after `os migrate meta --from 18`; the reference page `content/docs/references/ai/knowledge-source.mdx` carries the same sentence. - `.changeset/37304-knowledge-source-governed-type.md` is not edited: it sits in `.changeset/pre/` (consumed by pre mode). A new patch changeset covers the spec string change. ## Tests NOT MEASURED: `knowledge-source.test.ts` and `retired-key-migrate-sentence.test.ts` (the tombstone still ends with the migrate sentence and still begins with its pinned prefix), because the verify lock was never acquired in 4 attempts over about 36 minutes (holder was a dogfood run; VERDICT queue-timeout exit 99). ## Acceptance notes - NOT MEASURED: `pnpm gen:docs` regeneration (needs the spec build, same lock). The reference page was edited by one exact-string substitution mirroring the zod edit; CI `check:generated` is the judge. <details><summary>Verification</summary> - check:doc-authoring, check:doc-anchors, check:doc-frontmatter, check:docs-nav-label, check:docs-image-tag: exit 0. check:docs-transcript-drift: exit 3, NOT MEASURED (prerequisite). - overlap-check at d60a6ce: VERDICT clean exit 0 (main, #38043, #38013, #37963 merge cleanly). - Two-minute check: open the knowledge protocol page, 18 to 19 table, `id` row: it names the underscore exception. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP Co-authored-by: Claude <noreply@anthropic.com>
1 parent 206008a commit fd06b7a

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
docs(spec): the `knowledge_source.id` tombstone and the `knowledge-source-registration-governed` upgrade entry name the underscore exception and the `dropSource` cleanup, and say the old index outlives a restart only on a store that persists
6+
7+
Clause-②: no
8+
Metadata-protocol: none

‎content/docs/protocol/knowledge.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ write instead, and `os migrate meta --from 18` converts the mechanical ones:
155155

156156
| Before 19 | Now |
157157
|:--|:--|
158-
| `id` | `name` (the value is unchanged, so the index is found again) |
158+
| `id` | `name` (the value is unchanged, so the index is found again). One exception: `name` refuses a leading underscore, so a source whose `id` began with one takes a new name and is built again from nothing under it; the adapter still holds the index under the old id, which nothing searches or drops, so call `dropSource({ source })` on that adapter (`IKnowledgeService.getAdapter`) with the source's `name` set to the old id once the new build completes. An adapter without `dropSource`, or one whose store does not outlive the process (memory), has nothing to drop or keeps it until removed in its own store |
159159
| `source.contentFields` | `source.content` (a `'*'` member is replaced by hand with the field names) |
160160
| `embedding`, `vectorStore` | removed: the embedder and the store are the deployment's, never a source's |
161161
| `adapterConfig` | removed: an adapter takes its settings as options of the plugin that mounts it |

‎content/docs/references/ai/knowledge-source.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const result = KnowledgeRefreshPolicySchema.parse(data);
5151
| Property | Type | Required | Description |
5252
| :--- | :--- | :--- | :--- |
5353
| **name** | `string` | ✅ | Source machine name (snake_case) — what search_knowledge lists and its sourceIds argument names |
54-
| **id** | `never` | optional | [REMOVED] `knowledge_source.id` was removed in @objectstack/spec 19.0.0 (ADR-0161 K6) — a knowledge source is a metadata item, and an item is identified by `name`; use `name`. Rename the key; the value is unchanged, so the source's index is found again and is not rebuilt. A source registered in code (`KnowledgeServicePlugin({ sources })`, `registerSource`) is in no stack collection, so `os migrate meta` lists no edit for it: make this edit in the registration itself. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
54+
| **id** | `never` | optional | [REMOVED] `knowledge_source.id` was removed in @objectstack/spec 19.0.0 (ADR-0161 K6) — a knowledge source is a metadata item, and an item is identified by `name`; use `name`. Rename the key; the value is unchanged, so the source's index is found again and is not rebuilt, except for a source whose id began with an underscore: `name` refuses the underscore, so that source takes a new name, is built again under it, and its old index is dropped with `dropSource`; the upgrade entry `knowledge-source-registration-governed` says how, and its notices still apply after the conversion. A source registered in code (`KnowledgeServicePlugin({ sources })`, `registerSource`) is in no stack collection, so `os migrate meta` lists no edit for it: make this edit in the registration itself. Run `os migrate meta --from 18` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
5555
| **label** | `string` | ✅ | |
5656
| **description** | `string` | optional | |
5757
| **adapter** | `string` | optional | Adapter id; omitted means the deployment's store (pgvector on PostgreSQL, turso otherwise), else the only adapter registered |

‎packages/spec/src/ai/knowledge-source.zod.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ export const KnowledgeSourceSchema = lazySchema(() => strictObject(
252252
id: retiredKey(
253253
'`knowledge_source.id` was removed in @objectstack/spec 19.0.0 (ADR-0161 K6) — '
254254
+ 'a knowledge source is a metadata item, and an item is identified by `name`; use `name`. '
255-
+ 'Rename the key; the value is unchanged, so the source\'s index is found again and is not rebuilt. '
255+
+ 'Rename the key; the value is unchanged, so the source\'s index is found again and is not rebuilt, except for a source whose id began with an underscore: `name` refuses the underscore, so '
256+
+ 'that source takes a new name, is built again under it, and its old index is dropped with `dropSource`; '
257+
+ 'the upgrade entry `knowledge-source-registration-governed` says how, and its notices still apply after the conversion. '
256258
+ CODE_DOOR_18
257259
+ MIGRATE_18,
258260
),

‎packages/spec/src/migrations/entries/semantic/19.knowledge-source-registration-governed.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export const entry: SemanticMigration = {
4646
+ 'began with an underscore. Its name has to change, and an adapter keys everything it holds for a source '
4747
+ 'by the source\'s name. So the renamed source is built from nothing under its new name, as a source the '
4848
+ 'adapter has never held is: every record it covers is read, and on an adapter that embeds, the content '
49-
+ 'fields of each are sent to the embedding provider again. The adapter also keeps the index it built '
50-
+ 'under the old id. No source '
49+
+ 'fields of each are sent to the embedding provider again. On an adapter whose store outlives the process (Turso, pgvector) the adapter also keeps the index it built '
50+
+ 'under the old id; the memory adapter holds nothing across a restart. No source '
5151
+ 'holds that key any more: nothing searches that index or keeps it in step with the records, and nothing '
5252
+ 'drops it, because the service drops the index of a `knowledge_source` item it stops serving and never '
5353
+ 'that of a registration in code. A source registered in code shares one slot with a source of the same '

0 commit comments

Comments
 (0)