Skip to content

Commit 6107290

Browse files
fix(objectql): the security-catalog name-conflict refusals say a permission set holds one name per namespace (#33463)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDZYUbJbnXUTqZoZ56k4czR)_ Fixes #33389 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:`SecurityCatalogNameConflictError` 的两段报错文字(热安装与冷启动)不再说「岗位、权限集、能力每个部署一个名字」,改成「岗位和能力每个部署一个名字,权限集每个命名空间一个持有者」,并列出仍只有一个持有者的情形;措辞与 #33384 落地的 describe 一致。 - 为什么改:#32742 之后权限集按 (包, 名字) 识别,两个不同命名空间的包可以各持有同名权限集,旧句子从那时起就是错的;拒绝本身一直只在 `permissionSetHoldersMeet` 判定相遇时触发,没有错。 - 风险与回滚:只改报错文字和一段代码注释,不动规则、错误码(`NAMESPACE_CONFLICT`)或状态码(422);`@objectstack/objectql` patch changeset。回滚即 revert。 - 先看:`packages/objectql/src/registry.ts` 新增的 `SECURITY_CATALOG_NAME_RULE` 常量,以及它在 `coldBootConflictMessage` 与 `SecurityCatalogNameConflictError` 构造函数里的两处引用。 - 两分钟验证:`grep -n "A permission set holds one name per" packages/objectql/src/registry.ts`,预期恰命中常量一行;`grep -n "Positions, permission sets and capabilities each" packages/objectql/src/registry.ts` 预期零命中。 - 需要你做的:无,席位落地。 ## What changes - `packages/objectql/src/registry.ts`: - New module constant `SECURITY_CATALOG_NAME_RULE`, the one rule sentence both wordings of `SecurityCatalogNameConflictError` state: "Positions and capabilities each hold one name per deployment. A permission set holds one name per namespace: 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." This is the holder list of the permission set `name` describe that #33384 landed (`packages/spec/src/security/permission.zod.ts`), in the same words. - `coldBootConflictMessage` (the cold-boot refusal): FROM "Positions, permission sets and capabilities each hold one name per deployment: an assignment names a position or a permission set by its bare name, so with two holders the environment's stored item would be served in place of the package's definition." TO the rule sentence, then "Under that rule the environment's item and the package's share one definition of the name, so with two holders the environment's stored item would be served in place of the package's definition." - The hot-install message in the `SecurityCatalogNameConflictError` constructor: FROM "Positions, permission sets and capabilities each hold one name per deployment: an assignment names a position or a permission set by its bare name, with no package to tell two definitions apart, so with two holders which definition grants would depend on registration order." TO the rule sentence, then "Under that rule PACKAGE and each holder named here share one definition of the name, with nothing to tell two definitions of it apart, so with two holders which definition grants would depend on registration order." - The comment in `SchemaRegistry.registerItem` that explains why the three security catalog types are refused ("an assignment names a position or a permission set with no package context") now says a position or a capability is named with no package context and a permission set's name has one holder per namespace (ADR-0150 D2/D9, `permissionSetHoldersMeet`). - `.changeset/33389-security-catalog-conflict-text.md`: `@objectstack/objectql` patch. No rule changes. The doors, `permissionSetHoldersMeet` and the envelope (`NAMESPACE_CONFLICT`, `422`) are untouched; the head and the remedy of each message are unchanged. ## Tests No test pinned the old sentence: `git grep` on `0c2aeb9643` for "Positions, permission sets and capabilities", "assignment names a", "no package to tell" and "served in place of the package" found only `registry.ts` itself, a docs page, an ADR, a migration entry and comments (listed under Acceptance notes); no assertion in objectql, runtime, plugin-security, cloud-connection, metadata-protocol or dogfood reads either sentence. No new pin is added: the refusal prose has no consumer that parses it, and the existing suites already assert the envelope (`code` and `status`) and the holders. Local readings at `2a6c935f7e`, under `os-verify-lock`: - objectql build closure, then `vitest run` on `registry-security-catalog-namespace`, `protocol-permission-set-name-registry-reading`, `registry-security-catalog-names-held-by`, `manifest-service-residual-security-seal` and `environment-overlay-five-types`: 5 files, 103 tests passed. objectql typecheck, including `check:test-typecheck`: OK. - `protocol-boot-hydration-scoped`, `package-scoped-exact-qualifier` and `registry-namespace-install-gate`: 3 files, 314 tests passed. - eslint `--no-inline-config` on `registry.ts`: exit 0. ## Acceptance notes Other places that say a permission set holds one name per deployment, read on `0c2aeb9643` and left alone, each for the reason given: - `packages/metadata-protocol/src/protocol-save-door-refusals.ts` (the save door's `Security catalog name conflict` refusal): already says "A permission set holds one name per namespace" with the same holder list. Nothing to change. - `packages/spec/src/migrations/entries/semantic/18.security-catalog-environment-overlay-refused.ts` (`reason`: "Positions, permission sets and capabilities hold one name per deployment"): an ADR-0087 migration entry describing a v18 change, in `packages/spec`, outside this lane. #33384 raised it as an open question. - `packages/spec/src/kernel/customization-package.ts:252` (the `adr_0146_d6_security_catalog` basis): describes ADR-0146 D6 as written. - `packages/objectql/src/security-catalog-namespace.ts` module header: its first section states the original rule and its own "The narrowing: a permission set is one name per namespace" section already states the ADR-0150 narrowing. - Test comments, not assertions: `packages/objectql/src/protocol-boot-hydration-scoped.test.ts:217`, `packages/qa/dogfood/test/showcase-security.ts:32`, `packages/qa/dogfood/test/showcase-d7-default-profile.dogfood.test.ts:65`. - `content/docs/permissions/delegated-administration.mdx:69` ("an assignment names a position or set, and the gate resolves the name in the security catalog"): a description of the delegated-admin gate, not of the holder rule. - Decision records (ADR-0048 addendum, ADR-0131, ADR-0146 D6): not touched. ## Verification Derived gates at `2a6c935f7e`: `dispatch-gates --commands` gave 65 families. 64 exited 0. `check:dual-build-cjs-loads` exited 3, a prerequisite not met because only the objectql closure was built, so it is NOT MEASURED; CI Build Core covers it. `dispatch-gates --ran` reconciles 65 of 65. The CI check-runs on this pull are the authority for every gate family. --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cyrFFk86Jqf7Mp5Rzw)_ <!-- signed: domain:server#5 · os-elon-musk · session_016WV4cyrFFk86Jqf7Mp5Rzw --> Co-authored-by: Claude <noreply@anthropic.com>
1 parent e3f0cfd commit 6107290

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)