Skip to content

Commit 6ff3eee

Browse files
docs(spec, plugin-security): the runtime package install, the enable of a disabled package and a hot upgrade carry renamedFrom holders at once (#33642)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XXWfT73m4BSPgeTFD7644gK)_ Refs #33301 Follow-up PR for the card (PR 1 #33478 merged; PR 2 #33568 is the separate Tier H ADR leg). This one corrects the `PositionSchema.renamedFrom` text that #33448 and #33304/#33473 made false on `main`. ## 维护者速读 - **改了什么**:只改文字与一条日志文案,不改行为。`PositionSchema.renamedFrom` 的 jsdoc 与 `.describe()`(及其生成的参考文档行)、`plugin-security` 迁移模块注释:运行时 `POST /packages` 安装、`PATCH /packages/:id/enable` 启用一个已停用的包、以及热升级,现在都"立即迁移",不再列为"等下次重启"。同时更正两条未发布的变更说明(同一句错话),以及 `claimant-disabled` 警告里"启用后的第一次启动才迁移"的说法。 - **为什么改**:#33478 合入时写了"运行时安装/启用不发通告,要等重启",但 #33448 已让两扇门发 `metadata:reloaded`;另外 #33304 让热升级撤回旧版职位(#33473 已在模块注释里改过),spec 文字还说要重启。契约评审 6886866329 指出前者。 - **风险与回滚**:无 schema、取值或行为变化;唯一发布的运行时字节是一条警告文案。`check-empty-changeset` 因有意更正两条未发布说明而保持红(DELIBERATE CORRECTION,见下)。回滚即 revert。 - **先看**:`packages/spec/src/identity/position.zod.ts` 的 `renamedFrom` jsdoc 与 describe。 - **两分钟验证**:`git grep -n "do not announce\|does not announce, and" packages/spec/src/identity content/docs/references/identity`,预期无命中;对照 `packages/runtime/src/domains/packages.ts` 里两处 `announcePackageReload` 调用。 - **需要你做的**:无,席位做契约复审并落地。 ## What changes Text only; no schema, accepted value or behaviour changes. - `packages/spec/src/identity/position.zod.ts`, `renamedFrom` jsdoc: the doors carried at once are now a hot install-local install **or upgrade**, for the package the door announces, the runtime `POST /packages` install, a `PATCH /packages/:id/enable` that switches a disabled package on, a per-item publish and a publish-drafts. 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 (install-local announces only the artifact's own id, review 6889382518 on #33653; the code change is tracked in #33656) and an artifact reload that names only its file stay "at the next restart". - Same file, `.describe()`: "(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." - `position-renamed-holder-carry.ts` module doc: "When it runs" says 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 at the next restart; the `claimant-disabled` bullet (~:48-51) now names the enable that carries, matching the warning reason. - `content/docs/references/identity/position.mdx`: the `renamedFrom` row, regenerated (`pnpm gen:schema && pnpm gen:docs`), not hand-edited. - `packages/plugins/plugin-security/src/position-renamed-holder-carry.ts`, module doc "When it runs": the runtime install and the enable of a disabled package announce `app/ID` and are carried at once; an install that leaves the package disabled is refused `claimant-disabled` until that enable. - `.changeset/33301-renamed-from-install-enable-announce.md`: `@objectstack/spec` patch. - `position-renamed-holder-carry.ts` ~:690, the `claimant-disabled` warning reason, FROM "the renamed position's package is disabled; the first boot after it is enabled carries them" TO "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". No test pins the string (`git grep` over `*.test.ts`); the only test of the refusal asserts `reason: 'claimant-disabled'`. This string ships in `dist`, so `.changeset/33301-claimant-disabled-log-reason.md` is an `@objectstack/plugin-security` patch. - Two pending release notes, corrected in place (see DELIBERATE CORRECTION below). ### DELIBERATE CORRECTION of two pending release notes `check-empty-changeset` stays red on purpose: both notes are unreleased and describe the same doors, and restoring them would publish sentences that are false on `main`. - `.changeset/33301-renamed-from-carry-text.md` (this card's PR 1), FROM "(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." TO "(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." - `.changeset/33238-position-rename-hot-install.md` (#33238): the bullet "the runtime's package install and enable routes, which do not announce `metadata:reloaded`;" is removed from "Still carried at the next restart". "Carried at once" gains: "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." ### Where each claim is read on `main` (1cf2a5a) - Install announces on both answers: `packages/runtime/src/domains/packages.ts` ~:2781 `announcePackageReload(deps, _context, pkgId, 'installed')`, before the `enableOnInstall` lifecycle refusal returns. - Enable announces only when the package was disabled: ~:2856 `if (wasDisabled) await announcePackageReload(…, 'enabled')`. Pinned by `packages-reload-announce.test.ts`. - A disabled claimant is refused: `position-renamed-holder-carry.ts` `claimant-disabled` (judged on the reload path as on boot), so an install that lands disabled carries nothing until the enable announces. - Hot upgrade: `SchemaRegistry.replacingPackageBody` (#33050, landed in #33304) withdraws the positions the new body no longer ships inside `registerApp`; #33473 pinned it end to end through install-local and already corrected the carry's module doc, but not the spec text. ### Deviation from the prepared patch The order's patch (be318a6d) no longer applied: #33473 had rewritten the carry's module doc under it. It was re-applied by hand, and it kept "a hot upgrade over a version the kernel still serves … carried at the next restart", which #33473 measured false. Re-asserting that in rewritten text would claim more than the code does, so the same sentences drop it. Round 2, at the seat's request, adds the warning string and the two pending notes below. ## Tests None: a description and comment diff, no behaviour change. ## Acceptance notes - `@objectstack/plugin-security` changeset: the module-doc edit ships nothing (tsup strips comments; after the build `grep -rl 'enable of a' dist` has no hit), but the warning string does (`enabling it through` is in `dist/index.js` and `dist/index.mjs`), so the package gets a patch note for the string. - Left as is, at the seat's word: #33568's ADR-0150 wording still lists "a hot upgrade over a version the running kernel still serves" as carried at the next restart, false since #33304. That is the card's ADR follow-up after #33568 merges. Clause-②: no Metadata-protocol: none ## Verification At head `27a39b87` (`origin/main` `4c32b969` merged in), after building the lint, plugin-security, objectql, client-react and cli closures: - 106 derived gates (`dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`): 104 exit 0; `--ran` reads "106 derived famil(ies) accounted for — 105 run, 1 NOT-MEASURED". - `check-empty-changeset.mjs --base origin/main` exit 1: the DELIBERATE CORRECTION above, red on purpose. - NOT MEASURED: `check:dual-build-cjs-loads` (exit 3, a PREREQUISITE refusal: it reads every package's `dist`). CI runs it. - `pnpm --filter @objectstack/plugin-security test`: 267 files, 6679 passed, 45 skipped. `typecheck` exit 0. - Round 1 at `63085567`: `pnpm --filter @objectstack/spec test` 840 files, 26871 passed, 1 todo; `gen:schema && gen:docs` moved only `content/docs/references/identity/position.mdx`. Round 2 does not touch `packages/spec`. Round 3 at head `85543852` (`origin/main` `3c0033f9` merged in; the net diff against main was unchanged by the merges): `pnpm --filter @objectstack/spec test` 840 files passed, 1 skipped, 26878 passed; `pnpm --filter @objectstack/plugin-security test` 267 files, 6679 passed, 45 skipped, `typecheck` exit 0 (at `a797bffe`; the round-3 edit after it is comment and describe text only, and `position-renamed-holder-carry.test.ts` 35/35 at `85543852`); `gen:schema && gen:docs` moved only the `position.mdx` row; `check:generated` (after a spec rebuild), `check:docs`, `check:spec-docblock-symbol-anchors` and `check-issue-citations` exit 0. Records: `pm-orders/spec/33301-followup-gates-ran.txt` (round 1) and `pm-orders/spec/33301-followup-r2-gates-ran.txt` (round 2) in the project share. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5pKQmfpw66kCN9pAhn)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FEkQ5pKQmfpw66kCN9pAhn <!-- signed: domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 777877d commit 6ff3eee

7 files changed

Lines changed: 49 additions & 19 deletions

File tree

‎.changeset/33238-position-rename-hot-install.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ A position that declares `renamedFrom` moves the holders of each old name (`sys_
1212
Carried at once, without a restart:
1313

1414
- 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;
15-
- a per-item publish of a position, and a package publish of drafts, for each position they publish (`position/NAME`).
15+
- a per-item publish of a position, and a package publish of drafts, for each position they publish (`position/NAME`);
16+
- 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.
1617

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

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

2222
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.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/plugin-security': patch
3+
---
4+
5+
fix(plugin-security): the `claimant-disabled` warning of the `renamedFrom` holder carry names the enable that carries the holders
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
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.

‎.changeset/33301-renamed-from-carry-text.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ docs(spec): `PositionSchema.renamedFrom` and its liveness evidence say when the
77
Clause-②: no
88
Metadata-protocol: none
99

10-
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.
10+
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.
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): `PositionSchema.renamedFrom` counts the runtime package install, the enable of a disabled package and a hot upgrade among the cases carried at once
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
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.

‎content/docs/references/identity/position.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const result = PositionSchema.parse(data);
3333
| **description** | `string` | optional | |
3434
| **permissionSets** | `string[]` | optional | ADR-0131 D3/D4: the permission sets this position distributes, by name (resolved in the environment catalog). |
3535
| **delegatable** | `boolean` | optional (default: `false`) | ADR-0091 D3: holders may self-service delegate this position, time-boxed (default false). |
36-
| **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. |
36+
| **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. |
3737
| **protection** | `{ lock: Enum<'none' \| 'no-overlay' \| 'no-delete' \| 'full'>; reason: string; docsUrl?: string }` | optional | Package author protection block — lock policy for this position. |
3838
| **_lock** | `Enum<'none' \| 'no-overlay' \| 'no-delete' \| 'full'>` | optional | Item-level lock — controls overlay & delete (ADR-0010). |
3939
| **_lockReason** | `string` | optional | Human-readable reason shown when a write is refused by _lock. |

‎packages/plugins/plugin-security/src/position-renamed-holder-carry.ts‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
* are is not decidable, so neither carries (condition 3);
4848
* - `claimant-disabled` — the one position claiming the old name belongs to a
4949
* disabled package: nothing is carried onto a position that is switched
50-
* off with its package; the next boot after the package is enabled
51-
* carries;
50+
* off with its package; enabling it through `PATCH /packages/:id/enable`
51+
* carries, and so does the next boot after it is enabled;
5252
* - `still-declared` — the old name is still a position of the same holder:
5353
* the name is in use, so nothing was renamed away from it (condition 3;
5454
* a cycle is this case, since every name in a cycle is a current one);
@@ -132,13 +132,18 @@
132132
* A reload heard before the boot run is ignored: during the boot the catalog
133133
* is still being filled, and an old name whose holding package has not
134134
* registered yet would read as no position at all (condition 2). The boot run
135-
* judges it once the catalog is complete. A hot upgrade over a version the
135+
* judges it once the catalog is complete. A hot install-local install or
136+
* upgrade is carried at once for the package the door announces; the other
137+
* packages of a multi-package artifact are carried at the next restart (the
138+
* door names only the artifact's own id). A hot upgrade over a version the
136139
* running kernel still serves is carried at once: the re-register withdraws
137140
* the position the new version no longer ships (#33050), so the old name is
138-
* no current position when the announcement is heard. A door that registers
139-
* positions without announcing `metadata:reloaded` (the runtime's package
140-
* install and enable routes), and a package the announcement does not name,
141-
* are carried at the next boot.
141+
* no current position when the announcement is heard. The runtime's package
142+
* install (`POST /packages`) and the enable of a disabled package
143+
* (`PATCH /packages/:id/enable`) announce `app/ID` too, so they are carried
144+
* at once; an install that leaves the package disabled is refused
145+
* `claimant-disabled` until that enable announces it. A package the
146+
* announcement does not name is carried at the next boot.
142147
*
143148
* ## Its one limit
144149
*
@@ -685,7 +690,7 @@ const listIds = (ids: readonly string[]): string =>
685690

686691
const REFUSAL_SENTENCE: Record<PositionRenameRefusal, string> = {
687692
'claimed-twice': 'two positions claim it, so whose holders they are is not decidable',
688-
'claimant-disabled': 'the renamed position\'s package is disabled; the first boot after it is enabled carries them',
693+
'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',
689694
'still-declared': 'it is still a position of the same holder, so nothing was renamed away from it',
690695
'held-by-other': 'it is a position another holder declares, and a package never claims another holder\'s people',
691696
'owned-by-other': 'it was another package\'s position, and a package never claims another holder\'s people',

‎packages/spec/src/identity/position.zod.ts‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,17 @@ export const PositionSchema = lazySchema(() => strictObject(
163163
* `metadata:reloaded` after that over the claims of what the announcement
164164
* names as registered: `app/ID` while the registry holds package `ID`, and
165165
* `position/NAME`, whichever door announces them. So a hot install-local
166-
* install, a per-item publish of a position and the positions of a
167-
* publish-drafts are carried at once; a hot upgrade over a version the
168-
* running kernel still serves (its old position still reads as declared),
169-
* the runtime `POST /packages` install and enable routes (they do not
170-
* announce) and an artifact reload that names only its file are carried at
171-
* the next restart. As the system, in every organization, it moves each
166+
* install or upgrade, for the package the door announces (the re-register
167+
* withdraws the position the new version no longer ships, so the old name
168+
* no longer reads as declared), the runtime `POST /packages` install, a `PATCH /packages/:id/enable` that
169+
* switches a disabled package on, a per-item publish of a position and the
170+
* positions of a publish-drafts are carried at once. A package still
171+
* disabled when its announcement is heard is refused (`claimant-disabled`)
172+
* until the enable that switches it on announces it again. The other
173+
* packages of a multi-package artifact, which install-local does not
174+
* announce, and an artifact reload that names only its file are carried at
175+
* the next restart. As the
176+
* system, in every organization, it moves each
172177
* holder row of an old name to this one, idempotently. It moves HOLDERS
173178
* only; every other stored reference to the old name (sharing-rule,
174179
* queue-member and record-share recipients, pending approvers, pending
@@ -178,7 +183,7 @@ export const PositionSchema = lazySchema(() => strictObject(
178183
*/
179184
renamedFrom: z.array(SnakeCaseIdentifierSchema).optional().describe(
180185
'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`. '
181-
+ '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. '
186+
+ '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. '
182187
+ '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. '
183188
+ '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.',
184189
),

0 commit comments

Comments
 (0)