Skip to content

Commit 7d06248

Browse files
fix(metadata-protocol): the read naming no bundle member serves a declared override of the canonical member (#34322)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_ Fixes #32849 The last exit of the card: with #33815 (the member read) and #34169 (the layered member read), every read that serves Z's member now serves its declared override (see Acceptance notes for why nothing is left). Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:X 发 `welcome` 邮件模板的 `fr-FR`,附加包 Z 发它的规范成员 `en-US`,App 的 `.custom` pair 存了一行声明覆盖 Z 的 `en-US`(`overrides.package: Z`)。#33815 / #34169 之后,点名 `?member=en-US` 的读已给出覆盖;但不点名成员的读(普通读、执行读、`?layers=true` 分层读,以及靠分层读找已发布行的 `/published`)仍给出 Z 原版 `zeta en-US`。现在它们与 `?member=en-US` 一致,给出覆盖。 - 为什么改:不点名成员就是读规范成员,和点名 `en-US` 是同一个请求;声明了的覆盖应在每个给出 Z 该成员的出口被服务(ADR-0146 D8 第 2 项、ADR-0150 D4),同一请求不能因写法不同给出两份内容。 - 风险与回滚:只改一个判定函数 `declaredMemberOverrideAddressOf`:不点名成员时按规范成员判定,而不是直接放弃;点名成员的读一字未动。未声明覆盖、未声明的 pair 行、声明给 X 的行(仍 409)、X 自己的成员、草稿读的地址、被禁用的 Z 均不变(已钉、已消融)。回滚即还原本 PR,存储数据不变。 - 先看:`packages/metadata-protocol/src/protocol-meta-item-face.ts` 中 `declaredMemberOverrideAddressOf` 开头 `addressed` 那两行。 - 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/package-scoped-exact-qualifier.test.ts -t 'naming no member'`,预期 7 条全绿。 - 需要你做的:无,席位落地。 ## What changes Own files (three): `packages/metadata-protocol/src/protocol-meta-item-face.ts`, `packages/objectql/src/package-scoped-exact-qualifier.test.ts`, `.changeset/32849-nomember-read-declared-override.md`. No edit to `protocol.ts`, `protocol-save.ts`, `protocol-meta-item-reads.ts` or `protocol-meta-layered-reads.ts`: both callers already hand the predicate the selector they resolved (`undefined` when none was named), so the one predicate change reaches both. `declaredMemberOverrideAddressOf` answered `undefined` when no member was named. It now judges the member the read addresses, `bundleMemberDiscriminator(type, member)`: the selector, or the canonical member (`en-US`) when none was named. That is the member `getMetaItem` and `getMetaItemLayered` read when no member is named, and naming the canonical value is the same request (`resolveBundleMemberSelector`'s contract). Every check below it (one enabled shipper of that member, no environment item of it, an active row of it that is the shipper's served override) is unchanged and now runs at that member. A type with no members still answers `undefined`. A bundle that ships no canonical member has no shipper of it, so it is left as it was. | read (fixture: X ships `fr-FR`, Z ships `en-US`; both install orders) | before (`main` b8456eb) | after | |:--|:--|:--| | bare, no member, the pair row declares Z for `en-US` | `zeta en-US` | `pair en-US`, stamped Z, envelope Z (= `?member=en-US`) | | bare execution read, no member, same row | `zeta en-US` | `pair en-US`, stamped Z | | bare `?layers=true`, no member, same row | code `zeta en-US`, overlay null, effective `zeta en-US` | code `zeta en-US`, overlay `pair en-US`, effective `pair en-US`, envelope Z (= `?package=Z`) | | `GET /meta/email_template/welcome/published`, same row (REST door, temporary probe) | no overlay found; fell through to the snapshot exit | 200 `pair en-US` (the layered read's overlay exit) | | `?member=en-US`, `?package=Z`, layered `?member=en-US` | `pair en-US` | unchanged | | bare `?member=fr-FR` (X's own) | `suitex fr-FR` | unchanged | | strict draft read, no member, a pair draft pending | `pair en-US draft` (stamped the pair) | unchanged; the layered draft layer too | | no row / undeclared pair row | `zeta en-US`, no overlay | unchanged | | row declares X (#32606 shape) | 409 naming X and Z (plain and layered) | unchanged | | Z disabled | plain: Z's withheld item; layered: no overlay | unchanged | | door step 1c, `packagelessLayeredReadRefusal` | no refusal | unchanged | Nothing refused becomes served or the reverse; no authorable key or value moves. Same reading as #33815 and #34169 (review-b, 6894129336): an existing declaration taking effect on one more read exit is `Metadata-protocol: none`, patch. ## Tests New top-level describe in the shared real-`SchemaRegistry` harness `packages/objectql/src/package-scoped-exact-qualifier.test.ts`, beside #34169's: `[#32849] the read naming no member serves the pair's declared override of the canonical member an addition Z ships, as ?member=en-US does` (7 tests): - fix pin, both install orders: plain bare (no member) equals `?member=en-US` (`pair en-US`, Z, Z); the execution read the same; bare layers equal `?package=Z`'s with `effective` deep-equal; step 1c refuses nothing; layered `?member=en-US` unchanged; X's `fr-FR` untouched. - draft pin: the plain strict draft read naming no member serves the pair's draft; the layered draft layer is that draft; `?package=Z` has none. - CONTROL no override x2 (no row / undeclared pair row): Z's own, no overlay, on plain, execution and layered. - CONTROL row declares X: 409 `RESOURCE_CONFLICT` naming X and Z on plain and layered. - CONTROL Z disabled: plain answers Z's withheld item, layered has no overlay. BASE measured on `main` b8456eb before any edit, with a temporary probe in this harness (both install orders and the four CONTROL arrangements) and a temporary probe at the REST doors (`packages/rest`, real `SchemaRegistry`, the pair row stored and hydrated): plain bare and execution bare served `zeta en-US`; layered bare answered overlay null, effective `zeta en-US`; `?member=en-US`, `?package=Z` and layered `?member=en-US` served `pair en-US`. At the doors: `GET /meta/email_template/welcome` 200 `zeta en-US`, `/layers` effective `zeta en-US`, `/published` found no overlay. After the fix the same door probe answered 200 `pair en-US` on all three. Neither probe is committed. <details><summary>Ablations (each through `scripts/ablation-replace.mjs`, metadata-protocol rebuilt under the verify lock, `ablation-dist-preflight` marker present in dist, auto-restore blob equals HEAD (`17592e66` / `70eb6082`) with `git diff HEAD` empty, rebuilt, marker absent from all 24 dist files)</summary> Run: `-t 'naming no member'` (7 tests). | | mutation | result | |:--|:--|:--| | A1 | the fix reverted: `addressed` is the named `member` again (none named answers `undefined`) | 3 failed, 4 passed: both fix pins, `bare, no member: expected [ 'zeta en-US', 'com.acme.zeta', …(1) ] to deeply equal [ 'pair en-US', 'com.acme.zeta', …(1) ]`; the draft pin, `bare ?layers=true with drafts, no member: expected [ 'zeta en-US', 'pair en-US draft' ] to deeply equal [ 'pair en-US', 'pair en-US draft' ]` | | A2 | `isServedOverrideRowOf(row, shipper, installed)` OR-ed with an always-true term | 2 failed, 5 passed: the undeclared-row CONTROL, `expected [ 'zeta en-US', 'pair en-US', …(2) ] to deeply equal [ 'zeta en-US', null, …(2) ]`; the X-declared CONTROL, `the read answered; a refusal was expected` | | A3 | the plain read's draft guard removed (the strict draft read naming no member re-addressed to Z) | 1 failed, 6 passed: the draft pin, `No pending draft exists for email_template/welcome.` | | A4 | the layered draft address taken after the arm re-addresses the read | 1 failed, 6 passed: the draft pin, `expected [ 'pair en-US', null ] to deeply equal [ 'pair en-US', 'pair en-US draft' ]` | | A5 | the disabled-shipper guard made unreachable | 1 failed, 6 passed: the disabled CONTROL, `bare ?layers=true, no member: expected [ 'zeta en-US', 'pair en-US', …(2) ] to deeply equal [ 'zeta en-US', null, …(2) ]` | A2's first attempt used a constant-foldable marker (`'…' !== ''`): the build folded it away, so the dist pre-flight could not find the marker, and the reading was discarded and taken again with a marker the build keeps (`String(row.id) !== '…'`); both attempts read the same. A5's first attempt never got the build lock (queue-timeout), so its green run was on the unmutated dist and was discarded; the second attempt is the one above. The no-row CONTROL is an unchanged-outcome pin by construction (no row, nothing to re-address). </details> ## Acceptance notes - **Why `Fixes`:** the card asks that every exit serving Z's member serve the declared override. Exits now covered: the member read and the bare execution read (#33815); the layered member read (#34169); the plain, execution and layered reads naming no member, and `/published` through the layered read (this PR). Z's list, its execution list, `listServedOverrides` and `?package=Z` served it before #33815. - **A bundle with no shipped canonical member** (X ships `fr-FR`, Z ships `de-DE`, the pair declares Z for `de-DE`): measured with the fix, the read naming no member serves X's `suitex fr-FR` (the registry's bare-name fallback) and never Z's member, so there is no Z exit there; the predicate is left as it was (no one shipper of `en-US`). In that arrangement the layered read naming no member answered no layers at all while the plain read served `suitex fr-FR`, measured at the protocol only; the predicate does not reach it (same on `main`). Noted here, not filed: the door reading was not taken (the verify lock timed out). - **`/published`:** the door reads no query parameter, so its only exit is the read naming no member. In the door probe it moved from "no overlay" to 200 `pair en-US`. The before-side then fell through to the metadata service's snapshot (`getPublished`); the probe's snapshot double does not model email templates, so the harness answered 404 there. In a real kernel that exit serves the snapshot, which is not a refusal. No refused read became served and no served read became refused. - Same declaration reading as #33815 and #34169: `Clause-②: no`, `Metadata-protocol: none`, patch. ## Verification All readings on head `884050fa14` (the fix commit `b8a667f4` with `origin/main` 43dd565 merged in), after `pnpm install --frozen-lockfile` and a closure build under the verify lock (`VERDICT command-exit 0`). Every build and suite ran under `scripts/pm/os-verify-lock.sh`; each line is the run's own verdict. <details><summary>Suites (touched packages and direct dependents)</summary> - `@objectstack/metadata-protocol` typecheck exit 0; test exit 0, `Tests 22946 passed | 45 skipped (22991)`. - `@objectstack/objectql` test exit 0, `Test Files 598 passed (598)`, `Tests 13355 passed (13355)`. - `@objectstack/cli` `vitest run --project unit` exit 0, `Tests 6010 passed (6010)`; the integration tier is left to CI. - The other direct dependents of metadata-protocol (client, cloud-connection, rest, runtime, plugin-approvals, plugin-email, plugin-security, service-automation, service-messaging, service-package) and the objectql/cli typechecks were still queued behind the shared verify lock when this PR opened. Their local readings go in the os-dev report on #32849; CI's Test Core and TypeScript Type Check run them all. </details> <details><summary>Gates</summary> - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 64 derived families (3 paths, 144 changed lines vs the 3000 threshold). 61 exit 0 on `884050fa14`. - `check:engine-double-contract` first exit 1, caused by a temporary probe file present during that run (the gate named it). Re-run after the probe was deleted: exit 0. - `check:dual-build-cjs-loads` exit 3 `PREREQUISITE NOT MET` (14 packages outside this diff's closure have no `dist/`). Not measured locally; CI's Lint & Repo Gates runs it on a full build. - `check:type-check-debt` exit 3: its closure build queued behind the verify lock and timed out. Not measured at open time; re-run reported on #32849. - `pnpm lint` exit 0. - Body gates on this body: `check-changeset-no-major` 0, `check-adr-0087-registration` 0, `check-closing-keyword-parity` 0 (with `GITHUB_EVENT_PATH`), `check-partof-closing-keyword` 0 (with `PR_BODY`). - `git merge-tree --write-tree --name-only` of `884050fa14` against the open area PR heads: `origin/claude/area-E1-33308` (#34147, `624b7ff3`) exit 0, no conflict; `origin/claude/area-E1-34059` (#34238, `6f89ebf9`) exit 0, no conflict. Neither touches this PR's files. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 35c9a30 commit 7d06248

3 files changed

Lines changed: 139 additions & 5 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol): the read naming no bundle member serves an App pair's declared override of the canonical member a bundle addition ships
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A read that names no bundle member addresses the canonical one (`en-US` for an email template), the same request as `?member=en-US`. When a bundle addition Z ships that canonical member beside another package's member of the same name (for example X ships `fr-FR`), and the App's customization pair (`<app>.custom`) stores a row declaring `overrides: { package: Z }` for it, `?member=en-US` already served the override. The plain read, the execution read and the layered read naming no member (`GET /meta/email_template/:name`, `?layers=true`) served Z's shipped `en-US` instead, and `/published`, which asks the layered read for its overlay exit, found no runtime-published row there.
11+
12+
They now judge the canonical member as `?member=en-US` does and read it at Z: the override is served, the layered `effective` is the override with Z's shipped member as `code`, and `/published` serves the override. The strict draft read and the layered draft layer stay where they were. Nothing else moves: no override declared, an undeclared pair row, a row declaring another package (still refused naming both), another package's own member, the environment's own item, a disabled shipper, and a bundle that ships no canonical member answer as before. No stored row changes shape.

‎packages/metadata-protocol/src/protocol-meta-item-face.ts‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
} from '@objectstack/core';
4242
import type { ObjectStackProtocolImplementation } from './protocol.js';
4343
import { shippingPackageIds } from './protocol-environment-rows.js';
44-
import { resolveBundleMemberSelector } from './protocol-bundle-members.js';
44+
import { bundleMemberDiscriminator, resolveBundleMemberSelector } from './protocol-bundle-members.js';
4545
import { installedManifestsOfEngine } from './installed-manifests.js';
4646
import { pairsOf } from '@objectstack/metadata-core';
4747
import { disabledExactAddressHolder } from './protocol-exact-qualifier.js';
@@ -512,20 +512,30 @@ export function isAnotherHoldersCopy(registry: any, type: string, name: string,
512512
* The rows are read through `host.readItemActiveRows`, so the read below takes
513513
* them instead of reading them again (#24371). The layered read naming no
514514
* package takes the same address for its layers (`getMetaItemLayered`).
515+
*
516+
* [#32849] The read that names no member addresses the CANONICAL member
517+
* ({@link bundleMemberDiscriminator}), which is the same request as naming it
518+
* (`?member=en-US`), so it is judged at that member here and takes the same
519+
* address. Before, it was left as it was: with the addition Z shipping the
520+
* canonical member and a pair row declaring Z for it, the read naming no
521+
* member served Z's shipped member while `?member=en-US` served the override.
522+
* A bundle with no shipped canonical member has no one shipper of it here, and
523+
* is left as it was. A type with no members is never moved.
515524
*/
516525
export async function declaredMemberOverrideAddressOf(
517526
host: ServedRowHost,
518527
type: string, name: string, member: string | undefined,
519528
): Promise<string | undefined> {
520-
if (member === undefined) return undefined;
529+
const addressed = bundleMemberDiscriminator(type, member);
530+
if (addressed === undefined) return undefined;
521531
const registry: any = host.engine?.registry;
522532
if (typeof registry?.readsByPackage !== 'function' || registry.readsByPackage(type) !== true) return undefined;
523533
if (shippingPackageIds(host.shippedArtifactsOf(type, name)).size < 2) return undefined;
524-
const memberShippers = [...shippingPackageIds(host.shippedArtifactsOf(type, name, undefined, member))];
534+
const memberShippers = [...shippingPackageIds(host.shippedArtifactsOf(type, name, undefined, addressed))];
525535
if (memberShippers.length !== 1) return undefined;
526536
const [shipper] = memberShippers;
527537
if (typeof registry.isPackageDisabled === 'function' && registry.isPackageDisabled(shipper) === true) return undefined;
528-
if (typeof registry.getEnvironmentScopedItem === 'function' && registry.getEnvironmentScopedItem(type, name, member) !== undefined) {
538+
if (typeof registry.getEnvironmentScopedItem === 'function' && registry.getEnvironmentScopedItem(type, name, addressed) !== undefined) {
529539
return undefined;
530540
}
531541
let activeRows: Awaited<ReturnType<ServedRowHost['readItemActiveRows']>>;
@@ -536,7 +546,7 @@ export async function declaredMemberOverrideAddressOf(
536546
activeRows = [];
537547
}
538548
const singular = PLURAL_TO_SINGULAR[type] ?? type;
539-
const where = { type: singular, name, state: 'active', ...overlayMemberWhere(singular, member) };
549+
const where = { type: singular, name, state: 'active', ...overlayMemberWhere(singular, addressed) };
540550
const installed = installedManifestsOfEngine(host.engine);
541551
return activeRows.some((row) => rowMatchesOverlayWhere(row, where) && isServedOverrideRowOf(row, shipper, installed))
542552
? shipper

‎packages/objectql/src/package-scoped-exact-qualifier.test.ts‎

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,118 @@ describe('[#32849] the bare layered read serves the pair\'s declared override of
14521452
});
14531453
});
14541454

1455+
/**
1456+
* [#32849, ADR-0146 D8 item 2, ADR-0150 D4] The read naming NO member of a
1457+
* name whose canonical member (`en-US`) an addition ships, with the App's pair
1458+
* storing that addition's declared override of it. X ships `welcome` in
1459+
* `fr-FR`, the addition Z on X ships its `en-US`, and a row of the App's pair
1460+
* declares `overrides.package` Z for `en-US`. A read naming no member
1461+
* addresses the canonical member, the same request as `?member=en-US`, so it
1462+
* serves what that read serves: the override, at Z.
1463+
*
1464+
* BASE (measured on `main` b8456ebd4a, this fixture, both install orders):
1465+
* the plain bare read and the bare execution read served `zeta en-US`, and
1466+
* the bare layered read answered `effective` `zeta en-US` with `overlay`
1467+
* null, while `?member=en-US`, `?package=Z` and the layered `?member=en-US`
1468+
* served `pair en-US`. `/published` asks the layered read naming no member
1469+
* for its overlay exit, so it found no runtime-published row there either.
1470+
*/
1471+
describe('[#32849] the read naming no member serves the pair\'s declared override of the canonical member an addition Z ships, as `?member=en-US` does', () => {
1472+
const APP = 'com.acme.suite';
1473+
const X = 'com.acme.suitex';
1474+
const Z = 'com.acme.zeta';
1475+
const PAIR = `${APP}.custom`;
1476+
const moduleOf = (id: string, dependencies: Record<string, string>) => ({
1477+
id, name: id, version: '1.0.0', type: 'module', namespace: id.split('.').pop()!, dependencies,
1478+
}) as never;
1479+
const installZ = () => registry.installPackage(moduleOf(Z, { [APP]: '^1.0.0', [X]: '^1.0.0' }), 'code');
1480+
const tpl = (locale: string, packageId: string) => registry.registerItem('email_template', {
1481+
name: 'welcome', label: `${packageId.split('.').pop()} ${locale}`, locale,
1482+
subject: `${packageId.split('.').pop()} ${locale}`, bodyHtml: '<p>x</p>',
1483+
}, 'name' as never, packageId);
1484+
/** A row of the App's pair for the canonical member (stored with no `bundle_member`); an active one is hydrated as the boot lays it. */
1485+
const pairRow = (over: Record<string, unknown> = {}, state: 'active' | 'draft' = 'active') => {
1486+
const body = { name: 'welcome', label: state === 'draft' ? 'pair en-US draft' : 'pair en-US', locale: 'en-US', subject: 'pair en-US', bodyHtml: '<p>p</p>', ...over };
1487+
rows.push({ id: `row_en_${state}`, type: 'email_template', name: 'welcome', state, package_id: PAIR, bundle_member: null, metadata: JSON.stringify(body) });
1488+
if (state === 'active') registry.registerItem('email_template', { ...body, _packageId: PAIR, _provenance: 'org' }, 'name' as never);
1489+
};
1490+
type Served = { item?: { label?: string; _packageId?: string }; packageId?: string } | undefined;
1491+
type Layers = { code?: { label?: string } | null; overlay?: { label?: string } | null; effective?: { label?: string; _packageId?: string } | null; draft?: { label?: string } | null; packageId?: string };
1492+
const T = { type: 'email_template', name: 'welcome' } as const;
1493+
const plain = (over: Record<string, unknown> = {}, face: 'served' | 'execution' = 'served') =>
1494+
(face === 'served' ? protocol.getMetaItem : protocol.getMetaItemForExecution).call(protocol, { ...T, ...over } as never) as Promise<Served>;
1495+
const layered = (over: Record<string, unknown> = {}, withDraft = false) =>
1496+
protocol.getMetaItemLayered({ ...T, ...over } as never, { withDraft } as never) as Promise<Layers>;
1497+
const servedOf = (a: Served) => [a?.item?.label ?? null, a?.item?._packageId ?? null, a?.packageId];
1498+
const layersOf = (a: Layers) => [a.code?.label ?? null, a.overlay?.label ?? null, a.effective?.label ?? null, a.packageId];
1499+
1500+
beforeEach(() => {
1501+
registry.installPackage(manifest(APP), 'code');
1502+
registry.installPackage(moduleOf(X, { [APP]: '^1.0.0' }), 'code');
1503+
registry.installPackage(manifest(PAIR), 'code');
1504+
});
1505+
1506+
it.each([
1507+
['addition installed first', () => { installZ(); tpl('fr-FR', X); tpl('en-US', Z); pairRow({ overrides: { package: Z } }); }],
1508+
['row stored first', () => { tpl('fr-FR', X); pairRow({ overrides: { package: Z } }); installZ(); tpl('en-US', Z); }],
1509+
] as const)('the plain, execution and layered reads naming no member serve the override at Z, as `?member=en-US` does (%s; BASE: `zeta en-US`, no overlay)', async (_order, arrange) => {
1510+
arrange();
1511+
const named = await plain({ member: 'en-US' });
1512+
expect(servedOf(named), 'CONTROL: bare `?member=en-US` (UNCHANGED since the member read\'s fix)').toEqual(['pair en-US', Z, Z]);
1513+
expect(servedOf(await plain()), 'bare, no member').toEqual(servedOf(named));
1514+
expect(servedOf(await plain({}, 'execution')), 'the bare execution read, no member').toEqual(['pair en-US', Z, Z]);
1515+
const atZ = await layered({ packageId: Z });
1516+
expect(layersOf(atZ), 'CONTROL: `?package=Z&layers=true` (UNCHANGED)').toEqual(['zeta en-US', 'pair en-US', 'pair en-US', Z]);
1517+
expect(await protocol.packagelessLayeredReadRefusal(T as never), 'the door\'s step 1c refuses nothing').toBeUndefined();
1518+
// `/published` reads this same call for its overlay exit.
1519+
const bare = await layered();
1520+
expect(layersOf(bare), 'bare `?layers=true`, no member').toEqual(layersOf(atZ));
1521+
expect(bare.effective, '`effective` is the document `?member=en-US` serves').toEqual(atZ.effective);
1522+
expect(layersOf(await layered({ member: 'en-US' })), 'CONTROL: bare `?member=en-US&layers=true` (UNCHANGED)').toEqual(layersOf(atZ));
1523+
// CONTROL: X's own member is untouched by the override of Z's.
1524+
expect(servedOf(await plain({ member: 'fr-FR' })), 'bare `?member=fr-FR` (UNCHANGED)').toEqual(['suitex fr-FR', X, X]);
1525+
});
1526+
1527+
it('the draft stays at the strict draft read\'s address, which the arm does not move: the pair\'s pending draft (UNCHANGED; at Z\'s address it is no draft)', async () => {
1528+
installZ(); tpl('fr-FR', X); tpl('en-US', Z);
1529+
pairRow({ overrides: { package: Z } });
1530+
pairRow({ overrides: { package: Z } }, 'draft');
1531+
const strictDraft = await plain({ state: 'draft' });
1532+
expect([strictDraft?.item?.label, strictDraft?.item?._packageId], 'the plain bare strict draft read, no member').toEqual(['pair en-US draft', PAIR]);
1533+
const bare = await layered({}, true);
1534+
expect([bare.effective?.label, bare.draft?.label ?? null], 'bare `?layers=true` with drafts, no member').toEqual(['pair en-US', 'pair en-US draft']);
1535+
expect((await layered({ packageId: Z }, true)).draft ?? null, 'CONTROL: `?package=Z` reads no draft there (UNCHANGED)').toBeNull();
1536+
});
1537+
1538+
it.each([
1539+
['no row stored', () => { installZ(); tpl('fr-FR', X); tpl('en-US', Z); }],
1540+
['an undeclared pair row of the canonical member', () => { installZ(); tpl('fr-FR', X); tpl('en-US', Z); pairRow(); }],
1541+
] as const)('CONTROL — no override of Z declared (%s): the reads naming no member serve Z\'s own `en-US` and no overlay (UNCHANGED)', async (_order, arrange) => {
1542+
arrange();
1543+
expect(servedOf(await plain())).toEqual(['zeta en-US', Z, Z]);
1544+
expect(servedOf(await plain({}, 'execution'))).toEqual(['zeta en-US', Z, Z]);
1545+
expect(layersOf(await layered())).toEqual(['zeta en-US', null, 'zeta en-US', Z]);
1546+
});
1547+
1548+
it('CONTROL — the row declares X (the #32606 shape): the reads naming no member are not moved to Z, and keep their refusal naming both (UNCHANGED)', async () => {
1549+
installZ(); tpl('fr-FR', X); tpl('en-US', Z);
1550+
pairRow({ overrides: { package: X } });
1551+
for (const read of [() => plain(), () => layered()]) {
1552+
const err = await refusalOf(read);
1553+
expect([err.code, err.status, err.refusal.candidates.map((c) => (c as { packageId?: string }).packageId).sort()])
1554+
.toEqual(['RESOURCE_CONFLICT', 409, [X, Z].sort()]);
1555+
}
1556+
});
1557+
1558+
it('CONTROL — the shipper Z disabled: the plain read naming no member answers Z\'s withheld item, and the layered read is not moved by the override (UNCHANGED)', async () => {
1559+
installZ(); tpl('fr-FR', X); tpl('en-US', Z);
1560+
pairRow({ overrides: { package: Z } });
1561+
registry.disablePackage(Z);
1562+
expect(servedOf(await plain()), 'bare, no member').toEqual([null, null, Z]);
1563+
expect(layersOf(await layered()), 'bare `?layers=true`, no member').toEqual(['zeta en-US', null, 'zeta en-US', Z]);
1564+
});
1565+
});
1566+
14551567
/**
14561568
* [#33817, from #33131 N1] A package X of an App holds the name only through
14571569
* its own stored row (`package_id` X, hydrated into the bare slot), and that

0 commit comments

Comments
 (0)