You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0b87f12
Browse filesBrowse the repository at this point in the historyBrowse files
fix(metadata-protocol)!: refuse the bare publish and rollback of a name only disabled packages hold, with or without a package-less row (#37851) (#37948)
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoHpXeKaibCgzF7LxhhjHxMf)_Fixes#37851
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — no page under `skills/**` or `content/docs/**`
teaches a per-item publish or rollback naming no package over a name
only disabled packages hold; the refusal's own sentence names the fix
## 维护者速读
-
包停用后,不指明包的单项发布和回滚以前还能写进去(发布写进停用包自己的行,回滚把已删的无包定制重新插回来),现在和保存一样被拒绝,什么都不写。
- 这是 #37851 裁定 A 「两处都拒绝」的实现,外加裁定要求先测的第三格(停用包自有行的裸回滚):实测在 main
上也落地,所以一并拒绝。
-
写包自己的行的两种(发布自有草稿、回滚自有行)提示"指明包"(`?package=`),指明包后照常写;会把无包行插回来的回滚提示"先启用包"。指明包的写、读、启用后的行为都不变;本改动可整体撤回。
- 无
## What changes
Ruling A on #37851 (comment 7216539589, maintainer 「两处都拒绝」): the
per-item publish and rollback naming no package refuse a name only
disabled packages hold, as the bare save does, whether or not a
package-less row is stored. PR #37818 made both doors ask the
disabled-holders judgment only where they read or write a
package-unbound row that is already stored; three cells were left
writing.
- **Cell (a), per-item publish of the disabled package's own draft**
(`promoteDraftForPublish`,
`packages/metadata-protocol/src/protocol-history-and-publish.ts`): where
no package is named and the draft address is the package's own draft
(`key` and `into` that package), the door now asks
`packagelessHolderRefusal` (`arms: 'disabled-holders'`) with `unbound:
false`. Over a name only disabled packages hold it answers
`disabledHoldersOnlyRefusal` (verb `publish`): `409 RESOURCE_CONFLICT`,
"Name the package this publish is for, then send it again …", the bare
save's own sentence there. That holds whether or not a package-less row
is stored beside it, because the promotion never touches that row and
the publish naming the package reaches the draft. This flips the control
pin #37818 added (its line 320).
- **Cell (b), per-item rollback with the package-less row's history but
no row stored** (`rollbackMetaItemUnaudited`,
`packages/metadata-protocol/src/protocol-package-commits.ts`): the
`active.unbound` precondition is dropped. Where the restore writes the
package-unbound row (`rollbackPackageId === null`), stored or not, the
door answers `disabledHoldersCustomizationRefusal` (verb `rollback`):
`409 RESOURCE_CONFLICT`, "Enable the package that holds …". The restore
would have inserted the package-unbound row again, which is the disabled
holder's customization.
- **Cell (c), per-item rollback of the disabled package's own row**
(same door): measured first, as the ruling asks. On `main` 73d5e34 it
answered `success: true` and restored the row (pin below, red on main).
Refused in this PR as (a) is: `unbound: false`,
`disabledHoldersOnlyRefusal` (verb `rollback`), and the rollback naming
the package still restores it.
The rollback's candidate set is the active rows' bindings plus the
restore's binding, so a `.custom` pair of a disabled base is judged the
way the save judges it. The judgment returns `undefined` with any
enabled holder, so every answer over an enabled package is unchanged.
The `packagelessHolderRefusal` docblock now says which state each door
asks.
Also in this PR:
- **Migration entry**
`disabled-holder-package-less-row-bare-write-refused` (spec, pending
release): the surface, replacement, reason and acceptance criteria name
the three cells and their two remedies. The `reason` sentence L2 S1 on
#37818 required ("with none stored they judge no holder … not refused by
this entry") is replaced with what the doors now do.
- **New changeset**
`.changeset/37851-disabled-holder-own-row-publish-rollback-refused.md`:
`minor` for metadata-protocol and spec, BREAKING scoped to the three
cells, ADR-0087 `not-required (already-registered
disabled-holder-package-less-row-bare-write-refused)`. Its "Not moved"
paragraph also carries the correction to the 37608 note (next bullet).
- **No edit to the released note**
`.changeset/pre/37608-disabled-holder-publish-rollback-refused.md`. The
release PR #37661 (`19.0.0-next.1`) consumed it, so this PR keeps
`main`'s blob byte for byte (seat ruling, Option B, comment 7222609810).
Its "Not moved" list still names these three cells as landing; the
#37851 changeset above states the correction, and whether to edit the
pre/ text before GA is the release owner's call. `Check Changeset` is
green.
- ADR-0150 D3 note wording (`docs/adr/**`) is not in this diff; the seat
carries it to the ADR checklist, per the ruling.
## Tests
`packages/objectql/src/disabled-holder-packageless-row-doors.test.ts`,
inside the `describe` #37818 added (same fixture: `com.acme.mail` ships
`email_template` `acme.welcome` in en-US / zh-CN; `fr-FR` is a member it
never ships, the cell the D11 close leaves open):
- publish, the package's own draft, `it.each` over beside the stored
package-less row (the flipped :320 control) and with no package-less row
stored: refused 409 with the `?package=` sentence, no package named,
every stored row byte-identical. CONTROL: the publish naming the package
promotes it, the package-less row byte-identical.
- CONTROL: publish of the package's own draft, re-enabled: the bare
publish promotes it as on `main`.
- rollback with the package-less row's history but no row stored (saved
twice, deleted, then disabled): refused 409 with the enable sentence, no
row inserted. CONTROL: re-enabled, the same rollback restores the
version.
- rollback of the package's own row (saved twice with `packageId`, then
disabled): refused 409 with the `?package=` sentence, nothing written.
CONTROL: the rollback naming the package restores it; re-enabled, it is
served.
<details><summary>Measurement, reach on main, fix</summary>
- **Served-stack measurement before the ruling** (real `RestServer`
routes over the real ObjectQL engine and protocol, in-memory driver,
this fixture, `origin/main` 0a3ea67): recorded on the card, comment
7216513948. Bare `PUT` answered `409 RESOURCE_CONFLICT`; bare `POST
/publish` and bare `POST /rollback` answered `200` and wrote.
- **Reach on `main` 73d5e34** (pins committed first as 1217b6a, run
against main's `metadata-protocol` build): `Tests 5 failed | 9 passed
(14)`. The four refusal pins and the re-enabled publish control failed
with `no refusal: expected [ undefined, undefined ] to deeply equal [
409, 'RESOURCE_CONFLICT' ]`; that includes cell (c), so the ruling's
third cell lands on `main`.
- **Fix** (42bb7de, metadata-protocol rebuilt): `Tests 14 passed (14)`.
</details>
## Verification
Local, at head 0480711 on `origin/main` 73d5e34, each run through
`os-verify-lock`:
| Run | Result |
|---|---|
| `pnpm --filter @objectstack/metadata-protocol test` | `Test Files 372
passed \| 9 skipped (381)`, `Tests 23598 passed \| 45 skipped (23643)`,
exit 0 |
| `pnpm --filter @objectstack/objectql test` | `Test Files 642 passed
(642)`, `Tests 14535 passed (14535)`, exit 0 |
| `pnpm --filter @objectstack/rest test` | `Test Files 432 passed
(432)`, `Tests 8972 passed \| 351 skipped (9323)`, exit 0 |
| `typecheck` metadata-protocol, objectql | exit 0 |
| spec `vitest run src/migrations` | `Tests 206 passed (206)` |
| Derived gate families (`dispatch-gates.mjs --commands`, 98 commands) |
95 exit 0 (spec `check:api-surface`, `check:browser-reachable-entries`,
`check:dual-source-exports`, `check:entry-nameability`,
`check:exported-any` and cli `migrate-meta-engine-guidance.test.ts`
green after a spec + cli rebuild). `check-empty-changeset` was red at
this head on the then-DELIBERATE CORRECTION of the 37608 note; that edit
is gone at `c488ff99` (Option B) and `Check Changeset` is green there |
NOT MEASURED locally: `check:dual-build-cjs-loads`, reason: it needs
every package's `dist/` (no `adapters/hono`, `apps/account` build here);
CI's Lint & Repo Gates runs it. `check-plugin-teardown-shape
--self-test`, reason: shallow clone cannot reach its pinned fixture
commit; checker-health only.
Dogfood battery at the final head `c488ff99`, under `os-verify-lock`
(card comment 7223157350): closure build exit 0; spec `check:generated`
14 of 14 up to date; pin file 14 of 14 passed; dogfood 490 test files
passed (3 skipped), 4144 tests passed (68 skipped). CI at `c488ff99`: 58
success, 11 skipped, none red.
## Acceptance notes
- The enable sentence says "the row stored for it under no package is
that package's customization". In cell (b) no such row is stored at the
moment of the refusal; its history is, and the restore would store it.
The ruling names that sentence for (b), so this PR keeps it unchanged.
- In-process `publishMetaItem` with `packageId: null` present (#37818
record N1) still takes the named branch; unchanged here.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibz3J6vDGdnFpMq3hkm)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(metadata-protocol)!: refuse the per-item publish and rollback naming no package of a name only disabled packages hold, with or without a package-less row stored
7
+
8
+
Clause-②: no (narrowing)
9
+
Metadata-protocol: narrowed
10
+
Skills-docs: none — no page under `skills/**` or `content/docs/**` teaches a per-item publish or rollback naming no package over a name only disabled packages hold; the refusal's own sentence names the fix
11
+
12
+
<!-- adr-0087: not-required (already-registered disabled-holder-package-less-row-bare-write-refused) the entry the six other writes of this narrowing registered now names these three cells too -->
13
+
14
+
**BREAKING** for a deployment that publishes or rolls back one metadata item, with no package named, at a name whose every holder is disabled and no package-less row is stored for it: the write is now refused where it answered `200`. Fix: send the same publish or rollback naming the package (`?package=ID`, in process `packageId`) where the refusal says "Name the package this publish is for" or "Name the package this rollback is for"; enable a package that holds the name (`PATCH /api/v1/packages/:id/enable`) where it says "Enable the package that holds …".
15
+
16
+
The bare save of such an item already answers `409 RESOURCE_CONFLICT` and writes nothing (a disabled package holds no name). The per-item publish and rollback naming no package asked that judgment only where a package-less row or draft was stored, so they still wrote the disabled package's own row, or stored the package-less row again from its history, and enabling the package again served a body no read had shown.
17
+
18
+
Every moved answer, before → after, for a type the registry reads by package, while every holder of the name is disabled, where the ADR-0146 D11 close leaves the write open:
19
+
20
+
-`POST /api/v1/meta/:type/:name/publish` whose draft address is the disabled package's own draft (beside a package-less row or with none stored): `200` (the draft promoted into that package's active row) → `409 RESOURCE_CONFLICT`, "Name the package this publish is for, then send it again …", nothing written. The publish naming the package still promotes it.
21
+
-`POST /api/v1/meta/:type/:name/rollback` that restores the disabled package's own row: `200` (that row rewritten to the version's body) → `409 RESOURCE_CONFLICT`, "Name the package this rollback is for, then send it again …", nothing written. The rollback naming the package still restores it.
22
+
-`POST /api/v1/meta/:type/:name/rollback` with the package-less row's history but no package-less row stored: `200` (a package-less row inserted with the version's body) → `409 RESOURCE_CONFLICT`, "Enable the package that holds …", nothing written.
23
+
- The same three through the in-process `publishMetaItem` / `rollbackMetaItem` with no `packageId`.
24
+
25
+
Once a holder is enabled again the same publish or rollback answers as before the disable.
26
+
27
+
Not moved: a publish or rollback naming a package, with the package enabled or disabled; a publish with no draft at its address, which keeps its `404 NO_DRAFT`; an item the ADR-0146 D11 close covers, which keeps that close's `403 NOT_OVERRIDABLE`; a name no package holds; a name an enabled package holds; every read. Correction to the note `37608-disabled-holder-publish-rollback-refused`, released in `19.0.0-next.1` and left as released: its "Not moved" list says that a rollback of a package-bound row is not moved, and that two writes on an item only disabled packages hold still land, left open for a separate decision (#37851): a publish whose draft address is the disabled package's own draft, and a rollback with no package-less row stored. From this release on, all three are refused as listed above, while the same publish or rollback naming the package, or sent once a holder is enabled again, answers as before. Migration entry `disabled-holder-package-less-row-bare-write-refused` (`@objectstack/spec`) now carries them for the upgrade guide.
it('publish, the package\'s own draft beside the stored package-less row: promoted into the package\'s row as on `main`, the package-less row byte-identical',async()=>{
308
+
it.each([['beside the stored package-less row',true],['with no package-less row stored',false]]asconst)('publish, the package\'s own draft %s: refused 409 with the `?package=` remedy, nothing written; the publish naming the package promotes it, the package-less row byte-identical',async(_cell,withRow)=>{
it('rollback with the package-less row\'s history but no row stored: refused 409 with the enable as the remedy, no row inserted; re-enabled, the same rollback restores the version',async()=>{
it('rollback of the package\'s own row: refused 409 with the `?package=` remedy, nothing written; the rollback naming the package restores the version',async()=>{
0 commit comments