Skip to content

Commit a8758fb

Browse files
committed
fix(spec): the packageless-overlay-write-closed entry names the commit doors; changeset and dogfood case follow the review
Claude-Session: https://claude.ai/code/session_01JQwxbZ5jYNfPGLvPV8LYRe Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7f03663 commit a8758fb

3 files changed

Lines changed: 34 additions & 18 deletions

File tree

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
11
---
22
'@objectstack/metadata-protocol': patch
3+
'@objectstack/spec': patch
34
---
45

5-
fix(metadata-protocol)!: a package commit's revert plan and its revert address the committing package's own row; a revert whose row was deleted asks the package-less close, as the per-item rollback does
6+
fix(metadata-protocol)!: a package commit's revert plan and its revert address the committing package's own row, and a restore into a `.custom` pair's row is judged by the override write gate
67

7-
Clause-②: no (narrowing) — the commit revert (`POST /api/v1/packages/:id/commits/:commitId/revert`) and the package rollback (`POST /api/v1/packages/:id/rollback`) no longer restore a stored version into the package-unbound row when the committing package's own row of the item is gone, on an item of the five overlay types one installed read-only package ships, where `os migrate packageless-overlays` would move such a row into the base's paired `<base>.custom`; they inserted that package-less row before. The per-item rollback on the same package-less address has refused it since `packageless-overlay-write-closed`.
8+
Clause-②: no (narrowing) — the commit revert (`POST /api/v1/packages/:id/commits/:commitId/revert`) and the package rollback (`POST /api/v1/packages/:id/rollback`) no longer restore a stored version into a `<base>.custom` pair's row unless the version declares the override the pair's save requires, and no longer restore into another package's row of the name, or into a package-less row, when the committing package's own row was deleted since: they restore into the committing package's row, so a commit of an installed read-only package itself whose row is gone is refused by the close naming the pair. They restored into whichever row of the name the store returned first, or inserted a package-less row, before.
89

910
Metadata-protocol: none
1011

11-
Skills-docs: none needed — `skills/objectstack-platform/SKILL.md` already says the package-less save, reset and rollback of a movable row are refused once movable (D11), and places every customization of an installed base in its paired `.custom`; nothing it says becomes false.
12+
Skills-docs: none needed — `skills/objectstack-platform/SKILL.md` places every customization of an installed base in its paired `.custom`, declaring `overrides`, and says a pair row is honoured only when declared; nothing it says becomes false.
1213

13-
<!-- adr-0087: not-required (already-registered packageless-overlay-write-closed) That entry, unreleased and shipping in the same release, already prescribes this change's TO for every package-less write onto an item an installed read-only package ships: write it into the base's paired `<base>.custom` with `PUT /api/v1/meta/<type>/<name>?package=<base>.custom` and the `overrides` declaration (its replacement), because the customization lives there (its reason, ADR-0146 D1, D2, D11). This change closes the commit doors' restore into the package-less row, the one package-less write the per-item rollback already refuses and the commit revert still made, onto the same TO. No stored row is rewritten or moved, so `objectstack migrate meta` has nothing new to do. -->
14+
<!-- adr-0087: not-required (already-registered packageless-overlay-write-closed) That entry, unreleased and shipping in the same release, already prescribes this change's TO for every customization of an installed package: write it into the base's paired `<base>.custom` with `PUT /api/v1/meta/<type>/<name>?package=<base>.custom` and the `overrides` declaration (its replacement), because the customization lives there (its reason, ADR-0146 D1, D2, D11). Its surface and reason now name the commit doors as further addresses of the rollback it closes (text only, no new id). No stored row is rewritten or moved, so `objectstack migrate meta` has nothing new to do. -->
1415

15-
**BREAKING** write narrowing at the commit doors (`@objectstack/metadata-protocol`), shipped as `patch` (`Metadata-protocol: none`).
16+
**BREAKING** write narrowing at the commit doors (`@objectstack/metadata-protocol`), shipped as `patch` (`Metadata-protocol: none`). `@objectstack/spec` carries the text widening of the `packageless-overlay-write-closed` upgrade entry.
1617

17-
The plan a package publish records (`POST /api/v1/packages/:id/publish-drafts`, the commit's `existedBefore` and `prevVersion` per item) now reads the publishing package's own active row, and the revert removes or restores that row only. Before, both read any package's active row of the name: the first publish of a `<base>.custom` pair's declared override beside a row bound to the base (stored before the write naming the base was closed) was recorded as an edit of the base row's version, and its revert addressed the base row, refused there instead of removing the pair's row. It now removes the pair's row, and the row bound to the base is served again. Commits recorded before this change keep the plan they recorded.
18+
The plan a package publish records (`POST /api/v1/packages/:id/publish-drafts`, the commit's `existedBefore` and `prevVersion` per item) now reads the publishing package's own active row, and the revert removes or restores that row only. Before, both read any package's active row of the name: the first publish of a `<base>.custom` pair's declared override beside a row bound to the base (stored before the write naming the base was closed) was recorded as an edit of the base row's version, and its revert addressed the base row and was refused there instead of removing the pair's row. It now removes the pair's row, and the row bound to the base is served again.
19+
20+
A pair commit recorded before this change beside such a row still names the base row's version as the pair's pre-commit state. Its revert now restores into the pair's own row, so the restored body meets the override write gate exactly as the pair's per-item rollback does: the base row's body declares no override, so the item is refused per item (`403 NOT_OVERRIDABLE`, the save door's sentence) and the pair's declared row stays as it is.
1821

1922
### Migration: FROM → TO
2023

21-
FROM, undoing a commit of the installed package `com.acme.crm` (recorded before the write naming it was closed) that edited a customization whose row was deleted since:
24+
FROM, undoing a pair commit recorded before this change beside a row bound to the installed package `com.acme.crm`:
2225

2326
```http
24-
POST /api/v1/packages/com.acme.crm/commits/cmt_123/revert
27+
POST /api/v1/packages/com.acme.crm.custom/commits/cmt_123/revert
2528
```
2629

27-
It now answers `200` with `success: false`, and the item in `failed[]` with `code: NOT_OVERRIDABLE` and the sentence the per-item rollback gives; nothing is written. TO, write the version you want back into the base's paired `.custom`, declaring what it overrides:
30+
It answers `200` with `success: false`, and the item in `failed[]` with `code: NOT_OVERRIDABLE`; nothing is written. TO, write the version you want into the pair, declaring what it overrides, or remove the pair's row to serve what is under it:
2831

2932
```http
3033
PUT /api/v1/meta/view/account_list?package=com.acme.crm.custom
3134
{ "name": "account_list", "label": "My accounts", "overrides": { "package": "com.acme.crm", "basedOn": "1.4.0" } }
35+
36+
DELETE /api/v1/meta/view/account_list?package=com.acme.crm.custom
3237
```
3338

34-
- **Now refused, per item.** The restore of a commit item whose row in the committing package is gone, of a `view`, `dashboard`, `report`, `translation` or `email_template` one read-only package ships, where the package-less close applies (the row would be one `os migrate packageless-overlays` moves). The commit's other items still revert, and `POST /api/v1/packages/<id>/rollback` reports the item in its `failed[]` and continues.
35-
- **Still open.** Every restore into a row the committing package holds (a writable package's in place, the pair's in place), every removal, and every package-less restore the close leaves open (a name no read-only package ships, or one several ship).
39+
FROM, undoing a commit of `com.acme.crm` itself (recorded before the write naming it was closed) that edited a customization whose row was deleted since: the restore wrote a package-less row. It now restores into the row bound to `com.acme.crm`, which the close refuses (`NOT_OVERRIDABLE`, the rollback sentence naming the pair); TO, the same `PUT …?package=com.acme.crm.custom` with the `overrides` declaration.
40+
41+
- **Now refused, per item.** A restore into a `<base>.custom` pair's row of a version that does not declare the override the pair's save requires (the override write gate). A restore of a commit of a read-only package itself into its row bound to the package, now also when that row was deleted since (the close naming the pair). The commit's other items still revert, and `POST /api/v1/packages/<id>/rollback` reports each refused item in its `failed[]` and continues.
42+
- **Now restored into the committing package's row.** A commit whose row was deleted since, of a writable package or of the pair (a declared version): the row is created again under that package, never as a package-less row.
43+
- **Still open.** Every restore into a row the committing package holds that the gate admits (a writable package's in place, the pair's declared version in place), and every removal.

‎packages/qa/dogfood/test/package-commit-revert-path-package.dogfood.test.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@
5555
// [#29414] A commit names its own package's rows. The pair's first publish
5656
// beside such a base-bound row is recorded as a create (its plan used to read
5757
// the base row's version), so its revert removes the pair's row and the base
58-
// row is served again; a revert whose row was deleted since asks the
59-
// package-less close, as the per-item rollback does. Control: a writable
58+
// row is served again. A revert whose row was deleted since restores into the
59+
// committing package's own row, never a package-less one, so the base's own
60+
// commit is refused by the close naming the pair. Control: a writable
6061
// package's edit commit restores its own row in place.
6162

6263
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
@@ -349,7 +350,7 @@ describe('dogfood: package commit revert and rollback act only on a commit of th
349350
expect(await servedLabel()).toBe(shipped);
350351
});
351352

352-
it('[#29414] a commit that edited a base-bound row since deleted is refused by the package-less close, as the per-item rollback is, and writes nothing', async () => {
353+
it('[#29414] a commit that edited a base-bound row since deleted restores into the base\'s own row, so it is refused by the close naming the pair, and writes nothing', async () => {
353354
const shipped = await servedLabel();
354355
await publishBaseBound('Deleted later 1');
355356
const edited = await publishBaseBound('Deleted later 2');
@@ -361,7 +362,7 @@ describe('dogfood: package commit revert and rollback act only on a commit of th
361362
expect(res.status, JSON.stringify(res.json)).toBe(200);
362363
expect(res.json?.data).toMatchObject({ success: false, revertedCount: 0, failedCount: 1 });
363364
expect(res.json?.data?.failed?.[0]).toMatchObject({ type: 'view', name: OVERLAY, code: 'NOT_OVERRIDABLE' });
364-
expect(res.json.data.failed[0].error).toContain('a rollback of its package-less row is closed');
365+
expect(res.json.data.failed[0].error).toContain('a rollback of its row bound to the read-only base is closed');
365366
expect(res.json.data.failed[0].error).toContain(`?package=${SHOWCASE}.custom`);
366367
expect(await servedLabel()).toBe(shipped);
367368
});

‎packages/spec/src/migrations/entries/semantic/18.packageless-overlay-write-closed.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import type { SemanticMigration } from '../../types.js';
99
// its row as a declared override (a row it moves as the pair's own member
1010
// stays open), and a save, publish or rollback naming the read-only package
1111
// itself onto an item it ships is refused where the pair can take the
12-
// declared override (a delete naming the package stays open).
12+
// declared override (a delete naming the package stays open; a commit revert
13+
// or package rollback restoring a commit item into such a row is that
14+
// rollback, refused per item).
1315
// Registered because an upgrading deployment can carry the rows those writes
1416
// made, package-less or bound to the read-only package itself, and the
1517
// operator step that moves both kinds into the base's `.custom` pair ships in
@@ -28,7 +30,10 @@ export const entry: SemanticMigration = {
2830
+ 'member, an email template locale the base does not ship, keeps the write); (2) naming the '
2931
+ 'read-only package itself (a save in draft or publish mode or a per-item publish under '
3032
+ '/api/v1/meta/<type>/<name>?package=<base>, POST /api/v1/packages/<base>/publish-drafts '
31-
+ 'holding such a draft, and a rollback of a row bound to the package), where the pair can be '
33+
+ 'holding such a draft, and a rollback of a row bound to the package: the per-item rollback, '
34+
+ 'and the restore of a commit item into that row by POST /api/v1/packages/<base>/commits/'
35+
+ '<commitId>/revert and POST /api/v1/packages/<base>/rollback, reported per item in their '
36+
+ 'failed[]), where the pair can be '
3237
+ 'ensured, the base records a version and the override write gate admits the declared body '
3338
+ 'into the pair (a delete naming the package keeps the write); and the sys_metadata rows '
3439
+ 'those writes stored, package-less or bound to the read-only package itself',
@@ -80,7 +85,9 @@ export const entry: SemanticMigration = {
8085
+ 'member, keeps its package-less write. The close reaches only what the command moves as a '
8186
+ 'declared override (its own classification and its own move steps), so no customization is '
8287
+ 'left without a write door. The save, publish or rollback naming the read-only package '
83-
+ 'itself is refused 403 NOT_OVERRIDABLE naming the pair and the `overrides` declaration '
88+
+ 'itself (a commit revert or package rollback restoring a commit item into the row bound to '
89+
+ 'it among them, which reports the item in its failed[] and reverts the rest) is refused 403 '
90+
+ 'NOT_OVERRIDABLE naming the pair and the `overrides` declaration '
8491
+ 'wherever the pair can take the declared override (it can be ensured, the base records a '
8592
+ 'version and the override write gate admits the declared body); a delete naming the package '
8693
+ 'stays open, as the way to remove such a row, and so does every write the pair could not '

0 commit comments

Comments
 (0)