Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/knowledge-id-underscore-exception.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@objectstack/spec': patch
---

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

Clause-②: no
Metadata-protocol: none
2 changes: 1 addition & 1 deletion content/docs/protocol/knowledge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ write instead, and `os migrate meta --from 18` converts the mechanical ones:

| Before 19 | Now |
|:--|:--|
| `id` | `name` (the value is unchanged, so the index is found again) |
| `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 |
| `source.contentFields` | `source.content` (a `'*'` member is replaced by hand with the field names) |
| `embedding`, `vectorStore` | removed: the embedder and the store are the deployment's, never a source's |
| `adapterConfig` | removed: an adapter takes its settings as options of the plugin that mounts it |
Expand Down
2 changes: 1 addition & 1 deletion content/docs/references/ai/knowledge-source.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const result = KnowledgeRefreshPolicySchema.parse(data);
| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **name** | `string` | ✅ | Source machine name (snake_case) — what search_knowledge lists and its sourceIds argument names |
| **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. |
| **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. |
| **label** | `string` | ✅ | |
| **description** | `string` | optional | |
| **adapter** | `string` | optional | Adapter id; omitted means the deployment's store (pgvector on PostgreSQL, turso otherwise), else the only adapter registered |
Expand Down
4 changes: 3 additions & 1 deletion packages/spec/src/ai/knowledge-source.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ export const KnowledgeSourceSchema = lazySchema(() => strictObject(
id: retiredKey(
'`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. '
+ '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. '
+ CODE_DOOR_18
+ MIGRATE_18,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export const entry: SemanticMigration = {
+ 'began with an underscore. Its name has to change, and an adapter keys everything it holds for a source '
+ 'by the source\'s name. So the renamed source is built from nothing under its new name, as a source the '
+ 'adapter has never held is: every record it covers is read, and on an adapter that embeds, the content '
+ 'fields of each are sent to the embedding provider again. The adapter also keeps the index it built '
+ 'under the old id. No source '
+ '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 '
+ 'under the old id; the memory adapter holds nothing across a restart. No source '
+ 'holds that key any more: nothing searches that index or keeps it in step with the records, and nothing '
+ 'drops it, because the service drops the index of a `knowledge_source` item it stops serving and never '
+ 'that of a registration in code. A source registered in code shares one slot with a source of the same '
Expand Down
Loading