From 169a40a03336f679cb791b9d3d3d799c16921bfa Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 18:36:01 +0000 Subject: [PATCH 1/2] docs(skills): renaming a position tells the author to re-point their own source, names the environment owner, and restores the explain gate (#33566) skills/objectstack-data/rules/security.md, the Renaming a position paragraph and the explain sentence: 1. The author re-points their own package source that names the old position: a `type: 'position'` sharing recipient, queue member or approver, a policy's `positions`, a `current_user.positions` predicate. The boot log lists STORED references, by table. 2. The not-carried list says "recorded under another owner (a package or the environment)": the activation ledger's `sys_metadata` sentinel records the environment as an owner. 3. The carry reads and rewrites no metadata, a Setup-authored body included (position-renamed-holder-carry.ts, "What it is not"). An environment position's own `renamedFrom` is still judged; only holders move. 4. The explain sentence says again who may ask about another user: `manage_users`, administration of one of that user's organizations, or a delegated `adminScope` covering them (`mayDescribeAnotherUser`). One eval case (id 21) asks the rename with a same-package sharing rule. Paid in place, ceiling row unchanged (15834 -> 15835 bytes, 3959 -> 3959 tokens): the `tabPermissions` pointer (objectstack-ui rules/navigation.md), the kernel-name list (the placeholder table in the same file), the membership-tier list (the linked docs anchor), the second definition of the two closure refusals (the queue bullet above), and short restatements of what a heading or neighbouring sentence says. Claude-Session: https://claude.ai/code/session_01ADHkmTSWHtysbqqYGcsTP1 Co-authored-by: Claude --- ...33566-skills-position-rename-own-source.md | 10 +++++ .../hooks-security-seeds-datasources.json | 10 +++++ skills/objectstack-data/rules/security.md | 43 +++++++++---------- 3 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 .changeset/33566-skills-position-rename-own-source.md diff --git a/.changeset/33566-skills-position-rename-own-source.md b/.changeset/33566-skills-position-rename-own-source.md new file mode 100644 index 00000000000..d75ca3b16e0 --- /dev/null +++ b/.changeset/33566-skills-position-rename-own-source.md @@ -0,0 +1,10 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): renaming a position tells the author to re-point their own source, names the environment as an owner, and restores who may explain another user + +Clause-②: no +Metadata-protocol: none + +`skills/objectstack-data/rules/security.md`, the **Renaming a position** paragraph: the holder carry moves holders only and reads or rewrites no metadata, a Setup-authored body included, so the author re-points their own package source that names the old position (a `type: 'position'` sharing recipient, queue member or approver, a policy's `positions`, a `current_user.positions` predicate); the boot log lists stored references by table for an administrator. The not-carried list now says an old name recorded under another owner, a package or the environment, since the activation ledger records the environment as an owner too. § Assigning a permission set to a user says again who may ask `GET /api/v1/security/explain` about another user: a holder of `manage_users`, an administrator of one of that user's organizations, or a delegated `adminScope` covering that user. One eval case asks the rename with a same-package sharing rule. The file pays in place (no ceiling change) by dropping text that is stated elsewhere: the `tabPermissions` pointer (taught in objectstack-ui `rules/navigation.md`), the kernel-name list (now a reference to the placeholder table in the same file), the membership-tier list (at the linked docs anchor), the second definition of `outside-closure` / `ambiguous-in-closure` (now a reference to the queue bullet above it), and four short restatements. No schema or runtime change. diff --git a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json index 7bc313c3803..f27d0148e8a 100644 --- a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json +++ b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json @@ -200,6 +200,16 @@ "must_contain": ["function: 'count'", "'project.task_count': { readable: false }"], "must_not_contain": ["task: { allowRead: true }"] } + }, + { + "id": 21, + "prompt": "Our package `com.acme.crm` ships a position `sales_rep`, live at customers, and a sharing rule in the same package whose `sharedWith` is `{ type: 'position', value: 'sales_rep' }`. The next version must call the position `crm_sales_rep`. What changes in the package?", + "expected_output": "The position becomes `{ name: 'crm_sales_rep', label: 'Sales Rep', renamedFrom: ['sales_rep'], permissionSets: [...] }`: renamed in place with `renamedFrom`, never deleted and re-added, so at boot its holders (`sys_user_position`) move to the new name in every organization. Only holders move: no metadata is read or rewritten, so the package's own sharing rule is re-pointed in source to `sharedWith: { type: 'position', value: 'crm_sales_rep' }`, as is any approver, queue member, policy `positions` entry or `current_user.positions` predicate in the package that names `sales_rep`. Stored references in an installed environment (recipients, pending approvers, invitations) are listed by table in the boot log for an administrator to re-point in Setup.", + "files": [], + "assertions": { + "must_contain": ["renamedFrom: ['sales_rep']", "value: 'crm_sales_rep'"], + "must_not_contain": ["value: 'sales_rep'"] + } } ] } diff --git a/skills/objectstack-data/rules/security.md b/skills/objectstack-data/rules/security.md index b0ed14dc551..9d7971721bd 100644 --- a/skills/objectstack-data/rules/security.md +++ b/skills/objectstack-data/rules/security.md @@ -29,7 +29,6 @@ export const salesUser = definePermissionSet({ (`security-anchor-high-privilege`) and the binding refuse it. With none, invited members get nothing until an admin assigns each; no gate counts them. Its `systemPermissions` may name only app capabilities declared under `capabilities:`. -- `tabPermissions` hides an app from the set's holders, never gates it: objectstack-ui → Navigation. ## Assigning a permission set to a user @@ -47,14 +46,16 @@ index (none on `driver-memory`) holds grants naming no package to one per user, organization. Name `permission_set_package` on insert when two packages hold the name, or the grant is refused `409 RESOURCE_CONFLICT`, naming each holder. -Assignment is one `POST /api/v1/data/sys_user_permission_set`. Only a tenant admin — -or a delegated `adminScope` carrying `manageAssignments` for that set and user -— may write it; plain CRUD bits on the table are not enough. +Only a tenant admin — or a delegated `adminScope` carrying `manageAssignments` +for that set and user — may `POST /api/v1/data/sys_user_permission_set`; plain +CRUD bits on the table are not enough. **Grant looks inert?** Check in order: the set is switched off; the validity window has passed; `organization_id` mismatch. `GET /api/v1/security/explain?object=&operation=&userId=` answers from the -enforcing code path. +enforcing code path. Explaining another user takes `manage_users`, +administering one of their organizations, or a delegated `adminScope` covering +them. ## Row-Level Security (RLS) @@ -75,7 +76,6 @@ none applies the policies restrict nothing — an `select` policies. ```typescript -// in a permission set rowLevelSecurity: [ { name: 'own_records', @@ -114,8 +114,6 @@ traversal or subqueries — those are a compile error (ADR-0055), never silently ## Membership keys — a `current_user.KEY` set the roster object declares -Declare the set on the **roster** object, not one policy per record. - ```typescript import { ObjectSchema } from '@objectstack/spec/data'; @@ -152,9 +150,8 @@ rowLevelSecurity: [ - With `id` the set is the ids of the caller's own roster rows; it grants nothing by itself. Tested against a column not referencing the roster, or another object's `id`, it is refused (`rls-predicate-membership-key-target`). -- One name per stack: a key on two objects, a kernel name (`id`, - `organization_id`, `positions`, `org_user_ids`, `accessible_org_ids`, - `email`, `queues`) and a key on an object extension are refused. +- One name per stack: a key on two objects, a kernel name (a fixed + placeholder above, `accessible_org_ids`) and a key on an object extension are refused. - Read once per request as a system read in the caller's organization, at most 1,000 values; more, a failed read or a `filter` that does not compile matches **no rows**. Whoever writes roster @@ -179,20 +176,18 @@ rowLevelSecurity: [ - A position distributes **only** the sets its `permissionSets` names (ADR-0131 D3/D4): `{ name: 'crm_sales_rep', label: 'Sales Rep', permissionSets: ['crm_sales_user'] }`. A set that merely shares the position's name is reported, - never granted; a name matching no set, or refused below, confers nothing. + never granted; a name matching no set confers nothing. - A package's position reads each name as its package's set, else the one holder in its declared `dependencies` closure plus `sys`; else it is refused. It still loads; the boot's catalog reference report logs each refusal with every candidate, and the position grants nothing through that name (its other sets - still do). `outside-closure`: only a non-dependency holds it or only the - environment (a set authored in Setup). `ambiguous-in-closure`: two holders - it reaches (a second package shipping a name is refused at install). Fix: - declare the dependency. Stored grants, + still do). `outside-closure` / `ambiguous-in-closure` as for a queue above + (the environment: a set authored in Setup; a second package shipping a name + is refused at install). Fix: declare the dependency. Stored grants, environment-authored positions, admin overlays of a package position and the `everyone`/`guest` anchors resolve environment-wide. - A portal or partner user is an organization member on the `external` - membership tier (closed list `owner`, `admin`, `delegated_admin`, `member`, - `external`, one per member — + membership tier (one per member — https://objectstack.ai/docs/permissions/authentication#membership-tiers-are-a-closed-list). The `everyone` baseline does not reach it, it sees no member directory and holds no business unit, and every org-wide default is @@ -323,7 +318,11 @@ what changed and what an administrator re-checks after upgrading. **Renaming a position:** declare `renamedFrom: ['old_name']` on the renamed position, never delete and re-add (holders lose its sets). At boot its holders (`sys_user_position`) move to the new name in every organization, -idempotently. Only holders: the boot log lists other references (sharing, -queue and share recipients, pending approvers, invitations) for an admin. Not -carried (warned): an old name still a position anywhere, claimed twice, -recorded under another package, switched off, or a disabled claimant. +idempotently. Only holders: no metadata is read or rewritten, a Setup-authored +body included. Re-point your own source naming the old one: a `type: 'position'` +sharing recipient, queue member or approver, a policy's `positions`, a +`current_user.positions` predicate. The boot log lists stored references by +table (sharing, queue and share recipients, pending approvers, invitations) +for an admin. Not carried (warned): an old name still a position anywhere, +claimed twice, recorded under another owner (a package or the environment), +switched off, or a disabled claimant. From 653fe69812fc60c28d01f3b2bfc17ffa254dc0b5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 19:04:49 +0000 Subject: [PATCH 2/2] docs(skills): the position rename says what is not rewritten, and the tabPermissions pointer returns Review round 1 on the position-rename follow-up. - The carry reads every position's `renamedFrom`, an environment position's included, so "no metadata is read" was false. The paragraph now says what is not rewritten: no other reference to the old name, Setup-authored ones included. Same correction in the eval case's expected output and in the changeset. - The `tabPermissions` pointer is back in a shorter form: it hides an app and never gates it, taught in objectstack-ui, Who sees or opens an app. - The eval case no longer refuses `value: 'sales_rep'`, which its own prompt contains: a correct before/after answer quotes it. - Token ceiling of rules/security.md 3959 -> 3986, pinned at the measured 15942 bytes. The file already paid 313 bytes in place; no further true duplicate was found, so the measured remainder raises the row. Claude-Session: https://claude.ai/code/session_01ADHkmTSWHtysbqqYGcsTP1 Co-authored-by: Claude --- ...33566-skills-position-rename-own-source.md | 2 +- scripts/check-skills-token-ratchet.mjs | 20 +++++++++++++++++-- .../hooks-security-seeds-datasources.json | 4 ++-- skills/objectstack-data/rules/security.md | 13 ++++++------ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.changeset/33566-skills-position-rename-own-source.md b/.changeset/33566-skills-position-rename-own-source.md index d75ca3b16e0..85f02718e51 100644 --- a/.changeset/33566-skills-position-rename-own-source.md +++ b/.changeset/33566-skills-position-rename-own-source.md @@ -7,4 +7,4 @@ docs(skills): renaming a position tells the author to re-point their own source, Clause-②: no Metadata-protocol: none -`skills/objectstack-data/rules/security.md`, the **Renaming a position** paragraph: the holder carry moves holders only and reads or rewrites no metadata, a Setup-authored body included, so the author re-points their own package source that names the old position (a `type: 'position'` sharing recipient, queue member or approver, a policy's `positions`, a `current_user.positions` predicate); the boot log lists stored references by table for an administrator. The not-carried list now says an old name recorded under another owner, a package or the environment, since the activation ledger records the environment as an owner too. § Assigning a permission set to a user says again who may ask `GET /api/v1/security/explain` about another user: a holder of `manage_users`, an administrator of one of that user's organizations, or a delegated `adminScope` covering that user. One eval case asks the rename with a same-package sharing rule. The file pays in place (no ceiling change) by dropping text that is stated elsewhere: the `tabPermissions` pointer (taught in objectstack-ui `rules/navigation.md`), the kernel-name list (now a reference to the placeholder table in the same file), the membership-tier list (at the linked docs anchor), the second definition of `outside-closure` / `ambiguous-in-closure` (now a reference to the queue bullet above it), and four short restatements. No schema or runtime change. +`skills/objectstack-data/rules/security.md`, the **Renaming a position** paragraph: the holder carry moves holders only and rewrites no other reference to the old name, Setup-authored ones included, so the author re-points their own package source that names the old position (a `type: 'position'` sharing recipient, queue member or approver, a policy's `positions`, a `current_user.positions` predicate); the boot log lists stored references by table for an administrator. The not-carried list now says an old name recorded under another owner, a package or the environment, since the activation ledger records the environment as an owner too. § Assigning a permission set to a user says again who may ask `GET /api/v1/security/explain` about another user: a holder of `manage_users`, an administrator of one of that user's organizations, or a delegated `adminScope` covering that user. One eval case asks the rename with a same-package sharing rule. The `tabPermissions` pointer to objectstack-ui `rules/navigation.md` is kept, shortened. The file pays by dropping text that is stated elsewhere, and its token ceiling moves by the measured remainder: the kernel-name list (now a reference to the placeholder table in the same file), the membership-tier list (at the linked docs anchor), the second definition of `outside-closure` / `ambiguous-in-closure` (now a reference to the queue bullet above it), and short restatements. No schema or runtime change. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 049d64e6ef0..5f1a81cd13b 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -1045,8 +1045,24 @@ export const CEILINGS = new Map([ // `origin/main` the file was 15056 bytes (3764 tokens, headroom 4); the // LANDED file is 15834 bytes -> 3959 tokens, ceiling +191, pinned AT the // measurement, zero headroom. - // ceil($(wc -c < skills/objectstack-data/rules/security.md) / 4) == ceil(15834 / 4) - ['skills/objectstack-data/rules/security.md', 3959], + // 3959 -> 3986 (card #33566, the follow-up of the position-rename paragraph): + // a renamed position's holders are the only thing the boot carry rewrites, + // so the author re-points their own source that names the old position; an + // old name recorded under another owner, a package or the environment, is + // not carried; and who may explain another user (`manage_users`, an + // administrator of one of that user's organizations, or a delegated + // `adminScope` covering that user). Same standing ruling, tap A, verbatim + // and untranslated: 「A:先削重复,余额按实测提高」 (record 6513306068). PAID + // DOWN FIRST, 313 bytes: the kernel-name list of the membership-keys bullet + // (the placeholder table in the same file), the membership-tier list (the + // linked docs anchor), the second definition of the two closure refusals + // (the queue bullet above it), four restatements of a heading or a + // neighbouring sentence, and a shorter `tabPermissions` pointer. On + // `origin/main` the file was 15834 bytes (3959 tokens, headroom 0); the + // LANDED file is 15942 bytes -> 3986 tokens, ceiling +27, pinned AT the + // measurement, zero headroom. + // ceil($(wc -c < skills/objectstack-data/rules/security.md) / 4) == ceil(15942 / 4) + ['skills/objectstack-data/rules/security.md', 3986], // 3024 -> 3109 (2026-08-31 app-repo-principles raise, see the block above). // Severity Levels listed the three values and left the CHOICE unstated: a // block rests on a judgement a person made, so a machine-inferred signal — a diff --git a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json index f27d0148e8a..6f2650b23f0 100644 --- a/skills/objectstack-data/evals/hooks-security-seeds-datasources.json +++ b/skills/objectstack-data/evals/hooks-security-seeds-datasources.json @@ -204,11 +204,11 @@ { "id": 21, "prompt": "Our package `com.acme.crm` ships a position `sales_rep`, live at customers, and a sharing rule in the same package whose `sharedWith` is `{ type: 'position', value: 'sales_rep' }`. The next version must call the position `crm_sales_rep`. What changes in the package?", - "expected_output": "The position becomes `{ name: 'crm_sales_rep', label: 'Sales Rep', renamedFrom: ['sales_rep'], permissionSets: [...] }`: renamed in place with `renamedFrom`, never deleted and re-added, so at boot its holders (`sys_user_position`) move to the new name in every organization. Only holders move: no metadata is read or rewritten, so the package's own sharing rule is re-pointed in source to `sharedWith: { type: 'position', value: 'crm_sales_rep' }`, as is any approver, queue member, policy `positions` entry or `current_user.positions` predicate in the package that names `sales_rep`. Stored references in an installed environment (recipients, pending approvers, invitations) are listed by table in the boot log for an administrator to re-point in Setup.", + "expected_output": "The position becomes `{ name: 'crm_sales_rep', label: 'Sales Rep', renamedFrom: ['sales_rep'], permissionSets: [...] }`: renamed in place with `renamedFrom`, never deleted and re-added, so at boot its holders (`sys_user_position`) move to the new name in every organization. Only holders move: no other reference to the old name is rewritten, so the package's own sharing rule is re-pointed in source to `sharedWith: { type: 'position', value: 'crm_sales_rep' }`, as is any approver, queue member, policy `positions` entry or `current_user.positions` predicate in the package that names `sales_rep`. Stored references in an installed environment (recipients, pending approvers, invitations) are listed by table in the boot log for an administrator to re-point in Setup.", "files": [], "assertions": { "must_contain": ["renamedFrom: ['sales_rep']", "value: 'crm_sales_rep'"], - "must_not_contain": ["value: 'sales_rep'"] + "must_not_contain": [] } } ] diff --git a/skills/objectstack-data/rules/security.md b/skills/objectstack-data/rules/security.md index 9d7971721bd..34e333f8f20 100644 --- a/skills/objectstack-data/rules/security.md +++ b/skills/objectstack-data/rules/security.md @@ -29,6 +29,7 @@ export const salesUser = definePermissionSet({ (`security-anchor-high-privilege`) and the binding refuse it. With none, invited members get nothing until an admin assigns each; no gate counts them. Its `systemPermissions` may name only app capabilities declared under `capabilities:`. +- `tabPermissions` hides an app, never gates it: objectstack-ui → Who sees or opens an app. ## Assigning a permission set to a user @@ -318,11 +319,11 @@ what changed and what an administrator re-checks after upgrading. **Renaming a position:** declare `renamedFrom: ['old_name']` on the renamed position, never delete and re-add (holders lose its sets). At boot its holders (`sys_user_position`) move to the new name in every organization, -idempotently. Only holders: no metadata is read or rewritten, a Setup-authored -body included. Re-point your own source naming the old one: a `type: 'position'` -sharing recipient, queue member or approver, a policy's `positions`, a -`current_user.positions` predicate. The boot log lists stored references by -table (sharing, queue and share recipients, pending approvers, invitations) -for an admin. Not carried (warned): an old name still a position anywhere, +idempotently. Only holders: no other reference to the old name is rewritten, +Setup-authored ones included. Re-point your own source naming the old one: a +`type: 'position'` sharing recipient, queue member or approver, a policy's +`positions`, a `current_user.positions` predicate. The boot log lists stored +references by table (sharing, queue and share recipients, pending approvers, +invitations) for an admin. Not carried (warned): an old name still a position anywhere, claimed twice, recorded under another owner (a package or the environment), switched off, or a disabled claimant.