Skip to content

Commit 01598d9

Browse files
fix(metadata-protocol): an exact ?package= read never answers another package's metadata-service copy of a doc, view or other type the exact qualifier does not judge (#34241)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbBePzY6g11h3hyWk5ud4vWy)_ Fixes #34040 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:带 `?package=X` 的精确读取(doc、view、translation 等精确限定符不判定的类型),不再把元数据服务里“另一个包”的副本当作 X 的内容返回,而是改由注册表返回 X 自己的条目。 - 为什么改:元数据服务对这些类型只按名字保存(后注册的包覆盖先注册的),两个包发布同名 doc 时,`?package=先注册的包` 会拿到后注册包的正文,还套着 X 的包信封(ADR-0150 D3:精确地址应回答该持有者)。Console 文档阅读器的“选择包”链接正是按包名读取,修复后链接打开的才是对应包的文档。 - 风险与回滚:只在“精确地址 + 服务副本带有另一个已安装包的戳”时改变行为;单一持有者、无包戳副本、对象类型、不带包名的读取均不变。回滚即 revert 本 PR。 - 先看:`packages/metadata-protocol/src/protocol-meta-item-reads.ts`(`serviceCopyOfAnotherPackage` 与 step 2 / step 3 的两处改动)、`packages/runtime/src/domains/meta-disabled-holder-artifact-door.test.ts`(组合装配下的 doc 钉子与 item 4 钉子)、`packages/objectql/src/package-scoped-exact-qualifier.test.ts`(按类型枚举的钉子)。 - 两分钟验证:`pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/meta-disabled-holder-artifact-door.test.ts`,预期 17 个测试全部通过,其中 `[#34040]` 组在两种注册顺序下 `?package=alpha` 返回 alpha doc、`?package=beta` 返回 beta doc。 - 需要你做的:无,席位落地。 ## What changes `readMetaItem` step 2 asked the MetadataService before the registry. For a type the service keeps by name alone, its copy is the item of the package registered last. At an exact address (`?package=X`) of a type the exact qualifier (ADR-0150 D5) does not judge, nothing below the layers replaced that copy, so X's address answered the other package's body, wrapped in X's own envelope (`_packageId: X`). - **Step 2** declines the service's copy at such an address when it is stamped with another installed package: one that is not X, not a customization pair of X, and not a package X is the pair of (`serviceCopyOfAnotherPackage`). A copy bound to no package, a copy stamped X, a stamp the registry does not know, and `object` (one owner, read by `getObject`) are served as before. - **Step 3**, after such a decline, reads the registry's package slot for X (`getPackageScopedItem`) before `getItem`. `getItem` answers the bare slot first, so a package-less entry of a name two packages hold would answer at the address of the package registered first, and the package registered last would answer its own copy. When X holds no item of the name, `getItem` answers as before. - The bare doc refusal's docblock (PR #34036) no longer says a package-less bare entry is served: the item-4 pins measure that the layers serve the holder's service copy (registered last) instead. The docblock now says so. The answer itself is a loose end (below), not changed here. The family is enumerated in one pin. Every declared metadata type the registry does not read by package is either covered by the exact qualifier (`action`, `hook`, `job`, `sharing_rule`, `queue`, `assignment_rule`: already right, pinned as such), outside it and fixed here (`doc`, `view`, `translation`, `field`, `seed`, `datasource`, `external_catalog`, `object_extension`), one-holder (`position`, `capability`: a second holder is refused), or not judged (`object`). A new type fails the enumeration until it is placed. ## FROM → TO | Read | FROM (main) | TO | |---|---|---| | `GET /meta/doc/NAME?package=X`, X and Y ship NAME, Y registered last (dispatcher and REST) | 200, Y's doc body under X's envelope (`_packageId: X`) | 200, X's doc | | same, X registered last | 200, X's doc | 200, X's doc (unchanged) | | `?package=X` of `view`, `translation`, `field`, `seed`, `datasource`, `external_catalog`, `object_extension`, two holders, service keeping Y's copy | 200, Y's body | 200, X's body | | `?package=X` of a doc beside a stamp-less bare entry or a hydrated package-less row, X registered first | 200, Y's doc | 200, X's doc | | `?package=X` of a covered type (`action`, `hook`, `job`, `sharing_rule`, `queue`, `assignment_rule`) | 200, X's body | unchanged | | one holder; a service copy bound to no package; a copy stamped X; `object`; any read naming no package | as on main | unchanged | | `?package=X` of a doc only Y ships | 200, Y's doc | unchanged (see Acceptance notes) | No served answer becomes a refusal or a 404, so `Clause-②: no` holds as claimed. ## Tests - `packages/objectql/src/package-scoped-exact-qualifier.test.ts`: a new top-level describe after the `#32069` one. The enumeration pin, then one case per type outside one-holder and `object`: both holders, the service keeping each holder's copy in turn, `?package=` of each holder answers its own body. CONTROLs: the service's copy at its own holder, and a copy bound to no package at any address, are served. One-holder types refuse a second holder. - `packages/runtime/src/domains/meta-disabled-holder-artifact-door.test.ts` (the composed artifact rig: `MetadataPlugin` artifact door plus `AppPlugin`, both transports). `bootArtifactKernel` takes a body factory. New describes: the doc's exact address in both registration orders, a one-holder CONTROL, and acceptance item 4. Item 4 pins three things: the bare doc refusal (409 naming both) at the plain read, `/layers` and `/published`; a package-less row with no registry copy is still refused; and, measured and unresolved, a stamp-less bare entry and a hydrated package-less row, where the bare doors serve the holder registered last. Each item-4 state also pins that each exact address reads its own doc. ## Acceptance notes - **Loose end (item 4, measured):** with a stamp-less bare entry, or a hydrated package-less doc row (stored row plus its `sys_metadata`-stamped bare entry), beside two enabled holders, PR #34036's refusal is exempted, but the layers do not serve the package-less entry. The bare plain read and `/published` serve the holder the MetadataService registered last. `/layers` reports the row as `overlay` over that holder's `effective`. This is a registration-order pick on a public door. It is pinned as measured, and the docblock is corrected. Changing the answer is a behaviour change outside this card. - **Open (cell C):** `?package=X` for a doc X does not ship but Y does still answers Y's doc (the registry's first composite). Making it 404 would move 200 → 404, a narrowing the claim does not declare, so it is not done here. - `/layers?package=X` and the carry-forward code-layer read also ask `readItemFromMetadataService(type, name, X)` (`protocol-meta-layered-reads.ts`, `protocol-discovery-and-bases.ts`). They are outside this card's file surface and were not measured here. ## Verification All readings below are on head `32a489c698` (origin/main `dfb8ed3570` merged in), unless a line names another head. <details><summary>Suites and typechecks (head 32a489c, under os-verify-lock)</summary> - `pnpm --filter @objectstack/metadata-protocol test`: exit 0, Test Files 344 passed, 9 skipped; Tests 22940 passed, 45 skipped. - `pnpm --filter @objectstack/objectql test`: exit 0, Test Files 598 passed; Tests 13298 passed. - `pnpm --filter @objectstack/rest test`: exit 0, Test Files 413 passed; Tests 8473 passed, 332 skipped. - `pnpm --filter @objectstack/runtime test`: exit 0, Test Files 605 passed; Tests 11081 passed, 19 skipped. - `typecheck` of metadata-protocol, objectql and runtime: exit 0 each. - Pin files alone: `package-scoped-exact-qualifier.test.ts` 342 passed; `meta-disabled-holder-artifact-door.test.ts` 17 passed. - `eslint --no-inline-config` on the three touched source files: exit 0. The repo-wide `pnpm lint` is left to CI. </details> <details><summary>Ablations (each through scripts/ablation-replace.mjs, metadata-protocol rebuilt, marker proved in dist/ by ablation-dist-preflight, restore proved by blob equal to HEAD and an empty git diff HEAD)</summary> - **A: step 2's decline removed** (head 9ea243e). Red: the objectql enumeration, 8 failed (`doc`, `view`, `translation`, `field`, `seed`, `datasource`, `external_catalog`, `object_extension`), for example `doc at com.acme.beta, the service keeping com.acme.alpha's: expected 'alpha doc' to be 'beta doc'`. The covered types stayed green, which confirms they were already right. The runtime rig went red on every exact-address pin, both orders and both transports. The FROM answer it shows is `{"item":{"label":"beta doc","content":"# beta","_packageId":"com.qa.alpha",...},"packageId":"com.qa.alpha"}`: beta's body under alpha's envelope. - **B: step 3's package-slot read removed** (head 9ea243e). Red: the runtime rig's stamp-less and hydrated states, at the address of the package registered first, which answered the package-less entry (`"label":"bare entry"` / `"environment doc"` under `_packageId: com.qa.alpha`). The objectql enumeration stayed green: it lays no bare-slot entry. - **C: PR #34036's bare doc refusal call removed** (head 5783d98). Red: the item-4 refusal pins in both orders. The plain read answered 200 with the holder registered last (`"label":"beta doc"`), where 409 is pinned. </details> <details><summary>Gates</summary> - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 69 families. 67 were run locally on this head, each exit 0. `--ran` reconciliation: 69 derived, 67 run, 0 NOT-MEASURED, 2 UNRUN. The two are `check:dual-build-cjs-loads` and `check:type-check-debt`, left to CI (the second needs the verify lock). - `git merge-tree` against origin/main `dfb8ed3570` and fold PR #33995's head `69f4887137`: clean. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 43dd565 commit 01598d9

4 files changed

Lines changed: 336 additions & 14 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol): an exact by-name read (`?package=X`) of a `doc`, a `view` or another type the exact qualifier does not judge no longer answers another package's item from the metadata service
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`GET /api/v1/meta/doc/NAME?package=X` (both transports, and every reader of the protocol's by-name read) answered the other package's doc when two packages ship the name and the other one registered last. The metadata service keeps such a type by name alone, so it holds the item of the package registered last, and the read asked it before the registry. Now that copy is not served at X's address when it is stamped with another installed package (one that is neither X nor X's customization pair). The registry's read naming X answers X's own item instead (ADR-0150 D3: an exact address answers that holder).
11+
12+
The same holds for every type the exact qualifier of ADR-0150 D5 does not judge: `doc`, `view`, `translation`, `field`, `seed`, `datasource`, `external_catalog` and `object_extension`. `position` and `capability` keep one package holder. `object` is not changed: one package owns an object name, and the registry reads it by name. The covered types were already right, because the exact qualifier replaces another package's copy after the layers.
13+
14+
Unchanged: a package that is the only holder, a service copy bound to no package, a copy stamped X, and the read that names no package.

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

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ import {
2525
packageScopedRefusalMessage,
2626
type PackageScopedRefusal,
2727
} from '@objectstack/core';
28-
import { itemDiscriminator } from '@objectstack/metadata-core';
28+
import { isPairOf, itemDiscriminator } from '@objectstack/metadata-core';
2929
import { boundObjectOf, storedItemPackageId } from '@objectstack/metadata/stored-item-package';
3030
import { PLURAL_TO_SINGULAR, SINGULAR_TO_PLURAL } from '@objectstack/spec/shared';
3131
// [#24395] The draft row's per-key provenance, read back for the strict draft read.
3232
import { storedDraftChanges } from './draft-changes.js';
33+
import { installedManifestsOfEngine } from './installed-manifests.js';
3334
import { type StoredOverlayRow, resolveItemLock, storedRowDocument } from './item-lock.js';
3435
import {
3536
type MetadataDiagnostics,
@@ -324,11 +325,15 @@ export async function judgeBareActionRead(
324325
* the registry's first composite.
325326
*
326327
* Judge only: any answer the registry gives leaves the read to its layers,
327-
* exactly as before. The environment's own item answers first where the
328-
* registry holds it (its package-less bare slot: a hydrated or saved row);
329-
* a package-less row only the store holds is no exemption, because the
330-
* layers below do not serve it for a `doc` and would answer a holder by
331-
* registration order again.
328+
* exactly as before. A package-less entry in the registry's bare slot (a
329+
* hydrated or saved row, or a stamp-less registration) exempts the name from
330+
* the refusal, and the layers then read it as before: ⛔ they do not serve
331+
* that entry where the MetadataService holds a holder's copy, which answers
332+
* first (the holder registered last; the composed artifact rig of
333+
* runtime's `meta-disabled-holder-artifact-door.test.ts` pins it, measured and
334+
* unresolved). A package-less row only the store holds is no
335+
* exemption, because the layers below do not serve it for a `doc` and would
336+
* answer a holder by registration order again.
332337
*
333338
* @throws {PackageScopedNameRefusedError} two or more enabled package holders.
334339
*/
@@ -393,6 +398,42 @@ export async function servedFromDisabledHolder(
393398
return false;
394399
}
395400

401+
/**
402+
* [ADR-0150 D3, red line 2] Is the MetadataService's answer to a read that
403+
* names a package (`?package=X`) another package's item? Asked only where the
404+
* exact qualifier admitted no address ({@link admitExactQualifier}: a type
405+
* outside the set ADR-0150 addresses by `(package, name)`, a `doc` among
406+
* them), so no check below the layers replaces such an answer.
407+
*
408+
* The service keeps such a type by name alone: the item of the package
409+
* registered last. Served at step 2, it answered X's address with that
410+
* package's body whenever two packages ship the name, in the order that put
411+
* the other package last. Not served, the read falls through to the
412+
* registry, whose read naming X answers X's own item first.
413+
*
414+
* Another package's item is one stamped with a package the registry holds
415+
* that is neither X nor a customization pair of X or of which X is the pair.
416+
* A copy bound to no package (no stamp, `''`, the `sys_metadata` sentinel), a
417+
* copy stamped X, and a stamp the registry does not know are served as before.
418+
* ⛔ Not an `object`: one package owns an object name, and the registry's read
419+
* of it (`getObject`) does not read by package, so it has no item of X's to
420+
* answer in its place.
421+
*/
422+
export function serviceCopyOfAnotherPackage(
423+
host: Pick<ProtocolHost, 'engine'>,
424+
request: { type: string; packageId?: string },
425+
data: unknown,
426+
): boolean {
427+
const packageId = request.packageId;
428+
if (!packageId || request.type === 'object') return false;
429+
const served = storedItemPackageId(data);
430+
if (served === undefined || served === packageId) return false;
431+
const registry = host.engine?.registry as { getPackage?(id: string): unknown } | undefined;
432+
if (typeof registry?.getPackage !== 'function' || registry.getPackage(served) === undefined) return false;
433+
const installed = installedManifestsOfEngine(host.engine);
434+
return !isPairOf(served, packageId, installed) && !isPairOf(packageId, served, installed);
435+
}
436+
396437
/** The same item: one object, or (a loader's fresh copy) the same JSON. */
397438
function sameStoredItem(left: unknown, right: unknown): boolean {
398439
if (left === right) return true;
@@ -1105,6 +1146,8 @@ export async function readMetaItem(host: Pick<ProtocolHost, 'artifactLockLayerAt
11051146
// purpose — see the branch that reads it after step 3 for why the
11061147
// verdict cannot be acted on here.
11071148
let serviceDegraded: { degraded: boolean; errors: string[] } | undefined;
1149+
// [ADR-0150 D3] Step 2 declined the service's copy as another package's.
1150+
let anotherPackagesCopy = false;
11081151
if (item === undefined) {
11091152
try {
11101153
// Threads the caller's package id (ADR-0048) so a single-item
@@ -1119,9 +1162,16 @@ export async function readMetaItem(host: Pick<ProtocolHost, 'artifactLockLayerAt
11191162
// another holder's ({@link serviceAnswerFitsBareAction}), [#32560]
11201163
// or it is a disabled package's customization
11211164
// ({@link servedFromDisabledHolder}).
1165+
// [ADR-0150 D3, red line 2] …or, at an address naming a package
1166+
// the exact qualifier does not judge, it is another package's item
1167+
// ({@link serviceCopyOfAnotherPackage}): step 3 answers the
1168+
// package's own item from the registry.
1169+
anotherPackagesCopy = exactAddress === undefined && fromService.data !== undefined && fromService.data !== null
1170+
&& serviceCopyOfAnotherPackage(host, request, fromService.data);
11221171
if (fromService.data !== undefined && fromService.data !== null
11231172
&& !(bareActionAnswer && (!serviceAnswerFitsBareAction(bareActionAnswer, fromService.data)
1124-
|| await servedFromDisabledHolder(host, request.name, fromService.data)))) {
1173+
|| await servedFromDisabledHolder(host, request.name, fromService.data)))
1174+
&& !anotherPackagesCopy) {
11251175
// [#22877] …when it is the member this read addresses. The
11261176
// service keys a type's items by name alone, so for a
11271177
// bundle it holds whichever member it registered last, and
@@ -1185,7 +1235,20 @@ export async function readMetaItem(host: Pick<ProtocolHost, 'artifactLockLayerAt
11851235
} else if (bareActionAnswer) {
11861236
item = bareActionAnswer.item;
11871237
} else {
1188-
item = host.engine.registry.getItem(request.type, request.name, request.packageId, member);
1238+
// [ADR-0150 D3, red line 2] With another package's copy declined
1239+
// at step 2, the package named answers its own item: the
1240+
// registry's package slot ({@link serviceCopyOfAnotherPackage}),
1241+
// never `getItem`'s bare slot first, which a package-less entry of
1242+
// a name two packages hold fills, so the package registered first
1243+
// answered that entry and the one registered last its own item.
1244+
// A package that holds no item of the name reads `getItem`, as before.
1245+
if (anotherPackagesCopy && request.packageId) {
1246+
const scoped = host.engine.registry as { getPackageScopedItem?(type: string, name: string, packageId: string, member?: string): unknown };
1247+
if (typeof scoped.getPackageScopedItem === 'function') {
1248+
item = scoped.getPackageScopedItem(request.type, request.name, request.packageId, member);
1249+
}
1250+
}
1251+
if (item === undefined) item = host.engine.registry.getItem(request.type, request.name, request.packageId, member);
11891252
if (item === undefined) {
11901253
const alt = PLURAL_TO_SINGULAR[request.type] ?? SINGULAR_TO_PLURAL[request.type];
11911254
if (alt) item = host.engine.registry.getItem(alt, request.name, request.packageId, member);

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

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { assertEngineFindOnePredicate } from '@objectstack/metadata-core';
2727
import { SchemaRegistry } from './registry.js';
2828
import { PACKAGE_SCOPED_READ_TYPES, PackageScopedNameRefusedError } from './package-scoped-read.js';
2929
import { ENGINE_FUNCTION_TYPE, NAMESPACE_SCOPED_BARE_NAME_TYPES, PACKAGE_SCOPED_TYPES } from '@objectstack/core';
30+
import { MetadataTypeSchema } from '@objectstack/spec/kernel';
3031

3132
/** ADR-0150's covered types whose by-name readers no child of the epic has wired yet. */
3233
const UNWIRED_COVERED_TYPES = PACKAGE_SCOPED_TYPES.filter(
@@ -745,6 +746,90 @@ describe('the exact read serves the holder\'s own body under the holder\'s own s
745746
});
746747
});
747748

749+
/**
750+
* [#34040, ADR-0150 D3, red line 2] The same read for every type the registry
751+
* does not read by package. The MetadataService keeps such a type by name alone
752+
* (the package registered last), and its copy answers before the registry. A
753+
* covered type's copy of another package is replaced by the exact qualifier
754+
* after the layers. A type outside the covered set has no exact qualifier, so
755+
* step 2 declines that copy and the registry answers X's own item.
756+
*
757+
* BASE (measured before the fix on the composed artifact rig and here):
758+
* `?package=alpha` of a `doc` two packages ship answered beta's body, the
759+
* service's copy, in the order that registered beta last.
760+
*/
761+
describe('[#34040] the exact read never serves the service\'s copy of another package, for every type the registry does not read by package', () => {
762+
/**
763+
* The enumeration: every declared metadata type the registry does not read by
764+
* package, as the exact qualifier sees it. A new type lands in one of these
765+
* lists or this pin goes red.
766+
*/
767+
const NOT_READ_BY_PACKAGE = MetadataTypeSchema.options.filter((type) => !(PACKAGE_SCOPED_READ_TYPES as readonly string[]).includes(type));
768+
/** Judged by the exact qualifier after the layers (ADR-0150 D5). */
769+
const COVERED = NOT_READ_BY_PACKAGE.filter((type) => (PACKAGE_SCOPED_TYPES as readonly string[]).includes(type));
770+
/** Not judged by it: step 2 declines another package's copy. */
771+
const OUTSIDE = NOT_READ_BY_PACKAGE.filter((type) => !(PACKAGE_SCOPED_TYPES as readonly string[]).includes(type));
772+
/** Of them, the types the registry keeps one package holder of (the security catalog). */
773+
const ONE_HOLDER = ['position', 'capability'];
774+
/** `object`: one package owns the name, and the registry's read (`getObject`) does not read by package. */
775+
const NOT_JUDGED = ['object'];
776+
777+
it('the enumeration: the types outside the exact qualifier, each one pinned below or named as one-holder or not judged', () => {
778+
expect([...COVERED].sort()).toEqual([...UNWIRED_COVERED_TYPES].sort());
779+
expect([...OUTSIDE].sort()).toEqual(
780+
['capability', 'datasource', 'doc', 'external_catalog', 'field', 'object', 'object_extension', 'position', 'seed', 'translation', 'view'],
781+
);
782+
});
783+
784+
/** Ship an item that parses: a shipped action is stored as its schema parse, which wants a target. */
785+
const shipParsed = (type: string, name: string, packageId: string) => registry.registerItem(
786+
type,
787+
{ name, label: `${packageId.split('.').pop()} ${type}`, ...(type === 'action' ? { type: 'url', target: 'https://example.com' } : {}) },
788+
'name' as never,
789+
packageId,
790+
);
791+
792+
const servedWith = (wrongBody: Record<string, unknown>) => {
793+
const metadata = {
794+
get: vi.fn(async () => wrongBody),
795+
getDiagnosed: vi.fn(async () => ({ data: wrongBody, degraded: false, errors: [] })),
796+
};
797+
const served = new ObjectStackProtocolImplementation(engine as never, () => new Map<string, unknown>([['metadata', metadata]]));
798+
return { served, metadata };
799+
};
800+
801+
it.each([...NOT_READ_BY_PACKAGE].filter((type) => !ONE_HOLDER.includes(type) && !NOT_JUDGED.includes(type)))(
802+
'%s: `?package=` of each holder serves that holder\'s body, whichever holder\'s copy the service keeps',
803+
async (type) => {
804+
shipParsed(type, 'shared', A);
805+
shipParsed(type, 'shared', B);
806+
for (const kept of [A, B]) {
807+
const { served, metadata } = servedWith({ name: 'shared', label: `${kept.split('.').pop()} ${type}`, _packageId: kept });
808+
for (const [packageId, label] of [[A, `alpha ${type}`], [B, `beta ${type}`]] as const) {
809+
const answer = await served.getMetaItem({ type, name: 'shared', packageId });
810+
expect(labelOf(answer), `${type} at ${packageId}, the service keeping ${kept}'s`).toBe(label);
811+
}
812+
expect(metadata.get.mock.calls.length + metadata.getDiagnosed.mock.calls.length, 'the service layer was read').toBeGreaterThan(0);
813+
}
814+
},
815+
);
816+
817+
it.each(OUTSIDE.filter((type) => !NOT_JUDGED.includes(type)))('CONTROL — %s: the service\'s copy is served at its own holder\'s address, and a copy bound to no package at any address', async (type) => {
818+
shipParsed(type, 'shared', A);
819+
const own = servedWith({ name: 'shared', label: 'service copy', _packageId: A });
820+
expect(labelOf(await own.served.getMetaItem({ type, name: 'shared', packageId: A })), `${type} at its holder`).toBe('service copy');
821+
const unbound = servedWith({ name: 'shared', label: 'service copy' });
822+
for (const packageId of [A, B]) {
823+
expect(labelOf(await unbound.served.getMetaItem({ type, name: 'shared', packageId })), `${type} at ${packageId}`).toBe('service copy');
824+
}
825+
});
826+
827+
it.each(ONE_HOLDER)('%s keeps one package holder: a second package\'s registration of the name is refused', (type) => {
828+
ship(type, 'shared', A);
829+
expect(() => ship(type, 'shared', B)).toThrow();
830+
});
831+
});
832+
748833
/**
749834
* [#31699 F2, the epic's ruling on the contract review] Two packages of one
750835
* App share the App's customization pair, so a locale Studio added there with

0 commit comments

Comments
 (0)