Skip to content

Commit 05cd073

Browse files
committed
test(metadata-protocol): fixtures list the objects their named-package saves bind
A save naming an installed package is judged against that package's closure, so each fixture that now installs its package also lists the objects its views and flows bind. Claude-Session: https://claude.ai/code/session_01FEkQ5nhhuhjVQJ8R3qK9UB Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0da4490 commit 05cd073

6 files changed

Lines changed: 36 additions & 6 deletions

‎packages/metadata-protocol/src/protocol.org-scoped-write-refused.test.ts‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ const installedPackage = (id: string) => {
6969
return dependencies ? { manifest: { id, dependencies: Object.fromEntries(dependencies.map((d) => [d, '*'])) } } : undefined;
7070
};
7171

72+
/** The `task` object the views here bind — tenant-authored, or owned by `owner`. */
73+
const taskObject = (owner?: string) => ({
74+
name: 'task',
75+
...(owner ? { _packageId: owner, _provenance: 'package' } : {}),
76+
fields: { name: { type: 'text' }, title: { type: 'text' } },
77+
});
78+
7279

7380
interface Row {
7481
id: string;
@@ -191,7 +198,10 @@ function makeStubEngine(artifacts: Array<{ type: string; name: string }> = []) {
191198
registry: {
192199
registerItem: () => {},
193200
registerObject: () => {},
194-
listItems: () => [],
201+
// [#26708] The `task` object every view here binds, tenant-authored
202+
// (no package): a save naming an installed package is judged
203+
// against its closure, which holds it.
204+
listItems: (type: string) => (type === 'object' ? [taskObject()] : []),
195205
getItem: () => undefined,
196206
getObject: () => undefined,
197207
getPackage: installedPackage,
@@ -661,7 +671,8 @@ describe('each package\'s copy of a view container expands into its own package\
661671
},
662672
listItems: (type: string, packageId?: string) => (type === 'view'
663673
? [...entries.values()].filter((it) => !packageId || it._packageId === packageId)
664-
: []),
674+
// [#26708] The `task` object, owned by `owner` when a code package owns it.
675+
: type === 'object' ? [taskObject(owner)] : []),
665676
getItem: (type: string, name: string, packageId?: string) => (type !== 'view'
666677
? undefined
667678
: entries.get(name) ?? (packageId ? entries.get(`${packageId}:${name}`) : undefined) ?? composite(name)[0]),

‎packages/metadata-protocol/src/protocol.package-publish-audit-rows.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,11 @@ function makeStubEngine(opts: { failAudit?: boolean } = {}): Harness {
359359
registry: {
360360
registerItem: () => {},
361361
registerObject: () => {},
362+
// [#26708] The tenant object the views here bind: a save naming
363+
// an installed package is judged against its closure.
364+
listItems: (type: string) => (type === 'object'
365+
? [{ name: 'case', fields: { id: { type: 'text' }, title: { type: 'text' } } }]
366+
: []),
362367
getPackage: installedPackage,
363368
},
364369
};

‎packages/metadata-protocol/src/protocol.packageless-save-address.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function makeProtocol(artifacts: Array<{ type: string; item: Record<string, unkn
160160
// boot — or a save naming it is refused before any rule here.
161161
getPackage: (id: string) => (id === INSTALLED_READ_ONLY
162162
? { manifest: { id, scope: 'cloud' } }
163-
: [WRITABLE, OTHER_WRITABLE, CODE_PACKAGE].includes(id) ? { manifest: { id } } : undefined),
163+
: [WRITABLE, OTHER_WRITABLE, 'com.qa.thirdapp', CODE_PACKAGE].includes(id) ? { manifest: { id } } : undefined),
164164
isPackageDisabled: () => false,
165165
applyNavContributions: (app: unknown) => app,
166166
},
@@ -435,7 +435,12 @@ describe('an item a CODE package ships', () => {
435435

436436
it('with an overlay row bound to the code package: the package-less save writes that row', async () => {
437437
const name = 'showcase_task_grid';
438-
const { protocol, rows } = makeProtocol([packagedView(name)]);
438+
// [#26708] The code package ships the object its view binds: a save
439+
// naming the (installed) package is judged against its closure.
440+
const { protocol, rows } = makeProtocol([
441+
packagedView(name),
442+
{ type: 'object', item: { name: 'task', _packageId: CODE_PACKAGE, fields: { name: { type: 'text' } } } },
443+
]);
439444
// The overlay a save naming the package writes (ADR-0005: an overlay of
440445
// a code-shipped item names the package it customizes).
441446
await protocol.saveMetaItem({ type: 'view', name, item: viewBody(name, 'Named'), packageId: CODE_PACKAGE });

‎packages/metadata-protocol/src/protocol.platform-store-system-opt-in.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ function makeStubEngine() {
169169
registerItem: () => undefined,
170170
registerObject: () => undefined,
171171
unregisterItem: () => undefined,
172-
listItems: () => [],
172+
// [#26708] The tenant object the view here binds: a save naming an
173+
// installed package is judged against its closure.
174+
listItems: (type: string) => (type === 'object' ? [{ name: 'proj_task', fields: { title: { type: 'text' } } }] : []),
173175
getItem: () => undefined,
174176
getObject: () => undefined,
175177
getPackage: installedPackage,

‎packages/metadata-protocol/src/protocol.publish-item-draft-org-scope.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ function makeStubEngine() {
178178
// No declared package namespace → the ADR-0028 prefix check is
179179
// skipped (legacy-grandfathered path).
180180
getPackage: installedPackage,
181+
// [#26708] The tenant object the views here bind: a save naming
182+
// an installed package is judged against its closure.
183+
listItems: (type: string) => (type === 'object' ? [{ name: 'customer', fields: { name: { type: 'text' } } }] : []),
181184
},
182185
};
183186
return { engine, rows, historyRows };

‎packages/metadata-protocol/src/sys-metadata-repository.package-writability.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,11 @@ describe('#8184 — the scoped kernel answers the same code as the host-config k
766766
...(engine.registry as Record<string, unknown>),
767767
registerItem: () => {},
768768
registerObject: () => {},
769-
listItems: () => [],
769+
// [#26708] The code package's `showcase_task`, which `case_grid` binds: a
770+
// save naming the installed package is judged against its closure.
771+
listItems: (type: string) => (type === 'object'
772+
? [{ name: 'showcase_task', _packageId: READ_ONLY_PKG, _provenance: 'package', fields: { name: { type: 'text' } } }]
773+
: []),
770774
getItem: () => undefined,
771775
getArtifactItem: (type: string, name: string) =>
772776
(type === 'object' && name === 'showcase_task')

0 commit comments

Comments
 (0)