Skip to content

Commit 27f51db

Browse files
committed
fix(security): the packaged permission-set refusals name the clone control "New similar", as the console draws it
The ITEM_LOCKED save sentence, the NOT_OVERRIDABLE diagnostic and both user-facing texts (11 locales) sent the admin to a "Clone" action; Studio's Access pillar and Setup label that control "New similar" ("新建类似" in a Chinese session; every other language shows the English label). Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me Co-authored-by: Claude <noreply@anthropic.com>
1 parent c05a8a0 commit 27f51db

8 files changed

Lines changed: 74 additions & 34 deletions

‎content/docs/concepts/metadata-lifecycle.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ See [ADR-0005](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/
223223
| :--- | :--- |
224224
| `flow` | Declare an override from the base's paired `<base>.custom`, or rename it (a write from any other package is told to rename: only the pair declares an override), or switch it off (`POST /api/v1/automation/:name/toggle`, body `{enabled: false}`). The declared override is armed in the base flow's place, keeps its one activation switch, and a run suspended on the base finishes on the version it started on (ADR-0146 D9). A copy under a new name is "New similar", the clone door `POST /api/v1/automation/:name/clone` (body `{name, label}`), which the removal refusal still names. A flow that holds a credential (an inbound hook's `secret`, an `http` node's `signingSecret`) is not cloned in one step: the clone door refuses it with `409`, because a copy would share the secret, and the copy is authored as a new flow with its own. The copy is written switched off, into the source package's paired customization package `<base>.custom` (created on first use; a kernel package, of scope `system` or `cloud`, has no pair in this version, so a copy of a flow it ships answers the ensure door's `409` until the body names `package`), or into the writable package the body's optional `package` names; a flow no read-only package ships has no pair, so its clone names `package`. The answer's `packageId` says where the copy landed ([ADR-0146](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md) D3, D4). |
225225
| `action` | Switch it off (`POST /api/v1/actions/_activation/:object/:action`, body `{enabled: false}`; `:object` is `global` for an object-less action). No clone is offered. |
226-
| `permission` | Clone it under a new name: the "Clone" action on the permission set, or the clone door `POST /api/v1/security/permission-sets/:name/clone` (body `{name, label, package?}`) with a new name. The clone door copies the whole definition from the security catalog; a copy of a packaged set lands in the package's paired `<X>.custom`, and a copy of a set a kernel package ships lands environment-wide (ADR-0146 D3/D6). |
226+
| `permission` | Clone it under a new name: the "New similar" action on the permission set, or the clone door `POST /api/v1/security/permission-sets/:name/clone` (body `{name, label, package?}`) with a new name. The clone door copies the whole definition from the security catalog; a copy of a packaged set lands in the package's paired `<X>.custom`, and a copy of a set a kernel package ships lands environment-wide (ADR-0146 D3/D6). |
227227

228228
A permission set and a position also have a switch, outside the refusal: `POST /api/v1/security/_activation/:type/:name` (`:type` = `permission` or `position`), body `{enabled: false}`, switches one off for the deployment. The refusal does not name it: a packaged position's refusal keeps the managed seal's edit remedy. The audience anchors `everyone` and `guest` are not switchable.
229229

‎content/docs/permissions/authorization.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ only what it owns:
281281
of the write: `permission` declares `allowEnvironmentOverlay: false`
282282
(ADR-0005's security row — overlays of the authorization surface would
283283
create silent privilege drift), so no environment-scope overlay is minted,
284-
and the refusal names the clone (the "Clone" action on the set, or
284+
and the refusal names the clone (the "New similar" action on the set, or
285285
`POST /api/v1/security/permission-sets/:name/clone`). Narrowing the packaged
286286
set itself takes the channel ADR-0086 two-doors always named: **edit the
287287
package and re-publish**. (ADR-0094 D5's 2026-07-14 direction — translate

‎packages/metadata-protocol/src/packaged-base-regime.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@
5151
* the action-clone half is not chartered, so a clone route named here would
5252
* advertise one that does not exist;
5353
* - `permission` — the clone only (§8 item 3, the landed lock-and-clone
54-
* machinery): the "Clone" action on the permission set, which posts the copy
55-
* to `POST /data/sys_permission_set` under a new name. Spelled as
54+
* machinery): the "New similar" action on the permission set — the label
55+
* the console draws on that control in Studio's Access pillar and in Setup
56+
* (`perm.clone.action`) — which posts the copy to the catalog's clone door,
57+
* `POST /security/permission-sets/:name/clone`, under a new name. Spelled as
5658
* `plugin-security`'s own lock refusal spells that same path
5759
* (`packaged-permission-set-lock.ts`), so one condition reads one way at
5860
* every door;
@@ -201,7 +203,7 @@ export const PACKAGED_BASE_REGIME: Readonly<Record<string, PackagedBaseRegimeRow
201203
permission: {
202204
regime: 'C',
203205
routes: {
204-
clone: 'the "Clone" action on the permission set, '
206+
clone: 'the "New similar" action on the permission set, '
205207
+ 'or POST /api/v1/security/permission-sets/:name/clone with a new name',
206208
},
207209
},

‎packages/metadata-protocol/src/protocol.packaged-base-refusal.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ describe('packagedBaseRefusal — each Regime C type names its OWN sanctioned pa
396396
const message = expectRegimeC(refusalOn(environmentId, 'permission', 'pkg_perm', 'save'), 'permission', 'pkg_perm', 'save');
397397
// The clone route's spelling moved with C3 stage 8 (the retired
398398
// object's data route → the catalog's clone door); the sentence did not.
399-
expect(message).toContain('Clone it under a new name to customize it (the "Clone" action on the permission set, or POST /api/v1/');
399+
expect(message).toContain('Clone it under a new name to customize it (the "New similar" action on the permission set, or POST /api/v1/');
400400
expect(message).toContain(' with a new name).');
401401
expect(message.toLowerCase()).not.toContain('switch it off');
402402
expect(message).not.toContain('_activation');
@@ -436,7 +436,7 @@ describe('packagedBaseRefusal — each Regime C type names its OWN sanctioned pa
436436
for (const [type, name, path] of [
437437
['flow', 'pkg_flow', 'POST /api/v1/automation/:name/clone'],
438438
['action', 'pkg_action', 'POST /api/v1/actions/_activation/:object_or_global/:action'],
439-
['permission', 'pkg_perm', 'the "Clone" action on the permission set, or POST /api/v1/'],
439+
['permission', 'pkg_perm', 'the "New similar" action on the permission set, or POST /api/v1/'],
440440
] as const) {
441441
const r: any = p.packagedBaseRefusal({ type, name, operation: 'save', packageId: PACKAGE_ID });
442442
expect({ code: r?.code, status: r?.status, lockSource: r?.lockSource, packageId: r?.packageId }, type)

‎packages/metadata-protocol/src/sys-metadata-repository.package-writability.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ describe('#7682 — the refusal discriminates on package writability', () => {
581581
// The clone route is the catalog's clone door: the data route of the
582582
// `sys_permission_set` object retired with it (C3 stage 8).
583583
expect(message).toContain(
584-
'Clone it under a new name to customize it (the "Clone" action on the permission set, '
584+
'Clone it under a new name to customize it (the "New similar" action on the permission set, '
585585
+ 'or POST /api/v1/security/permission-sets/:name/clone with a new name).',
586586
);
587587
expect(message).not.toContain('OS_METADATA_WRITABLE');
@@ -1265,7 +1265,7 @@ describe('[#20910] the repository doors name a Regime C type\'s sanctioned path,
12651265
+ 'operator-only where one install serves several organizations).';
12661266
// The clone route is the catalog's clone door: the data route of the
12671267
// `sys_permission_set` object retired with it (C3 stage 8).
1268-
const PERMISSION_CLONE = 'Clone it under a new name to customize it (the "Clone" action on the permission set, '
1268+
const PERMISSION_CLONE = 'Clone it under a new name to customize it (the "New similar" action on the permission set, '
12691269
+ 'or POST /api/v1/security/permission-sets/:name/clone with a new name).';
12701270
const FLOW_PATHS = 'Clone it under a new name to customize it (POST /api/v1/automation/:name/clone, body {name, label}), '
12711271
+ 'or switch it off (POST /api/v1/automation/:name/toggle, body {enabled: false}; '

‎packages/plugins/plugin-security/src/packaged-permission-set-lock.test.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,3 +429,34 @@ describe('[#32780] a stored permission set in its package\'s registry slot is ne
429429
expect(classifyPackagedPermissionSet(N, ql)).toEqual({ status: 'packaged', packageId: CRM, packageIds: [CRM] });
430430
});
431431
});
432+
433+
// The control the refusal sends the admin to is named by the label the console
434+
// draws on it: "New similar" (Studio's Access pillar and Setup, the console's
435+
// `perm.clone.action`), "新建类似" in a Chinese session, Traditional included,
436+
// and the English label in every language the console's designer strings do
437+
// not ship. A sentence naming a "Clone" button points at a control that is not there.
438+
describe('the lock refusals name the clone control by its console label', () => {
439+
const LOCALES = ['en', 'zh-Hans', 'zh-Hant', 'ja', 'ko', 'es', 'fr', 'de', 'pt-BR', 'ru', 'ar'];
440+
const CHINESE = new Set(['zh-Hans', 'zh-Hant']);
441+
const refusals = (locale: string) => [
442+
new PackagedPermissionSetLockedError('crm_sales', 'com.example.crm', 'update', [locale]),
443+
new PackagedPermissionSetProvenanceUnknownError('crm_sales', 'registry unavailable', [locale]),
444+
];
445+
446+
for (const locale of LOCALES) {
447+
it(`${locale}: the guidance names the "${CHINESE.has(locale) ? '新建类似' : 'New similar'}" action`, () => {
448+
for (const refusal of refusals(locale)) {
449+
expect(refusal.code).toBe('NOT_OVERRIDABLE');
450+
expect(refusal.status).toBe(403);
451+
expect(refusal.userMessage).toContain(CHINESE.has(locale) ? '新建类似' : 'New similar');
452+
expect(refusal.userMessage).not.toMatch(/Clone action|“克隆”|「複製」動作|「複製」アクション|Clonar|Cloner|„Klonen“|«Клонировать»|복제 작업/);
453+
}
454+
});
455+
}
456+
457+
it('the diagnostic names the same control', () => {
458+
const [locked] = refusals('en');
459+
expect(locked.message).toContain('the "New similar" action on the permission set, or POST /api/v1/security/permission-sets/crm_sales/clone');
460+
expect(locked.message).not.toContain('"Clone" action');
461+
});
462+
});

0 commit comments

Comments
 (0)