Skip to content
Merged
4 changes: 2 additions & 2 deletions .changeset/33238-position-rename-hot-install.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
'@objectstack/plugin-security': patch
---
Expand All @@ -12,11 +12,11 @@
Carried at once, without a restart:

- a hot install or upgrade through the marketplace install-local door (`/marketplace/install-local`), for the positions of the package it names (`app/ID`). An upgrade over a version the running kernel still serves is carried too: re-registering the package withdraws the position its new version no longer ships (`@objectstack/objectql`, #33050), so the old name is no position the kernel serves when the announcement is heard;
- a per-item publish of a position, and a package publish of drafts, for each position they publish (`position/NAME`).
- a per-item publish of a position, and a package publish of drafts, for each position they publish (`position/NAME`);
- the runtime's package install (`POST /packages`) and the enable of a disabled package (`PATCH /packages/:id/enable`), which announce `app/ID` (`@objectstack/runtime`, #33302). A package still disabled when it is announced is not carried until the enable switches it on and announces it again.

Still carried at the next restart, by the boot run:

- the runtime's package install and enable routes, which do not announce `metadata:reloaded`;
- an artifact reload, which announces a file path and names no package or position.

An uninstall's announcement names a package no longer registered, so a withdrawal carries nothing. A reload heard before the boot run is ignored. Runs never overlap, and a run never fails the door that announced it. A reload run that moves no row does not read the other references it would leave behind, and a warning the run before already gave is not repeated; a move is always reported.
10 changes: 10 additions & 0 deletions .changeset/33301-claimant-disabled-log-reason.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/plugin-security': patch
---

fix(plugin-security): the `claimant-disabled` warning of the `renamedFrom` holder carry names the enable that carries the holders

Clause-②: no
Metadata-protocol: none

When a declared position rename is not carried because the renamed position's package is disabled, the warning said "the first boot after it is enabled carries them". Since the runtime enable route announces the package it switches on, enabling it through `PATCH /packages/:id/enable` carries the holders at once; the warning now says so, and still names the first boot after it is enabled. Only the warning's text changes.
2 changes: 1 addition & 1 deletion .changeset/33301-renamed-from-carry-text.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
'@objectstack/spec': patch
---
Expand All @@ -7,4 +7,4 @@
Clause-②: no
Metadata-protocol: none

The `renamedFrom` description said the holders of an old position name move at boot only. Since the carry also runs after a running kernel announces a reload, the description now says both: holders move at boot, and again when a running kernel announces the position or its package as registered (a hot install, a per-item publish of the position, a publish of drafts). A hot upgrade over a version the kernel still serves, a package install or enable that does not announce, and an artifact reload that names only its file are carried at the next restart. The `renamedFrom` row in `liveness/position.json` names the same two runs. No schema, accepted value or behaviour changes.
The `renamedFrom` description said the holders of an old position name move at boot only. Since the carry also runs after a running kernel announces a reload, the description now says both: holders move at boot, and again when a running kernel announces the position or its package as registered (an install or hot upgrade, the enable of a disabled package, a per-item publish of the position, a publish of drafts). A package still disabled when it is announced is carried when it is enabled; an artifact reload that names only its file is carried at the next restart. The `renamedFrom` row in `liveness/position.json` names the same two runs. No schema, accepted value or behaviour changes.
10 changes: 10 additions & 0 deletions .changeset/33301-renamed-from-install-enable-announce.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/spec': patch
---

docs(spec): `PositionSchema.renamedFrom` counts the runtime package install, the enable of a disabled package and a hot upgrade among the cases carried at once

Clause-②: no
Metadata-protocol: none

The `renamedFrom` description listed a hot upgrade over a version the kernel still serves, and a package install or enable that does not announce, among the cases carried at the next restart. Both are now carried at once: the runtime package install and the enable of a disabled package announce the package, and a hot upgrade's re-register withdraws the position the new version no longer ships. A hot install or upgrade through install-local is carried at once for the package the door announces; the other packages of a multi-package artifact are carried at the next restart. A package still disabled when it is announced is carried when it is enabled; an artifact reload that names only its file is still carried at the next restart. No schema, accepted value or behaviour changes.
2 changes: 1 addition & 1 deletion content/docs/references/identity/position.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const result = PositionSchema.parse(data);
| **description** | `string` | optional | |
| **permissionSets** | `string[]` | optional | ADR-0131 D3/D4: the permission sets this position distributes, by name (resolved in the environment catalog). |
| **delegatable** | `boolean` | optional (default: `false`) | ADR-0091 D3: holders may self-service delegate this position, time-boxed (default false). |
| **renamedFrom** | `string[]` | optional | Earlier names of THIS position, in the position-name grammar (lowercase snake_case), e.g. `renamedFrom: ['sales_rep']` on a position now named `crm_sales_rep`. The platform moves every holder of an old name (`sys_user_position`) to this position, in every organization, as the system: at boot, and again when a running kernel announces this position or its package as registered (a hot install, a per-item publish, a publish of drafts). A hot upgrade over a version the kernel still serves, an install or enable that does not announce, and an artifact reload that names only its file are carried at the next restart. A second run moves nothing. A position renamed twice lists both earlier names. Each entry once; never this position's own name; never a name another position still declares; never an old name another position also claims; never a name another package or the environment holds or is recorded as owning. Holders only: sharing rules, queue members, record shares, pending approvals and invitations that name the old position are listed in the log for an administrator, not rewritten. An old name switched off in the activation ledger is not carried, so its holders do not come back active. |
| **renamedFrom** | `string[]` | optional | Earlier names of THIS position, in the position-name grammar (lowercase snake_case), e.g. `renamedFrom: ['sales_rep']` on a position now named `crm_sales_rep`. The platform moves every holder of an old name (`sys_user_position`) to this position, in every organization, as the system: at boot, and again when a running kernel announces this position or its package as registered (an install or hot upgrade of the package the door announces, the enable of a disabled package, a per-item publish, a publish of drafts). A package still disabled then is carried when it is enabled. The other packages of a multi-package artifact, and an artifact reload that names only its file, are carried at the next restart. A second run moves nothing. A position renamed twice lists both earlier names. Each entry once; never this position's own name; never a name another position still declares; never an old name another position also claims; never a name another package or the environment holds or is recorded as owning. Holders only: sharing rules, queue members, record shares, pending approvals and invitations that name the old position are listed in the log for an administrator, not rewritten. An old name switched off in the activation ledger is not carried, so its holders do not come back active. |
| **protection** | `{ lock: Enum<'none' \| 'no-overlay' \| 'no-delete' \| 'full'>; reason: string; docsUrl?: string }` | optional | Package author protection block — lock policy for this position. |
| **_lock** | `Enum<'none' \| 'no-overlay' \| 'no-delete' \| 'full'>` | optional | Item-level lock — controls overlay & delete (ADR-0010). |
| **_lockReason** | `string` | optional | Human-readable reason shown when a write is refused by _lock. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
* are is not decidable, so neither carries (condition 3);
* - `claimant-disabled` — the one position claiming the old name belongs to a
* disabled package: nothing is carried onto a position that is switched
* off with its package; the next boot after the package is enabled
* carries;
* off with its package; enabling it through `PATCH /packages/:id/enable`
* carries, and so does the next boot after it is enabled;
* - `still-declared` — the old name is still a position of the same holder:
* the name is in use, so nothing was renamed away from it (condition 3;
* a cycle is this case, since every name in a cycle is a current one);
Expand Down Expand Up @@ -132,13 +132,18 @@
* A reload heard before the boot run is ignored: during the boot the catalog
* is still being filled, and an old name whose holding package has not
* registered yet would read as no position at all (condition 2). The boot run
* judges it once the catalog is complete. A hot upgrade over a version the
* judges it once the catalog is complete. A hot install-local install or
* upgrade is carried at once for the package the door announces; the other
* packages of a multi-package artifact are carried at the next restart (the
* door names only the artifact's own id). A hot upgrade over a version the
* running kernel still serves is carried at once: the re-register withdraws
* the position the new version no longer ships (#33050), so the old name is
* no current position when the announcement is heard. A door that registers
* positions without announcing `metadata:reloaded` (the runtime's package
* install and enable routes), and a package the announcement does not name,
* are carried at the next boot.
* no current position when the announcement is heard. The runtime's package
* install (`POST /packages`) and the enable of a disabled package
* (`PATCH /packages/:id/enable`) announce `app/ID` too, so they are carried
* at once; an install that leaves the package disabled is refused
* `claimant-disabled` until that enable announces it. A package the
* announcement does not name is carried at the next boot.
*
* ## Its one limit
*
Expand Down Expand Up @@ -685,7 +690,7 @@ const listIds = (ids: readonly string[]): string =>

const REFUSAL_SENTENCE: Record<PositionRenameRefusal, string> = {
'claimed-twice': 'two positions claim it, so whose holders they are is not decidable',
'claimant-disabled': 'the renamed position\'s package is disabled; the first boot after it is enabled carries them',
'claimant-disabled': 'the renamed position\'s package is disabled; enabling it through `PATCH /packages/:id/enable` carries them, and so does the first boot after it is enabled',
'still-declared': 'it is still a position of the same holder, so nothing was renamed away from it',
'held-by-other': 'it is a position another holder declares, and a package never claims another holder\'s people',
'owned-by-other': 'it was another package\'s position, and a package never claims another holder\'s people',
Expand Down
19 changes: 12 additions & 7 deletions packages/spec/src/identity/position.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,17 @@ export const PositionSchema = lazySchema(() => strictObject(
* `metadata:reloaded` after that over the claims of what the announcement
* names as registered: `app/ID` while the registry holds package `ID`, and
* `position/NAME`, whichever door announces them. So a hot install-local
* install, a per-item publish of a position and the positions of a
* publish-drafts are carried at once; a hot upgrade over a version the
* running kernel still serves (its old position still reads as declared),
* the runtime `POST /packages` install and enable routes (they do not
* announce) and an artifact reload that names only its file are carried at
* the next restart. As the system, in every organization, it moves each
* install or upgrade, for the package the door announces (the re-register
* withdraws the position the new version no longer ships, so the old name
* no longer reads as declared), the runtime `POST /packages` install, a `PATCH /packages/:id/enable` that
* switches a disabled package on, a per-item publish of a position and the
* positions of a publish-drafts are carried at once. A package still
* disabled when its announcement is heard is refused (`claimant-disabled`)
* until the enable that switches it on announces it again. The other
* packages of a multi-package artifact, which install-local does not
* announce, and an artifact reload that names only its file are carried at
* the next restart. As the
* system, in every organization, it moves each
* holder row of an old name to this one, idempotently. It moves HOLDERS
* only; every other stored reference to the old name (sharing-rule,
* queue-member and record-share recipients, pending approvers, pending
Expand All @@ -178,7 +183,7 @@ export const PositionSchema = lazySchema(() => strictObject(
*/
renamedFrom: z.array(SnakeCaseIdentifierSchema).optional().describe(
'Earlier names of THIS position, in the position-name grammar (lowercase snake_case), e.g. `renamedFrom: [\'sales_rep\']` on a position now named `crm_sales_rep`. '
+ 'The platform moves every holder of an old name (`sys_user_position`) to this position, in every organization, as the system: at boot, and again when a running kernel announces this position or its package as registered (a hot install, a per-item publish, a publish of drafts). A hot upgrade over a version the kernel still serves, an install or enable that does not announce, and an artifact reload that names only its file are carried at the next restart. A second run moves nothing. '
+ 'The platform moves every holder of an old name (`sys_user_position`) to this position, in every organization, as the system: at boot, and again when a running kernel announces this position or its package as registered (an install or hot upgrade of the package the door announces, the enable of a disabled package, a per-item publish, a publish of drafts). A package still disabled then is carried when it is enabled. The other packages of a multi-package artifact, and an artifact reload that names only its file, are carried at the next restart. A second run moves nothing. '
+ 'A position renamed twice lists both earlier names. Each entry once; never this position\'s own name; never a name another position still declares; never an old name another position also claims; never a name another package or the environment holds or is recorded as owning. '
+ 'Holders only: sharing rules, queue members, record shares, pending approvals and invitations that name the old position are listed in the log for an administrator, not rewritten. An old name switched off in the activation ledger is not carried, so its holders do not come back active.',
),
Expand Down
Loading