Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
6ecb1a3
fix(metadata-protocol): the read naming no member addresses the canon…
claude Nov 17, 2026
bcf681b
test(runtime): pin naming no member and naming the canonical member a…
claude Nov 17, 2026
661a6ea
test(runtime): the cell-1 CONTROL answers the read naming no member a…
claude Nov 17, 2026
c9ae39b
chore(changeset): metadata-protocol patch for the canonical-member ba…
claude Nov 17, 2026
dd36bfa
test: retire the removed layered lookup site from the call-site ledge…
claude Nov 17, 2026
af88513
Merge remote-tracking branch 'origin/main' into claude/issue-34682-bu…
claude Nov 17, 2026
3cb177c
feat(spec): register the canonical-member bare read as an ADR-0087 se…
claude Nov 17, 2026
91cfa33
test(objectql): the base-address pin answers the read naming no membe…
claude Nov 17, 2026
90b5cde
fix(metadata-protocol): a base's address naming no member serves its …
claude Nov 17, 2026
538121f
fix(metadata-protocol): an exact address naming no member replaces an…
claude Nov 17, 2026
7c19138
Merge remote-tracking branch 'origin/main' into claude/issue-34682-bu…
claude Nov 19, 2026
ce8d6e7
chore(changeset): name the two 18.6.0 statements this change reverses
claude Nov 19, 2026
c678d6e
Merge remote-tracking branch 'origin/main' into claude/issue-34682-bu…
claude Nov 19, 2026
bb9f1fd
fix(metadata-protocol): an exact address counts the environment's ite…
claude Nov 19, 2026
d226b31
chore: changeset and ledger entry name the /layers code-layer moves a…
claude Nov 19, 2026
e90a02e
Merge remote-tracking branch 'origin/main' into claude/issue-34682-bu…
claude Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .changeset/34682-bundle-member-selector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
'@objectstack/metadata-protocol': patch
'@objectstack/spec': patch
---

fix(metadata-protocol)!: the read naming no bundle member addresses the canonical member alone, as `?member=en-US` and `/published` do

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no page under `skills/**` or `content/docs/**` teaches the read naming no member of a bundle that has no canonical member; `content/docs/references` prints the selector sentence this change now follows, and the ADR-0146 paragraph of `skills/objectstack-platform/SKILL.md` names members only at a base or a package address. No taught sentence moves.

<!-- adr-0087: registered bundle-without-canonical-member-bare-read-absent -->

**BREAKING**: where the address holds no canonical member of a bundled name, the read naming no member (`GET /meta/TYPE/NAME`, with or without `?package=`), `/layers` naming none and the execution read naming none move from serving another member (200) to `404 RESOURCE_NOT_FOUND` (the execution read: `null`). Name the member (`?member=fr-FR`) to read it, as before.

The by-name doors' member selector reads a request naming no member as the canonical one (`en-US` for `email_template`), and naming the canonical value is the same request. That is the selector's declared contract (`GetMetaItemRequest.member`). For a bundle with no canonical member, the two requests got different answers:

- The plain read `GET /api/v1/meta/email_template/NAME` and `/layers` served the bundle's other member (for example `fr-FR`, status 200). The execution read (`getMetaItemForExecution`) returned that member too.
- `?member=en-US` and `/published` answered 404.

The same split held in two more arrangements:

- A base ships only `fr-FR` and a dependent that declares it stores `en-US`. The read naming no package and no member served the base's `fr-FR`.
- `?package=X` where X ships no `en-US` while another package does (a dependent, or a disabled holder that the read naming no package re-addresses past to X). The read naming no member served X's `fr-FR`. `?package=X&member=en-US` answered nothing.

For a bundle that only stores a non-canonical row (a package-less `fr-FR` row with no `en-US` row), the plain read also changed across a restart. It answered 404 before the restart. After the restart it served the row (200), because the restart had moved the row into the registry's bare slot.

The plain read, `/layers` and the execution read now ask every layer for the canonical member when no member is named. They take the registry's bare-name answer only when it is that member. The base-address fallback serves only the base's canonical member, and an exact address (`?package=`) replaces another package's item only with the holder's item at the addressed member. So each of these arrangements answers 404 on every door naming no member, the same as `?member=en-US` and `/published`, before and after a restart.

A bundle that ships or stores its canonical member keeps its status and served body, and so does any named member. Three more answers move:

- `/layers` naming no member, where the canonical member is stored over a package that ships only another member: `code` goes from that member's body to `null`, as `/layers?member=en-US` already answered. Status and `effective` do not move.
- For a type with no members, `/layers?package=X`, where X holds nothing of the name and the only holder is disabled: `code` goes from the disabled holder's artifact to `null`. A disabled package holds no name.
- `?package=X` naming no member, where X does not hold the name and the environment stores it only in a non-canonical member: the read was refused `409 RESOURCE_CONFLICT` (`not-held-by-qualifier`, naming the environment) once a restart had hydrated the row. It now answers the `404` that `?member=en-US` already answered, on the plain read and `/layers`. A non-canonical member is still read with its own selector, for example `?member=fr-FR`, which the Studio list already links to for each member.

**Reverses two statements of the 18.6.0 note** for the arrangement where base A ships `email_template` `welcome` in `fr-FR` only and dependent D, which declares A, stores `en-US`:

- 18.6.0 said "`GET /meta/email_template/welcome/layers` (no member) moves FROM `404` after a restart TO A's `fr-FR` (200)". Now `/layers` naming no member answers `404 RESOURCE_NOT_FOUND` on both sides of a restart, as `/layers?member=en-US` does.
- 18.6.0 said "**Not moved.** The plain read, `?member=CANONICAL` and the execution read of the first shape (A's `fr-FR` naming no member, 404 at `en-US`)." Now only `?member=CANONICAL` is unmoved. The plain read naming no member answers 404 and the execution read naming no member answers `null`, where both served A's `fr-FR`.

Migration: a caller that read a bundle with no canonical member without naming a member must name the member it wants (`?member=fr-FR`). The email template loader reads the list (`getMetaItemsForExecution`) and does not use this read, so it is not affected.
7 changes: 7 additions & 0 deletions packages/metadata-protocol/src/protocol-bundle-members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export const BUNDLE_MEMBER_MAX_LENGTH = 100;
* well-formed member with nothing stored or shipped is not refused here: each
* door answers it as it answers an absent item.
*
* [#34682] …the canonical member included, named or not: a bundle that ships
* or stores no canonical member answers the read naming no member as absent,
* as it answers `?member=en-US` and `/published`. The registry's bare-name
* read still answers such a bundle with its first member; the by-name reads
* (`getMetaItem`, `getMetaItemLayered`) take that answer only when it is the
* canonical member, so it reaches no door.
*
* Refuses, with a located 400 `VALIDATION_ERROR` — the code the REST door's
* recognition refusal answers for a misspelled selector on the same routes —
* a selector on a type whose identity is its name alone, and a value that
Expand Down
19 changes: 17 additions & 2 deletions packages/metadata-protocol/src/protocol-exact-qualifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import {
import { ENVIRONMENT_ADDRESS_SEGMENT, readNamespacePositionSegment } from '@objectstack/spec/kernel';
import { installedManifestsOfEngine } from './installed-manifests.js';
import { canonicalizeMetaRequestType } from './protocol-meta-type-schema.js';
import { bundleMemberDiscriminator } from './protocol-bundle-members.js';
import type { ProtocolHost } from './protocol-host.js';
import type { ServedOverrideRow } from './served-override.js';

Expand Down Expand Up @@ -364,7 +365,13 @@ export async function admitExactQualifier(
}

const candidates: PackageScopedHolder[] = holders.map((holder) => ({ kind: 'package' as const, packageId: holder }));
if (registry.getEnvironmentScopedItem(request.type, request.name, request.member) !== undefined) {
// [#34682] The environment's item AT the addressed member: the named one,
// else the canonical one (naming no member is naming the canonical value).
// Asked with the raw selector, a read naming no member counted the
// environment's first member of a bundle it holds only in another member,
// so `?package=X` was refused 409 naming the environment where
// `?package=X&member=<canonical>` was admitted and answered 404.
if (registry.getEnvironmentScopedItem(request.type, request.name, bundleMemberDiscriminator(request.type, request.member)) !== undefined) {
candidates.push({ kind: 'environment' });
}
// No holder anywhere: nothing to name, and the read answers its own miss.
Expand Down Expand Up @@ -491,7 +498,15 @@ export function exactQualifierItem(
address.registryHolders.map((holder) => ({ kind: 'package' as const, packageId: holder })));
}
const [holder] = address.registryHolders;
return holder === undefined ? undefined : registry.getPackageScopedItem(request.type, request.name, holder, member);
// [#34682] The admitted holder's item AT the addressed member: the named
// one, else the canonical one (the selector's contract: naming no member
// is naming the canonical value). Asked with the raw selector, a read
// naming no member got the holder's FIRST member when it ships no
// canonical one, while `?member=<canonical>` answered nothing. `undefined`
// for a type with no members, which reads as before.
return holder === undefined
? undefined
: registry.getPackageScopedItem(request.type, request.name, holder, bundleMemberDiscriminator(request.type, member));
}

/**
Expand Down
12 changes: 9 additions & 3 deletions packages/metadata-protocol/src/protocol-meta-item-reads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1363,9 +1363,12 @@ export async function readMetaItem(host: Pick<ProtocolHost, 'artifactLockLayerAt
// member's stored row; when there is none, the member is the code
// layer's — the artifact that ships it — and then the registry's, asked
// for that member. The registry's bare-name read answers the canonical
// member wherever it sits (its own [#22877] note), and still answers a
// bundle that ships no canonical member at all; a named member that no
// member wherever it sits (its own [#22877] note); a member that no
// layer holds answers nothing, so the door answers it as absent.
// [#34682] …the canonical member included: naming no member is the
// request that names it (the selector's contract), so a bundle that
// ships or stores no canonical member answers this read as absent, as
// `?member=<canonical>` and `/published` answer it.
// [ADR-0150 D3/D5] Whether the answer below is the code layers' (the
// artifact lookup and the registry), judged at the end of step 3.
const reachedCodeLayers = item === undefined;
Expand Down Expand Up @@ -1404,7 +1407,10 @@ export async function readMetaItem(host: Pick<ProtocolHost, 'artifactLockLayerAt
// [#22877] A registry that does not narrow by member (a host
// double, an older registry) can answer another member of the
// bundle for a named one; that answer is not this member.
if (member !== undefined && item !== undefined && !isWantedMember(item)) item = undefined;
// [#34682] …nor is the member the registry's bare-name read answers
// for a bundle with no canonical member, when none was named: this
// read addresses the canonical member ({@link resolveBundleMemberSelector}).
if (wantedMember !== undefined && item !== undefined && !isWantedMember(item)) item = undefined;
// [#20946] The registry half — see `storedRowDeclined` above.
// `getItem` answers the bare slot first, and for a shipped flow name
// that slot holds the hydrated stored row, which is not one of the
Expand Down
45 changes: 16 additions & 29 deletions packages/metadata-protocol/src/protocol-meta-layered-reads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,16 @@ export async function getMetaItemLayered(host: Pick<ProtocolHost, 'artifactLockL
// [#26699] Each lookup is asked for the addressed member, exactly
// as {@link getMetaItem}'s are: the artifact at the member (the
// canonical one when none was named), and the registry for the
// member named. The registry's bare-name read still answers a
// bundle that ships no canonical member; a registry that does not
// narrow by member can answer another one for a NAMED member, and
// that answer is not this member's layer.
// member named. A registry that does not narrow by member can answer
// another one for a NAMED member, and that answer is not this
// member's layer. [#34682] Nor, naming none, is the member the
// registry's bare-name read answers for a bundle with no canonical
// member: this read addresses the canonical member, as
// `?member=<canonical>` does, and that bundle has no layer of it.
const runtimeOnly = (item: unknown): unknown =>
item !== undefined && isTenantAuthored(item) ? undefined : item;
const namedMemberOnly = (item: unknown): unknown =>
member !== undefined && item !== undefined && !isWantedMember(item) ? undefined : item;
wantedMember !== undefined && item !== undefined && !isWantedMember(item) ? undefined : item;
// [#32365] The bare action read's judged answer: the one enabled
// holder's artifact (looked up at that holder), or the environment's
// own item (a runtime registration; a stored row is the overlay layer).
Expand Down Expand Up @@ -447,22 +449,8 @@ export async function getMetaItemLayered(host: Pick<ProtocolHost, 'artifactLockL
// now refused naming the holders (ruling 6917064203 on #34398).
if (exactAddress === undefined) regItem = namedMemberOnly(runtimeOnly(registryAnswerAtAddress(host, request, regItem, member, isWantedMember, { refuse: true })));
if (regItem !== undefined) code = regItem;

// [#34441 cell 1, #21059] Naming no member, the bare-name read answers
// a bundle that ships no canonical member with the member it ships,
// until a stored row is hydrated into that bare slot: the hydrated
// row is no artifact read (dropped above), and the shipped member it
// displaced is the artifact the bare name reads. Without this the same
// read answered `code` = the base's `fr-FR` before a restart and
// `null` after it (404 on `/layers`), with a dependent's `en-US` row
// stored. A named member is never answered here (its own lookups ran).
// [#34248] Nor is a bare doc read's environment entry: beside two
// enabled holders that entry is the read's answer, and the artifact
// lookup's first composite is the holder registered first, which the
// read never serves (as for the bare action read's judged answer).
if (code === null && member === undefined && bareActionAnswer === undefined && bareDocEnvironmentEntry === undefined) {
code = host.lookupArtifactItem(request.type, request.name, request.packageId) ?? null;
}
// [#34682] Naming no member, the code layer is the canonical member's
// artifact (asked above) or none: no lookup by name alone follows.
}

// [#5840] The code half of the rule #5707 wrote for the overlay half,
Expand Down Expand Up @@ -661,14 +649,13 @@ export async function getMetaItemLayered(host: Pick<ProtocolHost, 'artifactLockL
// package's in id order.
let orphaned = false;
// [#34441 cell 1] …and only over a code layer of the member this read
// addresses. Naming no member, a bundle whose base ships no canonical
// member takes the base's other member as its code layer (the registry's
// bare-name read, above); a dependent's row of the canonical member is
// then no row the base's document shadows but the dependent's addition
// (#28802 R2), and reported as an orphan it became `/published`'s
// document, before a restart only. FROM (`main` 31096af83d): A ships
// `fr-FR` only, D stores `en-US`: `/published` served D's row (200), where
// with no D row it answers 404.
// addresses: a dependent's row of a member the base does not ship is no
// row the base's document shadows but the dependent's addition (#28802
// R2), and reported as an orphan it became `/published`'s document.
// FROM (`main` 31096af83d): A ships `fr-FR` only, D stores `en-US`:
// `/published` served D's row (200), where with no D row it answers 404.
// [#34682] Naming no member, the code layer is the canonical member's
// alone (above), so this guard now also holds by that construction.
if (overlay === null && code !== null && isWantedMember(code) && typeof contentPackageId === 'string' && contentPackageId !== '') {
const base = contentPackageId;
let rows: readonly StoredOverlayRow[] = [];
Expand Down
15 changes: 10 additions & 5 deletions packages/metadata-protocol/src/protocol-write-gates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { baseAddressServesMember, readOnlyShippingPackages, shippingPackageIds }
import { canonicalMetaType, canonicalizeMetaRequestType } from './protocol-meta-type-schema.js';
import { boundPackageOf } from './protocol-package-bindings.js';
import type { ShippingPackages } from './protocol-package-bindings.js';
import { memberOption } from './protocol-bundle-members.js';
import { bundleMemberDiscriminator, memberOption } from './protocol-bundle-members.js';
import type { MetadataAuditEntry } from './protocol-audit-entry.js';
import { packagedBaseRegimeRow, packagedBaseRegimeSentence } from './packaged-base-regime.js';
import { packagelessCloseSubject } from './protocol-packageless-overlay-migration.js';
Expand Down Expand Up @@ -688,17 +688,22 @@ export class ProtocolWriteGatesFacet {
* [#28802] The registry's answer `item` for a bundle member read on the
* address of `base`, when that address serves it
* ({@link baseServesBundleMember}); else, for a read that named no
* member, the base's own member its artifact answers canonical-first,
* and otherwise nothing. An address that ships no member of the name is
* no base of it: `item` as before.
* member, the base's own CANONICAL member, and otherwise nothing. An
* address that ships no member of the name is no base of it: `item` as
* before. [#34682] A read naming no member addresses the canonical member
* (the selector's contract), so a base that ships none answers it with
* nothing, as `?member=<canonical>` is answered; FROM (`main` d947a93cf8):
* the base's first shipped member (`fr-FR`).
*/
static registryMemberServedAt(host: Pick<ProtocolHost, 'baseServesBundleMember' | 'engine' | 'shippedArtifactsOf' | 'shippingPackagesOf' | 'shipsBundleName'>, type: string, name: string, base: string, item: unknown, member: string | undefined): unknown {
const shipping = host.shippingPackagesOf(type);
if (!host.shipsBundleName(type, name, base, shipping)) return item;
if (host.baseServesBundleMember(type, name, base, item, shipping)) return item;
if (member !== undefined) return undefined;
const canonical = bundleMemberDiscriminator(type, undefined);
const own = host.shippedArtifactsOf(type, name, shipping)
.find((artifact) => (artifact as { _packageId?: unknown } | null)?._packageId === base);
.find((artifact) => (artifact as { _packageId?: unknown } | null)?._packageId === base
&& itemDiscriminator(canonicalMetaType(type), artifact) === canonical);
if (own === undefined) return undefined;
const candidate = host.engine.registry.getItem(type, name, base, itemDiscriminator(canonicalMetaType(type), own));
return candidate !== undefined && host.baseServesBundleMember(type, name, base, candidate, shipping) ? candidate : undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ const SITES: ReadonlyArray<Site & { readonly noPackage: boolean; readonly dispos
why: '[#22877] a bundled type\'s addressed member (the selector\'s, else the canonical one) when no stored row of it exists: the served body IS this artifact, and the envelope is looked up at its own package' },
{ file: LAYERED_READS_FILE, member: 'getMetaItemLayered', args: 'request.type, request.name, request.packageId || judgedPackageId, wantedMember', noPackage: true, disposition: 'no',
why: 'the layered read\'s code LAYER: body and envelope are one artifact, and its provenance fields are read off that layer; [#26699] at the addressed member (the selector\'s, else the canonical one); [#32365] a bare action read at the one enabled holder its judge answered' },
{ file: LAYERED_READS_FILE, member: 'getMetaItemLayered', args: 'request.type, request.name, request.packageId', noPackage: true, disposition: 'no',
why: '[#34441 cell 1] the layered read\'s code LAYER again, naming no member, when the registry\'s bare slot answered a hydrated stored row (dropped as no artifact read): the artifact the bare name reads, so body and envelope are one artifact, as on the row above' },
{ file: 'protocol-discovery-and-bases.ts', member: 'packagedArtifactBase', args: 'type, name', noPackage: true, disposition: 'no',
why: 'the packaged base the translators compare a served body against: nothing of it is grafted onto the body' },
{ file: 'protocol-discovery-and-bases.ts', member: 'readCodeLayerForCarryForward', args: 'type, name, pkg', noPackage: true, disposition: 'no',
Expand Down
Loading
Loading