Skip to content

Commit d38ceba

Browse files
docs(spec): the permission set name describe and the permission sets page say one holder per namespace (#33384)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XTb7VngXcrRUydhcV2b3MnX)_ Fixes #32758 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:权限集 `name` 字段的 describe 不再说「在环境的安全目录里唯一」,改成「权限集按 (包, 名字) 识别,每个命名空间一个持有者」;参考文档那一行重新生成;权限集指南里「权限集、岗位、能力每个部署一个名字」改成权限集按命名空间、岗位和能力仍按部署。 - 为什么改:#32742(2026-11-12 合入)让两个不同命名空间的包可以各持有同名权限集,这两处文字从那时起就是错的;技能包 `skills/objectstack-platform/SKILL.md` 已经按 (包, 名字) 讲,没有改。 - 风险与回滚:只改说明文字,不动 schema、规则或运行时;spec patch changeset。回滚即 revert。 - 先看:`packages/spec/src/security/permission.zod.ts` 里 `name` 的 describe;其次 `content/docs/permissions/permission-sets.mdx` 改动的那一段。 - 两分钟验证:`grep -n "one holder per namespace" content/docs/references/security/permission.mdx`,预期 `name` 行命中一次,且与 `permission.zod.ts` 的 describe 逐字一致。 - 需要你做的:无,席位落地。 ## What changes - `packages/spec/src/security/permission.zod.ts`: the `name` `describe()` and its JSDoc line. FROM "Permission set name, unique within the security catalog the environment serves (lowercase snake_case)" TO "Permission set name (lowercase snake_case). A set is identified by its package and name: a name has one holder 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". The holder list is the one #32742's save-door sentence and `permissionSetHoldersMeet` (`@objectstack/core`) state. The `//` comment above the field gains one line pointing at ADR-0150 D2/D9 and that predicate. `SnakeCaseIdentifierSchema` and the field are unchanged. - `content/docs/references/security/permission.mdx`: the generated `name` row, regenerated (`pnpm gen:schema && pnpm gen:docs` in `packages/spec`). No other generated file carries the string; `json-schema/` is untracked build output. - `content/docs/permissions/permission-sets.mdx` (the "set shipped in code cannot be edited" bullet): FROM "A set is never overridden under its own name, not even from `.custom`: permission sets, positions and capabilities hold one name per deployment (ADR-0146 D6)." TO: the set is still never overridden under its own name, now for the reason that holds (a permission set takes no override, ADR-0146 D6, and a set of the shipped set's name saved into the pair is refused `403 NOT_OVERRIDABLE`); a permission set is identified by its package and name (ADR-0150 D2), one holder per namespace, with the one-holder cases listed; positions and capabilities keep one name per deployment. - `.changeset/32758-permission-set-name-describe.md`: `@objectstack/spec` patch, since the describe ships in spec `dist`. ## Why PR #32742 (merged 2026-11-12, `5defbfeb`) made a permission-set name one holder per namespace: two packages of two namespaces may each hold a set of one name, judged by `permissionSetHoldersMeet`. Both texts still said one name per deployment. **The `.custom` sentence, measured against #32742.** The order asked whether "a set is never overridden under its own name, not even from `.custom`" is still true. The pair's namespace is `NAMESPACE_custom` (the base's namespace plus `_custom`), a different namespace from its base, so the name rule alone would admit a second set there. A probe on this head (the real protocol over the real `ObjectQL` engine and an in-memory driver, the harness of `protocol-custom-override-bare-slot-envelope.test.ts`; base `com.example.showcase`, namespace `showcase`, shipping `showcase_reader`; pair created by `ensureCustomizationPackage`, namespace `showcase_custom`) answered: | Write | Answer | | --- | --- | | Save `showcase_reader` into the pair, no `overrides` | `403 NOT_OVERRIDABLE` ("provided by a managed package and is sealed against in-place edits. Clone it under a new name…") | | Save it into the pair with `overrides: { package: BASE, basedOn: '1.0.0' }` | `403 NOT_OVERRIDABLE` ("a permission takes no override (ADR-0146 D6)…") | | Save it with no package | `403 NOT_OVERRIDABLE` (sealed) | | Save it into the base | `403 ITEM_LOCKED` | After the refused pair save, the base's set still read "Shipped label". So the point stays true and is kept; only its reason changed. The probe was a scratch file, deleted before the commit. ## Tests - No behaviour changes, so no test is added and nothing is ablated. The old describe string is pinned nowhere (`git grep` on `origin/main`: only the source, the generated row and released CHANGELOGs). - On `854b36e4`: `pnpm --filter @objectstack/spec typecheck` exit 0; `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/security/permission`: Test Files 4 passed (4), Tests 164 passed (164). ## Acceptance notes Outside this card's surface, present-tense "one name per deployment" for permission sets remains in: - `packages/spec/src/migrations/entries/semantic/18.security-catalog-environment-overlay-refused.ts` (`reason`: "Positions, permission sets and capabilities hold one name per deployment"). A migration entry's text, left alone per the order; in the report's `open_questions`. - `packages/spec/src/kernel/customization-package.ts:251-252` (the `adr_0146_d6_security_catalog` basis: "D6: one name per deployment (permission sets, positions, capabilities)"). It describes ADR-0146 D6's basis as written; in `open_questions`. - `packages/objectql/src/registry.ts:2818` and `:2880` (the boot and hot-install refusal sentences for an environment item against a package holder). The environment still meets every holder, so the refusal stays right, but its reason says an assignment names a permission set by its bare name. - `packages/spec/src/contracts/security-service.ts:419` (`PlatformBaselineSetContribution.name`, "unique in the security catalog"). A platform-baseline set lives in a platform namespace, which keeps one holder, so this stays true for what it describes. - ADR-0048's 2026-10-08 addendum and ADR-0146 D6 text, and the dogfood comments `showcase-security.ts:32` / `showcase-d7-default-profile.dogfood.test.ts:65`: decision records and test comments, not touched. `skills/objectstack-platform/SKILL.md:125` already teaches that permission sets "are identified by package and name", and `:129` that a permission set is never overridden; no skills change. ## Verification On `854b36e4`: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 103 commands. 102 exit 0. `pnpm --filter @objectstack/spec run check:generated` exited 1 in the loop because `check:test-typecheck`'s `tsc -p` died without diagnostics while other gates ran beside it; run alone after the loop it exited 0 ("All 14 generated artifacts are up to date"). `pnpm check:dual-build-cjs-loads` exited 3 (PREREQUISITE NOT MET: it needs every package's `dist`; only the spec, lint, objectql and client closures were built), so it is NOT MEASURED here and left to CI. `--ran` reconciliation: "103 derived famil(ies) accounted for — 102 run, 1 NOT-MEASURED". `node scripts/check-nul-bytes.mjs` exit 0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FEkQ5nvMv3rqz7e8UKwxD9 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9ba2d4c commit d38ceba

4 files changed

Lines changed: 26 additions & 6 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
docs(spec): the permission set `name` describe says a set is identified by its package and name, one holder of a name per namespace
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The `name` describe on `PermissionSetSchema` (`packages/spec/src/security/permission.zod.ts`) read "unique within the security catalog the environment serves", which stopped being true when a permission-set name became one holder per namespace (ADR-0150 D2/D9). It now says a set is identified by its package and name: 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. The generated reference page and the permission sets guide say the same; positions and capabilities keep one name per deployment. No schema, rule or runtime behaviour changes.

‎content/docs/permissions/permission-sets.mdx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,15 @@ posture, the platform operator. This has three author-visible consequences:
434434
Studio, or the clone door below) and edit the copy: a copy of a set an
435435
installed package ships lands in that package's paired `<package>.custom`,
436436
and package upgrades keep reaching the original. A set is never overridden
437-
under its own name, not even from `.custom`: permission sets, positions and
438-
capabilities hold one name per deployment (ADR-0146 D6). Every other set
437+
under its own name, not even from `.custom`: a permission set takes no
438+
override (ADR-0146 D6), and a set of the shipped set's name saved into the
439+
pair is refused like an edit of the set itself (`403 NOT_OVERRIDABLE`). A
440+
permission set is identified by its package and name (ADR-0150 D2), so a name
441+
has one holder per namespace: packages of two namespaces may each ship a set
442+
of one name, each granted by its own package and name, while two packages of
443+
one namespace, a package with no namespace, a platform package (`base`,
444+
`system`, `sys`) and the platform-requested `guest_portal` keep one holder.
445+
Positions and capabilities keep one name per deployment. Every other set
439446
(one authored in this system, a clone, or one saved into a writable runtime package) is edited in place: the edit
440447
lands on its one stored definition.
441448
- **The API name is immutable after creation.** It is the definition's metadata

‎content/docs/references/security/permission.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const result = AdminScopeSchema.parse(data);
119119

120120
| Property | Type | Required | Description |
121121
| :--- | :--- | :--- | :--- |
122-
| **name** | `string` | ✅ | Permission set name, unique within the security catalog the environment serves (lowercase snake_case) |
122+
| **name** | `string` | ✅ | Permission set name (lowercase snake_case). A set is identified by its package and name: a name has one holder 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 |
123123
| **label** | `string` | optional | Display label |
124124
| **description** | `string` | optional | Human-readable description shown in Setup |
125125
| **packageId** | `string` | optional | [ADR-0086 D3] Owning package id for a package-shipped set (absent = env-authored); a value that disagrees with the package that ships the set, or that it is saved into, is refused by the stack schema (defineStack, os validate, os build), the package registration, and the metadata save, restore and publish doors |

‎packages/spec/src/security/permission.zod.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,9 +1203,12 @@ export const PermissionSetSchema = lazySchema(() => strictObject(
12031203
// the environment serves. This `describe()` is the SOURCE of the generated
12041204
// reference page (`content/docs/references/security/permission.mdx`); its
12051205
// earlier "unique per organization" (#8554) read the retired
1206-
// `sys_permission_set` row's index.
1207-
/** Permission set name, unique within the security catalog the environment serves */
1208-
name: SnakeCaseIdentifierSchema.describe('Permission set name, unique within the security catalog the environment serves (lowercase snake_case)'),
1206+
// `sys_permission_set` row's index. [ADR-0150 D2/D9] A set is identified by
1207+
// its package and name, so a name has one holder per namespace (the one
1208+
// predicate is `permissionSetHoldersMeet`, `@objectstack/core`); positions
1209+
// and capabilities keep one name per deployment.
1210+
/** Permission set name; a set is identified by its package and name, one holder of a name per namespace */
1211+
name: SnakeCaseIdentifierSchema.describe('Permission set name (lowercase snake_case). A set is identified by its package and name: a name has one holder 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'),
12091212

12101213
/** Display label */
12111214
label: z.string().optional().describe('Display label'),

0 commit comments

Comments
 (0)