Skip to content

Commit d60a6ce

Browse files
committed
docs(knowledge): the 18 to 19 id row names the underscore exception and the dropSource cleanup
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
1 parent 8d34c44 commit d60a6ce

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)