From 3c3b8f0cc5879e8e8d45935208365904cafe34a7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 03:32:39 +0000 Subject: [PATCH 1/8] test(objectql): pin the per-item publish and the rollback naming no package of a disabled-only name Claude-Session: https://claude.ai/code/session_01L9qibwictsQHxYdcVwUTSp Co-authored-by: Claude --- ...abled-holder-packageless-row-doors.test.ts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/packages/objectql/src/disabled-holder-packageless-row-doors.test.ts b/packages/objectql/src/disabled-holder-packageless-row-doors.test.ts index c8cd95d96e2..45cc54e1331 100644 --- a/packages/objectql/src/disabled-holder-packageless-row-doors.test.ts +++ b/packages/objectql/src/disabled-holder-packageless-row-doors.test.ts @@ -272,3 +272,61 @@ describe('[#33401, review#2 S5] an enabled package holding the name through an u expect(refusal?.[Symbol.for('objectstack.metadata-protocol.disabledHoldersOnlyRefusal')]).toBe(true); }); }); + +describe('[ADR-0150 D3, the 2026-11-26 note] the per-item publish and the rollback naming no package, while every holder is disabled', () => { + /** Every stored row of the name, active and draft, as the store holds it. */ + const storedRows = (stores: Stores) => JSON.stringify(Array.from(stores.get('sys_metadata')?.values() ?? []) + .filter((r) => r.name === NAME) + .map((r) => [r.state, r.package_id ?? null, r.bundle_member ?? null, r.metadata, r.version]) + .sort((a, b) => JSON.stringify(a).localeCompare(JSON.stringify(b)))); + const refusalOf = (pending: Promise): Promise => pending.then(() => undefined, (error: unknown) => error); + + it.each([['beside the stored package-less row', true], ['with no row stored', false]] as const)('publish, a package-less draft %s: refused 409 with the enable as the remedy, nothing written; re-enabled, the row is served as it was and the same publish goes live', async (_cell, withRow) => { + const stores: Stores = new Map(); + const { engine, protocol } = await boot(stores); + // `fr-FR` is a member the package never ships: the ADR-0146 D11 close + // leaves this cell open, so the disabled-holders judgment answers. + if (withRow) await protocol.saveMetaItem({ type: 'email_template', name: NAME, item: template('fr-FR', 'SAVED fr') } as any); + await protocol.saveMetaItem({ type: 'email_template', name: NAME, item: template('fr-FR', 'DRAFT fr'), mode: 'draft' } as any); + engine.registry.disablePackage(PKG); + const before = storedRows(stores); + // FROM (`main` 56c9cae6): `success: true`, the draft promoted into the + // package-less active row the disabled package hides. TO: refused as + // the save and the delete are, and nothing is written. + const refused = await refusalOf(protocol.publishMetaItem({ type: 'email_template', name: NAME, member: 'fr-FR' } as any)); + expect([refused?.status, refused?.code], String(refused?.message ?? 'no refusal')).toEqual([409, 'RESOURCE_CONFLICT']); + expect(String(refused?.message).startsWith('Enable the package that holds email_template ')).toBe(true); + expect(String(refused?.message)).not.toContain(PKG); + expect(storedRows(stores)).toBe(before); + // CONTROL — re-enabled: the row is served byte-identical, and the publish goes live. + engine.registry.enablePackage(PKG); + expect(await subjectAt(protocol, 'fr-FR')).toBe(withRow ? 'SAVED fr' : undefined); + expect(await protocol.publishMetaItem({ type: 'email_template', name: NAME, member: 'fr-FR' } as any)).toMatchObject({ success: true }); + expect(await subjectAt(protocol, 'fr-FR')).toBe('DRAFT fr'); + }); + + it('rollback of the package-less row: refused 409 with the enable as the remedy, nothing written; re-enabled, the row is served as it was and the same rollback restores the version', async () => { + const stores: Stores = new Map(); + const { engine, protocol } = await boot(stores); + await protocol.saveMetaItem({ type: 'email_template', name: NAME, item: template('fr-FR', 'SAVED fr 1') } as any); + await protocol.saveMetaItem({ type: 'email_template', name: NAME, item: template('fr-FR', 'SAVED fr 2') } as any); + const events = (await protocol.historyMetaItem({ type: 'email_template', name: NAME, member: 'fr-FR' } as any)).events; + expect(events).toHaveLength(2); + const first = Math.min(...events.map((e: any) => e.version as number)); + engine.registry.disablePackage(PKG); + const before = storedRows(stores); + // FROM (`main` 56c9cae6): `success: true`, the hidden row rewritten + // to the first version's body. TO: refused, nothing written. + const refused = await refusalOf(protocol.rollbackMetaItem({ type: 'email_template', name: NAME, toVersion: first, member: 'fr-FR' } as any)); + expect([refused?.status, refused?.code], String(refused?.message ?? 'no refusal')).toEqual([409, 'RESOURCE_CONFLICT']); + expect(String(refused?.message).startsWith('Enable the package that holds email_template ')).toBe(true); + expect(String(refused?.message)).not.toContain(PKG); + expect(storedRows(stores)).toBe(before); + // CONTROL — re-enabled: the row is served byte-identical, and the rollback restores the version. + engine.registry.enablePackage(PKG); + expect(await subjectAt(protocol, 'fr-FR')).toBe('SAVED fr 2'); + expect(await protocol.rollbackMetaItem({ type: 'email_template', name: NAME, toVersion: first, member: 'fr-FR' } as any)) + .toMatchObject({ success: true, restoredFromVersion: first }); + expect(await subjectAt(protocol, 'fr-FR')).toBe('SAVED fr 1'); + }); +}); From e1cd3c5165811c9ba92d5ca1a1c0b257ed38ca77 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 03:35:11 +0000 Subject: [PATCH 2/8] fix(metadata-protocol): the per-item publish and rollback naming no package refuse over a disabled holder's package-less row Claude-Session: https://claude.ai/code/session_01L9qibwictsQHxYdcVwUTSp Co-authored-by: Claude --- .../src/protocol-history-and-publish.ts | 19 +++++++++++- .../src/protocol-package-commits.ts | 18 +++++++++++ .../metadata-protocol/src/protocol-save.ts | 31 +++++++++++++++---- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/packages/metadata-protocol/src/protocol-history-and-publish.ts b/packages/metadata-protocol/src/protocol-history-and-publish.ts index 4dfdae076b9..a7372564880 100644 --- a/packages/metadata-protocol/src/protocol-history-and-publish.ts +++ b/packages/metadata-protocol/src/protocol-history-and-publish.ts @@ -45,7 +45,7 @@ import type { MutationProjectionOutcome } from './protocol-mutation-events.js'; import { PREFLIGHT_AUDIT_CODE, withPendingAudit } from './protocol-audit-entry.js'; import type { PublishMetaItemRequest } from './protocol-door-requests.js'; import { withRefusalAudit } from './protocol-refusal-audit.js'; -import { environmentActionPublishSlotRefusal, packagelessRowHeldBaseAddress } from './protocol-save.js'; +import { environmentActionPublishSlotRefusal, packagelessHolderRefusal, packagelessRowHeldBaseAddress } from './protocol-save.js'; import { overlayMemberWhere } from './migrations/overlay-index.js'; import { isMissingTableError } from '@objectstack/metadata/errors'; import { readPublishBackfillRequest } from './protocol-publish-backfill-request.js'; @@ -876,6 +876,23 @@ export class ProtocolHistoryAndPublishFacet { if (address.kind === 'none' && address.into !== null && others.length > 0) { addressRefusal = packagelessPublishNoDraftRefusal(request.type, request.name, address.into, others); } + // [ADR-0150 D3, the 2026-11-26 note] …and the holders, where a + // package-unbound row or draft is stored for the name, as the + // draft save naming no package judges them + // ({@link packagelessHolderRefusal}, its disabled-holders + // judgment only): of a name only disabled packages hold, that + // row or draft is their customization, hidden with them, and + // the promotion wrote the active row the next enable serves. + // Refused with the enable as the remedy, nothing written. + if (addressRefusal === undefined) { + const active = await host.packagelessAddress(singularType, request.name, request.member, 'active'); + if (active.unbound || address.drafts.unbound) { + addressRefusal = packagelessHolderRefusal(host, 'publish', request.type, singularType, request.name, request.member, { + candidates: [...new Set([...active.candidates, ...address.drafts.candidates])], + unbound: true, + }, 'disabled-holders'); + } + } } } // ADR-0010 L3 — lock blocks publish too (publishing is a write). diff --git a/packages/metadata-protocol/src/protocol-package-commits.ts b/packages/metadata-protocol/src/protocol-package-commits.ts index cbe3e23f1be..153ae234d34 100644 --- a/packages/metadata-protocol/src/protocol-package-commits.ts +++ b/packages/metadata-protocol/src/protocol-package-commits.ts @@ -93,6 +93,7 @@ import { import { isNonCanonicalStoredType } from './protocol-stored-overlay-types.js'; import type { RollbackMetaItemRequest } from './protocol-door-requests.js'; import { historySlotOf, refusePackageSelectorOutsideSlottedTypes } from './protocol-history-slots.js'; +import { packagelessHolderRefusal } from './protocol-save.js'; import { withRefusalAudit } from './protocol-refusal-audit.js'; import type { ProtocolHost } from './protocol-host.js'; import type { ImportUnmanagedPackageAnswer, InstallPackageStoredRowHook, StoredPackageRow } from './protocol-package-install.js'; @@ -2236,6 +2237,23 @@ export class ProtocolPackageCommitsFacet { ); if (namedBase) throw namedBase; } + // [ADR-0150 D3, the 2026-11-26 note] A rollback naming no package + // that restores the package-unbound row of a name only disabled + // packages hold rewrote their customization, hidden with them, so the + // next enable served the restored body. It asks the judgment the + // save and the delete ask ({@link packagelessHolderRefusal}, its + // disabled-holders judgment only), after the D11 close above, and is + // refused with the enable as the remedy, nothing written. + if (request.packageId === undefined && rollbackPackageId === null) { + const active = await host.packagelessAddress(singularType, request.name, member, 'active'); + if (active.unbound) { + const holderRefusal = packagelessHolderRefusal( + host, 'rollback', request.type, singularType, request.name, member, + { candidates: active.candidates, unbound: true }, 'disabled-holders', + ); + if (holderRefusal) throw holderRefusal; + } + } // [ADR-0146 D2] A rollback of the base's paired `.custom` row is the // pair's declared override, as its save is: it edits no managed item, // so the store is told a runtime-only write — never judged an artifact diff --git a/packages/metadata-protocol/src/protocol-save.ts b/packages/metadata-protocol/src/protocol-save.ts index 2db1bcc3a7f..9d1af377de7 100644 --- a/packages/metadata-protocol/src/protocol-save.ts +++ b/packages/metadata-protocol/src/protocol-save.ts @@ -3263,6 +3263,15 @@ export async function environmentActionPublishSlotRefusal( return undefined; } +/** + * The writes naming no package that ask the disabled-holders judgment + * ({@link packagelessHolderRefusal}): the save (publish and draft mode), the + * delete and the draft discard, and [ADR-0150 D3, the 2026-11-26 note] the + * per-item publish and the per-item rollback. Every verb but `delete` writes a + * row, so its refusal says nothing was written. + */ +export type DisabledHoldersWriteVerb = 'save' | 'delete' | 'publish' | 'rollback'; + /** * [ADR-0150 D3, ruling A on the disabled-only name] The refusal of a write * naming no package of a name every holder of which is disabled. A disabled @@ -3272,11 +3281,11 @@ export async function environmentActionPublishSlotRefusal( * {@link packagelessAddressAmbiguityRefusal}, with no new code. */ export function disabledHoldersOnlyRefusal( - verb: 'save' | 'delete', + verb: DisabledHoldersWriteVerb, type: string, name: string, ): Error & { code: 'RESOURCE_CONFLICT'; status: 409 } { - const [nothing, single] = verb === 'save' + const [nothing, single] = verb !== 'delete' ? ['Nothing was written.', 'no row to write'] : ['Nothing was deleted.', 'no row to remove']; const err = new Error( @@ -3306,11 +3315,11 @@ export function disabledHoldersOnlyRefusal( * hidden row where it is and stores a second row beside it. */ export function disabledHoldersCustomizationRefusal( - verb: 'save' | 'delete', + verb: DisabledHoldersWriteVerb, type: string, name: string, ): Error & { code: 'RESOURCE_CONFLICT'; status: 409 } { - const nothing = verb === 'save' ? 'Nothing was written.' : 'Nothing was deleted.'; + const nothing = verb !== 'delete' ? 'Nothing was written.' : 'Nothing was deleted.'; // Kept well under the 500 characters a door's client message is cut at // (`truncateClientMessage`), so the remedy's last sentence arrives. const err = new Error( @@ -3476,6 +3485,9 @@ export async function packagelessRowHeldBaseDraftAddress( * bare draft discard answer as the bare read does in the two states below, * whether or not a row is stored at the address (over none, the delete and * the discard are refused too, not answered the no-op receipt). + * [ADR-0150 D3, the 2026-11-26 note] The bare per-item publish and the bare + * per-item rollback ask the second state only (`arms: 'disabled-holders'`), + * after the ADR-0146 D11 close, so they write nothing a disabled holder hides. * Asked after {@link servedPackagelessSaveAddress} (a name an enabled and a * disabled package both hold) and after the rows' own refusal (two or more * bindings), so neither answer moves. @@ -3513,7 +3525,7 @@ export async function packagelessRowHeldBaseDraftAddress( */ export function packagelessHolderRefusal( host: Pick, - verb: 'save' | 'delete', + verb: DisabledHoldersWriteVerb, shownType: string, type: string, name: string, @@ -3529,6 +3541,13 @@ export function packagelessHolderRefusal( */ readonly customized?: boolean; }, + /** + * `'disabled-holders'`: the disabled-holders judgment only, never the + * two-enabled-holders refusal. The per-item publish and rollback ask it + * so (ADR-0150 D3, the 2026-11-26 note); each has its own refusal of + * two holders' rows (`packagelessAddressAmbiguityRefusal`, `historySlotOf`). + */ + arms: 'all' | 'disabled-holders' = 'all', ): (Error & { code: 'RESOURCE_CONFLICT'; status: 409 }) | undefined { const registry = host.engine?.registry as HolderRegistry | undefined; if (typeof registry?.readsByPackage !== 'function' || registry.readsByPackage(type) !== true) return undefined; @@ -3538,7 +3557,7 @@ export function packagelessHolderRefusal( // A package-unbound row at the address leaves the ENABLED holders' answer // as it was (the write edits that row); only the disabled-holders // judgment below reads past it. - if (!address.unbound && typeof registry.resolveItem === 'function') { + if (arms === 'all' && !address.unbound && typeof registry.resolveItem === 'function') { try { registry.resolveItem(type, name, null, member); } catch (error) { From cb8e02f68f30828ae5d7ce98d0e38654b542ac1c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 03:38:25 +0000 Subject: [PATCH 3/8] chore(spec): the disabled-holder migration entry and changesets name the publish and rollback doors Claude-Session: https://claude.ai/code/session_01L9qibwictsQHxYdcVwUTSp Co-authored-by: Claude --- ...d-holder-unbound-row-bare-write-refused.md | 2 +- ...isabled-holder-publish-rollback-refused.md | 26 +++++++++++ .../metadata-protocol/src/protocol-save.ts | 9 ++-- ...der-package-less-row-bare-write-refused.ts | 45 +++++++++++-------- 4 files changed, 59 insertions(+), 23 deletions(-) create mode 100644 .changeset/37608-disabled-holder-publish-rollback-refused.md diff --git a/.changeset/37499-disabled-holder-unbound-row-bare-write-refused.md b/.changeset/37499-disabled-holder-unbound-row-bare-write-refused.md index 7fd2ecedf7f..eac3a7c03f8 100644 --- a/.changeset/37499-disabled-holder-unbound-row-bare-write-refused.md +++ b/.changeset/37499-disabled-holder-unbound-row-bare-write-refused.md @@ -25,4 +25,4 @@ Every moved answer, before → after, for a type the registry reads by package, The refusal's message starts with the fix ("Enable the package that holds …") and names no package. Once a holder is enabled again the read naming no package serves the package-less row as it was stored, and the same writes answer as before the disable. -Not moved: an item the ADR-0146 D11 close covers (one read-only code package ships it, with a pair, and `os migrate packageless-overlays` would move its package-less row) keeps that close's answer for the save, the draft save and the delete naming no package, `403 NOT_OVERRIDABLE` with that close's own remedy, with the package enabled or disabled; there only the draft discard moves, from `200` to the `409` above. Also not moved: a name no package holds (the environment's own item) saves, drafts, discards and deletes as before beside a disabled package; a package-less row at a name an enabled package holds; a name only disabled packages hold with no package-less row or draft stored, which keeps its `409` with the `?package=` remedy; the sealed types (`doc`, `action`), which answer `403 NOT_OVERRIDABLE` as before; every read. Migration entry `disabled-holder-package-less-row-bare-write-refused` (`@objectstack/spec`) carries the same fix for the upgrade guide. +Not moved: an item the ADR-0146 D11 close covers (one read-only code package ships it, with a pair, and `os migrate packageless-overlays` would move its package-less row) keeps that close's answer for the save, the draft save and the delete naming no package, `403 NOT_OVERRIDABLE` with that close's own remedy, with the package enabled or disabled; there only the draft discard moves: over a stored package-less draft from `200` to the `409` above, and over a stored package-less row with no draft from the `409` with the `?package=` sentence to the same `409` with the enable sentence. Also not moved: a name no package holds (the environment's own item) saves, drafts, discards and deletes as before beside a disabled package; a package-less row at a name an enabled package holds; a name only disabled packages hold with no package-less row or draft stored, which keeps its `409` with the `?package=` remedy; the sealed types (`doc`, `action`), which answer `403 NOT_OVERRIDABLE` as before; every read. Migration entry `disabled-holder-package-less-row-bare-write-refused` (`@objectstack/spec`) carries the same fix for the upgrade guide. diff --git a/.changeset/37608-disabled-holder-publish-rollback-refused.md b/.changeset/37608-disabled-holder-publish-rollback-refused.md new file mode 100644 index 00000000000..f4aa63b6271 --- /dev/null +++ b/.changeset/37608-disabled-holder-publish-rollback-refused.md @@ -0,0 +1,26 @@ +--- +'@objectstack/metadata-protocol': minor +'@objectstack/spec': minor +--- + +fix(metadata-protocol)!: refuse the per-item publish and rollback naming no package over the package-less row of a name only disabled packages hold + +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 + + + +**BREAKING** for a deployment that publishes or rolls back one metadata item, with no package named, at a name whose every holder is disabled while a package-less row or draft is stored for it: the write is now refused where it answered `200`. Fix: enable a package that holds the name (`PATCH /api/v1/packages/:id/enable`; `GET /api/v1/packages` shows which are disabled), then send the same publish or rollback again. Naming the package (`?package=`) is not the fix: it addresses that package's own row and leaves the hidden row where it is. + +The save, the draft save, the delete and the draft discard naming no package already refuse there (ADR-0150 D3, its 2026-11-26 note): a package-less row stored at a name a package holds is that package's customization, hidden with it. The per-item publish and the per-item rollback did not ask that judgment, so a publish promoted a package-less draft into the hidden row and a rollback rewrote it, and enabling the package again served a body no read had shown. + +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 package-less write open (a base with no pair, a member the package never ships, a holder that is not a read-only code package, among the cells that close lists): + +- `POST /api/v1/meta/:type/:name/publish` with a package-less draft stored, beside a package-less row or with none: `200` (the draft promoted into the hidden package-less row) → `409 RESOURCE_CONFLICT`, nothing written. +- `POST /api/v1/meta/:type/:name/rollback` with a package-less row stored: `200` (the hidden row rewritten to the version's body) → `409 RESOURCE_CONFLICT`, nothing written. +- The same two through the in-process `publishMetaItem` / `rollbackMetaItem` with no `packageId`. + +The refusal's message is the one the save and the delete answer there: it starts with the fix ("Enable the package that holds …"), names no package, and says "send this publish again" or "send this rollback again". Once a holder is enabled again the read naming no package serves the package-less row as it was stored, and the same publish or rollback answers as before the disable. + +Not moved: an item the ADR-0146 D11 close covers keeps that close's `403 NOT_OVERRIDABLE` for the publish and the rollback naming no package, with the package enabled or disabled; a publish or rollback naming a package; a publish whose draft is bound to a package and a rollback of a package-bound row, with no package-less row or draft stored; a rollback with no package-less row stored; a name no package holds; a name an enabled package holds; every read. Migration entry `disabled-holder-package-less-row-bare-write-refused` (`@objectstack/spec`), which already carried the four other writes, now carries these two for the upgrade guide. diff --git a/packages/metadata-protocol/src/protocol-save.ts b/packages/metadata-protocol/src/protocol-save.ts index 9d1af377de7..4b268c75b39 100644 --- a/packages/metadata-protocol/src/protocol-save.ts +++ b/packages/metadata-protocol/src/protocol-save.ts @@ -3303,10 +3303,11 @@ export function disabledHoldersOnlyRefusal( * no package of a name every holder of which is disabled, where a * PACKAGE-UNBOUND row or draft is stored for the name. That row is the * holder's customization (a package-less row over a held name is never a - * second item), so it is hidden with its holder, from the reads and from the - * writes alike: the save edited it unseen, the draft save stored a draft no - * read reaches, and the delete and the draft discard removed what the next - * enable would have served. + * second item), so it is hidden with its holder: the reads withhold it, and + * the writes naming no package that ask {@link packagelessHolderRefusal} leave + * it alone. The save edited it unseen, the draft save stored a draft no read + * reaches, the delete and the draft discard removed what the next enable + * would have served, and the per-item publish and rollback rewrote it. * * `409 RESOURCE_CONFLICT`, the refusal family of * {@link disabledHoldersOnlyRefusal}, with no new code, and naming no package diff --git a/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts b/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts index 632322d40e6..0e174118503 100644 --- a/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts +++ b/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts @@ -4,39 +4,46 @@ import type { SemanticMigration } from '../../types.js'; // A narrowing of the metadata writes that name no package, not of any key: // ADR-0150 D3 (its 2026-11-26 note) has a package-less row stored at a name a -// package holds hide with that holder, on the writes as on the reads. While -// every holder of the name is disabled, the save, the draft save, the delete -// and the draft discard naming no package are refused, where each answered 200 -// and edited, stored or removed a row no read served. No key is added, removed -// or re-shaped and no stored row changes shape, so no tombstone and no D2 -// conversion: whether to enable the holder again is the operator's judgement. -// No relevance question: the move turns on which installed packages are -// disabled, which no question over one stack can name. +// package holds hide with that holder: the reads withhold it, and the writes +// naming no package leave it alone. While every holder of the name is +// disabled, the save, the draft save, the delete, the draft discard, the +// per-item publish and the per-item rollback naming no package are refused +// where the ADR-0146 D11 close leaves them open. Each answered 200 there and +// edited, stored, removed, promoted into or restored a row no read served; +// where a code package ships the name, the draft discard over a stored row +// with no draft already answered 409, and only its sentence moves. No key is +// added, removed or re-shaped and no stored row changes shape, so no tombstone +// and no D2 conversion: whether to enable the holder again is the operator's +// judgement. No relevance question: the move turns on which installed packages +// are disabled, which no question over one stack can name. export const entry: SemanticMigration = { id: 'disabled-holder-package-less-row-bare-write-refused', surface: 'A write of a metadata item that names no package (PUT /api/v1/meta/TYPE/NAME in publish mode and with ' + '?mode=draft, DELETE /api/v1/meta/TYPE/NAME, its draft discard with ?state=draft, and the in-process save ' - + 'and delete of a metadata item with no packageId), for a name held only by installed packages that are ' + + 'and delete of a metadata item with no packageId; POST /api/v1/meta/TYPE/NAME/publish and ' + + 'POST /api/v1/meta/TYPE/NAME/rollback, and the in-process publishMetaItem and rollbackMetaItem with no ' + + 'packageId), for a name held only by installed packages that are ' + 'disabled, of a type the registry reads by package, while a package-less row or a package-less draft is ' + 'stored for that name. Where the package-less write onto a packaged item was already closed (ADR-0146 D11: ' - + '403 NOT_OVERRIDABLE for the save and the delete), only the draft discard moves', + + '403 NOT_OVERRIDABLE for the save, the delete, the publish and the rollback), only the draft discard moves', replacement: 'Enable a package that holds the name (PATCH /api/v1/packages/ID/enable; GET /api/v1/packages shows which ' - + 'packages are disabled), then send the same write again: it edits, drafts or removes the package-less row as ' - + 'it did before. While every holder stays disabled the write answers 409 RESOURCE_CONFLICT and stores, edits ' + + 'packages are disabled), then send the same write again: it edits, drafts, removes, publishes or rolls back ' + + 'the package-less row as it did before. While every holder stays disabled the write answers 409 RESOURCE_CONFLICT and stores, edits ' + 'and removes nothing. Naming the package on the write (?package=ID) is not the fix: it addresses that ' + 'package\'s own row, so it leaves the hidden row where it is and stores a second row beside it. An item the ' + 'ADR-0146 D11 close covers (one read-only code package ships it, with a pair, and os migrate ' - + 'packageless-overlays would move its row) is the exception this entry does not change: its save and its ' - + 'delete naming no package answer that close first, 403 NOT_OVERRIDABLE with that close\'s own remedy, with ' + + 'packageless-overlays would move its row) is the exception this entry does not change: its save, its ' + + 'delete, its publish and its rollback naming no package answer that close first, 403 NOT_OVERRIDABLE with that close\'s own remedy, with ' + 'the package enabled or disabled; there only the draft discard answers this 409.', reason: 'A package-less row stored at a name a package holds is that package\'s customization, never a second item, ' + 'and a disabled package\'s items are withheld from every read that names no package. The writes that name no ' + 'package still reached the row: the save edited it unseen, the draft save stored a draft the draft read then ' - + 'answered 404 for, the draft discard removed it, and the delete removed the row, so enabling the package ' - + 'again served its item without the customization. They now judge the name\'s holders past a stored ' + + 'answered 404 for, the draft discard removed it, the delete removed the row, the publish promoted a draft ' + + 'into it and the rollback rewrote it, so enabling the package again served its item without the ' + + 'customization, or with a body nobody saw land. They now judge the name\'s holders past a stored ' + 'package-less row, as they already did with none stored. A name no package holds, a package-less row at a ' + 'name an enabled package holds, and a name only disabled packages hold with no package-less row stored (its ' + 'refusal keeps the ?package= remedy) answer as before. There is no mechanical rewrite: whether the disabled ' @@ -44,9 +51,11 @@ export const entry: SemanticMigration = { acceptanceCriteria: 'For every name whose holders are all disabled and for which a package-less row or draft is stored, where the ' + 'ADR-0146 D11 close leaves the package-less write open: PUT /api/v1/meta/TYPE/NAME (publish mode and ' - + '?mode=draft) and DELETE /api/v1/meta/TYPE/NAME (and ?state=draft) naming no package answer 409 ' + + '?mode=draft), DELETE /api/v1/meta/TYPE/NAME (and ?state=draft), POST /api/v1/meta/TYPE/NAME/publish and ' + + 'POST /api/v1/meta/TYPE/NAME/rollback naming no package answer 409 ' + 'RESOURCE_CONFLICT and leave every stored row of the name byte-identical. Where that close applies, the ' - + 'draft discard answers the same 409, and the save, the draft save and the delete answer 403 NOT_OVERRIDABLE ' + + 'draft discard answers the same 409, and the save, the draft save, the delete, the publish and the rollback ' + + 'answer 403 NOT_OVERRIDABLE ' + 'as they did before, storing nothing. Once a holder is enabled again, the read naming no package serves the ' + 'package-less row as it was stored, and the same writes answer as they did before the disable.', }; From 245dbd0390b113f7b427e62bddfc618ca08e3c24 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 03:50:20 +0000 Subject: [PATCH 4/8] fix(metadata-protocol): the rollback verb never asks the two-enabled-holders arm; changeset disposition spelled as the gate reads it Claude-Session: https://claude.ai/code/session_01L9qibwictsQHxYdcVwUTSp Co-authored-by: Claude --- .changeset/37608-disabled-holder-publish-rollback-refused.md | 2 +- packages/metadata-protocol/src/protocol-save.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/37608-disabled-holder-publish-rollback-refused.md b/.changeset/37608-disabled-holder-publish-rollback-refused.md index f4aa63b6271..94ff71cae31 100644 --- a/.changeset/37608-disabled-holder-publish-rollback-refused.md +++ b/.changeset/37608-disabled-holder-publish-rollback-refused.md @@ -9,7 +9,7 @@ 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 - + **BREAKING** for a deployment that publishes or rolls back one metadata item, with no package named, at a name whose every holder is disabled while a package-less row or draft is stored for it: the write is now refused where it answered `200`. Fix: enable a package that holds the name (`PATCH /api/v1/packages/:id/enable`; `GET /api/v1/packages` shows which are disabled), then send the same publish or rollback again. Naming the package (`?package=`) is not the fix: it addresses that package's own row and leaves the hidden row where it is. diff --git a/packages/metadata-protocol/src/protocol-save.ts b/packages/metadata-protocol/src/protocol-save.ts index 4b268c75b39..60bab53d48a 100644 --- a/packages/metadata-protocol/src/protocol-save.ts +++ b/packages/metadata-protocol/src/protocol-save.ts @@ -3558,7 +3558,7 @@ export function packagelessHolderRefusal( // A package-unbound row at the address leaves the ENABLED holders' answer // as it was (the write edits that row); only the disabled-holders // judgment below reads past it. - if (arms === 'all' && !address.unbound && typeof registry.resolveItem === 'function') { + if (arms === 'all' && verb !== 'rollback' && !address.unbound && typeof registry.resolveItem === 'function') { try { registry.resolveItem(type, name, null, member); } catch (error) { From 0e37af4b121118c85c9b7b089797c544be966f3d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 05:32:04 +0000 Subject: [PATCH 5/8] fix(metadata-protocol): the per-item publish asks the disabled-holders judgment only where it reads the package-less draft or writes the package-less row Claude-Session: https://claude.ai/code/session_01L9qibwictsQHxYdcVwUTSp Co-authored-by: Claude --- .../src/protocol-history-and-publish.ts | 22 ++++++++------ ...abled-holder-packageless-row-doors.test.ts | 29 +++++++++++++++++++ 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/packages/metadata-protocol/src/protocol-history-and-publish.ts b/packages/metadata-protocol/src/protocol-history-and-publish.ts index a7372564880..309a6870b20 100644 --- a/packages/metadata-protocol/src/protocol-history-and-publish.ts +++ b/packages/metadata-protocol/src/protocol-history-and-publish.ts @@ -876,15 +876,19 @@ export class ProtocolHistoryAndPublishFacet { if (address.kind === 'none' && address.into !== null && others.length > 0) { addressRefusal = packagelessPublishNoDraftRefusal(request.type, request.name, address.into, others); } - // [ADR-0150 D3, the 2026-11-26 note] …and the holders, where a - // package-unbound row or draft is stored for the name, as the - // draft save naming no package judges them - // ({@link packagelessHolderRefusal}, its disabled-holders - // judgment only): of a name only disabled packages hold, that - // row or draft is their customization, hidden with them, and - // the promotion wrote the active row the next enable serves. - // Refused with the enable as the remedy, nothing written. - if (addressRefusal === undefined) { + // [ADR-0150 D3, the 2026-11-26 note] …and the holders, where + // the promotion reads the package-unbound draft or writes the + // package-unbound active row, as the draft save naming no + // package judges them ({@link packagelessHolderRefusal}, its + // disabled-holders judgment only): of a name only disabled + // packages hold, that draft and that row are their + // customization, hidden with them, and the promotion wrote the + // active row the next enable serves. Refused with the enable + // as the remedy, nothing written. A promotion of a package's + // own draft into its own row (`key` and `into` that package) + // touches no package-less row and is not asked; nor is a + // publish with no draft, which keeps its `NO_DRAFT`. + if (addressRefusal === undefined && address.kind === 'draft' && (address.key === null || address.into === null)) { const active = await host.packagelessAddress(singularType, request.name, request.member, 'active'); if (active.unbound || address.drafts.unbound) { addressRefusal = packagelessHolderRefusal(host, 'publish', request.type, singularType, request.name, request.member, { diff --git a/packages/objectql/src/disabled-holder-packageless-row-doors.test.ts b/packages/objectql/src/disabled-holder-packageless-row-doors.test.ts index 45cc54e1331..ac386dfdae5 100644 --- a/packages/objectql/src/disabled-holder-packageless-row-doors.test.ts +++ b/packages/objectql/src/disabled-holder-packageless-row-doors.test.ts @@ -305,6 +305,35 @@ describe('[ADR-0150 D3, the 2026-11-26 note] the per-item publish and the rollba expect(await subjectAt(protocol, 'fr-FR')).toBe('DRAFT fr'); }); + 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 () => { + const stores: Stores = new Map(); + const { engine, protocol } = await boot(stores); + await protocol.saveMetaItem({ type: 'email_template', name: NAME, item: template('fr-FR', 'SAVED fr') } as any); + await protocol.saveMetaItem({ type: 'email_template', name: NAME, item: template('fr-FR', 'PKG DRAFT fr'), mode: 'draft', packageId: PKG } as any); + engine.registry.disablePackage(PKG); + const packageless = () => JSON.stringify(Array.from(stores.get('sys_metadata')?.values() ?? []) + .filter((r) => r.name === NAME && (r.package_id ?? null) === null).map((r) => [r.state, r.bundle_member ?? null, r.metadata, r.version])); + const before = packageless(); + // The draft address is the package's own draft, promoted into the + // package's own row: no package-less row is read or written, so the + // judgment is not asked (the answer `main` 56c9cae6 gives). + expect(await protocol.publishMetaItem({ type: 'email_template', name: NAME, member: 'fr-FR' } as any)).toMatchObject({ success: true }); + expect(packageless()).toBe(before); + expect(Array.from(stores.get('sys_metadata')?.values() ?? []) + .filter((r) => r.name === NAME && r.state === 'active').map((r) => r.package_id ?? null).sort()).toEqual([PKG, null].sort()); + }); + + it('publish with no draft stored, beside the stored package-less row: `NO_DRAFT` as on `main`, nothing written', async () => { + const stores: Stores = new Map(); + const { engine, protocol } = await boot(stores); + await protocol.saveMetaItem({ type: 'email_template', name: NAME, item: template('fr-FR', 'SAVED fr') } as any); + engine.registry.disablePackage(PKG); + const before = storedRows(stores); + const missing = await refusalOf(protocol.publishMetaItem({ type: 'email_template', name: NAME, member: 'fr-FR' } as any)); + expect([missing?.status, missing?.code], String(missing?.message ?? 'no refusal')).toEqual([404, 'NO_DRAFT']); + expect(storedRows(stores)).toBe(before); + }); + it('rollback of the package-less row: refused 409 with the enable as the remedy, nothing written; re-enabled, the row is served as it was and the same rollback restores the version', async () => { const stores: Stores = new Map(); const { engine, protocol } = await boot(stores); From 4793a980fe58570a40b1775ea89062a834316764 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 05:34:26 +0000 Subject: [PATCH 6/8] chore(changeset): the publish's moved and unmoved cells as the door now answers them Claude-Session: https://claude.ai/code/session_01L9qibwictsQHxYdcVwUTSp Co-authored-by: Claude --- .changeset/37608-disabled-holder-publish-rollback-refused.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/37608-disabled-holder-publish-rollback-refused.md b/.changeset/37608-disabled-holder-publish-rollback-refused.md index 94ff71cae31..7d9a70d622f 100644 --- a/.changeset/37608-disabled-holder-publish-rollback-refused.md +++ b/.changeset/37608-disabled-holder-publish-rollback-refused.md @@ -17,10 +17,10 @@ The save, the draft save, the delete and the draft discard naming no package alr 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 package-less write open (a base with no pair, a member the package never ships, a holder that is not a read-only code package, among the cells that close lists): -- `POST /api/v1/meta/:type/:name/publish` with a package-less draft stored, beside a package-less row or with none: `200` (the draft promoted into the hidden package-less row) → `409 RESOURCE_CONFLICT`, nothing written. +- `POST /api/v1/meta/:type/:name/publish` whose draft address is the package-less draft (beside a package-less row or with none stored): `200` (the draft promoted into the hidden package-less row) → `409 RESOURCE_CONFLICT`, nothing written. - `POST /api/v1/meta/:type/:name/rollback` with a package-less row stored: `200` (the hidden row rewritten to the version's body) → `409 RESOURCE_CONFLICT`, nothing written. - The same two through the in-process `publishMetaItem` / `rollbackMetaItem` with no `packageId`. The refusal's message is the one the save and the delete answer there: it starts with the fix ("Enable the package that holds …"), names no package, and says "send this publish again" or "send this rollback again". Once a holder is enabled again the read naming no package serves the package-less row as it was stored, and the same publish or rollback answers as before the disable. -Not moved: an item the ADR-0146 D11 close covers keeps that close's `403 NOT_OVERRIDABLE` for the publish and the rollback naming no package, with the package enabled or disabled; a publish or rollback naming a package; a publish whose draft is bound to a package and a rollback of a package-bound row, with no package-less row or draft stored; a rollback with no package-less row stored; a name no package holds; a name an enabled package holds; every read. Migration entry `disabled-holder-package-less-row-bare-write-refused` (`@objectstack/spec`), which already carried the four other writes, now carries these two for the upgrade guide. +Not moved: an item the ADR-0146 D11 close covers keeps that close's `403 NOT_OVERRIDABLE` for the publish and the rollback naming no package, with the package enabled or disabled; a publish or rollback naming a package; a publish whose draft address is a package's own draft, promoted into that package's own row, beside a package-less row or not (it touches no package-less row); a publish with no draft at its address, which keeps its `404 NO_DRAFT`; a rollback of a package-bound row; a rollback with no package-less row stored; a name no package holds; a name an enabled package holds; every read. Migration entry `disabled-holder-package-less-row-bare-write-refused` (`@objectstack/spec`), which already carried the four other writes, now carries these two for the upgrade guide. From 35ca5027ddb57d487ac5e01a859f9d94dbd4e657 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 05:34:41 +0000 Subject: [PATCH 7/8] chore(spec): the migration entry's acceptance names the publish and rollback cells it moves Claude-Session: https://claude.ai/code/session_01L9qibwictsQHxYdcVwUTSp Co-authored-by: Claude --- .../19.disabled-holder-package-less-row-bare-write-refused.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts b/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts index 0e174118503..3a3162b3ba9 100644 --- a/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts +++ b/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts @@ -53,7 +53,9 @@ export const entry: SemanticMigration = { + 'ADR-0146 D11 close leaves the package-less write open: PUT /api/v1/meta/TYPE/NAME (publish mode and ' + '?mode=draft), DELETE /api/v1/meta/TYPE/NAME (and ?state=draft), POST /api/v1/meta/TYPE/NAME/publish and ' + 'POST /api/v1/meta/TYPE/NAME/rollback naming no package answer 409 ' - + 'RESOURCE_CONFLICT and leave every stored row of the name byte-identical. Where that close applies, the ' + + 'RESOURCE_CONFLICT and leave every stored row of the name byte-identical (the publish where the draft it ' + + 'promotes is the package-less one, the rollback where it restores the package-less row; a publish of a ' + + 'package\'s own draft and a publish with no draft answer as before). Where that close applies, the ' + 'draft discard answers the same 409, and the save, the draft save, the delete, the publish and the rollback ' + 'answer 403 NOT_OVERRIDABLE ' + 'as they did before, storing nothing. Once a holder is enabled again, the read naming no package serves the ' From f8da2ea030a5d9563ccf82ed873edaa0a5dd2de4 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 07:13:40 +0000 Subject: [PATCH 8/8] chore(spec): the migration entry's reason claims the no-row judgment for the four earlier writes only; the changeset names the two open cells' carrier Claude-Session: https://claude.ai/code/session_01L9qibwictsQHxYdcVwUTSp Co-authored-by: Claude --- ...608-disabled-holder-publish-rollback-refused.md | 4 ++-- ...d-holder-package-less-row-bare-write-refused.ts | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.changeset/37608-disabled-holder-publish-rollback-refused.md b/.changeset/37608-disabled-holder-publish-rollback-refused.md index 7d9a70d622f..c6625f34437 100644 --- a/.changeset/37608-disabled-holder-publish-rollback-refused.md +++ b/.changeset/37608-disabled-holder-publish-rollback-refused.md @@ -17,10 +17,10 @@ The save, the draft save, the delete and the draft discard naming no package alr 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 package-less write open (a base with no pair, a member the package never ships, a holder that is not a read-only code package, among the cells that close lists): -- `POST /api/v1/meta/:type/:name/publish` whose draft address is the package-less draft (beside a package-less row or with none stored): `200` (the draft promoted into the hidden package-less row) → `409 RESOURCE_CONFLICT`, nothing written. +- `POST /api/v1/meta/:type/:name/publish` whose draft address is the package-less draft (beside a package-less row or with none stored): `200` (the package-less draft promoted into the hidden package-less row, or, beside the disabled package's own active row, adopted into that row) → `409 RESOURCE_CONFLICT`, nothing written. - `POST /api/v1/meta/:type/:name/rollback` with a package-less row stored: `200` (the hidden row rewritten to the version's body) → `409 RESOURCE_CONFLICT`, nothing written. - The same two through the in-process `publishMetaItem` / `rollbackMetaItem` with no `packageId`. The refusal's message is the one the save and the delete answer there: it starts with the fix ("Enable the package that holds …"), names no package, and says "send this publish again" or "send this rollback again". Once a holder is enabled again the read naming no package serves the package-less row as it was stored, and the same publish or rollback answers as before the disable. -Not moved: an item the ADR-0146 D11 close covers keeps that close's `403 NOT_OVERRIDABLE` for the publish and the rollback naming no package, with the package enabled or disabled; a publish or rollback naming a package; a publish whose draft address is a package's own draft, promoted into that package's own row, beside a package-less row or not (it touches no package-less row); a publish with no draft at its address, which keeps its `404 NO_DRAFT`; a rollback of a package-bound row; a rollback with no package-less row stored; a name no package holds; a name an enabled package holds; every read. Migration entry `disabled-holder-package-less-row-bare-write-refused` (`@objectstack/spec`), which already carried the four other writes, now carries these two for the upgrade guide. +Not moved: an item the ADR-0146 D11 close covers keeps that close's `403 NOT_OVERRIDABLE` for the publish and the rollback naming no package, with the package enabled or disabled; a publish or rollback naming a package; a publish with no draft at its address, which keeps its `404 NO_DRAFT`; a rollback of a package-bound row; two writes that still land on an item only disabled packages hold, left open for a separate decision (#37851): a publish whose draft address is the disabled package's own draft, promoted into that package's own row (beside a package-less row or not), and a rollback with no package-less row stored, which stores the package-less row again from its history; a name no package holds; a name an enabled package holds; every read. Migration entry `disabled-holder-package-less-row-bare-write-refused` (`@objectstack/spec`), which already carried the four other writes, now carries these two for the upgrade guide. diff --git a/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts b/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts index 3a3162b3ba9..b52a180acb7 100644 --- a/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts +++ b/packages/spec/src/migrations/entries/semantic/19.disabled-holder-package-less-row-bare-write-refused.ts @@ -43,11 +43,15 @@ export const entry: SemanticMigration = { + 'package still reached the row: the save edited it unseen, the draft save stored a draft the draft read then ' + 'answered 404 for, the draft discard removed it, the delete removed the row, the publish promoted a draft ' + 'into it and the rollback rewrote it, so enabling the package again served its item without the ' - + 'customization, or with a body nobody saw land. They now judge the name\'s holders past a stored ' - + 'package-less row, as they already did with none stored. A name no package holds, a package-less row at a ' - + 'name an enabled package holds, and a name only disabled packages hold with no package-less row stored (its ' - + 'refusal keeps the ?package= remedy) answer as before. There is no mechanical rewrite: whether the disabled ' - + 'package should be enabled again is a judgement about the deployment.', + + 'customization, or with a body nobody saw land. The save, the draft save, the delete and the draft discard ' + + 'now judge the name\'s holders past a stored package-less row, as they already did with none stored. The ' + + 'publish and the rollback judge them only where they promote the package-less draft or restore the ' + + 'package-less row while one is stored; with none stored they judge no holder, as before, so a publish of ' + + 'the disabled package\'s own draft and a rollback that stores the package-less row again are not refused ' + + 'by this entry. A name no package holds, a package-less row at a name an enabled package holds, and, for ' + + 'the save, the draft save, the delete and the draft discard, a name only disabled packages hold with no ' + + 'package-less row stored (its refusal keeps the ?package= remedy) answer as before. There is no mechanical ' + + 'rewrite: whether the disabled package should be enabled again is a judgement about the deployment.', acceptanceCriteria: 'For every name whose holders are all disabled and for which a package-less row or draft is stored, where the ' + 'ADR-0146 D11 close leaves the package-less write open: PUT /api/v1/meta/TYPE/NAME (publish mode and '