Repository navigation
Commit b68f9ae
fix(metadata-protocol): the bare save, delete, publish, draft and history doors follow the row-held base the bare read serves (#35450)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgPKDiLo5gfWzDLyAK6J6UjZ)_
Fixes #34681
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
1.
用户能看到什么变化:同一封邮件模板的同一语言版本,基座包和依赖它的包各存了一份时,不指定包去保存、存草稿、发布、看历史、比较版本、回滚、删除,以前一律被拒绝并要求说明是哪个包,现在都直接作用在打开时看到的基座包那一份上,依赖包那一份原样保留;不指定包连删两次,第一次删基座包那份,第二次删依赖包那份。对外的接口说明文字同步改写。
2. 为什么做:落实「同一个地址,读到谁就写谁」这条已定规则,删除、丢弃草稿、回滚三扇门按 Bill 12:03Z 的裁决(选
A,三扇门都跟随)一并跟随。
3.
出错会怎样:受影响的只是这种两份并存的模板;基座包未安装或只读时,按指定基座包的同一请求拒绝,不会写进去;撤回这次改动即恢复为原来的拒绝,不需要迁移数据。
4. 要你做什么:无,席位落地。
## What changes
The seven doors naming no package (save in publish and draft mode,
per-item publish, delete and draft discard, and the history family:
history, diff and rollback) now resolve their address the way the read
naming no package does in this cell: a bundled type's name no package
ships, held as stored rows at one member by a base package and a package
that declares it. One helper, `packagelessRowHeldBaseAddress` in
`protocol-save.ts`, asks the read's own judgment
(`rowHeldBaseAddressOf`, unchanged) over the item's active rows, with
the same guard the layered read uses (two or more bound holders, no
package-less row, the base among them). Each door asks it only where it
would otherwise refuse naming two or more packages (the history family
through `historySlotOf`, its shared slot resolution), and then proceeds
as the same request naming the base, judged as named (a base bound to an
id no installed package has is refused `422 WRITABLE_PACKAGE_REQUIRED`
at the draft save too, see the third round below):
| Door (no package named) | `main` 8596c80 | This head |
|:--|:--|:--|
| save (REST `PUT` and in process) | 409 naming both | writes the base's
row (writable base); 422 `WRITABLE_PACKAGE_REQUIRED` naming the base, as
`?package=BASE` answers (read-only base) |
| draft save | 409 naming both | writes the base's draft |
| per-item publish | 409 naming both | promotes the base's draft |
| history | 409 naming both | the base's versions, equal to
`?package=BASE` |
| diff | 409 naming both | compares the base's versions, equal to
`?package=BASE` |
| rollback | 409 naming both | restores the base's row to the base's own
version; the receipt names the package (`(package=BASE)`), as the
delete's does |
| delete / draft discard | 409 naming both | removes the base's row /
draft; the receipt names the dependent's row as remaining; a second bare
delete removes the dependent's row |
The dependent's row is untouched and still read and written at its own
`?package=`. The destructive doors (delete, draft discard, rollback)
follow the base by the maintainer's ruling (S2, option A, comment
7008542936).
**Third round (contract review 7008272548 and ruling 7008542936):**
- **S1.** A bare draft save that follows the base now judges it with the
named-base rule (#26921) and the late override re-judgment, as the save
naming it is: the follow arm keeps the base in `followedBase` and both
sites read it, where before they read the cleared draft address and
judged nothing. Cell: the base's rows bound to an id no installed
package has, which an installed dependent declares. Before: bare draft
save 200, writing a draft bound to that id; now 422
`WRITABLE_PACKAGE_REQUIRED` naming it, as `?package=BASE` and the bare
publish-mode save answer.
- **Rider 1.** The rollback receipt's `message` names the package of the
row it restored (` (package=ID)`), in the delete receipt's spelling.
- **M1.** `packages/spec/src/api/protocol.zod.ts`: the `packageId`
descriptions of the save (active and draft), the per-item publish, the
delete, and `HISTORY_PACKAGE_SELECTOR_DESCRIPTION` (history, diff,
rollback) now state the row-held base exception, that two packages
neither of which declares the other are still refused `409`, and, on the
delete, that a second bare delete removes the dependent's row and the
base's copy comes back only by saving it again. `gen:schema` and
`gen:docs` regenerated `content/docs/references/api/protocol.mdx`.
Description text only; no shape, key or accepted value moves.
- **S3.** Comment-only: the `packagelessAddress`,
`packagelessDraftAddress`, `historyMetaItem` and `rollbackMetaItem`
docblocks in `protocol.ts` and the `protocol-history-slots.ts` module
header no longer say the bare doors refuse this cell.
Files: `packages/metadata-protocol/src/protocol-save.ts` (the helper;
the publish-mode and draft-mode address), `protocol-diff-delete-load.ts`
(delete and discard), `protocol-history-and-publish.ts` (publish),
`protocol-history-slots.ts` (`historySlotOf`: history, diff and
rollback); host `Pick` lists widened by the members the read's judgment
reads (one line each in the history, diff and rollback doors, the
rollback's in `protocol-package-commits.ts`). Comment-only: the
`packagelessLayeredReadRefusal` docblock in `protocol.ts` and the
`rowHeldBaseAddressOf` docblock in `protocol-meta-item-face.ts` now say
the writes follow the base (claim amendment 7005577225), plus the S3
docblocks above. `protocol-lock-version-gates.ts` needed no edit. No
file seat 4's PR touched; under `packages/spec` only `protocol.zod.ts`'s
five descriptions (claim amendment in 7008542936).
Changesets: `.changeset/34681-bare-write-doors-follow-base.md`
(`@objectstack/metadata-protocol` patch) and
`.changeset/34681-spec-bare-doors-follow-base.md` (`@objectstack/spec`
patch), each with `Clause-②: yes (widening)` and `Metadata-protocol:
none`.
Pins:
`packages/runtime/src/domains/meta-bare-write-doors-follow-base-34681.test.ts`
(new file, named for this card; the shared harness file
`meta-disabled-holder-served-stack.test.ts` is fenced for this card).
## Tests
<details><summary>Readings on `main` 8596c80 before the change (A1),
through the real protocol on a booted kernel</summary>
Bare read 200 `base en` at the base. Each bare door, code (read-only)
pair and authored (writable) pair alike: save 409, draft save 409,
publish 409, history 409, delete 409, draft discard 409, every message
naming both packages. `?package=BASE` (authored base) save: 200 into the
base's row. Diff and rollback, measured on branch head 90d943c before
their change (the new diff and rollback pins run against that build):
each 409 RESOURCE_CONFLICT naming both packages (`Tests 2 failed | 5
passed (7)`).
</details>
<details><summary>Third round, RED before the fixes (the build at
`aa1df8a4`, new pins added first)</summary>
`Tests 3 failed | 9 passed (12)`:
- S1: the base bound to `com.qa.ghostbase` (no installed package has
it), declared by the installed `com.qa.ghostaddon`. `?package=` naming
it and the bare publish-mode save answered `422
WRITABLE_PACKAGE_REQUIRED`; the bare draft save answered 200, `Saved
email_template 'ghost_mail' (env-wide, package=com.qa.ghostbase,
state=draft)`.
- Rider 1: the bare rollback's receipt read `Reverted to version 1 —
type=email_template, name=rb_mail [seq=16]`, no package.
- N2's REST `DELETE` pin: `405 METHOD_NOT_ALLOWED` (`use GET, HEAD,
PUT`). The `HttpDispatcher` metadata-item route does not mount `DELETE`
(`domains/meta.ts` says mounting it needs its own card), so the pin was
dropped, not the door; see Acceptance notes.
</details>
<details><summary>Pins at the final head: 11/11 pass</summary>
`pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2
src/domains/meta-bare-write-doors-follow-base-34681.test.ts` → `Tests 11
passed (11)`. Added this round: the uninstalled base (S1), two bare
deletes in a row, the bare draft read beside the bare discard (the
dependent's draft stored first, so a first-match read would meet it
first; the read serves the base's draft with a version token), the
destructive doors under a read-only base (bare delete, draft discard and
rollback each answer what `?package=BASE` answers, never `409`), the
rollback receipt's package, and a bare read after the bare publish.
</details>
<details><summary>Ablation (one-shot, not kept)</summary>
Round 3, each through `scripts/ablation-replace.mjs`, rebuilt,
`ablation-dist-preflight` checked, then the pin file:
- S1: `followedBase = base;` deleted (anchor 1 → 0, blob e8a6970 →
fb961e6f), dist marker absent: `Tests 1 failed | 10 passed (11)`, the
uninstalled-base pin red.
- Rider 1: the receipt's package clause replaced (blob 3445e11 →
73848178), dist marker present in 2 built files: `Tests 1 failed | 10
passed (11)`, the rollback pin red.
- The helper answering no base (main's behaviour at every door; blob
e8a6970 → 4364e64b, marker present in 2 built files): `Tests 9 failed |
2 passed (11)`; every moved pin red, including the four rider-2 pins;
the shipped-base neighbour and the controls green. A first attempt used
a comment marker the bundle strips: the preflight refused it before any
test ran, so that leg was a no-op and was re-run with a marker that
survives.
- Restored each: blob == HEAD, `git diff HEAD` empty, `git status
--porcelain` empty, rebuilt, preflight `--absent` clean, `Tests 11
passed (11)`.
Round 2, the `historySlotOf` site: its follow-the-base `return` replaced
so it never fires (anchor 1 → 0, blob 3106fd3 → 9365a157), rebuilt,
marker present in 2 built files: `Tests 3 failed | 4 passed (7)`, the
history, diff and rollback pins red, the rest green. Restored: blob ==
HEAD 3106fd3, `git diff HEAD` empty, rebuilt, preflight `--absent`
clean, `Tests 7 passed (7)`.
Round 1, the helper itself:
Mutation through `scripts/ablation-replace.mjs`: the helper's final
`return` replaced so it never answers a base (anchor 1 → 0, blob
517f041 → aec26a74), `@objectstack/metadata-protocol` rebuilt,
`ablation-dist-preflight` marker present in 2 built files. Run: `Tests 3
failed | 2 passed (5)`: the three moved pins went red (first failure:
the REST `PUT` answered 409 where 200 is pinned); the neighbour reading
and the controls stayed green, as expected. Restored: blob == HEAD
517f041, `git diff HEAD` empty, rebuilt, preflight `--absent` clean,
`Tests 5 passed (5)`.
</details>
## Acceptance notes
- **A2, the shipped-base neighbour (measured, unchanged, pinned).** The
base ships the member in code and the dependent stores a row of it: the
bare read serves the base's code item, and the bare save is refused `403
NOT_OVERRIDABLE` toward `BASE.custom`, writing nothing (the package-less
write is closed for a shipped name, ADR-0146 D11). The predicted
disagreement (the save landing in the dependent's row) does not occur on
`main` or here.
- **A3, read after the bare delete (measured, pinned).** Once the bare
delete removes the base's row, the bare read serves the dependent's row
(200, `packageId` = dependent). Not silent: the delete receipt says the
item still exists and names the dependent's row as remaining.
- **Read-only base.** Where the base is a code or installed package, the
bare save now answers what naming the base answers (`422
WRITABLE_PACKAGE_REQUIRED` naming the base) instead of `409` naming
both, and so do the bare delete, draft discard and rollback (pinned
equal to `?package=BASE`).
- **Destructive doors (S2, ruled).** Bill picked option A at 12:03Z
(comment 7008542936): the bare delete, draft discard and rollback follow
the row-held base. The accepted consequence is pinned: a second bare
delete removes the dependent's row, and the base's copy comes back only
by saving it again. The spec delete text states it.
- **N1, wording.** The per-item publish naming no package still states
no package to the runtime authoring gate, as every bare publish does;
the changeset says so instead of "exactly as named".
- **N2.** The REST `DELETE` door is not mounted on this transport
(`405`), so the REST pin stays on `PUT`; the delete is pinned in
process. Mounting `DELETE` there is a public-surface change for its own
card, not this one.
- **Not moved (CONTROLS, pinned):** two holders with no base relation, a
package-less row beside the holders, and a type with no members still
refuse `409` naming every holder; `?package=` still writes where it
names.
- **Same family, moved here (claim amendment 7005577225):** the bare
diff and the bare rollback follow the base through `historySlotOf`,
pinned beside the first five doors. The two contract docblocks that said
the writes do not follow the base are rewritten in the same PR.
- **Neighbour defect, reported for filing, left to the area:** a
dependent's non-canonical member over a base holding only the canonical
member (the base's `en-US` row, the dependent's `fr-FR` row): the bare
read at `fr-FR` answers 404, the bare save of `fr-FR` writes the
dependent's row (200), and the bare read at `fr-FR` then answers 409.
Present on `main` 8596c80, untouched here.
## Verification
Third round at head `914e61af` (merge base with `origin/main` 6f36818;
`overlap-check` against `origin/main` 819c067). The suites ran at
`531d0988`; `914e61af` only re-flows four docblocks in `protocol.ts`
(comments), after which the facade ratchet and the other ratchets were
re-run.
<details><summary>Local subset, each exit captured before any
pipe</summary>
- `pnpm --filter @objectstack/metadata-protocol exec vitest run
--maxWorkers=2`: exit 0, `Test Files 360 passed | 9 skipped (369)`,
`Tests 23249 passed | 45 skipped (23294)`.
- `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2` on
the pin file plus `meta-disabled-holder-served-stack.test.ts` and
`meta-bundle-member-one-request.test.ts`: exit 0, `Test Files 3 passed
(3)`, `Tests 173 passed (173)`.
- `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2`: exit
0, `Test Files 947 passed (947)`, `Tests 28933 passed | 1 todo (28934)`.
- Typecheck: `@objectstack/metadata-protocol`, `@objectstack/runtime`
(tsc plus `check:test-typecheck`) and `@objectstack/spec`: each exit 0.
- `gen:schema` and `gen:docs`: exit 0; they changed only
`content/docs/references/api/protocol.mdx`, committed.
- Derived gate families (`dispatch-gates.mjs --commands`, 120): 118 exit
0; `check:dual-build-cjs-loads` and `check:skill-examples` exit 3,
PREREQUISITE NOT MET (no full build here), NOT MEASURED locally and left
to CI. `check:facade-delegation-only` was red in the first pass
(`protocol.ts` 11717 lines over its ceiling 11705, from the S3
docblocks); the docblocks were re-flowed line-neutral and the gate
re-run at `914e61af`: exit 0. `--ran` reconciliation: 120 derived, 118
run, 2 NOT-MEASURED, 0 UNRUN.
- Re-run at `914e61af`: `check:facade-delegation-only`,
`check:query-options-erasure` (236 sites, at the ceiling),
`check:nul-bytes`, `@objectstack/spec check:generated` (all 14 artifacts
current; a first run without the 4096 MB heap cap died in `tsc` with no
diagnostics, re-run with it: exit 0). Each exit 0.
- `overlap-check.mjs --branch=HEAD`: `VERDICT clean`, against
`origin/main` and #35459.
- `test:repo` not run locally (no file of that project changed); CI's
`Test Core` runs it.
</details>
## 席位核对
- Read first: `protocol-save.ts` (`packagelessRowHeldBaseAddress`, the
draft-mode follow arm with `followedBase`, and the two sites that read
it), `packages/spec/src/api/protocol.zod.ts` (the five descriptions),
`protocol-diff-delete-load.ts` (the two address sites in the delete).
- Two-minute check: `pnpm --filter @objectstack/runtime exec vitest run
--maxWorkers=2
src/domains/meta-bare-write-doors-follow-base-34681.test.ts`, expect
`Tests 11 passed (11)` (after `pnpm --filter
@objectstack/metadata-protocol build`).
- Dogfood battery: not owed (no `!` in the title, the arm is
`(widening)`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Utp6CbP6iSEGkWb5fn8yqd
<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CbP6iSEGkWb5fn8yqd -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent c890070 commit b68f9ae
12 files changed
Lines changed: 622 additions & 76 deletions
File tree
- .changeset
- content/docs/references/api
- packages
- metadata-protocol/src
- runtime/src/domains
- spec/src/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
| 457 | + | |
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| |||
713 | 713 | | |
714 | 714 | | |
715 | 715 | | |
716 | | - | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
717 | 724 | | |
718 | 725 | | |
719 | 726 | | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
724 | 736 | | |
725 | 737 | | |
726 | 738 | | |
727 | 739 | | |
728 | 740 | | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
733 | 749 | | |
734 | 750 | | |
735 | 751 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
281 | 283 | | |
282 | 284 | | |
283 | 285 | | |
| |||
671 | 673 | | |
672 | 674 | | |
673 | 675 | | |
674 | | - | |
| 676 | + | |
675 | 677 | | |
676 | 678 | | |
677 | 679 | | |
| |||
834 | 836 | | |
835 | 837 | | |
836 | 838 | | |
837 | | - | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
838 | 850 | | |
839 | 851 | | |
840 | 852 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
153 | 157 | | |
154 | 158 | | |
155 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
156 | 166 | | |
157 | | - | |
158 | | - | |
| 167 | + | |
| 168 | + | |
159 | 169 | | |
160 | 170 | | |
161 | 171 | | |
162 | | - | |
| 172 | + | |
163 | 173 | | |
164 | 174 | | |
165 | 175 | | |
166 | 176 | | |
167 | 177 | | |
168 | 178 | | |
169 | 179 | | |
170 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
171 | 185 | | |
172 | 186 | | |
173 | 187 | | |
| |||
0 commit comments