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 74a15cb
Browse filesBrowse the repository at this point in the historyBrowse files
fix(spec,metadata-protocol): name the row-held-base exception's whole cell in the packageId texts; the read-only-base rollback pin restores a real version (#38639)
repo:objectstack#3 · os-steve · session_01ADHkmSAjFEZHRpRq3WCj6z
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi95y2NHsVF2knp6wnXXUMwDL)_Fixes#35529
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:没有。只改协议说明文字、三处代码注释和一条测试,服务端行为不变。
- 为什么做:写操作跟随基座包上线后的契约复审留了三个小尾巴,说明文字漏了两种情形,注释还按旧规则写。
- 出错会怎样:不改的话,读协议文档的人会以为代码里自带同名项时也能按名字写,或以为只有一个依赖包;改错只影响文字,可直接撤回。
- 要你做什么:无。
## What changes
Nits N4–N6 of the contract review on the parent change (record
7011078775, VERDICT PASS), each re-checked on `origin/main` 681fec2
before editing.
- **N4 — `packages/spec/src/api/protocol.zod.ts`.** The row-held-base
exception in the `packageId` descriptions of the save (active and
draft), per-item publish, delete and history/diff/rollback requests
(`HISTORY_PACKAGE_SELECTOR_DESCRIPTION`) now names the two conditions
the texts left out (a name no package ships in code; one or more
dependents) of the cell the server applies (`rowHeldBaseJudgment` in
`packages/metadata-protocol/src/protocol-meta-item-face.ts`): a bundled
type's member **of a name no package ships in code**, whose active rows
a base package and **one or more** packages declaring it hold, with no
package-unbound row beside them. The delete's consequence sentence no
longer assumes one dependent: after the base's row goes, the next bare
request is judged over the dependents' rows alone (one dependent: served
next, a second bare delete removes it; two or more: judged by the same
rule). The deletion is bounded to the base holding no other member, or
the canonical member; at a named non-canonical member while the base
holds another, the bare read still takes the base's address (404). The
draft-save sentence refers back to the save's and is unchanged.
Regenerated: `packages/spec/docs/references/api/protocol.md`,
`protocol.part-2.md`, `protocol.part-3.md` (`check:docs`; the card's
`content/docs/references/api/protocol.mdx` path no longer exists, the
generated reference lives here now).
- **N5 — `packages/metadata-protocol/src/protocol-door-requests.ts`.**
The publish, rollback and delete request docblocks state the
row-held-base exception beside the two-package `409`, pointing at
`packagelessRowHeldBaseAddress`. Comment-only.
- **N6 —
`packages/runtime/src/domains/meta-bare-write-doors-follow-base-34681.test.ts`.**
The read-only-base pin seeds one `sys_metadata_history` version of the
base's slot before the rollback, so `toVersion: 1` is a real restore,
and asserts that the bare rollback restored that version into the base's
row with the dependent's row untouched, as `?package=BASE` does.
- Changeset `.changeset/35529-spec-row-held-base-texts.md`
(`@objectstack/spec` patch: the describe text ships in the package;
`@objectstack/metadata-protocol` patch: the three request types'
comments ship in its `dist/index.d.ts`).
No schema shape, key, accepted value, error code or server answer moves.
## Tests
- `meta-bare-write-doors-follow-base-34681.test.ts`: 11/11 pass.
- Ablation of N6 (seed line removed, test file only): the pin goes red,
both bare and named rollback answering `404 VERSION_NOT_FOUND` with the
rows unchanged, which is what the pin measured before this change.
Restored from the commit.
<details><summary>Ablation reading</summary>
```
"rollback":["VERSION_NOT_FOUND",404],"rolledRows":["active:com.qa.writeaddon:addon en","active:com.qa.writebase:base en"]
Tests 1 failed | 10 skipped (11)
```
</details>
## Acceptance notes
- None filed. The read-only (code) base's rows are restored, discarded
and removed in process by a system caller, bare and named alike; this
pin records that equality and judges nothing about it.
## Verification
Read first: the delete sentence in `protocol.zod.ts` (the one text whose
meaning moved), then the N6 hunk.
Two-minute check: `pnpm --filter @objectstack/runtime exec vitest run
--maxWorkers=2
src/domains/meta-bare-write-doors-follow-base-34681.test.ts` prints
`Tests 11 passed (11)`.
<details><summary>Local gates at 0ee1576</summary>
- `node scripts/pm/dispatch-gates.mjs --commands` derived 94 commands;
all 94 run, each exit 0; `--ran` reconciliation: 94 derived, 94 run, 0
NOT-MEASURED. Three first answers were not verdicts and were re-run: the
teardown-shape self-test exit 3 (shallow clone; re-run after `git fetch
--unshallow`), `check:dual-build-cjs-loads` exit 3 (no full build) and
`check:lean-entry-closure` exit 1 (`packages/spec/dist` being rebuilt
under it by a concurrent build), both re-run after `turbo run build`
(123/123).
- `pnpm --filter @objectstack/spec check:generated`: stale `check:docs`
regenerated with `--fix`, re-check all 14 up to date.
- `pnpm --filter @objectstack/runtime typecheck`: exit 0.
- `node scripts/pm/overlap-check.mjs`: clean against `origin/main` and
the two open PRs sharing a file.
- Not run locally: `@objectstack/metadata-protocol` tests (comment-only
diff there); CI carries the rest of the farm.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmT5it85jhPpGaNANG7)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
docs(spec): the row-held-base exception in the request texts names its whole cell
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
The `packageId` descriptions of the save, draft save, per-item publish, delete and history/diff/rollback requests (`HISTORY_PACKAGE_SELECTOR_DESCRIPTION`) state when a request naming no package follows the row-held base. They now name the two conditions the server already applies and the earlier text left out: the exception holds only for a name no package ships in code (a shipped name is its shipper's, and such a request answers as before), and the base may be declared by one or more packages, not exactly one. The delete text no longer assumes a single dependent: after the base's row is removed, and where the base holds no other member of the name or the member is the canonical one, the next request naming no package is judged over the dependents' rows alone, so one dependent's row is served next and a second delete removes it, while two or more are judged by the same rule. At a named non-canonical member while the base still holds another member, the read naming no package still takes the base's address and answers `404` until the base holds a row there again, and a second delete naming no package still removes a lone dependent's row. Description text only; no schema shape, key, accepted value or server answer moves.
12
+
13
+
In `@objectstack/metadata-protocol`, the doc comments of the publish, rollback and delete request types, which ship in the built declarations, now state the same row-held-base exception beside the two-package `409`; comment text only.
Copy file name to clipboardExpand all lines: packages/spec/docs/references/api/protocol.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -788,7 +788,7 @@ A write-path strip event: caller-supplied fields legally dropped from the payloa
788
788
|**state**|`Enum<'active' \| 'draft'>`| optional | Which lifecycle row to discard: `draft` discards the pending draft overlay only (the still-active overlay, if any, keeps serving); `active` or absent resets the live row. Absent defaults to `active`. |
789
789
|**dropStorage**|`boolean`| optional | Destructive opt-in, default false: also drop the object's physical table after the metadata row is removed (`object` type + `active` state only; never `sys_` tables). Used by the "discard a previewed object" flow so a publish-to-preview leaves no orphan table. |
790
790
|**member**|`string`| optional | Bundle member selector, for a metadata type whose identity is a pair (today only `email_template`, identified by `(name, locale)`): the member this request addresses, spelled as its discriminator value (`zh-CN`). Absent, the canonical member (`en-US` for `email_template`), which is what a bare-name read answers; naming the canonical value is the same request. It is not the response translation locale, which `?locale=` and `Accept-Language` choose. Refused with 400 `VALIDATION_ERROR` on a type that has no members, and for a blank value or one longer than a stored member can be (100 characters). A well-formed member with nothing stored or shipped answers as that door answers an absent item. |
791
-
| **packageId** | `string \| null` | optional | ADR-0048 — the software package whose row this delete removes (`sys_metadata.package_id`; `?package=<id>` on the REST door, where `all` and an empty value name no package), as a save names the row it writes. Named, the delete removes that package's row and no other; a package that holds no row removes nothing. Absent or `null` names no package: the delete of the `active` row then removes the row of the one package the item's active rows are bound to, is refused `409 RESOURCE_CONFLICT` when they are bound to two or more, and with none removes the env-local row (no package stamp). Bound to two or more, one exception: a bundled type's member whose active rows a base package and a package declaring it both hold, with no package-unbound row beside them, is the row-held base's, as the read naming no package serves it, and the delete removes the base's row as naming the base does (two packages neither of which declares the other are still refused `409`). The dependent's row is then the item's only row at that address: the read naming no package serves it next, and a second delete naming no package removes it too; the base's copy comes back only by saving it again. The discard of the `draft` removes the draft a draft save naming no package writes, the one the per-item publish naming none promotes, and is refused where that publish is (see `PublishMetaItemRequestSchema.packageId`). That row is the one `parentVersion` is judged against. When another row of the item is still stored afterwards, the receipt `message` names it. |
791
+
| **packageId** | `string \| null` | optional | ADR-0048 — the software package whose row this delete removes (`sys_metadata.package_id`; `?package=<id>` on the REST door, where `all` and an empty value name no package), as a save names the row it writes. Named, the delete removes that package's row and no other; a package that holds no row removes nothing. Absent or `null` names no package: the delete of the `active` row then removes the row of the one package the item's active rows are bound to, is refused `409 RESOURCE_CONFLICT` when they are bound to two or more, and with none removes the env-local row (no package stamp). Bound to two or more, one exception: a bundled type's member of a name no package ships in code, whose active rows a base package and one or more packages declaring it hold, with no package-unbound row beside them, is the row-held base's, as the read naming no package serves it, and the delete removes the base's row as naming the base does (two packages neither of which declares the other are still refused `409`). The dependents' rows stay. Where the base holds no other member of the name, or the member is the canonical one, the next request naming no package is judged over them alone: one dependent's row is served next and a second delete naming no package removes it too, while two or more are judged by the rule above. At a named non-canonical member while the base still holds another member, the read naming no package still takes the base's address and answers `404` until the base holds a row there again, and a second delete naming no package still removes a lone dependent's row there. The base's copy comes back only by saving it again. The discard of the `draft` removes the draft a draft save naming no package writes, the one the per-item publish naming none promotes, and is refused where that publish is (see `PublishMetaItemRequestSchema.packageId`). That row is the one `parentVersion` is judged against. When another row of the item is still stored afterwards, the receipt `message` names it. |
792
792
793
793
794
794
---
@@ -862,7 +862,7 @@ A write-path strip event: caller-supplied fields legally dropped from the payloa
862
862
|**name**|`string`| ✅ | Item name |
863
863
|**fromVersion**|`integer`| optional | The older side's history version, a whole number as the history lists it. Absent, the nearest earlier version whose body differs from the `to` side's. A version with no history row of the item (or, with `packageId`, of that holder) is refused 404 `VERSION_NOT_FOUND`. |
864
864
|**toVersion**|`integer`| optional | The newer side's history version, a whole number as the history lists it. Absent, the active row (with `packageId`, that holder's own active row). Refused 404 `VERSION_NOT_FOUND` as `fromVersion` is. |
865
-
| **packageId** | `string` | optional | Optional package ID (`?package=` on the REST door, the `/layers` spelling) — for a type stored per (package, name), the holder whose versions to address: the slot of the row a read naming the package serves (its own row, its `.custom` pair's declared override, or the package-less row that read falls back to), else the package's own empty slot when it ships the name; a package that neither holds nor ships the name is refused 409 `not-held-by-qualifier` (ADR-0150 D3/D4). Versions attributed to no package, or to the environment, are that slot's only while it is the name's sole slot. Absent, a name two holders hold (in stored rows or in code) is refused 409 naming every holder, except where the read naming no package serves the row-held base (a bundled type's member whose active rows a base package and a package declaring it both hold, with no package-unbound row beside them): there the base's slot is addressed, as naming the base addresses it. Two packages neither of which declares the other are still refused. Refused with 400 `VALIDATION_ERROR` on a type not stored per (package, name). |
865
+
| **packageId** | `string` | optional | Optional package ID (`?package=` on the REST door, the `/layers` spelling) — for a type stored per (package, name), the holder whose versions to address: the slot of the row a read naming the package serves (its own row, its `.custom` pair's declared override, or the package-less row that read falls back to), else the package's own empty slot when it ships the name; a package that neither holds nor ships the name is refused 409 `not-held-by-qualifier` (ADR-0150 D3/D4). Versions attributed to no package, or to the environment, are that slot's only while it is the name's sole slot. Absent, a name two holders hold (in stored rows or in code) is refused 409 naming every holder, except where the read naming no package serves the row-held base (a bundled type's member of a name no package ships in code, whose active rows a base package and one or more packages declaring it hold, with no package-unbound row beside them): there the base's slot is addressed, as naming the base addresses it. Two packages neither of which declares the other are still refused. Refused with 400 `VALIDATION_ERROR` on a type not stored per (package, name). |
0 commit comments