Skip to content

Commit 344fc14

Browse files
committed
docs(metadata-protocol): say the bare draft read still serves the package-unbound draft with no base draft
Measured: with no base draft at the member, the draft read naming no package and the one naming the base both serve the package-unbound draft. The wrapper's docblock and the changeset said no door acted on it; the pin now holds the bare read equal to the named one. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAj3FYe91JCMQZPS88h
1 parent 4f232bf commit 344fc14

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎.changeset/35524-bare-save-follows-base-dependent-member.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Metadata-protocol: none
1414
- FROM: the save naming no package (REST `PUT` and in process, `active` mode) rewrote the dependent's row at that member, and the read naming no package then still answered `404` (or `409 RESOURCE_CONFLICT` where the rows had been stored after boot). The `draft` save wrote the dependent's draft; the draft read, per-item publish and draft discard naming no package read, promoted or removed the dependent's draft.
1515
- TO: the save naming no package writes the base's row (or, in `draft` mode, the base's draft) at that member, exactly as the same save naming the base (`?package=BASE`, `packageId: BASE`) does; the dependent's row is left byte-unchanged, and the next read naming no package serves the saved content (`200`). The draft read, per-item publish and draft discard naming no package act on the base's draft there. With only the dependent's draft stored at that member, the per-item publish naming no package answers `404 NO_DRAFT` naming that draft, and the draft discard naming no package discards nothing and says which draft remains, as the same requests naming the base answer.
1616
- FROM, a package-unbound draft stored at that member (as a `draft` save naming no package writes it while no package holds the member) with no draft of the dependent beside it: the draft read naming no package served that draft, the per-item publish naming no package promoted it into the dependent's row, the draft discard naming no package removed it, and the `draft` save naming no package adopted it into the dependent's draft, after which the draft doors naming no package still acted on it.
17-
- TO, at that sub-cell: the `draft` save naming no package writes the base's draft beside the package-unbound one and leaves the package-unbound draft untouched, as the save naming the base does; the draft read naming no package then reads back what was saved; the per-item publish naming no package promotes the base's draft into the base's row; a second `draft` save naming no package updates the base's draft (no second draft). With no base draft stored, the per-item publish naming no package answers `404 NO_DRAFT` and the draft discard naming no package discards nothing and names the package-unbound draft as still stored, exactly as the same requests naming the base answer. No door naming no package acts on the package-unbound draft at that member any more, as no door naming the base does.
17+
- TO, at that sub-cell: the `draft` save naming no package writes the base's draft beside the package-unbound one and leaves the package-unbound draft untouched, as the save naming the base does; the draft read naming no package then reads back what was saved; the per-item publish naming no package promotes the base's draft into the base's row; a second `draft` save naming no package updates the base's draft (no second draft). With no base draft stored, the per-item publish naming no package answers `404 NO_DRAFT` and the draft discard naming no package discards nothing and names the package-unbound draft as still stored, exactly as the same requests naming the base answer. With no base draft stored, the draft read naming no package still serves the package-unbound draft, as the draft read naming the base does; once the base's draft is saved, both read the base's draft.
1818

1919
**Not moved.** The canonical member (a base and its dependent both holding it, or only the dependent holding it), two packages neither of which declares the other, a base that ships the name in code, and the delete, history, diff and rollback naming no package at this member.
2020

‎packages/metadata-protocol/src/protocol-save.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3365,9 +3365,10 @@ export function draftAddressFollowsRowHeldBase(address: { into: string | null })
33653365
* reads back what it saved, the bare per-item publish promotes the base's
33663366
* draft, and the bare draft discard with no base draft answers as the discard
33673367
* naming the base does, naming the remaining package-unbound draft
3368-
* (`protocol-diff-delete-load.ts`). No bare draft door at this member acts
3369-
* on the package-unbound draft any more, exactly as no door naming the base
3370-
* does; the discard's receipt names it as still stored.
3368+
* (`protocol-diff-delete-load.ts`). With no base draft there, the bare draft
3369+
* read still serves the package-unbound draft, as the draft read naming the
3370+
* base does, while the bare publish and discard leave it stored, as the
3371+
* requests naming the base do.
33713372
*
33723373
* `pending` (the draft address the stored rows give) itself otherwise: an
33733374
* ambiguous address (the doors ask {@link packagelessRowHeldBaseAddress} for

‎packages/runtime/src/domains/meta-bare-save-dependent-only-member-35524.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// row moves too (contract review S2 option (b)): the bare draft save writes
2020
// WA's draft beside it and leaves it untouched, the bare draft read reads back
2121
// what was saved, the bare publish promotes WA's draft, and with no WA draft
22-
// the bare publish and discard answer as `?package=WA` does. Driven on a
22+
// the bare draft read, publish and discard answer as `?package=WA` does. Driven on a
2323
// booted kernel (the real protocol, metadata service, registry and
2424
// `sys_metadata` store).
2525
//
@@ -304,11 +304,14 @@ describe('[#35524] the bare save at a member only the dependent holds writes the
304304
expect(await bareRead(b, 'ud_publish_bare', fr)).toEqual([200, 'saved fr', WA]);
305305
});
306306

307-
it('with no base draft, the bare per-item publish and draft discard answer as the requests naming the base do, the discard naming the package-unbound draft still stored', async () => {
307+
it('with no base draft, the bare draft read, per-item publish and draft discard answer as the requests naming the base do, the discard naming the package-unbound draft still stored', async () => {
308308
await lay('ud_discard');
309309
await lay('ud_discard_named');
310310
const publishOf = (name: string, extra: Record<string, unknown> = {}) => settle(b.protocol.publishMetaItem({ type: 'email_template', name, member: 'fr-FR', ...extra }))
311311
.then((r: any) => [r.code, r.status]);
312+
// The draft read with no base draft serves the package-unbound draft, bare as named.
313+
expect(await draftRead('ud_discard')).toEqual(await draftRead('ud_discard_named', { packageId: WA }));
314+
expect(await draftRead('ud_discard')).toEqual(['unbound fr', null]);
312315
const barePublish = await publishOf('ud_discard');
313316
expect(barePublish).toEqual(await publishOf('ud_discard_named', { packageId: WA }));
314317
expect(barePublish).toEqual(['NO_DRAFT', 404]);

0 commit comments

Comments
 (0)