Skip to content

Commit 2a6c935

Browse files
committed
fix(objectql): the security-catalog name-conflict refusals say a permission set holds one name per namespace
The hot-install and cold-boot texts of SecurityCatalogNameConflictError said positions, permission sets and capabilities each hold one name per deployment. Since ADR-0150 D2/D9 a permission set holds one name per namespace; both texts now state that rule in the words of the permission set name describe. Text only: the doors and permissionSetHoldersMeet are unchanged. Claude-Session: https://claude.ai/code/session_016WV4cyrFFk86Jqf7Mp5Rzw Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0c2aeb9 commit 2a6c935

2 files changed

Lines changed: 37 additions & 10 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/objectql': patch
3+
---
4+
5+
fix(objectql): the security-catalog name-conflict refusals say a permission set holds one name per namespace
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The `SecurityCatalogNameConflictError` text, at a hot install and at a cold boot, said "Positions, permission sets and capabilities each hold one name per deployment: an assignment names a position or a permission set by its bare name". That stopped being true for permission sets when a set became identified by its package and name (ADR-0150 D2/D9). Both texts now say what the doors already do: positions and capabilities each hold one name per deployment, and a permission set holds one name per namespace, so packages of two namespaces may each hold a set of one name, while two packages of one namespace, a package with no namespace, a platform package (`base`, `system`, `sys`), the environment and the platform-requested `guest_portal` share one set of it. These are the words of the permission set `name` describe and the permission sets guide. No rule changes: the refusal still fires only where `permissionSetHoldersMeet` says two holders meet, with the same `NAMESPACE_CONFLICT` code and `422` status.

‎packages/objectql/src/registry.ts‎

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2800,6 +2800,21 @@ export interface SecurityCatalogNameConflict {
28002800
readonly existingHolder: SecurityCatalogHolder;
28012801
}
28022802

2803+
/**
2804+
* The rule both wordings of {@link SecurityCatalogNameConflictError} state, in
2805+
* the words the permission set `name` describe (`@objectstack/spec`) and the
2806+
* permission sets guide use. [ADR-0150 D2/D9] A permission set is identified
2807+
* by its package and name, so its name has one holder per namespace, judged by
2808+
* `permissionSetHoldersMeet` (`@objectstack/core`); positions and capabilities
2809+
* keep one name per deployment. Text only: which holders are refused is decided
2810+
* by the doors, never by this sentence.
2811+
*/
2812+
const SECURITY_CATALOG_NAME_RULE =
2813+
'Positions and capabilities each hold one name per deployment. A permission set holds one name per ' +
2814+
'namespace: packages of two namespaces may each hold a set of one name, while two packages of one ' +
2815+
'namespace, a package with no namespace, a platform package (`base`, `system`, `sys`), the environment ' +
2816+
'and the platform-requested `guest_portal` share one set of it.';
2817+
28032818
/**
28042819
* The cold-boot wording of {@link SecurityCatalogNameConflictError}: every
28052820
* package registered before the environment catalog hydrated, so each line
@@ -2815,9 +2830,9 @@ function coldBootConflictMessage(conflicts: readonly SecurityCatalogNameConflict
28152830
return (
28162831
`Security catalog name conflict at boot: ${conflicts.length === 1 ? 'a name' : `${conflicts.length} names`} ` +
28172832
`a configured package declares ${conflicts.length === 1 ? 'is' : 'are'} already held by another holder — ` +
2818-
`${lines.join('; ')}. Positions, permission sets and capabilities each hold one name per deployment: an ` +
2819-
`assignment names a position or a permission set by its bare name, so with two holders the environment's ` +
2820-
`stored item would be served in place of the package's definition. The environment catalog loads from ` +
2833+
`${lines.join('; ')}. ${SECURITY_CATALOG_NAME_RULE} Under that rule the environment's item and the ` +
2834+
`package's share one definition of the name, so with two holders the environment's stored item would be ` +
2835+
`served in place of the package's definition. The environment catalog loads from ` +
28212836
`sys_metadata before this check, so the boot is refused. Rename the item in the package, or rename or ` +
28222837
`delete the environment's item (its environment-wide sys_metadata row: \`os migrate security-catalog-overlays\` ` +
28232838
`lists every such row with no server running, and with --apply deletes them), then restart. ` +
@@ -2876,10 +2891,10 @@ export class SecurityCatalogNameConflictError extends Error {
28762891
? coldBootConflictMessage(conflicts)
28772892
: `Security catalog name conflict: package "${first.incomingPackageId}" cannot register ` +
28782893
`${conflicts.length === 1 ? 'a name' : `${conflicts.length} names`} another holder ` +
2879-
`already holds — ${lines.join('; ')}. Positions, permission sets and capabilities each ` +
2880-
`hold one name per deployment: an assignment names a position or a permission set by ` +
2881-
`its bare name, with no package to tell two definitions apart, so with two holders ` +
2882-
`which definition grants would depend on registration order. Rename the item in ` +
2894+
`already holds — ${lines.join('; ')}. ${SECURITY_CATALOG_NAME_RULE} Under that rule ` +
2895+
`"${first.incomingPackageId}" and each holder named here share one definition of the ` +
2896+
`name, with nothing to tell two definitions of it apart, so with two holders which ` +
2897+
`definition grants would depend on registration order. Rename the item in ` +
28832898
`"${first.incomingPackageId}"${
28842899
first.existingHolder.kind === 'package'
28852900
? `, rename it in "${first.existingHolder.packageId}", or uninstall one of the two packages`
@@ -8677,9 +8692,11 @@ export class SchemaRegistry {
86778692
// composite keys and each caller resolves to its own. What the original
86788693
// guard flagged as a collision is now the supported marketplace case.
86798694
// ⚠️ Except for the three security catalog types, refused at the top of this
8680-
// method: an assignment names a position or a permission set with no
8681-
// package context, so there a second holder is an ambiguity no caller can
8682-
// resolve (maintainer ruling Q4 = A on #15196). ⚠️ And except for the
8695+
// method: a position or a capability is named with no package context, and
8696+
// a permission set's name has one holder per namespace (ADR-0150 D2/D9,
8697+
// `permissionSetHoldersMeet`), so there a second holder that meets the
8698+
// first is an ambiguity no caller can resolve (maintainer ruling Q4 = A on
8699+
// #15196). ⚠️ And except for the
86838700
// bare-name types, refused (once the cold boot has sealed) at the top of
86848701
// this method too: a field's picklist, an import's mapping and a dashboard's
86858702
// dataset are resolved by name with no package (ruling C on #30798;

0 commit comments

Comments
 (0)