Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -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.
**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.

- **Date**: 2026-11-08
- **Supersedes**: [ADR-0028](./0028-metadata-naming-and-namespace-isolation.md) in part (D1 and D3, for buckets 2–4)
Expand Down Expand Up @@ -91,6 +91,7 @@ On 2026-11-08 the maintainer redirected it: 「你不能只考虑现状,还要
| **1 — global literal prefix, unchanged** | `object` (ADR-0129 D2, the table name) · `field` · `object_extension` · `view` (object-derived) · `capability` (`NS.SHORT`, ruling 6683456244) · `doc` (ADR-0046 doc lint) · an api's `path` (globally unique) | the literal name | unchanged |
| **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)) |
| **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 |

Expand All @@ -102,6 +103,46 @@ On 2026-11-08 the maintainer redirected it: 「你不能只考虑现状,还要

ADR-0028 D2 proposed deriving physical names from `(namespace, short)` to hide that prefix. The ruling keeps objects literal, because a derived table name is a second spelling that every external reader of the database sees and the authoring layer does not. Behavioural metadata has no such reader: every consumer of a flow, an action or a page is platform code that can carry the package coordinate. So the tier that leaves the platform keeps the name that leaves it, and the tier the platform resolves is resolved by the platform.

#### Addendum (2026-11-25): `ai_context` joins bucket 3

Proposed on card [#37180](https://github.com/objectstack-ai/objectstack/issues/37180), from finding R15 of the contract review of PR #37173 (record [`7150240017`](https://github.com/objectstack-ai/objectstack/pull/37173#issuecomment-7150240017); the review's own numbering, not D8's row R15). `docs/adr/` is Tier H, and this addendum 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 on it. Two of its points are no other approver's to decide (points 1 and 3 under "Past the card's words"). It 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 context pack, `ai_context` ([ADR-0160](./0160-record-scoped-ai-inquiry.md) D1), is identified by `(package, name)` and joins bucket 3 beside `skill`. Two packages may each ship a pack of one name, and each reader reaches the one it means. What this record says of a bucket-3 type holds for it as for `skill`:

- **D2.** A pack name has one package holder inside a namespace. A second is refused at install and `os validate` by child N's predicate. Its list (`packages/objectql/src/namespace-co-owner-names.ts#NAMESPACE_UNIQUE_TYPES`) reserves any further type to the maintainer, so admitting this one is the maintainer's decision (point 3).
- **D3.** A bare pack name resolves by the one rule. It gains no exception.
- **D6.** A pack is listed on no server, so no face is registered for it. Where its name crosses the AI face, in the `context` argument of `get_record_context` and in the candidates a refusal lists, a package's pack is spelled `NS-NAME` by the one derivation (`packages/spec/src/ai/face-name.ts#deriveAiFaceName`), and an environment pack keeps its bare `NAME`. A pack name holds no `-` (`packages/spec/src/kernel/address-grammar.ts#ROUTER_ADDRESSABLE_NAME_PATTERN`), so a face is never also a bare pack name. A face two packs derive is refused at the call, naming each holder. D6 was ruled for names a server lists. A face as the value of an argument widens it, and that is the maintainer's decision (point 1).
- **D8** gains no row: no column stores a pack name. A skill's `context` is a reference inside a `sys_metadata` body (row R17), resolved by D3.

**The tree today** (measured on `main` at `0a1b69c0`). ADR-0160 is Accepted, and its row 5 has landed (#37140): the type (`packages/spec/src/ai/ai-context.zod.ts#AiContextSchema`) and the tool with its pack selection (`packages/services/service-record-context/src/read-set.ts#selectContextPack`). The skill key `context` has not (row 8, #37141). `ai_context` is in none of the lists named here, so the type meets this:

- The registry keeps each package's item (`PACKAGE:NAME`, TL;DR 2). **The metadata service keeps one copy per name**, the one registered last, for every type outside `packages/spec/src/api/protocol.zod.ts#PACKAGE_SLOTTED_METADATA_TYPES` (the rule is `packages/metadata/src/package-slotted-store.ts#storeWriteKey`). `skill` is in that list.
- The one rule resolves no type outside `packages/core/src/package-scoped-resolution.ts#PACKAGE_SCOPED_TYPES` (it throws for one), and a by-name read consults `(package, name)` only for a type in `packages/objectql/src/package-scoped-read.ts#PACKAGE_SCOPED_READ_TYPES`. `skill` is in both.
- Pack selection holds no package and asks no rule. It keeps the parsed packs rooted on `objectName` and matches `context` to a pack's bare `name`.

**What changes with the bucket.**

- **The service's copy** becomes one slot per `(package, name)` (D4), so one package's pack no longer replaces another's before any reader sees it.
- **Overlays.** No channel opens: a pack takes no environment overlay (ADR-0160 D1, on [ADR-0005](./0005-metadata-customization-overlay.md)'s ai row) and joins no declared-override list ([ADR-0146](./0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md) D2; ADR-0160 D1, "Later work"). So a package-less row under a name a package ships is not served, today and after: the type opens no overlay channel, so the package's definition is sealed (ADR-0131 D6), and the type is not in `packages/metadata-protocol/src/protocol-package-bindings.ts#SEALED_ROW_SERVED_OVERRIDE_TYPES`, the types whose declared override is served from its row. That is D4 as for `skill`: the row is that holder's customization and never a second pack. It is read at `(type, name)`, whatever the row's root, so an environment pack stops being a pack when a package that holds its name installs, even when the two root on different objects. The follow-up card states this and measures it. What the bucket changes is the item such a row is read against. Today it is whichever package's item a by-name lookup finds. By D4 it is the one holder's item. Under a name two packages hold, the row is bound to neither and reported (row R15), ⛔ never bound on a guess. Under a name no package holds, it is the environment's own pack (bucket 4).
- **Owner stamps** do not change. The registration stamps every 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`). The pack's collection, `aiContexts`, is among the collections it judges. The stamp is the holder the moved readers read.
- **Uninstall.** The registry already withdraws by package (`packages/objectql/src/registry.ts#uninstallPackage`). The service's half changes with the slot (`packages/metadata/src/metadata-manager.ts#unregisterPackage`). Today it removes the name's one copy when that copy is the uninstalled package's, though another package still ships the name, and removes nothing when it is not. With a slot per package it drops that package's pack and keeps the other's.

**The readers that move.** ⛔ This addendum moves none.

1. **Pack selection behind `get_record_context`** (ADR-0160 D4, step 3; `selectContextPack`, above). The candidates stay the packs rooted on `objectName`, so a pack on another root is still answered as no pack. Among them `context` is read as a skill prompt's name is (`packages/mcp/src/skill-prompts.ts#lookupSkillPrompt`): a face answers its one pack; otherwise a bare name resolves as for a caller with no package (D3), to the environment's own pack, else the one package holder, else a refusal that names each candidate by its face (`409`, D5). With `context` omitted, D4's "several" answer spells each pack's name as its face; what else that answer carries is D4's.
2. **The skill key `context`** (ADR-0160 D8; row 8, #37141, not yet on `main`). It is a reference between items: a bare name, resolved by D3 from the skill's package, and as a caller with no package for an environment skill. ⛔ The key gains no qualified spelling (D3). The author surfaces that validate a skill judge it by the same rule. Each reader hands on the pack the reference resolved to, by its face: the MCP skill prompt, in the `context` of the arguments it carries, and the in-app runtime in cloud (row 9; carrier: cloud).
3. **The `/meta` doors and the service's store** follow the lists: the by-name read, its `?package=` exact qualifier, and the slot.

**Follow-up: [#37216](https://github.com/objectstack-ai/objectstack/issues/37216), after the merge.** It adds `ai_context` to the four lists named above and moves reader 1. It lands before row 8 (#37141): row 8 wires the key by this rule from its first day, and the one rule throws for a type outside `PACKAGE_SCOPED_TYPES`. Its narrowings are declared on that card, each with a count measured on the tree it lands on: D2's install refusal; the `/meta` by-name read, where a bare name two packages hold is refused and `getItem` serves the first today; and the package-less row under a held name (Overlays, above). Reader 1 narrows nothing: the interim rule already refuses a bare name two packs share on a root, and the face then reaches each. Nothing first-party is refused. On `main` at `0a1b69c0` the one declarer is `examples/app-showcase`: one package, with two packs of different names on different roots (`examples/app-showcase/src/ai/record-context.ai-context.ts`). `objectstack-ai/hotcrm` at `b1ea6fcc` declares none.

**Interim rule, until reader 1 moves.** Two parsed packs that share a name and a root are never chosen between (`selectContextPack`, on `main`). A `context` that names them is refused (`409`). So is an omitted `context` when theirs is the only name on the root. Where the root has another name too, an omitted `context` gets D4's "several" answer, which lists the shared name once. ⛔ The first match is taken in none of these: that is the silent first match this record retires (D5) and ADR-0160 D4's "No silent fallback". Declining this addendum leaves that rule as the only one, and no list changes.

**Past the card's words.** The card says "beside `skill`". Points 1 and 3 go past that, and each is the maintainer's decision alone: the merge accepts it, or the maintainer strikes it. Point 2 is no new decision.

1. **Bucket 3, not 2 (the maintainer's decision).** A pack's name is typed by a model, so it needs a spelling on the AI face though no face is listed. This widens D6 from the names a server lists to the value of an argument, and `context` in ADR-0160 D4 and D8 then holds a face or a bare name, where it held a pack's `name`. Not taken: bucket 2 with an optional `namespace` input on the tool (D5's `run_action` form), which adds a member to ADR-0160 D4's input and to D8's argument object. The face adds none.
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.

### 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.
Expand Down
2 changes: 2 additions & 0 deletions docs/adr/0160-record-scoped-ai-inquiry.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ ADR-0088's three clauses:
2. **Declarative governability.** It ships from a package as a standalone file and is authored at runtime through the metadata API and Studio (row 7).
3. **A real consumer.** The render service behind `get_record_context` reads it and lands in the same PR as the type (row 5). Row 8 and row 9 add readers.

> **Cross-reference (2026-11-25, objectstack#37180).** Which package's pack a name means, in [D4](#d4)'s pack selection and in [D8](#d8)'s `context` key, is ADR-0150's question: its [addendum of 2026-11-25](./0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md#addendum-2026-11-25-ai_context-joins-bucket-3) puts `ai_context` in bucket 3 beside `skill` and carries the interim rule for two packs that share a name and a root. Its follow-up, objectstack#37216, lands before row 8 (objectstack#37141). No sentence of this record is changed.

**v1 keys.** The schema is strict: an unknown key is refused at parse. Every key is read by the render service in row 5 (ADR-0049). The schema also bounds a pack's size — how many lookups its `fields` lists and how many `related` entries it holds — so a pack over a bound is refused at parse and nothing is cut silently at call time. Row 5 fixes the numbers and says how they stand against the record tools' per-call caps.

| Key | Meaning | Reader (row 5) |
Expand Down
Loading