|
1 | 1 | # ADR-0048: Cross-package metadata collision — package-id identity, namespace install gate, package-scoped resolution |
2 | 2 |
|
3 | | -**Status**: Revised (2026-06-13) — supersedes the original *per-item collision detection* framing. The runtime guard shipped under the original proposal is **retained as a same-package authoring backstop**; the strategic direction for the app-marketplace era is revised below. · **Superseded in part by [ADR-0146](./0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md)** (2026-10-31) — §3.3's sentence that a context-free read "is best-effort: it returns the first match": a read of a name a code package ships has an owner — that package, or the declared override its paired `<base>.custom` publishes — and a same-named item of a package outside that closure is served only under its own address (ADR-0146 D8); and §3.4's coexistence "by construction", for a base's dependency closure only: the paired `<base>.custom`'s item bearing a base item's name is a declared override or is refused at publish — declare or rename — and any other dependent package's item bearing a base item's name is refused at publish — rename; only the pair declares (ADR-0146 D2, ruled 2026-10-31 on #28364 and #28390). Packages with no dependency relation keep §3.3 and §3.4 as written; qualify-to-cross, the same-package overwrite and the 2026-10-08 addendum stand. |
| 3 | +**Status**: Revised (2026-06-13) — supersedes the original *per-item collision detection* framing. The runtime guard shipped under the original proposal is **retained as a same-package authoring backstop**; the strategic direction for the app-marketplace era is revised below. · **Superseded in part by [ADR-0146](./0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md)** (2026-10-31) — §3.3's sentence that a context-free read "is best-effort: it returns the first match": a read of a name a code package ships has an owner — that package, or the declared override its paired `<base>.custom` publishes — and a same-named item of a package outside that closure is served only under its own address (ADR-0146 D8); and §3.4's coexistence "by construction", for a base's dependency closure only: the paired `<base>.custom`'s item bearing a base item's name is a declared override or is refused at publish — declare or rename — and any other dependent package's item bearing a base item's name is refused at publish — rename; only the pair declares (ADR-0146 D2, ruled 2026-10-31 on #28364 and #28390). Packages with no dependency relation keep §3.3 and §3.4 as written; qualify-to-cross, the same-package overwrite and the 2026-10-08 addendum stand. · **Amended** (2026-11-07, [#30794](https://github.com/objectstack-ai/objectstack/issues/30794)): §3.5 — rename-on-install ships for **unmanaged** copies, through the one rename engine `duplicatePackage` applies; a managed install is never renamed and §3.2 stands for it as written. See the dated note under §3.5. |
4 | 4 | **Deciders**: ObjectStack Protocol Architects |
5 | 5 | **Builds on**: [ADR-0003](./0003-package-as-first-class-citizen.md) (package as first-class citizen), [ADR-0005](./0005-metadata-customization-overlay.md) (artifact vs runtime overlay precedence), [ADR-0008](./0008-metadata-repository-and-change-log.md) (metadata repository, `MetaRef` identity), [ADR-0010](./0010-metadata-protection-model.md) (package provenance / `_packageId` stamping) |
6 | 6 | **Consumers**: `@objectstack/objectql` (`SchemaRegistry.registerItem`, `ObjectQL.registerApp`, install path), `@objectstack/console` / `objectui` (routing + metadata resolution), package authors, CLI/CI install path, the app marketplace registry. |
@@ -293,6 +293,45 @@ formula / view / flow that names `crm_account`. That is a deep rewrite, not a |
293 | 293 | URL change. v1 is **refuse-on-conflict** (§3.2). Rename-on-install is recorded |
294 | 294 | as future work, not part of this decision. |
295 | 295 |
|
| 296 | +> **Amended (2026-11-07, #30794) — rename-on-install ships for unmanaged copies, and only for them.** |
| 297 | +> An unmanaged install ([ADR-0131](./0131-total-organization-ownership-no-null-organization-id.md) D6) |
| 298 | +> may name a `targetNamespace`. The copy's new base takes it as its `namespace`. Every copied object |
| 299 | +> name takes it in place of the package's, and a name that lacks the package's prefix takes it in front. |
| 300 | +> Every reference to a renamed name follows. That is the deep rewrite this section describes, done by |
| 301 | +> the one engine `duplicatePackage` already applies (ADR-0070 D4): `planNamespaceRename`, |
| 302 | +> `packages/metadata-protocol/src/package-namespace-rename.ts`. Both doors call it, so the two renames |
| 303 | +> cannot drift. The doors share the rename and nothing more: only the duplicate rebinds a permission |
| 304 | +> set's `packageId` (ADR-0086 D3), which the import never does, and only the import judges the copy |
| 305 | +> names against the item-name grammar and the identifier limits below. |
| 306 | +> |
| 307 | +> - **The rename runs after view containers are expanded.** A view item follows its object, and so |
| 308 | +> does a view container (a view named exactly like an object) and every view it expands into; this |
| 309 | +> holds on both doors, so a bare object's container now follows it under the duplicate too. |
| 310 | +> Translations are named `<targetNamespace>_<locale>`, with the object keys inside them renamed. A |
| 311 | +> field keeps its key. Free text is renamed only at a whole prefixed object name. |
| 312 | +> - **Every refusal the names can answer comes before the base exists**: a copy name another object's |
| 313 | +> copy takes, a copy name the item-name grammar refuses, a copy name longer than an object's table |
| 314 | +> identifier (63) or an item name (255) may be, and a renamed key that meets a key the item already |
| 315 | +> holds. `targetNamespace` is judged by `manifest.namespace`'s own declaration, and the shared |
| 316 | +> namespaces `base`, `system` and `sys` are refused; both refusals answer `400 INVALID_REQUEST`, |
| 317 | +> naming `targetNamespace`. |
| 318 | +> - **§3.2's refuse-on-conflict runs on the renamed names.** A `targetNamespace` another package owns |
| 319 | +> is refused, and so is a renamed name the environment or a managed package holds. |
| 320 | +> - ⛔ **A managed install is never renamed.** It keeps the package's namespace and its upgrade |
| 321 | +> channel, and `targetNamespace` beside it is refused (`400 INVALID_REQUEST`) before anything is |
| 322 | +> fetched. For a managed install, §3.2 stands exactly as written. |
| 323 | +> - **Provenance** is the import answer's `sourceNamespace` and the install-local answer's |
| 324 | +> `installedFrom.namespace`. Both are information only, as ADR-0131 D6 records provenance. |
| 325 | +> - **The request carries it, the CLI does not.** `targetNamespace` is a key of the import's request |
| 326 | +> (`importUnmanagedPackage`) and of the `POST /api/v1/marketplace/install-local` body; |
| 327 | +> `os package install` sends none. |
| 328 | +> |
| 329 | +> Not in this amendment: renaming bare non-object names (ruling C on #30798 makes every |
| 330 | +> package-authored top-level name carry the namespace, see the |
| 331 | +> [2026-11-06 addendum](#addendum-2026-11-06-bare-names-resolved-without-a-package-hold-one-package--34-narrowed)), |
| 332 | +> seed data (the import copies none), and the hosted-cloud default namespace |
| 333 | +> (objectstack-ai/cloud#3624). |
| 334 | +
|
296 | 335 | ### 3.6 The package-id URL is transparent; a friendly alias is optional |
297 | 336 |
|
298 | 337 | A reverse-domain URL — `/apps/com.acme.crm/page/home` — is **self-describing**: |
|
0 commit comments