Skip to content

Commit 3269cab

Browse files
fix(metadata-protocol)!: the metadata lists serve nothing a disabled package's customization pair or a dependent's added bundle member carries for it (ADR-0150 D3) (#33405)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D75mRNRrsy6GfiJD9q7La4j)_ Fixes #32354 Clause-②: no (narrowing) Metadata-protocol: none Skills-docs: none — `skills/**` and `content/docs/**` teach that a disabled module is hidden (`content/docs/deployment/marketplace-handbook.mdx`) and never teach a list serving a disabled package's customization or a dependent's addition to its bundle, so no taught sentence moves. > **BREAKING** (ADR-0087 `not-required (no-migration-prescription)`): while a package is disabled, the metadata lists no longer serve the rows its customization pair stores for its names, nor a dependent's added bundle member of them. Area-lease pilot #33059, area E1. The list-door remainder of this card: PR #33130 (merged) did the bare, exact and layered reads. ## 维护者速读 - 改了什么:某个包停用后,元数据列表不再列出它的定制包(`包名.custom`)为它的名字存的行,也不再列出依赖它的包给它的邮件模板追加的语言版本。涉及:不指名包的列表及其执行列表、指名停用包的列表、指名其定制包的列表。不指名包的发信读的就是这个执行列表,所以也不再发出这两类内容。 - 为什么改:专题 ADR-0150 D3「停用的包不持有任何名字」。按名读取早已对这些地址答 404,列表却还按注册和保存顺序列出它们;停用一个包应在每个读门上都消失(epic note 6820147040)。 - 风险与回滚:只在有包被停用时生效,没有包停用时所有列表与之前完全相同;依赖包自己的地址(`?package=DEP`)仍列出它追加的语言。过渡期内从依赖包本身发信(读不指名列表)在基础包停用时找不到该语言,等 #32670 让发信按在用持有者判定后恢复。回滚即 revert 本 PR,不改任何存储数据。 - 先看:`packages/metadata-protocol/src/protocol-meta-list-reads.ts` 的 `disabledHolderListing`(新增谓词,`'unscoped'` 分支里依赖包追加的判定)以及它在停用过滤处的调用。 - 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run src/package-scoped-exact-qualifier.test.ts -t 32354`,预期 14 例全过。 - 需要你做的:无,席位落地 ## What changes One function, in `@objectstack/metadata-protocol`'s list read (`readFlattenedMetaItems`), next to the existing disabled-package filter, on the effective and execution faces only (the per-package layer, which the package export reads, keeps a disabled package's items as before): - `disabledHolderListing(host, type)` answers whether an item the list serves at a package is a disabled holder's. It is `undefined` (nothing moves) for a type the registry does not read by package and while no installed package is disabled. - **A list scoped to a package** serves no name whose exact read at that package is a disabled package's withheld item. The predicate is the exact read's own, `disabledExactAddressHolder` (`protocol-exact-qualifier.ts`, unchanged): the package is disabled, or it is a customization pair whose every base holding the name is. - **The list naming no package** leaves out an item whose own package's address is withheld that way (a disabled holder's pair row), and, for a bundle (`ITEM_KEY_DISCRIMINATORS`), an addition to a disabled holder's bundle: the item's package holds the name only as an addition (the registry's holders read as any other caller leave it out, read as itself keep it) and every holder in its declared dependency closure is disabled. Every holder is read with `includeDisabledPackages`, so a disable never promotes an addition to a holder. ## Moved answers Measured over a real `SchemaRegistry` and `ObjectStackProtocolImplementation`, on `2b2e5b41` (FROM: #33251's head, `main` plus #32606) and on this branch: A ships `welcome` in `en-US`; A's pair `A.custom` stores a `fr-FR` row of it, or DEP (depends on A) ships a `fr-FR` addition; with one holder, or beside B, an enabled second holder of `welcome`. Both registration orders, the pair row stored before and after the registrations. A disabled: | read | FROM | TO | |:--|:--|:--| | `getMetaItems` / `getMetaItemsForExecution`, no package (`GET /meta/email_template`) | the pair's `fr-FR` row, or DEP's `fr-FR` (beside B's `en-US` with two holders) | neither (B's `en-US` only with two holders, else nothing) | | the same, `?package=A` | the pair's `fr-FR` row | `[]` | | `?package=A.custom` | the pair's `fr-FR` row | not listed | | a send naming no package, `fr-FR` (`createRegistryEmailTemplateLoader` over the protocol) | the pair's row, or DEP's member | no template | | a send from DEP, `fr-FR` | DEP's member | no template (declared; see below) | **Not moved.** With nothing disabled every list answers as on FROM (CONTROL in every pin). `?package=DEP` keeps DEP's `fr-FR`, as `?package=DEP&member=fr-FR` serves it. `?package=B` and B's items, the pair's own item of a name A ships nothing of (CONTROL, both orders), the per-package layer, and every by-name read answer as before. Re-enabling A restores every list (asserted in every pin). **Declared interim move.** A send from DEP itself resolves to the list naming no package for this name (`bundleAddressOf` finds one holder), so it no longer finds DEP's `fr-FR` while A is disabled. #32670 (the send judges the served holders, nested under this card and landing after it) reads such a send at DEP's own address, which keeps the member. ## Red lines 1. **Resolution never loosened.** Only items leave lists, and only items the by-name read of the same address already withholds. Nothing refused or absent is now served. 2. **Ambiguity reported, never guessed.** The answer no longer depends on registration or save order: every pin runs both orders and both save orders, and reads twice after the first read hydrated the stored row. 3. **Independently releasable.** No stored row, key or export changes; it moves nothing while no package is disabled, and re-enabling restores every answer. ## Tests - `packages/objectql/src/package-scoped-exact-qualifier.test.ts`, top-level `[#32354] the list doors serve nothing a disabled holder's pair or dependent carries for it` (real registry and protocol, `environmentId` unset so the list hydrates rows): 12 cases (four states × both registration orders × both save orders for the pair row) asserting seven lists with nothing disabled, A disabled (read twice), and A re-enabled; plus 2 CONTROLs for the pair's own item. - `packages/rest/src/meta-disabled-package-doors.test.ts`, `[#32354] RestServer: the list doors and the send naming no package beside a disabled holder` (an environment-scoped protocol): `GET /meta/email_template` unscoped and with `package=` A, A.custom, DEP through the `RestServer` route, and the email loader's send with no package and from DEP; 6 cases. ## Acceptance notes - The bare by-name read is not this PR's: measured through the `RestServer` route on this branch, with A the sole holder and disabled, `GET /meta/email_template/welcome?member=fr-FR` (no package) answers 200 with the pair's `fr-FR` row, and 200 with DEP's `fr-FR` in the addition state. With two holders (B enabled) it answers 404 in both states. That path is `protocol-meta-item-face.ts`, held by #32814's work, so it is reported for a card, not changed here. - Stacked on #33251 while it was open; it has merged (`51ceb433`), and this branch merged `origin/main` `87330e8959` once (no rebase). The diff against `main` is this card's four files: the list read, two test files and one changeset. - The send door's own rule (a send returns only members of the resolved holder, its pair, its dependents, or no package) stays #32670's. ## Verification Head `333edb0868` (this branch with `origin/main` `87330e8959` merged). <details><summary>Pins and ablations</summary> - objectql `src/package-scoped-exact-qualifier.test.ts -t 32354`: 14 passed. REST `src/meta-disabled-package-doors.test.ts`: 47 passed (the 6 new cases among them). - Ablations (source changed with `scripts/ablation-replace.mjs`, `@objectstack/metadata-protocol` rebuilt under the verify lock, `ablation-dist-preflight` saw the marker in `dist/`, then restored: `git diff HEAD` empty, rebuilt, marker `--absent` exit 0): - A1, the exact-address arm off (`disabledExactAddressHolder` never withholds): objectql 8 failed (every pair-row case: one and two holders, both orders, both save orders), 6 passed (the four addition cases and both CONTROLs); REST 4 failed (every pair-row case), 43 passed. - A2, the addition arm off (`bases.every(disabled)` never true): objectql 4 failed (every addition case), 10 passed; REST 2 failed (both addition cases), 45 passed. - A first A2 attempt never reached the lock (queue-timeout), so the preflight refused (marker absent from `dist/`) and its green run was discarded; the rerun above is the leg. </details> <details><summary>Package tests, typecheck, lint</summary> - `turbo run test --concurrency=2 --continue` over the affected set against `main` (82 packages, `@objectstack/dogfood` left to its own battery), under the verify lock: stopped on the area lead's order once it held the lock too long, after 68 packages had finished, with 0 failed test files. Among them `@objectstack/metadata-protocol` 339 files passed (9 skipped), `@objectstack/objectql` 595, `@objectstack/rest` 410, `@objectstack/runtime` 599, `@objectstack/cli` 637 (2 skipped), `@objectstack/plugin-email` 53. The rest of the set (UI packages) is CI's Test Core. - `pnpm --filter` metadata-protocol, objectql, rest `run typecheck`: exit 0 (VERDICT command-exit 0). - `pnpm lint`: exit 0. - NOT MEASURED locally: the full dogfood battery (owed by the `(narrowing)` arm; not run, because the shared lock was the bottleneck and the area lead asked for the narrowed pre-push set; the queue's `Dogfood Regression Gate` runs it), and the derived gate families (CI's `Lint & Repo Gates`). </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent b5f2f51 commit 3269cab

4 files changed

Lines changed: 291 additions & 2 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol)!: the metadata lists serve nothing a disabled package's customization pair or a dependent's added bundle member carries for it (ADR-0150 D3, #32354)
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export changes shape. The moved answers are list reads under a reversible package state: no stored row changes, so there is nothing for a migration to rewrite and no tombstone. -->
11+
12+
**BREAKING** for a reader of a metadata list while a package is disabled. A disabled package holds no name (ADR-0150 D3), and the by-name reads already withheld what it carries; three lists still served it, by the order things were registered and saved. Measured over a real `SchemaRegistry`, both registration orders, the pair's row stored before and after: package A ships `welcome` in `en-US`; its pair `A.custom` stores a `fr-FR` row of it, or package DEP (depending on A) ships a `fr-FR` addition to A's template; A is disabled.
13+
14+
- `GET /meta/email_template` and the execution list (`getMetaItemsForExecution`, no package): the pair's `fr-FR` row and DEP's `fr-FR` addition were listed → not listed, with one holder or beside an enabled second holder of the name. A send naming no package reads this list, so it no longer sends either while A is disabled.
15+
- `GET /meta/email_template?package=A` and its execution list: the pair's `fr-FR` row was listed → `[]`, as `?package=A&member=fr-FR` answers 404.
16+
- `GET /meta/email_template?package=A.custom`: the pair's `fr-FR` row was listed → not listed, as `?package=A.custom&member=fr-FR` answers 404.
17+
18+
The rule is the exact read's: a list scoped to a package serves no name whose exact read at that package is a disabled package's withheld item; the list naming no package leaves out an item whose own package's address is, and a bundle addition whose every base in its dependency closure is disabled. It applies to every package-scoped type, and only while some package is disabled.
19+
20+
**Not moved.** With nothing disabled, every list answers as before. DEP's own list (`?package=DEP`) keeps its addition, as its exact read does. An enabled holder's lists, the pair's own item of a name A ships nothing of, and the per-package layer (the package export, which keeps a disabled package's items) answer as before. Re-enabling A restores every list.
21+
22+
Until the email send door judges the served holders (#32670), a send made from DEP itself reads the list naming no package for this name, so it no longer finds DEP's `fr-FR` while A is disabled.
23+
24+
The fix for a reader: re-enable the package to list its customization again; a dependent's addition stays readable at the dependent's own address.

‎packages/metadata-protocol/src/protocol-meta-list-reads.ts‎

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* not move.
1919
*/
2020

21-
import { ITEM_KEY_DISCRIMINATORS, isTenantAuthored, pairsOf } from '@objectstack/metadata-core';
21+
import { ITEM_KEY_DISCRIMINATORS, isTenantAuthored, packageDependencyClosure, pairsOf } from '@objectstack/metadata-core';
2222
import { PLURAL_TO_SINGULAR, SINGULAR_TO_PLURAL } from '@objectstack/spec/shared';
2323
import { isAggregatedViewContainer } from '@objectstack/spec/ui';
2424
import {
@@ -49,7 +49,13 @@ import { storedEntryRow } from './protocol-stored-overlay-types.js';
4949
import { viewIdentityPatch } from './protocol-view-normalization.js';
5050
import { isServedOverrideRowOf, type ServedOverrideRow } from './served-override.js';
5151
import { installedManifestsOfEngine } from './installed-manifests.js';
52-
import { declinesPackageLessRowAt, holdsNameForExactRead, packageLessRowWithheld, pairMemberWithheldAt } from './protocol-exact-qualifier.js';
52+
import {
53+
declinesPackageLessRowAt,
54+
disabledExactAddressHolder,
55+
holdsNameForExactRead,
56+
packageLessRowWithheld,
57+
pairMemberWithheldAt,
58+
} from './protocol-exact-qualifier.js';
5359

5460
/** The body of `ObjectStackProtocolImplementation#getMetaItems`; the method's docblock there is its contract. */
5561
export async function getMetaItems(host: Pick<ProtocolHost, 'readFlattenedMetaItems'>, request: { type: string; packageId?: string; names?: readonly string[]; previewDrafts?: boolean }) {
@@ -92,6 +98,68 @@ function decorateListedItem(type: string, item: unknown): unknown {
9298
return { ...served, name: (item as { name: string }).name, ...(_diagnostics !== undefined ? { _diagnostics } : {}) };
9399
}
94100

101+
/**
102+
* [#32354, ADR-0150 D3] Whether the effective or execution list withholds an
103+
* item of `name` it serves at `packageId` because the item belongs to a
104+
* disabled holder: a disabled package holds no name, and the list hides what
105+
* the by-name read naming the same address hides, independent of the order
106+
* things were registered or saved. `undefined` (nothing withheld) for a type
107+
* the registry does not read by package, a registry that cannot answer, and
108+
* while no package is disabled, so no list moves then.
109+
*
110+
* - `'address'` (a list scoped to `packageId`): the exact read of the name at
111+
* that address is the disabled package's withheld item
112+
* ({@link disabledExactAddressHolder}: the package is disabled, or it is a
113+
* customization pair whose every base holding the name is). Before, the
114+
* list scoped to a disabled base, or to its pair, listed the pair's row at
115+
* a member the base does not ship while both exact reads answered 404.
116+
* - `'unscoped'` (the list naming no package, `packageId` the item's own
117+
* binding): the same, which leaves out a disabled holder's pair row; and,
118+
* for a bundle (`ITEM_KEY_DISCRIMINATORS`), an addition to a disabled
119+
* holder's bundle: `packageId` holds the name only as an addition (the
120+
* registry's served holders leave it out for every other reader) and each
121+
* holder in its declared dependency closure is disabled. Both were listed,
122+
* so a send naming no package, which reads this list, sent them. The
123+
* dependent's own address keeps serving its addition, as its exact read
124+
* does.
125+
*
126+
* Every holder is read with `includeDisabledPackages`, so a disable never
127+
* promotes a dependent's addition to a holder. Answers are cached per call.
128+
*/
129+
function disabledHolderListing(
130+
host: Pick<ProtocolHost, 'engine'>,
131+
type: string,
132+
): ((name: string, packageId: string, naming: 'address' | 'unscoped') => boolean) | undefined {
133+
const registry: any = host.engine?.registry;
134+
if (typeof registry?.packageScopedHoldersOf !== 'function' || typeof registry.isPackageDisabled !== 'function'
135+
|| typeof registry.getAllPackages !== 'function') return undefined;
136+
if (!(registry.getAllPackages() as ReadonlyArray<{ enabled?: unknown; status?: unknown } | undefined>)
137+
.some((pkg) => pkg?.enabled === false || pkg?.status === 'disabled')) return undefined;
138+
const disabled = (id: string): boolean => registry.isPackageDisabled(id) === true;
139+
const isBundle = ITEM_KEY_DISCRIMINATORS[type] !== undefined;
140+
const answers = new Map<string, boolean>();
141+
const judge = (name: string, packageId: string, naming: 'address' | 'unscoped'): boolean => {
142+
if (disabledExactAddressHolder(host, { type, name, packageId }) !== undefined) return true;
143+
if (naming !== 'unscoped' || !isBundle) return false;
144+
const every: readonly string[] = registry.packageScopedHoldersOf(type, name, null, { includeDisabledPackages: true }) ?? [];
145+
if (every.includes(packageId)) return false;
146+
const own: readonly string[] = registry.packageScopedHoldersOf(type, name, packageId, { includeDisabledPackages: true }) ?? [];
147+
if (!own.includes(packageId)) return false;
148+
const reach = new Set(packageDependencyClosure(packageId, registry)?.dependencies ?? []);
149+
const bases = every.filter((holder) => holder !== packageId && reach.has(holder));
150+
return bases.length > 0 && bases.every(disabled);
151+
};
152+
return (name, packageId, naming) => {
153+
const key = `${naming}\u0000${packageId}\u0000${name}`;
154+
let answer = answers.get(key);
155+
if (answer === undefined) {
156+
answer = judge(name, packageId, naming);
157+
answers.set(key, answer);
158+
}
159+
return answer;
160+
};
161+
}
162+
95163
/** The body of `ObjectStackProtocolImplementation#readFlattenedMetaItems`; the method's docblock there is its contract. */
96164
export async function readFlattenedMetaItems(host: Pick<ProtocolHost, 'artifactLockLayerAt' | 'baseServesBundleMember' | 'convertStoredItem' | 'declinesStoredRow' | 'disabledActionsOf' | 'engine' | 'environmentId' | 'expandStoredViewContainers' | 'findEnvironmentRows' | 'flowRegistrationsOf' | 'foldObjectExtendersFromRegistry' | 'getServicesRegistry' | 'governServedObject' | 'hydrateOverlayIntoRegistry' | 'isStoredEntryOfDeclinedName' | 'isUnservedSealedOverlay' | 'isWritablePackage' | 'lookupArtifactItem' | 'namesWithOwnStoredRow' | 'readActiveOverlayRows' | 'rethrowUnlessMetadataStoreUnprovisioned' | 'shippedArtifactsOf' | 'shippingPackagesOf' | 'shipsBundleName' | 'storedOverlayEntries'>, request: { type: string; packageId?: string; names?: readonly string[]; previewDrafts?: boolean },
97165
audience: 'served' | 'execution',
@@ -870,6 +938,21 @@ export async function readFlattenedMetaItems(host: Pick<ProtocolHost, 'artifactL
870938
// package's items installed elsewhere as an empty package.
871939
if (request.type !== 'package' && !keepDisabledPackages) {
872940
items = (items as any[]).filter((it) => !isItemOfDisabledPackage(host.engine.registry, it));
941+
// [#32354, ADR-0150 D3] …and an item another package carries for a
942+
// disabled holder ({@link disabledHolderListing}): the list scoped to
943+
// a package serves no name its exact read withholds as a disabled
944+
// package's, and the list naming no package leaves out a disabled
945+
// holder's pair row and a dependent's addition to its bundle.
946+
const withheld = disabledHolderListing(host, request.type);
947+
if (withheld) {
948+
items = (items as any[]).filter((it) => {
949+
const itemName = (it as { name?: unknown } | null)?.name;
950+
if (typeof itemName !== 'string') return true;
951+
if (packageId) return !withheld(itemName, packageId, 'address');
952+
const bound = boundPackageOf((it as { _packageId?: unknown })._packageId);
953+
return bound === undefined || !withheld(itemName, bound, 'unscoped');
954+
});
955+
}
873956
}
874957
// [#28877] …and, on the effective served list, an action that launches
875958
// into a disabled package ({@link isActionWithheldByDisabledPackage}),

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

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,6 +2529,98 @@ describe('[#32183] an App\'s pair two modules share, one of them disabled', () =
25292529
});
25302530
});
25312531

2532+
/**
2533+
* [#32354, ADR-0150 D3, epic note 6820147040] The list doors beside a disabled
2534+
* holder: a disabled package holds no name, so no list serves what it carries
2535+
* for one. FROM (measured on `2b2e5b41`, both registration orders and both save
2536+
* orders): with A disabled, the list naming no package and its execution face
2537+
* listed the row A's customization pair stores at a member A does not ship,
2538+
* and a dependent's added locale of A's template; the lists scoped to A and to
2539+
* A's pair listed the pair's row too, while the exact reads of both addresses
2540+
* answered 404. A send naming no package reads that execution list. TO: none
2541+
* of them. The dependent's own list keeps its addition, as its exact read
2542+
* does, and an enabled holder's lists are unchanged. Re-enabled, as before.
2543+
*/
2544+
describe('[#32354] the list doors serve nothing a disabled holder\'s pair or dependent carries for it', () => {
2545+
const DEP = 'com.acme.dep';
2546+
const tpl = (packageId: string, locale: string) => registry.registerItem('email_template', {
2547+
name: 'welcome', label: `${packageId.split('.').pop()} ${locale}`, locale, subject: locale, bodyHtml: '<p>x</p>',
2548+
}, 'name' as never, packageId);
2549+
const pairRow = (name: string, label: string) => rows.push({
2550+
id: `row_${name}`, type: 'email_template', name, state: 'active', package_id: PAIR_A, bundle_member: 'fr-FR',
2551+
metadata: JSON.stringify({ name, label, locale: 'fr-FR', subject: label, bodyHtml: '<p>p</p>' }),
2552+
});
2553+
const labelsOf = async (read: Promise<{ items?: unknown[] }>, name = 'welcome') => ((await read).items ?? [])
2554+
.filter((it) => (it as { name?: unknown }).name === name)
2555+
.map((it) => (it as { label?: string }).label)
2556+
.sort();
2557+
const answers = async () => ({
2558+
list: await labelsOf(protocol.getMetaItems({ type: 'email_template' })),
2559+
execution: await labelsOf(protocol.getMetaItemsForExecution({ type: 'email_template' })),
2560+
atA: await labelsOf(protocol.getMetaItems({ type: 'email_template', packageId: A })),
2561+
executionAtA: await labelsOf(protocol.getMetaItemsForExecution({ type: 'email_template', packageId: A })),
2562+
atPair: await labelsOf(protocol.getMetaItems({ type: 'email_template', packageId: PAIR_A })),
2563+
atDep: await labelsOf(protocol.getMetaItems({ type: 'email_template', packageId: DEP })),
2564+
atB: await labelsOf(protocol.getMetaItems({ type: 'email_template', packageId: B })),
2565+
});
2566+
type Answers = Awaited<ReturnType<typeof answers>>;
2567+
const lists = (unscoped: string[], atA: string[], rest: Pick<Answers, 'atPair' | 'atDep' | 'atB'>): Answers =>
2568+
({ list: unscoped, execution: unscoped, atA, executionAtA: atA, ...rest });
2569+
2570+
/** `[state, holders, carried, enabled answers, A-disabled answers]`. */
2571+
const STATES: ReadonlyArray<[string, readonly string[], 'pair row' | 'addition', Answers, Answers]> = [
2572+
['one holder, its pair\'s row', [A], 'pair row',
2573+
lists(['alpha en-US', 'pair fr-FR'], ['alpha en-US', 'pair fr-FR'], { atPair: ['pair fr-FR'], atDep: [], atB: [] }),
2574+
lists([], [], { atPair: [], atDep: [], atB: [] })],
2575+
['two holders, the disabled one\'s pair\'s row', [A, B], 'pair row',
2576+
lists(['alpha en-US', 'beta en-US', 'pair fr-FR'], ['alpha en-US', 'pair fr-FR'], { atPair: ['pair fr-FR'], atDep: [], atB: ['beta en-US'] }),
2577+
lists(['beta en-US'], [], { atPair: [], atDep: [], atB: ['beta en-US'] })],
2578+
['one holder, a dependent\'s addition', [A], 'addition',
2579+
lists(['alpha en-US', 'dep fr-FR'], ['alpha en-US'], { atPair: [], atDep: ['dep fr-FR'], atB: [] }),
2580+
lists([], [], { atPair: [], atDep: ['dep fr-FR'], atB: [] })],
2581+
['two holders, a dependent of the disabled one\'s addition', [A, B], 'addition',
2582+
lists(['alpha en-US', 'beta en-US', 'dep fr-FR'], ['alpha en-US'], { atPair: [], atDep: ['dep fr-FR'], atB: ['beta en-US'] }),
2583+
lists(['beta en-US'], [], { atPair: [], atDep: ['dep fr-FR'], atB: ['beta en-US'] })],
2584+
];
2585+
const CASES = STATES.flatMap(([state, holders, carried, enabled, disabled]) =>
2586+
(['as listed', 'reversed'] as const).flatMap((order) => (carried === 'pair row'
2587+
? (['stored first', 'stored last'] as const)
2588+
: (['no row'] as const)).map((save) => [state, order, save, holders, carried, enabled, disabled] as const)));
2589+
2590+
beforeEach(() => {
2591+
registry.installPackage({ ...(manifest(DEP) as object), dependencies: { [A]: '^1.0.0' } } as never, 'code');
2592+
registry.installPackage(manifest(PAIR_A), 'code');
2593+
});
2594+
2595+
it.each(CASES)('%s, registered %s, row %s: A disabled, no list serves what is carried for A; re-enabled, as before', async (_state, order, save, holders, carried, enabled, disabled) => {
2596+
if (save === 'stored first') pairRow('welcome', 'pair fr-FR');
2597+
const shipped: Array<[string, string]> = [...holders.map((id): [string, string] => [id, 'en-US']), ...(carried === 'addition' ? [[DEP, 'fr-FR'] as [string, string]] : [])];
2598+
for (const [id, locale] of order === 'reversed' ? [...shipped].reverse() : shipped) tpl(id, locale);
2599+
if (save === 'stored last') pairRow('welcome', 'pair fr-FR');
2600+
2601+
// CONTROL — nothing disabled: every list as on FROM.
2602+
expect(await answers()).toEqual(enabled);
2603+
registry.disablePackage(A);
2604+
expect(await answers()).toEqual(disabled);
2605+
// Read again, after the first reads hydrated the stored row: the same answers.
2606+
expect(await answers()).toEqual(disabled);
2607+
registry.enablePackage(A);
2608+
expect(await answers()).toEqual(enabled);
2609+
});
2610+
2611+
it.each(['as listed', 'reversed'] as const)('CONTROL — registered %s: the pair\'s own item of a name A ships nothing of stays listed while A is disabled, as its by-name read serves it', async (order) => {
2612+
const arrange = [() => tpl(A, 'en-US'), () => pairRow('farewell', 'pair own farewell')];
2613+
for (const step of order === 'reversed' ? [...arrange].reverse() : arrange) step();
2614+
registry.disablePackage(A);
2615+
expect(labelOf(await protocol.getMetaItem({ type: 'email_template', name: 'farewell', member: 'fr-FR' } as never))).toBe('pair own farewell');
2616+
for (const read of [
2617+
protocol.getMetaItems({ type: 'email_template' }),
2618+
protocol.getMetaItemsForExecution({ type: 'email_template' }),
2619+
protocol.getMetaItems({ type: 'email_template', packageId: PAIR_A }),
2620+
]) expect(await labelsOf(read, 'farewell')).toEqual(['pair own farewell']);
2621+
});
2622+
});
2623+
25322624
/**
25332625
* [#32814] The read naming no package, at the member only a holder's
25342626
* customization pair stores, where every package holding the name is

0 commit comments

Comments
 (0)