Skip to content

Commit 50d655f

Browse files
fix(metadata-protocol)!: a package-less action save on an object no package binds the name to writes the environment's own action (#34238)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_ Fixes #34059 Clause-②: yes (narrowing) Metadata-protocol: semantic Skills-docs: none — no skill under `skills/**` teaches where a package-less save of a writable package's item is written; `skills/objectstack-platform` teaches only the managed base's `.custom` pair, whose refusals do not move. ## 维护者速读 - 改了什么:环境不带包名保存一个动作(`PUT /meta/action/NAME`,无 `?package=`),无论直接保存还是草稿保存(`?mode=draft`)再按条发布,只要持有这个名字的包都把它绑在别的对象上,就写成环境自己的动作行,绑在本次保存的对象上;包里的动作原地不动。ADR-0150 D4 增补注记与 R15 指针、`SaveMetaItemRequest.packageId` 的说明随本 PR 落地。 - 为什么改:维护者裁决 6902014292(方案 B):动作按 ADR-0150 D4 的键 `(package, objectName, name)` 认定。以前这种保存被改写进那个包,把包的动作从 A 对象挪到 B 对象,回执还写着包名;草稿门与按条发布有同样的缺陷。 - 风险与回滚:只对 `action` 生效;同对象保存、其它类型、托管(代码)包照旧。BREAKING(收窄):原来写进包(或被 409、422 拒绝)的几种保存现在写成环境行,逐条列在 changeset。尚未改的:环境行没有不带包名的按名读取、不在列表里,不带包名的删除删掉的是包的行(#33904)。回滚 = revert 本 PR。 - 先看:`packages/metadata-protocol/src/protocol-save.ts`(风险 hunk:`packagelessActionKeyedAddress` 与 `servedPackagelessSaveAddress` 新增的 `atObject` 分支)→ `packages/metadata-protocol/src/sys-metadata-repository.ts`(`actionHeldOnlyOnOtherObjects` 与 `resolveWriteHead` 的草稿分支)→ `packages/metadata-protocol/src/protocol-lock-version-gates.ts`(`packagelessDraftAddress`:按条发布、草稿丢弃与草稿门共用的地址)。 - 两分钟验证:`pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.packageless-save-address.test.ts -t "ADR-0150 D4"`,预期 35 个用例全绿;在 main 上标 FROM 的负向用例转红(回执写着包名,包的动作被挪走)。 - 需要你做的:Tier H,合并要维护者本人批准;contract review owed(PASS 记录出现后把 id 填在这里)。 ## What changes ADR-0150 D4 keys an action `(package, objectName, name)`, and the ruling on #34059 (6902014292, option B) puts that key on every door that writes an action naming no package. The doors used to address such a write by name alone: into the one package whose active row holds the name, whatever object that package binds it to, so the package's declaration moved onto the saved object. - **One rule.** `actionHeldOnlyOnOtherObjects` (`sys-metadata-repository.ts`, module-level, not exported from the package entry) reads the item's active rows: true when some row is bound to a package and none of those rows binds the object the body binds (`boundObjectOf`, the owner-key reader the read side uses; object-less is its own key). A stored body that does not parse counts as binding the body's object, so it never drops a holder. `actionRowsBindingObjectOf` is the object filter it reads. - **Publish-mode save.** `saveMetaItemUnaudited` asks `packagelessActionKeyedAddress` after the address is read. When the rule holds, `packageId` stays empty and the save writes the package-unbound row. When some holder binds the body's object and another binds another object, the served step (`servedPackagelessSaveAddress`, `atObject`) judges the holders at the body's object only: it skips the by-name read judgment and the by-name content package, and with only disabled holders there, the address is theirs, as `packagelessAddress` answers a name only disabled packages hold. Every holder on the body's object: unchanged. When no holder at the body's object is disabled, that at-object judgment declines and the name's own served judgment answers, as on main: an enabled holder on the body's object beside a disabled holder on another object takes the write (without the fallback that cell fell to the two-binding refusal, `409` naming both). - **Draft save.** `SysMetadataRepository.resolveWriteHead` takes the body (from `put`, and from `headAt` for the save's parent and receipt). Under the rule a package-less `draft` write inherits no package, ahead of its two-binding refusal. Its orphan-draft adoption no longer takes an unbound action draft bound to another object than the body: that is the environment's own pending draft, and it stays. - **Draft address: per-item publish, draft discard, draft read, and the save's draft gates.** `packagelessDraftAddress` (body in `protocol-lock-version-gates.ts`; its wrapper in `protocol.ts` gains the body parameter and two host reads, the only `protocol.ts` edit) asks the rule above its two-holder refusal: of the saved body first, for a draft save (as the repository does); of the stored package-unbound draft's body, for the doors that act on a stored draft, wherever no package's own draft is the address. Under the rule the address is the package-unbound draft, promoted into the package-unbound row. The address is one rule in one place for all four doors; `protocol-history-and-publish.ts` carries only the publish's slot refusal (below), not an address of its own. - **The environment's one slot.** The environment keeps one package-unbound row and one package-unbound draft per action name. `environmentActionSlotRefusal` (`protocol-save.ts`) refuses an environment-own write (publish or draft) over that row or draft when it binds an object a package's active row binds: it is that package's customization, and the write would move it. `409 RESOURCE_CONFLICT` naming the holder, nothing written, no new code. The per-item publish of the environment's draft writes that same row, so it asks the same refusal of the draft it promotes (`environmentActionPublishSlotRefusal`, called from `promoteDraftForPublish` whether the caller names no package or, in process, states `packageId: null`), and the draft save asks it of the stored package-unbound row as well as the stored draft. Over the environment's own row or draft bound to another object no package binds, the write rewrites it onto the body's object, as a save of a name no package holds always has (declared in the changeset). - **ADR and spec prose.** The ADR-0150 amendment note under D4's customization paragraph (its "every door" sentence names the draft save, the per-item publish and the draft discard, each above its two-holder refusal) and the R15 pointer (lifted for this PR by the ruling); one clause in `SaveMetaItemRequest.packageId`'s `.describe`, now also stating the version-conflict answer until #33904, with `content/docs/references/api/protocol.mdx` regenerated (`check:generated --fix`, re-checked green). - Not changed: every other type; a save naming a package; managed (code) packages, refused `403 NOT_OVERRIDABLE` by the door's sealed gate and the repository's store backstop before the address is read; two enabled holders, one on the body's object, still `409`; an enabled holder on the body's object beside a disabled holder on another object: that enabled holder's row, as on main. One enabled and one disabled holder with the body on the disabled holder's object: the publish-mode save writes the disabled holder's row, while the draft save is still refused `409` naming both (pinned as a CONTROL; the changeset says the two modes differ there). Every moved answer (writable `P`, `Q`; `GONE` a package that is not installed): | Shape | Before | After | |:--|:--|:--| | `P` on `invoice`, save bound to `task` | `200`, receipt `package=P`; `P`'s row moved to `task` | the environment's row on `task`; `P`'s untouched | | `P` on `invoice`, object-less save | same move | the environment's object-less row | | `P` on `invoice`, `Q` on `product`, save bound to `task` | `409` naming both | the environment's row on `task` | | `P` disabled, sole holder on `invoice`, save bound to `task` | written into `P`'s row | the environment's row on `task` | | sole row on `invoice` bound to `GONE`, save bound to `task` | `422` naming `GONE` | the environment's row on `task` | | `P` enabled on `invoice`, `Q` disabled on `task`, save bound to `task` | into `P`, its action moved to `task` | `Q`'s row on `task`; `P`'s untouched | | draft save bound to `task` over `P` on `invoice` | `P`'s draft (receipt `package=P`) | the environment's draft (no package in the receipt) | | its per-item publish naming no package | over `P`'s row on `invoice` | the environment's row on `task` | | draft save bound to `task` beside a sole row bound to `GONE` | `422` | the environment's draft | | its per-item publish naming no package | (refused at the save) | the environment's row on `task` | | `P` on `invoice`, `Q` on `product`: draft save bound to `task`, its per-item publish, its draft discard (each naming no package) | `409` naming both, at each door | the environment's draft; promoted into the environment's row; removed | | `P` enabled on `invoice`; `Q` enabled and `R` disabled on `task`; save bound to `task` | `409` naming `P` and `Q` | `Q`'s row on `task`; `P`'s untouched (without `R`: still `409`) | | `P` on `invoice` and a package-unbound row on `invoice` (`P`'s customization); save bound to `task` | into `P`, its action moved to `task` | `409` naming `P`, nothing written (the draft twin the same) | | the same customization row; draft save bound to `task` | `P`'s draft, whose publish moved `P`'s action to `task` | `409` naming `P`, no draft written | | the same row, a package-unbound draft on `task` stored; per-item publish naming no package | promoted into `P`'s row, `P`'s action moved to `task` | `409` naming `P`; the row and the draft stay | | the environment's draft on `task` stored; draft save bound to `invoice` | the environment's draft adopted into `P` and rewritten on `invoice` | `P`'s draft on `invoice`; the environment's draft on `task` stays | ## Tests - `packages/metadata-protocol/src/protocol.packageless-save-address.test.ts`, describe `[ADR-0150 D4] a package-less save of an ACTION on an object the holder does not bind` (35 cases, 7 under `CONTROLs`; since round 4 also the in-process publish stating `packageId: null` (S6), the draft save beside a customization row and the publish of a stored environment draft beside one; the list below is round 3's 23, and since then: the slot refusal for the stored row and the stored draft, the per-item publish and the draft discard with `P`'s draft and the environment's draft both stored, the version-conflict FROM, and the enabled-on-the-body's-object beside a disabled holder elsewhere cell): 16 negative pins (receipt and rows; `?package=P` read; a second save; object-less; two holders on two other objects; sole disabled holder; sole uninstalled binding; enabled holder beside a disabled holder at the body's object; enabled `P` beside enabled `Q` and disabled `R` at the body's object; the draft save with its receipt; the draft save beside an uninstalled binding and its publish; the per-item publish; for two holders on two other objects the draft save, its publish and its discard) and 7 CONTROLs (same-object draft and its publish stay `P`'s; same-object save; the same with the environment's row stored; the same-object draft save with the environment's draft stored (`P`'s draft, the environment's draft stays); a holder on each object `409`; one enabled and one disabled holder, the draft save still `409`; managed `403`, nothing written). - `packages/qa/dogfood/test/action-save-packageless-other-object.dogfood.test.ts` (real showcase boot over HTTP): the measured cell; the draft save and `POST /meta/action/NAME/publish` leg (`?package=P` still serves `showcase_invoice`; `/actions/_env/showcase_task/NAME` judges the environment's); the same-object and managed CONTROLs; and FROM pins for what does not move yet (#33904): a save on `showcase_task` carrying the version the bare read served (`If-Match`) is refused `409` as a version conflict, before and after the environment's row exists; the bare by-name read serves `P`'s item, and a package-less `DELETE` answers `Deleted action 'NAME' (package=P), and it still exists: its package-less row remains`, after which `?package=P` is `409 RESOURCE_CONFLICT` (held by the environment only). <details><summary>Ablations (ablation-replace.mjs, each restored to blob == HEAD with git diff HEAD empty; trap restore on exit)</summary> Unit file, source-resolved (`./protocol.js`, no dist step), `-t 'ACTION on an object the holder does not bind'`: - D-draft, `resolveWriteHead`'s rule (`if (body !== undefined && actionHeldOnlyOnOtherObjects(` to `if (false && …`): 2 failed, the draft save (`Received "com.qa.lanebapp"` for the draft's binding) and the per-item publish. - P-publish, `promoteInto = null;` to `void 0;`: 1 failed, the per-item publish (P's row overwritten). - S3-atobject, the keyed address (`if (actionRowsBindingObjectOf(item, held).length === held.length) return undefined;` to `if (held.length >= 0) …`): 1 failed, `Expected … package=com.qa.otherapp …`, `Received … package=com.qa.lanebapp …` (the FROM). - E-envown, the environment-own arm (`if (actionHeldOnlyOnOtherObjects(type, item, activeRows)) return 'environment';` to `if (activeRows === null) …`): 7 failed, every publish-mode negative pin, including the sole disabled holder (`Received … package=com.qa.lanebapp …`) and the uninstalled binding (`Cannot save action 'approve_p' without naming a package: its stored rows are bound to package 'com.qa.uninstalled', which is not installed`). - H-head, the save's write head body (`body: request.item,` to `body: undefined,`): 1 failed, the draft receipt (`Received "Saved action 'approve_p' (env-wide, package=com.qa.lanebapp, state=draft) [seq=2]"`). - G-gates, the draft gates' address (`=== 'environment'` to `=== 'never'`): 1 failed, the draft beside the uninstalled binding (the `422` text above). - Round 3, at `1b08a46eec` (the same unit file filter, 23 cases), each restored to blob == HEAD with git diff HEAD empty: - M1-ambiguous (the stored-draft check above the two-holder refusal disabled): 2 red, the two-holder publish and discard (`Name the package this publish is for` and `… delete is for …`, naming both). - M1-single (the stored-draft check where `P` holds no draft disabled): 2 red, the single-holder publish and the publish beside the uninstalled binding (`Cannot publish action 'approve_p' into package 'com.qa.uninstalled'`). - M1-body (the saved-body check disabled): 2 red, the draft save and its publish beside the uninstalled binding (the `422` text). - S1-adopt (the adoption skip disabled): 1 red, the same-object draft with the environment's draft stored. - S3-atobject: 2 red, the enabled-beside-disabled pin and the enabled-plus-disabled pin. FROM for the latter: `Name the package this save is for … belongs to 2 packages ('com.qa.lanebapp', 'com.qa.otherapp')`. - Round 4, at `61f86b4c85` (the unit file, 100 cases), the at-object fallback removed (`?? await servedPackagelessSaveAddress(…, address)` folded back into the old single call), restored with `git restore --source=HEAD --staged --worktree`, porcelain empty: 1 red, the enabled-on-`task` beside disabled-on-`invoice` cell (the save refused `409` naming both). - Round 6, at `017deafea7` (103 cases): the publish guard back to `!('packageId' in request) && …`, 1 red (the `packageId: null` pin); restored, porcelain empty. - Round 5, at `aaa0897430` (the unit file, 102 cases), each restored with `git restore --source=HEAD --staged --worktree`, porcelain empty: the publish guard off, 1 red (the publish pin); the draft-save address condition back to `kind === 'draft'`, 1 red (the draft-save pin); the draft-save active-row check off, 1 red (the same pin). The FROM of both pins measured with `origin/main`'s five `metadata-protocol` sources restored: the draft save wrote `P`'s draft on `task`, and its publish moved `P`'s row to `task` (the customization row stayed on `invoice`). - Round 1 (head `0e5faaaa`, still in force): A1 removing the exception, 5 negative pins red, also on `dist/` for the dogfood cell; A2 over-broad, the three CONTROLs red; A3 the managed CONTROL red only with both the door gate and the store backstop lifted. </details> ## Acceptance notes - **#34263 (the ADR-0150 note card)**: this PR carries the note the card asks for, as the ruling binds. The card has no claim of its own, so it is not closed by keyword. Close it by hand when this PR merges. - **Not moved yet, routed to #33904** (the read, list and delete half): the environment's row has no bare by-name read and is not in `GET /meta/action`; a package-less `DELETE` of the name removes the holder's row. `/actions/_env/OBJECT/NAME` is the address that reaches the environment's row today. The changeset states all three; the dogfood file pins them as FROM. - **Prose nits left at the reviewed head (L2 6941877825, N7 and N8):** the docblock of `environmentActionPublishSlotRefusal` opens with "naming no package" without the in-process `packageId: null` spelling, and the changeset's FROM parenthesis after the in-process publish names `P`'s row where, for that spelling, it was the customization row that moved. Not pushed, so the reviewed head stands; a follow-up edit can carry them. - **Edge, declared and pinned:** with `P` holding its own draft and the environment's unbound draft both stored, the per-item publish naming no package promotes `P`'s draft and the draft discard naming no package removes it (`packagelessDraftAddress` returns `P`'s key first); the environment's draft is reached once `P` has no draft. ## Verification Final head `fb520b2f07` (seat repo:objectstack#2 took the card over from seat repo:objectstack#1, hand-over 6933582027). Since the hand-over head `2396f22385`: origin/main `ed45eb92` merged through `scripts/pm/os-regen-merge.sh` (`073d5e1c66`, no conflicted path); the at-object fallback (`61f86b4c85`, the PROBE cell the hand-over flagged: red before, now pinned); the reference page regenerated (`9a1c3b5011`); one changeset sentence (`f2d1b67f73`); the ADR-0150 D4 note's served-address clause (`5f635f1e5c`, L1 R1 of 6938189771); the slot refusal at the per-item publish and the draft save over a customization row (`aaa0897430`, L2 M3 of 6938418286, with N4); the ADR note, the spec clause (N5) and the changeset stating it (`0a8bebb2`) and the reference page (`6677a8ff1b`); the publish refusal also for an in-process publish stating `packageId: null` and the draft-save refusal's wording (`017deafea7`, L2 S6 and N6 of 6940310036); the changeset naming that publish (`fb520b2f07`). Readings under the shared verify lock where heavy, on `fb520b2f07`: - Closure rebuilt first in the same locked run (`pnpm --filter "@objectstack/dogfood^..." build`, exit 0). - `pnpm --filter @objectstack/metadata-protocol test`: Test Files 347 passed, 9 skipped; Tests 23046 passed, 45 skipped; exit 0. `typecheck`: exit 0. The facet file: 103 passed (`-t "ADR-0150 D4"`: 35). - Dogfood battery (`pnpm --filter @objectstack/dogfood test`): exit 0; Test Files 479 passed, 3 skipped; Tests 4058 passed, 68 skipped (the pin file included). - `pnpm --filter @objectstack/spec check:generated`: 14/14 up to date at `6677a8ff1b` (with `NODE_OPTIONS=--max-old-space-size=8192`, which `check:test-typecheck` needs on this container); `packages/spec` has not changed since. - `eslint --no-inline-config` over every touched `.ts`: exit 0. - `dispatch-gates --ran`: 122 derived, 122 run, exit 0. The first run recorded `check-plugin-teardown-shape.mjs --self-test` exit 3 (its fixture commit is outside the shallow clone); after fetching that commit it ran exit 0, and the final record carries that run. - At `61f86b4c85`: the two pins of #34324 (now on main), `disabled-holder-packageless-row-doors.test.ts` 5/5 and `meta-disabled-holder-served-stack.test.ts` 136/136. - `git merge-tree` against #34347 (`0ba6987aec`, the other open `metadata-protocol` PR): no own file in common; only generated paths flagged. - CI on `fb520b2f07`, read once after every run completed: 58 success, 10 skipped, none failed. Earlier readings (seat repo:objectstack#1 and the first implementer), kept as they were taken: HAND-OFF STATE (maintainer order, 09:01Z): head `db96228e6c`. This section still carries the round-2 readings below; round-3 readings are partial and are listed here. At `1b08a46eec`: - The facet file passed 91/91 after the closure build. - `metadata-protocol` typecheck: exit 0. `rest` test: Test Files 413 passed; Tests 8497 passed, 350 skipped. `dogfood` typecheck: exit 0. - `metadata-protocol` test: 1 red, the census pin `protocol.view-expansion-reconcile-call-sites.test.ts`. It is fixed in `db96228e6c` (the host binds `getOverlayRepo: (...a) => this.getOverlayRepo(...a)`, the spelling the census reads), but not yet re-run. - The dogfood version pin was red because the bare read's body carries no `version`. `db96228e6c` reads the body or the ETag, but this is not yet measured. - `check:doc-authoring`: red at `1b08a46eec`, which put `#33904` in the `.describe`. Green at `a8e34adfa2`: exit 1, then exit 0. - `check:generated`: not re-run after the `.describe` edit. The reference page was regenerated with `gen:schema` and `gen:docs`. - Not run on the final head: the gates union, the dogfood battery, check-runs. Head `0ed4158ef6`: origin/main `a00b422876` merged through `scripts/pm/os-regen-merge.sh` (it brings #34147, which edits `protocol.zod.ts` and the generated reference pages); the merge took main's side of `content/docs/references/api/protocol.mdx`, then `gen:schema` and `gen:docs` regenerated it on the committed merge. The own non-generated patch-id (`git diff MERGE_BASE HEAD` without `content/docs/references/**`, `git patch-id --stable`) is `a45294cd56` both before (merge base `43dd5656e4`, head `6f89ebf980`) and after (merge base `a00b422876`, head `0ed4158ef6`): the change is the same bytes. Readings under the shared verify lock. <details><summary>Typecheck, tests, lint, gates</summary> On `0ed4158ef6` (closure rebuilt first, `pnpm --filter "@objectstack/dogfood^..." build` exit 0): - `pnpm --filter @objectstack/spec check:generated`: exit 0, all 14 generated artifacts up to date (against the `packages/spec/dist` that build produced). - `packages/spec/scripts/root-index.test.ts`: Test Files 1 passed; Tests 20 passed; exit 0. - The facet file `protocol.packageless-save-address.test.ts`: 84/84; exit 0. - `pnpm --filter @objectstack/metadata-protocol typecheck`: exit 0. - The dogfood pin file `action-save-packageless-other-object.dogfood.test.ts`: 4/4; exit 0. - CI on `0ed4158ef6`, read once after every run completed: 58 success, 10 skipped, none failed, including Lint & Repo Gates, TypeScript Type Check, Build Core, Test Core, Test UI, Live E2E UI, Dogfood Regression Gate, Check Changeset, PR-body guards, Governed Surface Queue Guard, Spec property liveness, Build Docs. Earlier readings, kept as they were taken (the battery and the gates union at `6f89ebf980`, the suites at `499f9b47be`; not re-run on `0ed4158ef6`): - `pnpm --filter @objectstack/metadata-protocol test`: Test Files 344 passed, 9 skipped; Tests 22962 passed, 45 skipped; exit 0. `typecheck` exit 0. - `pnpm --filter @objectstack/rest test`: Test Files 413 passed; Tests 8479 passed, 332 skipped; exit 0. - `pnpm --filter @objectstack/dogfood typecheck` exit 0; the dogfood pin file 4/4 on a rebuilt `dist/` (`ablation-dist-preflight.mjs` marker `packagelessActionKeyedAddress` present). - Dogfood battery at `6f89ebf980` (`pnpm --filter @objectstack/dogfood test`, closure rebuilt): lock VERDICT command-exit 0; Test Files 471 passed, 3 skipped; Tests 3989 passed, 42 skipped. - `eslint --no-inline-config` over the six touched source files: exit 0. `check:nul-bytes` OK. - `pnpm --filter @objectstack/spec check:generated --fix`: 1 of 14 stale (`content/docs/references/**`), regenerated, re-checked green. - `dispatch-gates --ran`: 120 derived, 117 run (exit 0), 3 NOT MEASURED (exit 3, PREREQUISITE NOT MET): `check:skill-examples` (client-react unbuilt), `check:dual-build-cjs-loads` (a package without `dist/` while the battery's closure build ran), `check:type-check-debt` (its closure build queue-timed out behind the battery). CI on `6f89ebf980` (superseded by the reading above): 58 success, 10 skipped, none failed, including Lint & Repo Gates, TypeScript Type Check and its lanes (debt ledger included), Build Core, Test Core 8/8, Test UI, Live E2E UI, Dogfood Regression Gate, Check Changeset, Spec property liveness. - `git merge-tree --write-tree --name-only HEAD origin/claude/area-E1-33308` (#34147 at `624b7ff393`): exit 0, no conflicted path; `content/docs/references/api/protocol.mdx` is flagged by the merge driver as generated (regenerate on the merged tree). </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ <!-- signed: repo:objectstack#2 · os-steve · session_01ADHkmQsQf9Js79MC6c1kdF --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent f83f7c5 commit 50d655f

11 files changed

Lines changed: 1140 additions & 25 deletions
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
'@objectstack/metadata-protocol': minor
3+
'@objectstack/spec': patch
4+
---
5+
6+
fix(metadata-protocol)!: a package-less action save on an object no package binds the name to writes the environment's own action
7+
8+
Clause-②: yes (narrowing)
9+
Metadata-protocol: semantic
10+
Skills-docs: none — no skill under `skills/**` teaches where a package-less save of a writable package's item is written; `skills/objectstack-platform` teaches only the managed base's `.custom` pair, whose refusals do not move.
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) No schema key, accepted value or metadata type is added, removed, renamed or re-shaped. The moved answer is which stored row a package-less save of an action writes; a row an older build re-addressed into a package stays as it was stored, so there is nothing for a migration to rewrite. -->
13+
14+
**BREAKING** (ADR-0150 D4, maintainer ruling 6902014292): an action is keyed `(package, objectName, name)`. A package-less `PUT /api/v1/meta/action/NAME` (no `?package=`) whose body binds an object that no package holding the name binds it to now writes the environment's own action on that object. Every package's action of that name stays where it is.
15+
16+
The moved answers, for a writable package `P` holding `approve` on `invoice`:
17+
18+
- a package-less save of `approve` bound to `task` was written into `P` (receipt `package=P`) and moved `P`'s action from `invoice` to `task`; it now writes the environment's own row on `task` (a receipt with no package), and `P`'s action on `invoice` is untouched: `GET /meta/action/approve?package=P` still serves it and `/actions/invoice/approve` still runs it.
19+
- the same save with an object-less body: it now writes the environment's own object-less row.
20+
- with two packages holding `approve` on two other objects, the save was refused `409 RESOURCE_CONFLICT` naming both; it now writes the environment's own row.
21+
- with `P` the sole holder and `P` disabled, the save was written into `P`'s row; it now writes the environment's own row on `task`.
22+
- with the sole row on `invoice` bound to a package that is not installed, the save was refused `422`; it now writes the environment's own row on `task`.
23+
- with `P` on `invoice` and `Q` on `product`, a draft save bound to `task` was refused `409` naming both; it now writes the environment's own draft, the per-item publish naming no package promotes it into the environment's own row, and the draft discard naming no package removes it (each was `409` naming both).
24+
- with `P` (enabled) on `invoice` and a disabled package `Q` on `task`, the save on `task` was written into `P` and moved its action to `task`; it is now judged over the holders on `task` only, so it writes `Q`'s row (as a save over a name only a disabled package holds does), and `P`'s action on `invoice` is untouched.
25+
- with `P` (enabled) on `invoice`, and on `task` an enabled `Q` and a disabled `R`, the save on `task` was refused `409` naming `P` and `Q`; it is now judged over the holders on `task` only, so it writes `Q`'s row, and `P`'s action on `invoice` is untouched. Without `R` the same save is still refused `409` naming `P` and `Q` (below).
26+
- a draft save (`PUT …?mode=draft`) of `approve` bound to `task` was written as `P`'s draft (receipt `package=P`), and the per-item publish naming no package (`POST /meta/action/approve/publish`) promoted it over `P`'s action on `invoice`; the draft is now the environment's own draft (a receipt with no package), and its publish writes the environment's own row on `task`. Beside a sole binding to a package that is not installed, the draft save was refused `422`; it now writes the environment's own draft, and its publish the environment's own row.
27+
- with the environment's draft on `task` stored, a package-less draft save on `invoice` adopted that draft into `P` and rewrote it on `invoice`, so the environment's pending draft was gone; it now writes `P`'s draft on `invoice` and the environment's draft on `task` stays.
28+
- with a package-unbound row on `invoice` beside `P`'s (`P`'s customization, stored by the other save order or an older build), the save bound to `task` was written into `P` and moved its action; it is now refused `409 RESOURCE_CONFLICT` naming `P`, and nothing is written. The same for a package-unbound draft on `invoice` (`P`'s pending change) and a draft save bound to `task`, which adopted that draft into `P` and rewrote it on `task`. A draft save bound to `task` beside that package-unbound row on `invoice` is refused the same way, because the environment's draft would be published into that one row (it was written as `P`'s draft, whose publish moved `P`'s action onto `task`). With a package-unbound draft on `task` already stored beside that row, the per-item publish naming no package (`POST /meta/action/approve/publish`; in process, also one stating `packageId: null`) is refused `409 RESOURCE_CONFLICT` naming `P`, and the row and the draft stay (it was promoted into `P`'s row, moving `P`'s action onto `task`). The environment keeps one package-unbound row and one package-unbound draft per action name, and here that one is `P`'s: edit it on `invoice`, or give the environment's own action on `task` another name.
29+
30+
Unchanged: the same save or draft save on `invoice` (the object `P` binds) is still `P`'s customization, and its publish is `P`'s row; a package on `invoice` and another on `task`, both enabled, still answer a save on `task` with `409` naming both; an enabled package on `task` beside a disabled package on `invoice` still answers a save on `task` by writing the enabled package's row; a managed (code) package's action name is still refused `403 NOT_OVERRIDABLE`; every type other than `action`.
31+
32+
The two modes still differ for one enabled and one disabled holder with the body on the disabled holder's object: the publish-mode save writes the disabled holder's row, while the draft save is refused `409` naming both, as it was.
33+
34+
One slot per name, as before: the environment's own action row (and its draft) is one package-unbound row per name, so a package-less save of the environment's action bound to another object that no package binds the name to (`product`, with the environment's row on `task`) rewrites that row onto `product`, as a save of a name no package holds always has; `/actions/_env/task/approve` then answers nothing. The same for the environment's draft and a draft save.
35+
36+
Not moved yet (#33904, the read, list and delete half): the environment's row on `task` has no by-name read, since `GET /meta/action/approve` naming no package still serves `P`'s action; it is not in `GET /meta/action`; and a package-less `DELETE /meta/action/approve` removes `P`'s row on `invoice`, not the environment's. The version the read naming no package serves in process (`getMetaItem`) is `P`'s, so a save on `task` that carries it as its parent (`parentVersion`) is refused `409 METADATA_CONFLICT`, before and after the environment's row exists; send the save without a parent. Over REST the bare read of an action carries no `version` to send. The one address that reaches the environment's row today is the action route `/actions/_env/task/approve`; a read or delete naming `P` (`?package=P`) reaches `P`'s.
37+
38+
With `P`'s own draft and the environment's draft both stored, the per-item publish naming no package promotes `P`'s draft (its receipt names `P`) and the draft discard naming no package removes `P`'s draft; the environment's draft stays, and those doors reach it once `P` has no draft. With two or more packages holding the name on other objects, they act on the environment's draft (above).
39+
40+
Until #33904 lands, no meta address deletes only the environment's own action: do not send a package-less delete of the name to remove it, because that removes the package's action. A package's own action is moved to another object by a save naming the package (`?package=P`), as before. A package's action that an older build moved to another object stays where it was stored.

‎content/docs/references/api/protocol.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3004,7 +3004,7 @@ Answer to a device registration: the device id the client keeps
30043004
| **actor** | `string` | optional | Identity recorded on the write's history event (`recorded_by`, a lookup into `sys_user`) and audit row. On the REST door this is the request's authenticated identity (one producer) — never a caller-supplied header. Absent, the event is recorded actor-less (null), deliberately not attributed to "system". |
30053005
| **force** | `boolean` | optional | Destructive-change acknowledgement (`?force=true` on the REST door): skips the safety diff that refuses an `object` save whose body drops fields or narrows types the stored item still carries (409 with the findings otherwise). Only `object` saves reach that diff, so the flag is inert for every other type. Absent = the guard runs. |
30063006
| **mode** | `Enum<'draft' \| 'publish'>` | optional | Per-item lifecycle (ADR-0005 drafts): `draft` stages the body as a pending draft overlay (`?mode=draft` on the REST door; the publish door promotes it later); `publish` or ABSENT writes straight to the live `active` row — the legacy default, kept so callers that predate the draft/publish split keep working. Any value other than `draft` is read as `publish`. |
3007-
| **packageId** | `string \| null` | optional | ADR-0048 — the software package to bind the saved row to (`sys_metadata.package_id`; `?package=<id>` on the REST door, where `all` and an empty value name no package). Set when authoring inside a Studio package workspace; a named read-only base package is refused. On create the row is stamped with this id; on update an existing binding is preserved, never silently re-bound. Absent or `null` names no package. An `active` save then writes the row of the one package the item's active rows are bound to, as a save naming that package does, is refused `409 RESOURCE_CONFLICT` when they are bound to two or more, and with none writes the env-local overlay (no package stamp); a `draft` save writes the draft of the one package the item's active rows are bound to (a pending change stays in the package it edits), else its package-unbound draft, adopted into that package — the draft the per-item publish naming no package promotes. For an item never published into a package it is the package-unbound draft, else the one package's draft, and with no draft at all the save creates the package-unbound draft. It is refused `409 RESOURCE_CONFLICT` when the active rows (or, with none and no package-unbound draft, the drafts) are bound to two or more packages, as that publish is (see `PublishMetaItemRequestSchema.packageId`). The row written is also the one the parent-version resolution reads: an unpinned save takes its version as the parent (last-write-wins), a pinned one is judged against it, and the item read at the same scope serves it as `version`. |
3007+
| **packageId** | `string \| null` | optional | ADR-0048 — the software package to bind the saved row to (`sys_metadata.package_id`; `?package=<id>` on the REST door, where `all` and an empty value name no package). Set when authoring inside a Studio package workspace; a named read-only base package is refused. On create the row is stamped with this id; on update an existing binding is preserved, never silently re-bound. Absent or `null` names no package. An `active` save then writes the row of the one package the item's active rows are bound to, as a save naming that package does, is refused `409 RESOURCE_CONFLICT` when they are bound to two or more, and with none writes the env-local overlay (no package stamp); a `draft` save writes the draft of the one package the item's active rows are bound to (a pending change stays in the package it edits), else its package-unbound draft, adopted into that package — the draft the per-item publish naming no package promotes. For an item never published into a package it is the package-unbound draft, else the one package's draft, and with no draft at all the save creates the package-unbound draft. It is refused `409 RESOURCE_CONFLICT` when the active rows (or, with none and no package-unbound draft, the drafts) are bound to two or more packages, as that publish is (see `PublishMetaItemRequestSchema.packageId`). An `action` is keyed by the object it binds (ADR-0150 D4): when one or more packages' active rows hold the name and none of those rows binds the object the body binds (object-less is its own key), the save writes the environment's own package-unbound row (`active`) or draft (`draft`), never a package's item. The environment keeps one package-unbound row and one package-unbound draft per action name: such a save over the environment's own row or draft bound to another object rewrites it onto the body's object, and over one bound to an object a package's active row binds (that package's customization) it is refused `409 RESOURCE_CONFLICT`; a `draft` save is refused the same way when the package-unbound row its publish would rewrite is that customization. Otherwise the address above stands, judged over every holder of the name (every enabled holder, for an `active` save), except that an `active` save is judged over the holders at the body's object only when a disabled package is one of them and another holder binds another object. The per-item publish and the draft discard naming no package act on the environment's draft so written, except that with one package holding the name, that package's own draft, when one is stored, comes first; that publish is refused `409 RESOURCE_CONFLICT` when the package-unbound row it would rewrite is a package's customization. Until the read naming no package keys an action by object, the version it serves is the package's item's, so a save carrying it as the parent is refused as a version conflict. The row written is also the one the parent-version resolution reads: an unpinned save takes its version as the parent (last-write-wins), a pinned one is judged against it, and the item read at the same scope serves it as `version`. |
30083008
| **writeFace** | `Enum<'package-duplicate' \| 'meta-envelope' \| 'meta-dispatch' \| 'external-import'>` | optional | Which write door a refusal is being rendered FOR — stated by the SERVER, never by a remote caller: every door builds this request field by field and never spreads a request body into it, so there is no path for a client to smuggle a face in, and a face arriving in a wire body is simply never read. Two refusals branch on it, for different questions: the 409 destructive-change remedy names the acknowledgement mechanism that actually exists on the refusing door (`?force=true` on the REST doors; the dispatcher, the duplicate-package door and the external-table import have none), and the 422 invalid-metadata message adapts to whether a structured `issues[]` channel reaches the consumer beside it. Absent = the conservative default wording. |
30093009
| **surface** | `Enum<'copilot' \| 'mcp' \| 'studio' \| 'api'>` | optional | The authoring surface this save is made through (see `MetadataAuthoringSurfaceSchema`). A draft save (`mode: 'draft'`) stamps it as `by` on every key path it changes, the entries the strict draft read serves as `draftChanges`; an active save records no per-key provenance. ABSENT stamps `api`. On the REST door and the runtime dispatcher it is the `?surface=` query parameter, which takes `studio` or `api` and refuses every other value `400 VALIDATION_ERROR`, `copilot` and `mcp` included: `copilot` is stated only by an in-process AI tool calling the save and `mcp` only by the MCP build door after it verified the client's token, never by a remote caller, so an HTTP request cannot mark its own write as the copilot's or an MCP agent's. A value outside the set in-process is refused `400 INVALID_REQUEST`, before anything is written. |
30103010
| **client** | `{ id: string; name?: string }` | optional | The OAuth client this save is made by (see `MetadataAuthoringClientSchema`), stated only by the MCP build door, in-process, from the token it verified. Only with `surface: 'mcp'`: a `client` beside any other surface, or a malformed one, is refused `400 INVALID_REQUEST` before anything is written. A draft save stamps it as `client` beside `by: 'mcp'` on every key path it changes; an active save records it nowhere. No HTTP door reads it: the REST door and the dispatcher build this request member by member, so a `client` in a wire body or query is never read. |

0 commit comments

Comments
 (0)