Skip to content

Commit 3f834fb

Browse files
committed
feat(objectql)!: an API, an object-less action and an engine function hold one name per package
The request family of ruling C's phase 1 on the bare-name rule the data family introduced. Once the cold boot has sealed the registry: - an API or an object-less action whose name another installed package holds is refused at the package door and the item seam, as a picklist is; an action bound to an object (keyed objectName:name) neither holds a name nor is refused over one; - a hook-binder bind bringing a function another package holds is refused ahead of every registration and bind, the holders being the claims each package's bind records (the runtime's handler owner app:<packageId> is read as the package); - the cold boot reads all three under the same switch, which stays 'warn' as ruled. The refusal's reason now names the consumers of the types it lists, and the boot warning no longer says the first-registered holder is served: an API, an object-less action's handler and a function are served last-registered. ADR-0048's 2026-11-06 addendum gains P1.7. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4d1EuHiCqvh8VEz81QD
1 parent 1aeeafd commit 3f834fb

8 files changed

Lines changed: 982 additions & 100 deletions
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@objectstack/objectql': minor
3+
---
4+
5+
feat(objectql)!: an API, an object-less action and an engine function hold one name per package — once the cold boot has sealed the registry, a package declaring an API or object-less action, or binding a function, under a name another installed package holds is refused, naming both holders and the rename; a boot that already holds such a clash warns
6+
7+
Clause-②: no (narrowing) — the engine's package door (`SchemaRegistry.installPackage`), item seam (`SchemaRegistry.registerItem`) and hook binder (`bindHooksToEngine`) refuse, after the cold boot, a package registration they accepted before: one whose API or object-less action, or one of whose functions, bears a name another installed package holds. Nothing is widened.
8+
Metadata-protocol: narrowed
9+
Skills-docs: none — `skills/**` does not teach that two packages may share an API, object-less action or function name, and the naming rule itself is phase 2's (#30805); the prescription ships in the refusal and warning text and in ADR-0048's 2026-11-06 addendum (P1.7).
10+
11+
<!-- adr-0087: not-required (no-migration-prescription) the refusal removes no key, export or field and changes the shape of no stored body; what an author does about a refused name is pick a different one, which no conversion can choose for them -->
12+
13+
**BREAKING** accept-set narrowing at the package registration door, the second family of maintainer ruling C on #30798, phase 1 (the first was picklists, mappings and datasets): managed install (`install-local`, a post-start `manifest.register`, a hot reload) and package registration (`ObjectQL.registerApp` and every package-bound `registerItem`), for APIs and object-less actions; and the hook binder's function bind, for functions. ADR-0048 §3.4 narrowed (addendum 2026-11-06, P1.7).
14+
15+
- **Why.** Measured on a booted showcase with two packages sharing one bare name per type, in both registration orders: the endpoint matcher kept one API per name, so the other package's declared path answered `404`; `/actions/global/NAME` ran the last-registered package's object-less action while `/meta/action/NAME` served the first-registered package's declaration; and the engine's function registry kept the last-registered function, which a flow `script` node's `function` and an action's `target` resolve with no package. Each answer flipped with registration order; only the action's handler bind warned, naming neither package.
16+
- **Before.** Two installed packages could each ship an API or an object-less action under one name, or bind a function under one name, at boot or by a later install; every caller was served one of them, chosen by registration order.
17+
- **Now.** After the cold boot (the engine plugin seals the registry at `kernel:bootstrapped`, once every package of the boot has registered and bound its functions), a package registration declaring an API or object-less action under a name another installed package holds is refused ahead of every mutation, and a hook-binder bind bringing a function another package holds is refused ahead of every registration and bind it would make. The envelope is the first family's: `code: 'NAMESPACE_CONFLICT'`, `status: 422`, `install-local` answering `422 PLUGIN_REGISTER_FAILED`, every conflicting name in one refusal, both holders named, the rename (the incoming package's namespace prefixed) carried, `conflicts[]` structured. A function's holder is named as its package, never as the runtime's handler owner `app:<packageId>`. A refused function bind is logged by `AppPlugin` at `error` and leaves the package's other registrations as they are.
18+
- **The cold boot.** A deployment whose installed packages already share such a name still boots: the one warning line names every such name, both holders and the rename, and changes nothing about which holder each caller is served. The maintainer ruled this on 2026-11-06: the boot warns, and only a new holder is refused (`BARE_NAME_COLD_BOOT_MODE` stays `'warn'`). The warning's sentence about what is served now reads "changes nothing about which holder each caller is served" for every family, since an API, an object-less action's handler and a function are served last-registered.
19+
- **Who moves.** An author whose package declares an API or object-less action, or binds a function, under a name another package installed beside it already ships, at the next install or upgrade into a running deployment. **The one-line fix: rename the item in one of the two packages — the refusal names the namespace-prefixed name — or uninstall one of them.** A client, flow or action that named the old name must name the new one; nothing rewrites stored references.
20+
- **Unchanged.** An action bound to an object (`objectName`, or a collector's `object`): keyed `objectName:name` from declaration to handler, it neither holds a name nor is refused over one. A hook's `handler`, which resolves among its own package's functions only. The same package registering or binding its own name again. An environment item under a package's name (never judged, never a holder: the ADR-0005 overlay). A bind naming no owner, a function entry with no callable handler, and a direct `ObjectQL.registerFunction` call. `OS_METADATA_COLLISION=warn` does not downgrade the refusal.
21+
22+
**Measured producers.** On objectstack `1aeeafd9`, the four examples carry 3 APIs, 1 object-less action and 3 functions (`app-showcase`: 3 APIs, 1 object-less action, 2 functions; `app-todo`: 1 function), and no name has more than one holder. HotCRM `6961ab1` (five packages, one artifact) declares no API, no object-less action and no function in its stack (its 40 actions are all bound to objects). Measured separately: no name coincides across the two sets. Deployed and marketplace packages, and functions a runtime module registers outside the stack definition, NOT MEASURED.

‎docs/adr/0048-cross-package-metadata-collision.md‎

Lines changed: 74 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**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)
66
**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.
77
**Surfaced by**: ADR-0046 review (doc naming) → generalised to all bare-named metadata → re-examined through the app-marketplace install lens.
8-
**Addenda**: [2026-08-08 — publish-time / marketplace namespace exclusivity](#addendum-2026-08-08-publish-time--marketplace-namespace-exclusivity) (**Accepted** 2026-08-08 — maintainer ruling on #1825, [acceptance comment 5226411687](https://github.com/objectstack-ai/objectstack/issues/1825#issuecomment-5226411687), landed by PR #6671; additive to §3.2, supersedes nothing); [2026-11-06 — bare names resolved without a package hold one package](#addendum-2026-11-06-bare-names-resolved-without-a-package-hold-one-package--34-narrowed) (**Accepted**, ruling C on #30798, phase 1; narrows §3.4 for picklists, mappings and datasets, supersedes nothing).
8+
**Addenda**: [2026-08-08 — publish-time / marketplace namespace exclusivity](#addendum-2026-08-08-publish-time--marketplace-namespace-exclusivity) (**Accepted** 2026-08-08 — maintainer ruling on #1825, [acceptance comment 5226411687](https://github.com/objectstack-ai/objectstack/issues/1825#issuecomment-5226411687), landed by PR #6671; additive to §3.2, supersedes nothing); [2026-11-06 — bare names resolved without a package hold one package](#addendum-2026-11-06-bare-names-resolved-without-a-package-hold-one-package--34-narrowed) (**Accepted**, ruling C on #30798, phase 1; narrows §3.4 for picklists, mappings, datasets, APIs, object-less actions and engine functions, supersedes nothing).
99

1010
---
1111

@@ -266,19 +266,23 @@ package — stays covered by the `naming/namespace-prefix` lint in `os lint`.
266266
> above. Every other type keeps §3.4 as written. See
267267
> [Addendum (2026-10-08)](#addendum-2026-10-08-the-security-catalog-holds-one-name-per-deployment--34-narrowed).
268268
269-
> **Narrowed (2026-11-06) — picklists, mappings and datasets are out of §3.4.**
270-
> Their consumers resolve the name with no package — a field's `picklist`, an
271-
> import's `mappingName`, a dashboard's `datasetName` — so with two holders every
272-
> caller is served the first-registered one, measured on a booted two-package
273-
> deployment (#30803). Once the cold boot has sealed the registry, a package whose
274-
> picklist, mapping or dataset bears a name another installed package holds is
275-
> refused at managed install and at package registration (a built-in's name, at
276-
> managed install), naming both holders and the rename. ⛔ The environment catalog is never a
277-
> holder: an environment item under a package's name is the ADR-0005 overlay.
278-
> The other types the measurement found resolving without a package context —
279-
> `api`, the object-less `action`, the engine function registry, `email_template`,
280-
> `webhook`, `connector`, `flow`, `agent` and `skill` — are to follow, each in its
281-
> own change. Every other type keeps §3.4 as written. See
269+
> **Narrowed (2026-11-06) — picklists, mappings, datasets, APIs, object-less
270+
> actions and engine functions are out of §3.4.** Their consumers resolve the
271+
> name with no package — a field's `picklist`, an import's `mappingName`, a
272+
> dashboard's `datasetName`, the endpoint matcher's one API per name,
273+
> `/actions/global/NAME`, a flow `script` node's function — so with two holders
274+
> every caller is served one of them, chosen by registration order, measured on a
275+
> booted two-package deployment (#30803). Once the cold boot has sealed the
276+
> registry, a package whose picklist, mapping, dataset, API or object-less action
277+
> bears a name another installed package holds is refused at managed install and
278+
> at package registration (a built-in's name, at managed install), and a package
279+
> whose handlers bring a function another package holds is refused at the hook
280+
> binder's bind, each naming both holders and the rename. ⛔ The environment
281+
> catalog is never a holder: an environment item under a package's name is the
282+
> ADR-0005 overlay. The other types the measurement found resolving without a
283+
> package context — `email_template`, `webhook`, `connector`, `flow`, `agent` and
284+
> `skill` — are to follow, each family in its own change. Every other type,
285+
> an action bound to an object among them, keeps §3.4 as written. See
282286
> [Addendum (2026-11-06)](#addendum-2026-11-06-bare-names-resolved-without-a-package-hold-one-package--34-narrowed).
283287
284288
### 3.5 Namespace rename-on-install is deferred (non-goal)
@@ -890,9 +894,9 @@ first phase.
890894
## Addendum (2026-11-06): bare names resolved without a package hold one package — §3.4 narrowed
891895

892896
> **Status of this addendum: Accepted** — it records phase 1 of a maintainer
893-
> ruling. It **narrows §3.4 for three more metadata types and supersedes no other
894-
> text**: §§1–6, the 2026-08-08 addendum and the 2026-10-08 addendum stand
895-
> verbatim.
897+
> ruling. It **narrows §3.4 for more metadata types, one family per change (P1.2,
898+
> P1.7), and supersedes no other text**: §§1–6, the 2026-08-08 addendum and the
899+
> 2026-10-08 addendum stand verbatim.
896900
>
897901
> **Ruling this addendum records** — #30798, answered by the maintainer
898902
> 「同意 c」 (ruling record 6676670839, 2026-11-06). The ruled option's text,
@@ -969,12 +973,14 @@ the engine plugin seals the registry, and every name two installed packages
969973
already hold is handled by one switch, `BARE_NAME_COLD_BOOT_MODE`:
970974

971975
- **`'warn'`** — one warning line naming every such name, both holders and the
972-
rename; the boot continues and keeps serving the first-registered holder;
976+
rename; the boot continues and changes nothing about which holder each caller
977+
is served;
973978
- **`'refuse'`** — the boot is refused with the P1.2 envelope, as N.3's
974979
amendment refuses the security catalog's.
975980

976-
The switch is `'warn'` until the maintainer rules on the cold boot of a
977-
deployment that already holds a clash. In either mode the doors refuse a NEW
981+
The maintainer ruled the cold boot of a deployment that already holds a clash on
982+
2026-11-06 (#30803): it warns, and only a new holder is refused — the switch is
983+
`'warn'`. In either mode the doors refuse a NEW
978984
holder after the seal. A package that already holds a name is never a new holder
979985
of it: a reload, a re-install or an upgrade of a package that came through the
980986
boot beside another holder keeps its name, while a third package is refused,
@@ -999,19 +1005,58 @@ the doors never refuse.
9991005
### P1.5 To follow
10001006

10011007
The same measurement found these types resolving without a package context too:
1002-
`api` (the endpoint store is keyed by name — the other package's path answers
1003-
404), the object-less `action` (the last handler runs while `/meta` serves the
1004-
first declaration), the engine function registry (`functions:`, last wins, read by
1005-
flow `script` nodes and action `target` refs), `email_template`, `webhook` (the
1006-
second package's webhook is never subscribed), `connector`, `flow`, `agent` and
1007-
`skill`. Each joins P1.2's list in its own change under #30803, with its own pins,
1008-
narrowing §3.4 the same way; a type the security seat claims lands there instead.
1009-
`tool` and `rag_pipeline` share a reader with `agent` and were not measured.
1008+
`email_template`, `webhook` (the second package's webhook is never subscribed),
1009+
`connector`, `flow`, `agent` and `skill`. Each family joins P1.2's list in its own
1010+
change under #30803 — `flow`, `webhook`, `connector` and `email_template`; then
1011+
`agent` and `skill` — with its own pins, narrowing §3.4 the same way (the
1012+
maintainer kept all of them in #30803 on 2026-11-06). `tool` and `rag_pipeline`
1013+
share a reader with `agent` and were not measured. The request family that was
1014+
listed here is P1.7.
10101015

10111016
### P1.6 Where it is implemented
10121017

10131018
`@objectstack/objectql`: the rule, the holders and the switch in
10141019
`bare-name-one-holder.ts`; the package door in `SchemaRegistry.installPackage` and
1015-
the item seam in `SchemaRegistry.registerItem`; the seal in
1020+
the item seam in `SchemaRegistry.registerItem`; the function door in
1021+
`bindHooksToEngine`, through `SchemaRegistry.claimBareNameFunctions`; the seal in
10161022
`SchemaRegistry.sealBareNameHolders`, called by the engine plugin at
10171023
`kernel:bootstrapped` through `sealBareNameHoldersAtColdBoot`.
1024+
1025+
### P1.7 The request family: `api`, the object-less `action`, the engine function registry
1026+
1027+
Measured with P1.1's two packages, in both orders (#30803, stage 1):
1028+
1029+
- **`api`** — the endpoint matcher keeps one API per name, the last-registered:
1030+
that package's path answers `200` and the other package's declared path `404`.
1031+
- **the object-less `action`** — `/actions/global/NAME` runs the last-registered
1032+
package's handler while `/meta/action/NAME` serves the first-registered
1033+
package's declaration, so the button a client draws and the code that runs
1034+
come from two packages. The handler bind warns that it replaces one, naming
1035+
neither package.
1036+
- **the engine function registry** — one function per name, the last-registered,
1037+
resolved with no package by a flow `script` node's `function` and an action's
1038+
`target`.
1039+
1040+
**What is refused.** An API and an object-less action join P1.2's list: the same
1041+
two doors, the same holders, the same envelope and rename. An action **bound to
1042+
an object** (`objectName`, or a collector's `object`) is not covered — it is keyed
1043+
`objectName:name` from declaration to handler — so it neither holds a name nor is
1044+
refused over one, whatever object-less action shares its name.
1045+
1046+
A function is not a registry item: a package's functions are code its runtime
1047+
module brings, and the one door they pass is the hook binder's bind
1048+
(`bindHooksToEngine`, `functions`), which the runtime makes for a package under
1049+
the handler owner `app:<packageId>` — read as that package. The bind records the
1050+
package's claim to each function name; once the cold boot has sealed the
1051+
registry, a bind bringing a function another package holds is refused ahead of
1052+
every registration and bind it would make, every conflicting name in one
1053+
refusal, naming both holders and the rename. A package binding its own functions
1054+
again (a hot reload) is no new holder, and uninstalling a package releases its
1055+
claims. Not judged: a bind naming no owner, an entry with no callable handler,
1056+
and a direct `ObjectQL.registerFunction` call — the imperative registration a
1057+
host's own code makes outside any package's bind. A hook's `handler` was never
1058+
ambiguous: the binder resolves it among its own package's functions only.
1059+
1060+
**The cold boot** reads the bind claims with the registry's holders, under P1.3's
1061+
switch: two packages of one boot binding one function name are named in the same
1062+
warning line, as packages, never as their handler owners.

0 commit comments

Comments
 (0)