Skip to content

Commit 7e5c6a7

Browse files
committed
docs(adr): ADR-0070 D1 mark names Setup's datasource create as the one open door (#38174)
Opus review 7390508171 on the ADR PR (seat decisions relayed 20:00Z). M1: Setup's POST /api/v1/datasources inserts a package-less datasource row outside protocol.saveMetaItem, so #39386's kernel close does not meet it, and no ruling exempts it. The status line, Implementation status and D3's Kernel bullet now say the kernel save is closed and D1 is complete except for that door, tracked in #39398; "and no other" is dropped from the exemptions bullet, and the D1 note gains a bullet for the open door. N1: "What is refused" names the permission-set clone door and Setup's landing-package pick (claim amendment 7389333883, ruled A, no new exemption). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CasbvyQnz4st6s79P9
1 parent 2824f8c commit 7e5c6a7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎docs/adr/0070-package-first-authoring.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ADR-0070: Package-first authoring — every runtime-authored item lives in a writable package (base); no orphans
22

3-
**Status**: Accepted (2026-06-24) — P1–P3 implemented, merged & live-verified (see *Implementation status*); D4–D6 remaining · **Superseded in part by [ADR-0146](./0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md)** (2026-10-31) — D3's prompt to create a base, for the paired case only: a customer's first customization of an installed base lands in the auto-created `<base>.custom` package without a prompt (ADR-0146 D3); D5's destination for a package-less overlay row of a packaged item: the base's `<base>.custom`, as a declared override, after which the package-less write closes (ADR-0146 D11). D1, D2, D4 and D6 stand; D3's prompt stands everywhere else. · **Amended** (2026-10-31, [#28117](https://github.com/objectstack-ai/objectstack/issues/28117) — the maintainer's ruling of 2026-10-30, 「大包 + 设置里启用模块」, then 「同意」: a `type: module` sub-package of an installed app may be **disabled**, not authored into, by an admin, on the tie PR [#28308](https://github.com/objectstack-ai/objectstack/pull/28308) shipped; see the amendment note under D2. D2's two kinds and its writability predicate stand.) · **Amended** (2026-11-29, [#38150](https://github.com/objectstack-ai/objectstack/issues/38150) — ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3, ruled C, as [ADR-0084](./0084-application-builder-information-architecture.md#amendment-2026-11-26-org) records it: D5's "move into a base" is the move-in door, and D5's bulk assignment to a default base is superseded; see the amendment note under D5. D1 and D6 stand.) · **Amended** (2026-12-03, [#38174](https://github.com/objectstack-ai/objectstack/issues/38174) — ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 2, ruled A, as [ADR-0084](./0084-application-builder-information-architecture.md#amendment-2026-11-26-org) records it, and ruling record [comment 7380917604](https://github.com/objectstack-ai/objectstack/issues/38174#issuecomment-7380917604), ruled A: the kernel refuses a create that names no package, five writers keep a named exemption (the four of the first ruling and, by the second, the organization-ownership ceremony's conversions of rows stored before the upgrade), and a loose row that exists is still saved in place; D1 is complete with [PR #39386](https://github.com/objectstack-ai/objectstack/pull/39386); see the amendment note under D1. D1's text stands.)
3+
**Status**: Accepted (2026-06-24) — P1–P3 implemented, merged & live-verified (see *Implementation status*); D4–D6 remaining · **Superseded in part by [ADR-0146](./0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md)** (2026-10-31) — D3's prompt to create a base, for the paired case only: a customer's first customization of an installed base lands in the auto-created `<base>.custom` package without a prompt (ADR-0146 D3); D5's destination for a package-less overlay row of a packaged item: the base's `<base>.custom`, as a declared override, after which the package-less write closes (ADR-0146 D11). D1, D2, D4 and D6 stand; D3's prompt stands everywhere else. · **Amended** (2026-10-31, [#28117](https://github.com/objectstack-ai/objectstack/issues/28117) — the maintainer's ruling of 2026-10-30, 「大包 + 设置里启用模块」, then 「同意」: a `type: module` sub-package of an installed app may be **disabled**, not authored into, by an admin, on the tie PR [#28308](https://github.com/objectstack-ai/objectstack/pull/28308) shipped; see the amendment note under D2. D2's two kinds and its writability predicate stand.) · **Amended** (2026-11-29, [#38150](https://github.com/objectstack-ai/objectstack/issues/38150) — ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3, ruled C, as [ADR-0084](./0084-application-builder-information-architecture.md#amendment-2026-11-26-org) records it: D5's "move into a base" is the move-in door, and D5's bulk assignment to a default base is superseded; see the amendment note under D5. D1 and D6 stand.) · **Amended** (2026-12-03, [#38174](https://github.com/objectstack-ai/objectstack/issues/38174) — ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 2, ruled A, as [ADR-0084](./0084-application-builder-information-architecture.md#amendment-2026-11-26-org) records it, and ruling record [comment 7380917604](https://github.com/objectstack-ai/objectstack/issues/38174#issuecomment-7380917604), ruled A: the kernel refuses a create that names no package, five writers keep a named exemption (the four of the first ruling and, by the second, the organization-ownership ceremony's conversions of rows stored before the upgrade), and a loose row that exists is still saved in place; [PR #39386](https://github.com/objectstack-ai/objectstack/pull/39386) closes the kernel save, and D1 is complete except for one open door outside that save, Setup's datasource create, tracked in [#39398](https://github.com/objectstack-ai/objectstack/issues/39398); see the amendment note under D1. D1's text stands.)
44
**Deciders**: ObjectStack Protocol Architects
55
**Builds on**: [ADR-0005](./0005-metadata-customization-overlay.md) (`allowOrgOverride` / runtime overlay model; one Zod source per type), [ADR-0048](./0048-cross-package-metadata-collision.md) (one app per package; package id is the addressing unit), [ADR-0033](./0033-ai-assisted-metadata-authoring.md) (AI authors metadata as drafts), [ADR-0067](./0067-commit-history-and-rollback-for-ai-authoring.md) (commit history & rollback for AI authoring)
66
**Consumers**: `@objectstack/objectql` (`protocol.saveMetaItem` write path), `@objectstack/spec` (metadata-type registry), `../objectui` (Studio create flow, package scope selector, `PackagesPage`), `../cloud` (`service-ai-studio` — `create_metadata` / `resolvePackageId` / `apply_blueprint`)
@@ -23,7 +23,7 @@ Built across the three surfaces and verified end-to-end in a real environment vi
2323
- **P3 — AI (D3)** — `../cloud` `service-ai-studio` ([cloud#479](https://github.com/objectstack-ai/cloud/pull/479), [cloud#481](https://github.com/objectstack-ai/cloud/pull/481); tests [cloud#480](https://github.com/objectstack-ai/cloud/pull/480)): drops the shared `com.workspace` catch-all and auto-creates an **intentional named** base via `protocol.installPackage` (a real, Studio-visible package); single-writable-base coherence groups an incremental build into one base; an explicit platform/system `packageId` is discarded; empty field props are sanitized.
2424
- **Live dogfood (real LLM + runtime)**: a one-sentence magic build plus iterative business-user changes (add a related object, add a field) all landed in **one** app base (`app.iojn`), live and editable — no `com.workspace`, no orphans.
2525
- **Remaining**: **D4** (package-as-lifecycle-unit: delete-cascade / export / duplicate), **D5** (orphan migration + stopgap removal), **D6** (framing). The P1 kernel rejection becomes the runtime backstop once the framework release is consumed by the cloud runtime (today's runtime links the published framework).
26-
- **D1 complete (2026-12-03, [#38174](https://github.com/objectstack-ai/objectstack/issues/38174))** — P1 refused a runtime create that names a read-only package, and still accepted one that names no package. [PR #39386](https://github.com/objectstack-ai/objectstack/pull/39386) closes that create too: the kernel save answers `422 WRITABLE_PACKAGE_REQUIRED` and names the writable packages. D1 is complete, and D3's Kernel bullet is done; the amendment note under D1 has the exemptions and what stays open.
26+
- **D1's kernel close (2026-12-03, [#38174](https://github.com/objectstack-ai/objectstack/issues/38174))** — P1 refused a runtime create that names a read-only package, and still accepted one that names no package. [PR #39386](https://github.com/objectstack-ai/objectstack/pull/39386) closes that create too: the kernel save answers `422 WRITABLE_PACKAGE_REQUIRED` and names the writable packages. The kernel save is closed and D3's Kernel bullet is done. D1 is complete except for one open door outside the kernel save, Setup's datasource create, tracked in [#39398](https://github.com/objectstack-ai/objectstack/issues/39398); the amendment note under D1 has the exemptions and what stays open.
2727

2828
## TL;DR
2929

@@ -59,11 +59,12 @@ A runtime **create** (`intent = runtime-only`, i.e. not an overlay of an artifac
5959

6060
> **Amended 2026-12-03 ([#38174](https://github.com/objectstack-ai/objectstack/issues/38174), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 2, ruled A, written into [ADR-0084's amendment of 2026-11-26](./0084-application-builder-information-architecture.md#amendment-2026-11-26-org); and ruling record [comment 7380917604](https://github.com/objectstack-ai/objectstack/issues/38174#issuecomment-7380917604), ruled A) — the kernel refuses a create that names no package; five writers keep a named exemption, and a loose row that exists is still saved in place.** This note records the implementation status of the decision above, with the exemptions the two rulings name. Before [PR #39386](https://github.com/objectstack-ai/objectstack/pull/39386), the kernel enforced one half of it: it refused a runtime create that named a read-only package, and it accepted one that named no package and stored a loose row. That PR closes the second half, in the same phase as the interface's ask and after it, with no flag.
6161
>
62-
> - **What is refused.** A save through `protocol.saveMetaItem`, draft or publish, that names no package is a create when no package holds the name, as an item or as a draft, and no package-less row or draft of it is stored. It is refused before anything is written, with `422 WRITABLE_PACKAGE_REQUIRED`, D1's own code, in a sentence that names the type and the name and lists, up to a cap, the writable packages the caller may name. `os meta register` is closed with the rest: a new item needs its `--package`.
63-
> - **Five writers keep a named exemption, and no other.** The ruling of 2026-11-26 names four. An overlay of a kernel item, until the platform pair's whitelist exists: an overlay is `intent = override-artifact`, which the third bullet above leaves unchanged. The ruled import of an external datasource, which the server stamps `writeFace: 'external-import'`. A migration that preserves a binding, which re-saves a stored row under a server-stated `source`. Platform registration, which writes the metadata service's own store and does not pass the kernel save. The ruling of 2026-12-03 names the fifth, which the next bullet gives with its bound. A remote caller can state none of the marks these exemptions are read by. Decisions Q-a, answered A, and Q-b, answered C, add no metadata type and no case to the five (ADR-0084's first note of 2026-12-03 gives them).
62+
> - **What is refused.** A save through `protocol.saveMetaItem`, draft or publish, that names no package is a create when no package holds the name, as an item or as a draft, and no package-less row or draft of it is stored. It is refused before anything is written, with `422 WRITABLE_PACKAGE_REQUIRED`, D1's own code, in a sentence that names the type and the name and lists, up to a cap, the writable packages the caller may name. `os meta register` is closed with the rest: a new item needs its `--package`. The permission-set clone door is closed with it too: a copy with no package to land in (a loose source, or a set a kernel package ships) is refused, and Setup's clone dialog asks for the landing package, offering the writable packages (claim amendment [7389333883](https://github.com/objectstack-ai/objectstack/issues/38174#issuecomment-7389333883), ruled A on 2026-12-03, with no new exemption).
63+
> - **Five writers keep a named exemption.** The ruling of 2026-11-26 names four. An overlay of a kernel item, until the platform pair's whitelist exists: an overlay is `intent = override-artifact`, which the third bullet above leaves unchanged. The ruled import of an external datasource, which the server stamps `writeFace: 'external-import'`. A migration that preserves a binding, which re-saves a stored row under a server-stated `source`. Platform registration, which writes the metadata service's own store and does not pass the kernel save. The ruling of 2026-12-03 names the fifth, which the next bullet gives with its bound. A remote caller can state none of the marks these exemptions are read by. Decisions Q-a, answered A, and Q-b, answered C, add no metadata type and no case to the five (ADR-0084's first note of 2026-12-03 gives them).
6464
> - **The fifth: the organization-ownership ceremony's conversions of rows stored before the upgrade** (ruling record [comment 7380917604](https://github.com/objectstack-ai/objectstack/issues/38174#issuecomment-7380917604): on the decision card the maintainer chose the option 「A 迁移照旧落为散落项」, and the record is the maintainer's word for "four writers, and no other" becoming five). `os migrate organization-ownership --apply` makes two creates that name no package (`packages/cli/src/utils/organization-ownership-apply.ts`): it converts an organization's authored positions and permission sets into environment metadata, and it promotes an email template. Both state one server-side provenance, the request field `packagelessCreateProvenance: 'organization-ownership-ceremony'`, on the precedent of the external import's `writeFace`, and no wire body can state it. Only the create judgment reads it. `source` is not set, so every other gate still judges these saves: a permission set that grants on an object that does not exist is still refused, and the ceremony reports it as a blocker. That is the exemption's bound: the ceremony's conversions of rows stored before the upgrade, and no other save. The converted items land loose. The ceremony's report lists what it left loose and names the door that moves it into a package, `POST /api/v1/packages/:id/move-in` (the amendment note under D5).
6565
> - **What stays open.** A loose row that exists is saved in place, as a draft or as a published item, and it is deleted and its draft published as before. A save that names no package for a name a package holds is unchanged too: the name is not new, and [ADR-0150](./0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md) D4 judges the save as before ("A package-less row that bears a package-held name is a customization, never a second item"). A name whose only stored row is a draft that a package holds is not new either: a save of it that names no package is no create, and the draft address judges it as before (`packages/metadata-protocol/src/sys-metadata-repository.ts#unboundItemDraftAddress`).
6666
> - **The automation definition doors.** `POST /api/v1/automation` and `PUT /api/v1/automation/:name` created flows that belong to no package. The first is retired, and the second updates a flow that exists and refuses a new name (decision Q-g, answered C: [comment 7234518908](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7234518908)). A flow is created with `PUT /api/v1/meta/flow/NAME?package=PKG`, which registers the flow and arms it at once. The refusal of a notify node that names an unregistered channel, which the automation doors ran and that save did not, moves onto it ([comment 7378011450](https://github.com/objectstack-ai/objectstack/issues/38174#issuecomment-7378011450)).
67+
> - **One open door outside the kernel save.** Setup's `POST /api/v1/datasources` creates a runtime `datasource` and inserts its row into `sys_metadata` with no package, directly (`persistDatasourceRow`), so the write never reaches `protocol.saveMetaItem` and the close does not meet it. It is none of the five exemptions, the census that ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035) ruled on did not list it, and no ruling covers it. Until [#39398](https://github.com/objectstack-ai/objectstack/issues/39398) closes it (or a ruling exempts it), D1 is not complete for that door.
6768
> - **Not reached.** Sharing rules, queues and assignment rules that an organization authors in Setup are data rows, and no metadata save writes them; ADR-0084's first note of 2026-12-03 corrects the sentence that bound them to a package.
6869
>
6970
> D1's three bullets stand as written.
@@ -83,7 +84,7 @@ Every authoring surface follows the same contract; none silently defaults into a
8384

8485
- **Studio UI** [new]: the scope selector defaults to a *writable* package (the user's most-recent base) or, when none exists, the create entry points (`新建`) **prompt to create a base** (reuse the existing `PackagesPage` create dialog) before opening the designer. New items are bound to the active writable package. The "Local / Custom" (`sys_metadata`) scope is removed as a create destination (see D5).
8586
- **AI authoring** [new] (`../cloud` `service-ai-studio`): `resolvePackageId` **drops the auto-`com.workspace` fallback** (`metadata-tools.ts`) and the `applyDraft` re-bind (); when no writable package is resolvable it returns an actionable error directing the agent to `create_package` or `set_active_package`. `apply_blueprint` requires a package context (its `ensureAppPackage` is invoked only after an explicit create/confirm). Skill prompts (`metadata-authoring-skill.ts`, `solution-design-skill.ts`) are updated to make "establish the base first" a hard step, not a hint.
86-
- **Kernel** [new]: D1 is the backstop — even if a surface regresses, the write is rejected, not orphaned. *(Done 2026-12-03, [#38174](https://github.com/objectstack-ai/objectstack/issues/38174): the kernel refuses a create that names no package — the amendment note under D1.)*
87+
- **Kernel** [new]: D1 is the backstop — even if a surface regresses, the write is rejected, not orphaned. *(Done 2026-12-03, [#38174](https://github.com/objectstack-ai/objectstack/issues/38174): the kernel refuses a create that names no package — the amendment note under D1; Setup's datasource create, which writes outside the kernel save, stays open in [#39398](https://github.com/objectstack-ai/objectstack/issues/39398).)*
8788

8889
### D4 — The package is the lifecycle unit (delete / export / snapshot / duplicate) [new]
8990

0 commit comments

Comments
 (0)