Repository navigation
Commit 152b53c
docs(spec): the package-less row entry's remedy deletes the package-less row first, and saves a code package's customization in its .custom pair (#32973)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuXJAMZYj59b5X3KNNXXrJPe)_
Fixes #32968
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:#32568 升级指南条目 `package-less-row-exact-address-by-type-class`
的补救写法和对应 changeset 的 The fix 段。现在先读出并保存包外行的正文(从 `GET
/api/v1/data/sys_metadata` 读),先清掉同名已绑包的行,再删包外行,最后保存;代码包的定制存到它的 `.custom`
配对包,可写包才用 `?package=<持有方>`。另外写明:代码包发布同名时,flow、action、doc、mapping
和无覆盖通道的封闭类型(skill 除外)的包外删除返回 403,这些行没有元数据接口能删,留着也不被任何读取服务。
- 为什么改:在 main 上实测,按原顺序(先存后删)不带包的删除会删掉刚存的那份定制,包外行却留着,属于数据丢失。另外对代码包传
`?package=<持有方>` 保存会返回 403。
- 风险与回滚:只改文字,不改任何答案、键或导出。回滚即 revert 本 PR。本 PR 有意改写了 #32568 尚未发版的 note(见
DELIBERATE CORRECTION 一节),`Check Changeset` 按设计保持红。
-
先看:`packages/spec/src/migrations/entries/semantic/18.package-less-row-exact-address-by-type-class.ts`。
- 两分钟验证:读 `replacement` 与 `acceptanceCriteria` 两段,对照下面的实测表。
- 需要你做的:无,席位落地。
## What changes
The ADR-0087 entry #32568 registered
(`package-less-row-exact-address-by-type-class`, in 18.4.0's upgrade
guide) prescribed: save the customization, then delete the package-less
row. Measured on `main` (`25ee50765`), that order loses the user's
change:
- A delete naming no package addresses the one package the name's rows
are bound to (the save door's resolution, `packagelessAddress` /
`packagelessDraftAddress`). Run after the save, it removes the row just
saved and leaves the package-less row.
- A save at `?package=<holder>` answers `403 NOT_OVERRIDABLE` when the
holder is a code package, naming its `.custom` pair.
The entry's `replacement` now gives the remedy as steps, each measured
or read on `main`:
1. Read and keep the package-less row's stored body first. A holder's
exact address does not serve it (a sealed type's row is served by no
read); its `sys_metadata` record does (`GET /api/v1/data/sys_metadata`,
filtered by type, name and state with `package_id` null;
`sys-metadata.object.ts` opens `get` and `list` on that object, and the
body is its `metadata` field). The delete hard-deletes the row and a
draft leaves no history copy, so the kept body is the only copy a
refused save can be retried from (contract review must-fix 1).
2. Check the same list for rows of the name bound to a package. A delete
naming no package addresses the one package the name's rows are bound
to: for an active row, a bound row at that state; for a draft, the
item's ACTIVE rows decide (their package's own draft is removed, and
with active rows bound to two or more packages the delete answers `409`
whatever drafts exist). Such a row is kept, deleted at its own address,
and re-saved there after the package-less delete; it is folded into the
saved change only when it belongs to the package that change goes to
(should-fix 3; r2 review should-fix 1 and 2).
3. Delete the package-less row (its receipt names no package), then
save: a writable holder at `?package=ID`; a code package in
`?package=ID.custom` with `overrides: { package: ID, basedOn }`. Run
after the save, the same delete removes the change just saved.
4. When a code package ships the name, the package-less delete of
`flow`, `action`, `doc`, `mapping` and every type of (2b) but `skill`
answers `403 NOT_OVERRIDABLE`, sealed against removal
(`refusePackagedBaseRemoval`: artifact-backed, no
`allowEnvironmentOverlay`, no `supportsOverlay`). No metadata door
removes that row; it stays stored and served by no read, and the remedy
skips the delete there: for the (2a) types the declared override is
saved, for (2b) the change ships as before (must-fix 2). Per kernel
topology, measured: `hook`, `action` and `flow` answer 403 on both;
`job`, `queue` and `agent` answer 403 on an environment kernel and are
removed on a host-config kernel, whose delete door takes the legacy path
for a type with `allowRuntimeCreate: false` (r3 review should-fix 1).
`sharing_rule`, `assignment_rule` and `api` share those flags and were
not run.
`acceptanceCriteria` name the address the saved draft answers at, allow
the 403-sealed row to remain, and require every package-bound row
cleared on the way to be back at its own address.
`.changeset/32568-package-less-row-sealed-and-draft-exits.md`'s "The
fix" says the same. A new `@objectstack/spec` patch changeset records
the text change.
## DELIBERATE CORRECTION
`Check Changeset` refuses the edit of
`.changeset/32568-package-less-row-sealed-and-draft-exits.md`, a pending
note on the merge base that this PR did not add. It is not a filename
collision: #32968 exists to correct that note, whose remedy order is
measured false (table below), and restoring the base text would
republish it. Named note:
`.changeset/32568-package-less-row-sealed-and-draft-exits.md`. Sentences
corrected:
- BEFORE `The fix:` · AFTER `The fix (first read and keep the
package-less row's stored body …; then check the same list for rows of
the name bound to a package … for a draft it is decided by the item's
ACTIVE rows … Clear such a row first: keep its body, delete it at its
own address ?package=<its package>, and after the package-less delete
re-save it at that same address; fold it into the change saved below
only when it belongs to the package that change goes to … then delete
the package-less row …, and only then save, because run after the save
the same delete removes the change just saved):`
- BEFORE `… TO saving the customization under the one package it
customizes, then deleting the package-less row.` · AFTER `… TO deleting
the package-less draft, then saving it under the package it customizes:
?package=<holder> for a writable (authored) holder; for a code package …
the holder's paired .custom package (?package=<holder>.custom with
overrides: { package: <holder>, basedOn }), where
?package=<holder>.custom&state=draft then answers it.`
- BEFORE `… TO a declared override in the holder's paired .custom
package (ADR-0146), then deleting the package-less row.` · AFTER `… TO
deleting the package-less row, then a declared override in the holder's
paired .custom package (ADR-0146). When a code package ships the name,
the package-less delete of a flow, action, doc or mapping row answers
403 NOT_OVERRIDABLE (sealed against removal): no metadata door removes
that row, it stays stored and served by no read, and the declared
override is saved without the delete.`
- BEFORE `… TO deleting the package-less row and shipping the change in
a new version …` · AFTER `… TO deleting the package-less row (when a
code package ships the name, that delete answers 403 NOT_OVERRIDABLE for
hook everywhere, and for every other one of these but skill on an
environment kernel; there the row stays stored and served by no read,
while a host-config kernel removes the row of a type that allows no
runtime creation: job, queue, sharing_rule, assignment_rule, agent, api)
and shipping the change in a new version …`
The diff also changes code text (the ADR-0087 entry), so this is
confirmed by the same-head at-tier contract-review PASS (pm-dispatch
`references/landing-operations.md`). The gate stays red by design. The
same declaration is on the PR as comment 6841100444 (written at
`f2642c6b0`; the third and fourth bullets above are new at `7441aa675`,
the first bullet's bound-row clause was rewritten at `bf6e09b9b`, and
the fourth bullet's 403 sentence is per kernel topology at `f36b5fea3`).
### Measured (real `ObjectQL` engine and `SchemaRegistry`, the boot of
`environment-overlay-five-types.test.ts`, `email_template` and
`dashboard` unless named)
| Case | As written (save, then delete) | Corrected (delete, then save)
|
|---|---|---|
| (1) Two code holders, package-less draft: save at `?package=<holder>`
| `403 NOT_OVERRIDABLE` naming the pair | (not the path) |
| (1) Two code holders: draft saved at `?package=<holder>.custom` with
`overrides` | both rows kept until the delete; the delete removes the
package-less draft; the pair's draft answers at
`?package=<holder>.custom&state=draft` | same end state: pair draft
kept, package-less draft gone |
| (1) A writable (authored) holder: draft saved at `?package=<holder>` |
the delete removes the draft just saved; the package-less draft stays
and is still served | package-less draft gone;
`?package=<holder>&state=draft` answers the saved draft |
| (2a) `dataset`, declared override in `<holder>.custom` | the delete
removes the override; the package-less row stays; `?package=<holder>`
answers the shipped item | override kept, package-less row gone;
`?package=<holder>` answers the override |
| `dataset`, a `.custom` override stored BEFORE the remedy, beside the
package-less active row | first package-less delete removes the
override; receipt: `Customization overlay deleted (package=…custom) …
its package-less row remains`; a second removes the package-less row |
(the precondition the entry now states: clear the bound row at its own
address first) |
| `action` and `flow` shipped by a code package, package-less active
row, both topologies | package-less delete: `403 NOT_OVERRIDABLE` sealed
against removal, row stays | `?package=<holder>.custom` delete answers
success and removes nothing; `?package=<holder>`: 403 (environment
kernel), success and nothing removed (host-config); the row stays; an
engine read of `sys_metadata` returns it with its body |
| `job`, `queue`, `agent`, `hook` shipped by a code package,
package-less active row | environment kernel: all four `403
NOT_OVERRIDABLE` sealed against removal, row stays | host-config kernel:
`job`, `queue`, `agent` deleted (`reset to artifact default`), row gone;
`hook` `403`, row stays |
| `email_template` and `dashboard`, two code holders, an active override
in each `.custom` pair, package-less draft | package-less draft delete:
`409 RESOURCE_CONFLICT` naming both, nothing deleted | delete the second
pair's override at `?package=<holder2>.custom` (receipt names it), then
the package-less draft delete discards it; save the draft in
`<holder1>.custom`, re-save the second override: `<holder1>.custom`
draft and both overrides answer at their addresses |
After the corrected remedy with a code holder,
`?package=<holder>&state=draft` answers 404 (no draft at the base's
address; the draft is the pair's), which is why the acceptance criteria
now name `?package=ID.custom&state=draft` for a code package. The
written order happened to survive the two-code-holder draft case because
no active row binds the name there; the corrected order is the one that
holds in every case measured.
Probes: `/mnt/project-files/issue-32968/remedy-probe.test.ts.txt` and
`remedy-probe-r2.test.ts.txt` and `remedy-probe-r3.test.ts.txt`,
`remedy-probe-r4.test.ts.txt` beside it (a copy of the five-types boot;
its `sys_metadata` double gains `draft_changes`, which the draft save
writes). Not measured: the REST data read itself (`GET
/api/v1/data/sys_metadata`); it is read from the object's `apiMethods:
['get', 'list']`. `doc`, `mapping`, `sharing_rule`, `assignment_rule`
and `api` are read from their type flags, not run.
## Acceptance notes
- The writable-holder case was measured with one registry holder (an
authored package's saved item is a stored row, not a registry holder in
this harness); the trap is in the delete's address resolution and does
not depend on the holder count.
- Branch note: this branch held card #32820's on-hold work (`0637a5006`,
recorded on #32820). A force push to restart it was refused, so
`74a36e1f6` returns those seven files to `main`'s text; this PR's diff
against `main` is the three files above. #32820's commits remain in the
branch history and as patches beside that card.
- First-party count: no first-party composition stores a package-less
row of a name a package holds; text only.
## Verification
On `f36b5fea3`:
- `pnpm --filter @objectstack/spec build`: exit 0.
- `pnpm --filter @objectstack/spec check:generated`: exit 0.
- `pnpm --filter @objectstack/spec exec vitest run --project local
src/migrations`: 5 files, 198 tests passed.
- `pnpm check:adr-0087-registration`: exit 0 . `node
scripts/check-changeset-no-major.mjs`: exit 0.
- eslint on the entry: exit 0.
Gate scope per the seat's order (text only): `check:generated`, ADR-0087
and the spec migrations.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic
(one migration entry's text).
- [x] 2. No name added.
- [x] 3. No formatter ran.
- [x] 4. One issue, one branch, one pull request (see the branch note).
- [x] 5. The change carries a changeset, and both declaration lines are
filled in here and in it.
- [x] 6. `packages/spec` touched: one entry file; the registry,
`spec-changes.json` and the upgrade guide are generated, git-ignored
projections.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgV84zNSi6HwSHmMU2c)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgV84zNSi6HwSHmMU2c
<!-- signed: domain:server#1 · os-sales ·
session_01L6bhgVaKJ9TPfXPRhdqx3e -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 870ce55 commit 152b53c
3 files changed
Lines changed: 57 additions & 16 deletions
File tree
- .changeset
- packages/spec/src/migrations/entries/semantic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
34 | 61 | | |
35 | 62 | | |
36 | 63 | | |
| |||
44 | 71 | | |
45 | 72 | | |
46 | 73 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
50 | 81 | | |
51 | 82 | | |
52 | 83 | | |
| |||
0 commit comments