From aca7eb4a48d2b50fe2fd27d6f79a8f39f1da3c5d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 17:00:26 +0000 Subject: [PATCH 1/2] =?UTF-8?q?docs(adr):=20ADR-0150=20addendum=20?= =?UTF-8?q?=E2=80=94=20knowledge=5Fsource=20joins=20the=20package-scoped?= =?UTF-8?q?=20bucket=20beside=20skill=20and=20ai=5Fcontext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A dated addendum under D1 writes the maintainer's ruling of 2026-11-25 (seat record 7168239918) into ADR-0150: a knowledge source is identified by (package, name), in bucket 3 beside skill and ai_context. The status line gains one appended Amended clause and the D1 table one dated row; no ruled sentence is rewritten. The addendum names the readers that move, moves none, and lists the points that go past the ruling's words. ADR-0161 gains one cross-reference note after K4's point 3. No sentence of it is changed. Docs only: no schema, no code, no changeset. Claude-Session: https://claude.ai/code/session_01JQwxbZjKjZ947xtTvgJuHX Co-authored-by: Claude --- ...package-objects-keep-the-literal-prefix.md | 57 ++++++++++++++++++- ...urn-knowledge-source-is-a-governed-type.md | 2 + 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md b/docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md index 4c260982313..aa86dc86073 100644 --- a/docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md +++ b/docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md @@ -1,6 +1,6 @@ # ADR-0150: Behavioural metadata is addressed by (package, name) — objects keep the literal prefix; ADR-0028 re-opened for the behavioural tier -**Status**: Accepted (2026-11-08, merged in #31586). `docs/adr/` is Tier H (Prime Directive #14): this record became **Accepted** by the maintainer's merge of #31586 (commit `5d1382a54c`), on the day it was proposed. The child cards under [Execution plan](#execution-plan-after-acceptance) are filed under the epic ruling [`6723499113`](https://github.com/objectstack-ai/objectstack/issues/31527#issuecomment-6723499113) (child R is #31575); ⛔ no child lands before this record is accepted. **This record declares; it implements nothing**: no schema, no code, no changeset. · **Supersedes in part** [ADR-0028](./0028-metadata-naming-and-namespace-isolation.md) (D1 and D3, for the metadata types of buckets 2–4 below; ADR-0028 stays Deferred for objects and everything else) · **Amends** [ADR-0048](./0048-cross-package-metadata-collision.md) §3.3 and its 2026-11-06 addendum (the one-holder refusal retires per type as that type's readers carry the package, [D9](#d9--what-retires-and-what-stays)) · **Withdraws** the non-object half of ruling C on #30798: phase 3 (#30806 S1 and S5) does not ship. · **Amended** (2026-11-09, [#31685](https://github.com/objectstack-ai/objectstack/issues/31685), child A): the rulings and epic-seat readings recorded on the children since acceptance are written in: D2 (the shareable namespaces), D3 ((c) and the caller-less references), D4 (owner-less functions), TL;DR 7, and the execution plan's releasability sentence and covered-types paragraph. · **Amended** (2026-11-10, [#32060](https://github.com/objectstack-ai/objectstack/issues/32060), after G1 [#31691](https://github.com/objectstack-ai/objectstack/issues/31691) closed): dated notes record what G1 and its follow-ups landed: TL;DR 7 (where the address literals are refused), D4 (one armed flow per bare name until B #31696), D5 (the R1 boot reading, the literal rules after a qualifier, and the `runs` qualifier), and row K (what each door compares). No ruled sentence is rewritten. · **Amended** (2026-11-17, [#34704](https://github.com/objectstack-ai/objectstack/issues/34704)): the status keyword now records the acceptance, and two counts in the execution plan that still read as they did before `tool` joined phase 1 (#31414) are corrected: the B row's label (`B1…B14`, as "14 in all" below it), and "For the other 9" with the "those 9 types" that refers back to it (11 uncovered types, less hook and job). No ruled sentence is rewritten. · **Amended** (2026-11-25, [#37180](https://github.com/objectstack-ai/objectstack/issues/37180)): an [addendum under D1](#addendum-2026-11-25-ai_context-joins-bucket-3) puts the context pack `ai_context` (ADR-0160 D1) in bucket 3 beside `skill`, with one dated row added to the D1 table, and says what that changes for the metadata service's copy, overlays, uninstall and the readers of a pack name. It is the maintainer's alone to rule, by the maintainer's own merge of the PR that carries it or by the maintainer's word: it widens D6 and admits a type to a list reserved to the maintainer. No ruled sentence is rewritten. +**Status**: Accepted (2026-11-08, merged in #31586). `docs/adr/` is Tier H (Prime Directive #14): this record became **Accepted** by the maintainer's merge of #31586 (commit `5d1382a54c`), on the day it was proposed. The child cards under [Execution plan](#execution-plan-after-acceptance) are filed under the epic ruling [`6723499113`](https://github.com/objectstack-ai/objectstack/issues/31527#issuecomment-6723499113) (child R is #31575); ⛔ no child lands before this record is accepted. **This record declares; it implements nothing**: no schema, no code, no changeset. · **Supersedes in part** [ADR-0028](./0028-metadata-naming-and-namespace-isolation.md) (D1 and D3, for the metadata types of buckets 2–4 below; ADR-0028 stays Deferred for objects and everything else) · **Amends** [ADR-0048](./0048-cross-package-metadata-collision.md) §3.3 and its 2026-11-06 addendum (the one-holder refusal retires per type as that type's readers carry the package, [D9](#d9--what-retires-and-what-stays)) · **Withdraws** the non-object half of ruling C on #30798: phase 3 (#30806 S1 and S5) does not ship. · **Amended** (2026-11-09, [#31685](https://github.com/objectstack-ai/objectstack/issues/31685), child A): the rulings and epic-seat readings recorded on the children since acceptance are written in: D2 (the shareable namespaces), D3 ((c) and the caller-less references), D4 (owner-less functions), TL;DR 7, and the execution plan's releasability sentence and covered-types paragraph. · **Amended** (2026-11-10, [#32060](https://github.com/objectstack-ai/objectstack/issues/32060), after G1 [#31691](https://github.com/objectstack-ai/objectstack/issues/31691) closed): dated notes record what G1 and its follow-ups landed: TL;DR 7 (where the address literals are refused), D4 (one armed flow per bare name until B #31696), D5 (the R1 boot reading, the literal rules after a qualifier, and the `runs` qualifier), and row K (what each door compares). No ruled sentence is rewritten. · **Amended** (2026-11-17, [#34704](https://github.com/objectstack-ai/objectstack/issues/34704)): the status keyword now records the acceptance, and two counts in the execution plan that still read as they did before `tool` joined phase 1 (#31414) are corrected: the B row's label (`B1…B14`, as "14 in all" below it), and "For the other 9" with the "those 9 types" that refers back to it (11 uncovered types, less hook and job). No ruled sentence is rewritten. · **Amended** (2026-11-25, [#37180](https://github.com/objectstack-ai/objectstack/issues/37180)): an [addendum under D1](#addendum-2026-11-25-ai_context-joins-bucket-3) puts the context pack `ai_context` (ADR-0160 D1) in bucket 3 beside `skill`, with one dated row added to the D1 table, and says what that changes for the metadata service's copy, overlays, uninstall and the readers of a pack name. It is the maintainer's alone to rule, by the maintainer's own merge of the PR that carries it or by the maintainer's word: it widens D6 and admits a type to a list reserved to the maintainer. No ruled sentence is rewritten. · **Amended** (2026-11-25, [#37325](https://github.com/objectstack-ai/objectstack/issues/37325)): an [addendum under D1](#addendum-2026-11-25-knowledge_source-joins-bucket-3) puts the knowledge source `knowledge_source` (ADR-0161 K4) in bucket 3 beside `skill` and `ai_context`, with one dated row added to the D1 table, on the maintainer's ruling of that day: decision card tapped **B 「按应用+名字区分,都保留」** (seat record [`7168239918`](https://github.com/objectstack-ai/objectstack/issues/37304#issuecomment-7168239918) on #37304). It says what the bucket changes for the metadata service's copy, the readers of a source name and the keys of a source's index, and lists the points that go past the ruling's words: the one that is the maintainer's is accepted by the maintainer's merge of the PR that carries it, or struck first. No ruled sentence is rewritten. - **Date**: 2026-11-08 - **Supersedes**: [ADR-0028](./0028-metadata-naming-and-namespace-isolation.md) in part (D1 and D3, for buckets 2–4) @@ -92,6 +92,7 @@ On 2026-11-08 the maintainer redirected it: 「你不能只考虑现状,还要 | **2 — (package, name)** (20 types) | `flow` · `action` (`objectName:name` plus package) · `hook` · `job` (`jobKeyFor` aligned to the package coordinate) · `webhook` · `mapping` · `connector` · `permission` (set) · `sharing_rule` · `queue` · `assignment_rule` · `app` · `page` · `dashboard` · `report` · `dataset` · `analytics_cube` · `picklist` · `email_template` · `book`; an api item's `name` | `(package, name)` | D3 resolution; D5 addresses | | **3 — (package, name) plus a derived flat name on the AI face** | `tool` · `skill` · `agent` · `rag_pipeline` (retired (#31456) before the ruled table was measured; no child touches it); the cloud's action tool name (#31515) | `(package, name)` | D3 resolution; D6 face spelling | | **3 — joined by the addendum of 2026-11-25** ([#37180](https://github.com/objectstack-ai/objectstack/issues/37180)) | `ai_context` (ADR-0160 D1) | `(package, name)` | D3 resolution; D6 spelling where its name crosses the AI face ([addendum](#addendum-2026-11-25-ai_context-joins-bucket-3)) | +| **3 — joined by the addendum of 2026-11-25** ([#37325](https://github.com/objectstack-ai/objectstack/issues/37325)) | `knowledge_source` (ADR-0161 K4) | `(package, name)` | D3 resolution; D6 spelling where its name crosses the AI face; the keys of its index carry the package ([addendum](#addendum-2026-11-25-knowledge_source-joins-bucket-3)) | | **4 — environment-authored rows** | mostly `datasource`, and every customer-authored item whose name no package holds for that type (a package-less row bearing a package-held name is that holder's customization, D4) | `(environment, name)`: package null, the implicit environment package | unique in the environment; no rename, no migration | | **position (ruled separately)** | `position` | one slot per name in the environment | D7 | @@ -143,6 +144,60 @@ Proposed on card [#37180](https://github.com/objectstack-ai/objectstack/issues/3 2. **The root narrows before D3 picks (no new decision).** It follows from ADR-0160 D4. Step 3 selects among the packs whose `object` is `objectName`, and gives one answer for a name no pack has and for a pack rooted on another object. Its naming bound lets no refusal name a pack beyond those rooted on an object the caller is served. So the holders D3 judges are those whose pack of that name is rooted on `objectName`. 3. **Child N's predicate carries D2's refusal (the maintainer's decision).** The type never had a phase-1 one-holder rule, so D9 has nothing to narrow for it, and child N's list is the carrier. That list's header reserves a further type to the maintainer. +#### Addendum (2026-11-25): `knowledge_source` joins bucket 3 + +Ruled by the maintainer on card [#37304](https://github.com/objectstack-ai/objectstack/issues/37304), question Q1: decision card tapped **B 「按应用+名字区分,都保留」** at 16:34:09Z, against the card's recommendation, A (seat record [`7168239918`](https://github.com/objectstack-ai/objectstack/issues/37304#issuecomment-7168239918) on #37304). The option read 「两个都能用,AI 要写「应用-名字」来区分。已有索引全部重建,约 3 个 PR。」, and the record states it as: "`knowledge_source` joins ADR-0150 bucket 3 beside `skill` and `ai_context`: the metadata service keeps one slot per `(package, name)`; the AI face spells `NS-NAME` and refuses a bare ambiguous name loudly (409); document ids and adapter tables are keyed by package as well." This addendum writes that ruling into the record, on card [#37325](https://github.com/objectstack-ai/objectstack/issues/37325). `docs/adr/` is Tier H, and point 1 under "Past the ruling's words" is no other approver's to decide, so it lands by the maintainer's own merge of the PR that carries it, as the ruling record has it, and is in force from that merge. It declares and implements nothing. No ruled sentence is rewritten; the table above gains one row, marked with this date. + +**The type.** A knowledge source, `knowledge_source` ([ADR-0161](./0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md) K4), is identified by `(package, name)` and joins bucket 3 beside `skill` and `ai_context`. Two packages may each ship a source of one name: each is registered, built and searched, and neither replaces the other. ADR-0161's "A name is one source" (K4, point 3) holds between them by keeping both, not by refusing the second, as the ruling record says. What this record says of a bucket-3 type holds for it as for `skill`: + +- **D2.** A source name has one package holder inside a namespace, so `NS-NAME` names one source. The type never had a phase-1 one-holder rule, so the refusal is carried by child N's predicate, whose list (`packages/objectql/src/namespace-co-owner-names.ts#NAMESPACE_UNIQUE_TYPES`) reserves any further type to the maintainer (point 1). +- **D3.** A bare source name resolves by the one rule. It gains no exception. +- **D4.** Every index that keys a source by its bare name gains the package. For this type those are the knowledge service's registry of sources and, by the ruling, the keys of a source's index: its document ids and what an adapter keeps for it. +- **D5.** A source name takes the name grammar of buckets 2 and 3 and starts with a letter (`packages/spec/src/kernel/address-grammar.ts#ROUTER_ADDRESSABLE_NAME_PATTERN`; point 2). +- **D6.** A source is neither a tool nor a prompt, so no server lists it by a face and none is registered for it. Its name crosses the AI face inside `search_knowledge`: in the `sources` list of every answer, and in the `sourceIds` argument, which takes what that list shows (`packages/services/service-knowledge/src/knowledge-tools.ts#SearchKnowledgeSourceSummary`). There a package's source is spelled `NS-NAME` by the one derivation (`packages/spec/src/ai/face-name.ts#deriveAiFaceName`), and an environment source keeps its bare `NAME`. A source name holds no `-`, so a face is never also a bare source name. A bare name that two packages' sources share is refused `409`, naming each by its face, and a face two sources derive is refused at the call, naming each holder. A face as a value, in an argument or in an answer, is the widening of D6 that the `ai_context` addendum made. +- **D8** gains no row: no column of a platform object stores a source name, and no key of another metadata type names a source. + +**The principle, read for this type.** D1's principle keeps the global literal for storage identity, and today a source's name is the key of an index: a document id is the source's `id`, a `:` and the record id (`packages/services/service-knowledge/src/knowledge-service.ts#documentIdFor`), and an adapter finds its store by the `id` of the source it is handed (`packages/spec/src/contracts/knowledge-adapter.ts#AdapterContext`). The card's recommendation read the name under that half of the principle. The ruling did not: the type is in the behavioural tier, and the keys of its index are derived from its identity, as its face is. So this type keeps no global literal. "Why objects differ" above asks who reads the name. An object keeps its literal because consumers the platform does not control read it. A source's index has no such contract: it is a copy for ranking and snippets behind the adapter contract (ADR-0161 K1), an adapter's tables are its own (ADR-0161 K7, rule 2), and the one door that takes a document id from a caller is the push door (`deleteDocument` on `packages/spec/src/contracts/knowledge-service.ts#IKnowledgeService`), which ADR-0161's point 1 retires in row 3. Three things this reading does not hide: + +- D6 calls the face "the one physical surface this tier has". For this type the keys of an index are a second derived one. +- An adapter that stores in the deployment's own database keeps tables that a reader of that database sees. Nothing promises that reader their names or their keys. +- A `search_knowledge` hit shows its `sourceId` and its `documentId`, and their values move with the key (point 4). + +**The tree today** (measured on `main` at `829a45e9`). ADR-0161's row 3 has not landed, so the type is not registered and the bucket has nothing to change yet. + +- `knowledge_source` is in no row of `packages/spec/src/kernel/metadata-plugin.zod.ts#DEFAULT_METADATA_TYPE_REGISTRY`, no stack collection holds one, and it is in none of the four lists a bucket-3 type is read through. They are `packages/spec/src/api/protocol.zod.ts#PACKAGE_SLOTTED_METADATA_TYPES` (the metadata service's slot per `(package, name)`; a type outside it gets one copy per name, the one registered last, by `packages/metadata/src/package-slotted-store.ts#storeWriteKey`), `packages/core/src/package-scoped-resolution.ts#PACKAGE_SCOPED_TYPES` (the one rule, which throws for a type outside it), `packages/objectql/src/package-scoped-read.ts#PACKAGE_SCOPED_READ_TYPES` (the by-name read) and `NAMESPACE_UNIQUE_TYPES`. `skill` is in the first three. +- A source reaches the service through code only (`packages/services/service-knowledge/src/knowledge-service-plugin.ts#KnowledgeServicePlugin`, and `registerSource`), and it carries no package. The service keeps its sources in one map by `id`, and a second registration of an `id` replaces the first with a warning (`packages/services/service-knowledge/src/knowledge-service.ts#KnowledgeService`). +- The keys of an index are the bare `id`, as above. The one in-tree store keyed by it is in memory (`packages/plugins/knowledge-memory/src/index.ts#KnowledgeMemoryAdapter`). `knowledge-pgvector` (#37100) and `knowledge-turso` (#37107) are not on `main`. +- The tool lists each source by its `id`, and refuses a `sourceIds` entry that names none of them `NOT_FOUND` (`packages/services/service-knowledge/src/knowledge-tools.ts#createKnowledgeTools`). + +**What changes with the bucket.** + +- **The service's copy** is one slot per `(package, name)` (D4), so one package's source never replaces another's before a reader sees it. +- **Overlays.** No channel opens: ADR-0161 K4 opens no environment overlay for the type, and this addendum adds it to no declared-override list ([ADR-0146](./0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md) D2). So the package's definition is sealed (ADR-0131 D6), and a package-less row under a name a package ships is not served. As for `skill` and `ai_context`, that row is the holder's customization (D4) and never a second source. A source authored in the environment under a name no package holds is the environment's own (bucket 4) and keeps its bare name. Point 7 is the case where a package later ships that name. +- **Owner stamps.** The registration stamps a package's item with the package that registers it, and the one judge refuses a body that names another owner (`packages/spec/src/kernel/collection-item-owner-stamp.ts#judgeCollectionItemOwnerStamp`), once 3a's collection is among the collections it judges. The stamp is the holder the moved readers read. A registration in code has none (point 6). +- **Uninstall.** The registry withdraws by package (`packages/objectql/src/registry.ts#uninstallPackage`), and with a slot per package the service drops that package's source and keeps another's (`packages/metadata/src/metadata-manager.ts#unregisterPackage`). +- **The keys of an index** carry the package. Two packages' sources of one name then share no document id and no store, so removing one source and its index (`dropSource`, ADR-0161 K8, item 4) leaves the other's whole. The ruled option counts a rebuild of every existing index (「已有索引全部重建」). + +**The readers that move.** ⛔ This addendum moves none. + +1. **The `search_knowledge` executor** (`createKnowledgeTools`, above). `sources` lists each source by its face. A `sourceIds` entry is read as a skill prompt's name is (`packages/mcp/src/skill-prompts.ts#lookupSkillPrompt`): a face answers its one source; otherwise a bare name resolves as for a caller with no package (D3), to the environment's own source, else the one package holder, else a refusal that names each candidate by its face (`409`, D5). A name no source holds keeps today's `NOT_FOUND` (point 3). +2. **The knowledge service's registry and its by-name members** (`KnowledgeService` and `IKnowledgeService`, above: `getSource`, `unregisterSource`, `reindexSource`, and `sourceIds` on `search`). One map by `id` becomes one entry per `(package, name)`. +3. **The store keys**: `documentIdFor`, and each adapter's use of the source it is handed (`AdapterContext`). The contract hands an adapter the whole source, and a source carries no package today. +4. **3a's loader** (ADR-0161 K4, clause 3) registers each package's item under its stamp and, when an item is removed, drops that item's index only. +5. **The `/meta` doors and the metadata service's store** follow the lists: the by-name read, its `?package=` exact qualifier, and the slot. + +**Follow-up: [#37304](https://github.com/objectstack-ai/objectstack/issues/37304), after the merge** ("3a": row 3 of ADR-0161's execution, less the part that card leaves to row 3b). By the ruling's execution this addendum lands first. 3a then takes the four lists, the readers above and the store keying, in memory, pgvector and turso, and item 11 of its card pins that a second package shipping a name gets its own `(package, name)` slot. The keying reaches #37100 and #37107 if they land before 3a; landing after it, they are built on the package-carrying key. 3a declares its narrowings, each with a count measured on the tree it lands on: D2's install refusal, D5's name grammar, the `409` for a bare name two packages hold, and the package-less row under a held name. On `main` at `829a45e9` nothing first-party can be refused: no file under `packages/`, `examples/`, `ui/`, `skills/` or `content/` spells `knowledge_source`, and nothing under `examples/` registers a source in code. + +**Past the ruling's words.** The ruling's words are quoted at the head of this addendum, and each point below goes past them. ⛔ None is decided here. Point 1 is the maintainer's: the merge accepts it, or the maintainer strikes it. Points 2 and 3 follow from text already ruled. Points 4 to 7 are open: 3a states each on its PR, and one that the text it lands on does not answer goes to the maintainer. + +1. **The fourth list (the maintainer's decision).** The ruling record counts "the `domain:server` four lists and readers (precedent PR #37291)" and names none of them. In that PR, open at this writing, the fourth is `NAMESPACE_UNIQUE_TYPES`: D2's refusal of a second holder inside one namespace, at install and in `os validate`. So "Two packages shipping one source name both work" holds for two namespaces, and inside one namespace the second is refused. The list's header reserves a further type to the maintainer. Struck, two co-owners of a namespace may ship one name, and the one face they derive is refused at the call (D6). +2. **The name grammar (no new decision).** D5 refuses a `_`-led name for every bucket 2/3 type, and today's `id` pattern admits one (`packages/spec/src/ai/knowledge-source.zod.ts#KnowledgeSourceSchema`). 3a's `name` takes the bucket's pattern, and that narrowing is declared beside ADR-0161 K6's. +3. **The candidates of a `409` (no new decision).** ADR-0161 K9 has the tool refuse an unexposed source `NOT_FOUND`, in the sentence an unknown id gets. So D3 judges the sources the tool may search, and a `409` names none beyond them. +4. **What each shape carries (open).** The ruled option puts `NS-NAME` in `sources`. ADR-0161 K6, item 5, keeps the spellings `sourceIds`, `sources[].id` and `sourceId` and says they carry the source's name. Not in the ruling's words: what a hit's `sourceId` and `documentId` carry on the tool's answer, what `sourceId` carries on a stored document and on an adapter's hit, and what the by-name members of `IKnowledgeService` take from a caller in code. +5. **Which coordinate a key carries, and what rebuilds (open).** The ruling says "keyed by package". D2 has two coordinates: the package id, which is identity and what every stored package column holds (D8), and the namespace, which is the address. Only the first tells every two packages apart, because the shareable namespaces admit two holders of one name. 3a states the key, how a document id and a table name spell it inside their length limits, and what removes an index left under the old key. ADR-0161 K7 starts a rebuild on a changed fingerprint or recipe hash, and a key is in neither; it builds a source an adapter holds nothing for, which a new key is. +6. **A registration in code (open).** `KnowledgeServicePlugin({ sources })` and `registerSource` carry no package, and ADR-0161's point 3 keeps that door. The ruling does not say which holder such a source is: the environment's, the platform's (as D4 reads an owner-less engine function), or the package of the plugin that registers it. Nor does it say whether point 3's refusal of a second arrival then compares names or `(package, name)`. +7. **An environment source under a name a package later ships (open).** D4 reads its row as that holder's customization, and the type opens no channel, so the row is not served: it stops being a source, as an environment pack does, and its index is the index of no source. The ruling covers two packages, not this pair. 3a states and measures it, and says what becomes of that index. + ### D2 — The package coordinate: identity is the package id, the address is the namespace - **Identity** is `(package id, type, name)`: the registry's composite key, ADR-0048 §3.1's globally unique package id, and every new stored package column (D8) holds the package id. diff --git a/docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md b/docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md index 971306f9089..9f7a5fb5587 100644 --- a/docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md +++ b/docs/adr/0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md @@ -216,6 +216,8 @@ The package whose README and tests carry the `http` shape, `knowledge-ragflow`, **▲ Point 3, past the rulings' words — registration in code stays a door for the same schema.** The epic's phase 2 says sources are still registered in code, and row 3 adds the metadata door. This record reads "one strict contract" as one shape, not one door: `KnowledgeServicePlugin({ sources })` and `registerSource` remain, they take the type's schema and nothing else, and they parse with it (today `registerSource` stores what it is given without a parse). **A name is one source, whichever door it came through**: a registration from one door never replaces a source that arrived through the other. Today `registerSource` overwrites an existing id with a warning. Once a governed item and a code registration can carry one name, that is a silent override of governed metadata, so the second arrival is refused with a coded refusal that names both. A metadata item that reloads its own earlier version is not a second arrival. Row 3 writes the refusal's code and words. Whether the code door is closed once every source can be metadata is not decided here. +> **Cross-reference (2026-11-25, [#37325](https://github.com/objectstack-ai/objectstack/issues/37325)).** Which package's source a name means is ADR-0150's question, and this record does not ask it. Its [addendum of 2026-11-25](./0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md#addendum-2026-11-25-knowledge_source-joins-bucket-3) puts `knowledge_source` in bucket 3 beside `skill` and `ai_context`, on the maintainer's ruling 「按应用+名字区分,都保留」 (record [`7168239918`](https://github.com/objectstack-ai/objectstack/issues/37304#issuecomment-7168239918) on #37304): a source is identified by `(package, name)`, two packages that ship one source name each keep their source, and the keys of a source's index carry the package. Point 3 above is read with it: "A name is one source" holds between two packages by keeping both, and which holder a registration in code is stays open there, for row 3. So is [K6](#k6--adr-0087-dispositions): item 4 stays true of the rename, and the re-keying is what moves a document id and rebuilds an index; item 5 keeps its spellings, and the value each carries for a package's source is that addendum's and row 3's to state. Row 3 ([#37304](https://github.com/objectstack-ai/objectstack/issues/37304)) follows the addendum. No sentence of this record is changed. + ### K5 — A source lists its content fields; embedding is egress Ruling D5: a source lists its content fields explicitly. From 05f35b6106e21b448474764c12ee88958b04fdaf Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 17:17:11 +0000 Subject: [PATCH 2/2] docs(adr): the knowledge_source addendum's tree readings are re-measured on the merged main main moved under six of the files the addendum anchors (the knowledge service, its plugin, the memory adapter and three spec contracts) between the first reading and this branch's merge of main. Every statement of "The tree today" and every anchor was read again on the merged tree and holds, so the two dated readings now name the main commit they were last measured on. Docs only: no schema, no code, no changeset. Claude-Session: https://claude.ai/code/session_01JQwxbZjKjZ947xtTvgJuHX Co-authored-by: Claude --- ...ta-addressed-by-package-objects-keep-the-literal-prefix.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md b/docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md index aa86dc86073..b4b27454f7d 100644 --- a/docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md +++ b/docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md @@ -163,7 +163,7 @@ Ruled by the maintainer on card [#37304](https://github.com/objectstack-ai/objec - An adapter that stores in the deployment's own database keeps tables that a reader of that database sees. Nothing promises that reader their names or their keys. - A `search_knowledge` hit shows its `sourceId` and its `documentId`, and their values move with the key (point 4). -**The tree today** (measured on `main` at `829a45e9`). ADR-0161's row 3 has not landed, so the type is not registered and the bucket has nothing to change yet. +**The tree today** (measured on `main` at `fbb62e1c`). ADR-0161's row 3 has not landed, so the type is not registered and the bucket has nothing to change yet. - `knowledge_source` is in no row of `packages/spec/src/kernel/metadata-plugin.zod.ts#DEFAULT_METADATA_TYPE_REGISTRY`, no stack collection holds one, and it is in none of the four lists a bucket-3 type is read through. They are `packages/spec/src/api/protocol.zod.ts#PACKAGE_SLOTTED_METADATA_TYPES` (the metadata service's slot per `(package, name)`; a type outside it gets one copy per name, the one registered last, by `packages/metadata/src/package-slotted-store.ts#storeWriteKey`), `packages/core/src/package-scoped-resolution.ts#PACKAGE_SCOPED_TYPES` (the one rule, which throws for a type outside it), `packages/objectql/src/package-scoped-read.ts#PACKAGE_SCOPED_READ_TYPES` (the by-name read) and `NAMESPACE_UNIQUE_TYPES`. `skill` is in the first three. - A source reaches the service through code only (`packages/services/service-knowledge/src/knowledge-service-plugin.ts#KnowledgeServicePlugin`, and `registerSource`), and it carries no package. The service keeps its sources in one map by `id`, and a second registration of an `id` replaces the first with a warning (`packages/services/service-knowledge/src/knowledge-service.ts#KnowledgeService`). @@ -186,7 +186,7 @@ Ruled by the maintainer on card [#37304](https://github.com/objectstack-ai/objec 4. **3a's loader** (ADR-0161 K4, clause 3) registers each package's item under its stamp and, when an item is removed, drops that item's index only. 5. **The `/meta` doors and the metadata service's store** follow the lists: the by-name read, its `?package=` exact qualifier, and the slot. -**Follow-up: [#37304](https://github.com/objectstack-ai/objectstack/issues/37304), after the merge** ("3a": row 3 of ADR-0161's execution, less the part that card leaves to row 3b). By the ruling's execution this addendum lands first. 3a then takes the four lists, the readers above and the store keying, in memory, pgvector and turso, and item 11 of its card pins that a second package shipping a name gets its own `(package, name)` slot. The keying reaches #37100 and #37107 if they land before 3a; landing after it, they are built on the package-carrying key. 3a declares its narrowings, each with a count measured on the tree it lands on: D2's install refusal, D5's name grammar, the `409` for a bare name two packages hold, and the package-less row under a held name. On `main` at `829a45e9` nothing first-party can be refused: no file under `packages/`, `examples/`, `ui/`, `skills/` or `content/` spells `knowledge_source`, and nothing under `examples/` registers a source in code. +**Follow-up: [#37304](https://github.com/objectstack-ai/objectstack/issues/37304), after the merge** ("3a": row 3 of ADR-0161's execution, less the part that card leaves to row 3b). By the ruling's execution this addendum lands first. 3a then takes the four lists, the readers above and the store keying, in memory, pgvector and turso, and item 11 of its card pins that a second package shipping a name gets its own `(package, name)` slot. The keying reaches #37100 and #37107 if they land before 3a; landing after it, they are built on the package-carrying key. 3a declares its narrowings, each with a count measured on the tree it lands on: D2's install refusal, D5's name grammar, the `409` for a bare name two packages hold, and the package-less row under a held name. On `main` at `fbb62e1c` nothing first-party can be refused: no file under `packages/`, `examples/`, `ui/`, `skills/` or `content/` spells `knowledge_source`, and nothing under `examples/` registers a source in code. **Past the ruling's words.** The ruling's words are quoted at the head of this addendum, and each point below goes past them. ⛔ None is decided here. Point 1 is the maintainer's: the merge accepts it, or the maintainer strikes it. Points 2 and 3 follow from text already ruled. Points 4 to 7 are open: 3a states each on its PR, and one that the text it lands on does not answer goes to the maintainer.