Skip to content

Commit b083959

Browse files
committed
wip: re-judge packageless-save-address code-package block
Claude-Session: https://claude.ai/code/session_01FEkQ5ni5yjiTswP6crgAkX Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ab5ba9e commit b083959

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

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

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
* - CONTROL: a package-less row minted beside a package's row before the fix
3636
* stays as it is, and a server-stated rewrite of that row (the
3737
* stored-metadata migration passes `packageId: null`) still writes it;
38-
* - an item a code package ships, with no stored row: the package-less save
39-
* writes the package-unbound overlay and the read serves it, as before; with
40-
* an overlay row already bound to the code package, it writes that row;
38+
* - [#28576, ADR-0146 D11] an item a code package ships: the package-less save
39+
* is refused naming the base's pair and the migration ceremony, with no
40+
* stored row or with an overlay row bound to the code package, and writes
41+
* nothing;
4142
* - the draft path: a package-less draft save still inherits the package
4243
* (its own suite, `sys-metadata-repository.draft-package-inherit.test.ts`,
4344
* holds the rest).
@@ -419,37 +420,41 @@ describe('CONTROL: what the resolution leaves alone', () => {
419420
});
420421
});
421422

422-
describe('an item a CODE package ships', () => {
423-
it('with no stored row: the package-less save writes the package-unbound overlay, and the read serves it', async () => {
423+
describe('an item a CODE package ships: the package-less write is closed (ADR-0146 D11)', () => {
424+
const PAIR = `${CODE_PACKAGE}.custom`;
425+
const closed = (e: unknown) => {
426+
expect(resolveThrownHttpError(e)).toMatchObject({ status: 403, code: 'NOT_OVERRIDABLE' });
427+
expect(String((e as Error).message)).toContain(`'${PAIR}'`);
428+
expect(String((e as Error).message)).toContain('os migrate packageless-overlays');
429+
};
430+
431+
it('with no stored row: the package-less save is refused naming the pair, and nothing is written', async () => {
424432
const name = 'showcase_task_grid';
425433
const { protocol, rows } = makeProtocol([packagedView(name)]);
426434

427-
const saved = await protocol.saveMetaItem({ type: 'view', name, item: viewBody(name, 'Overlaid') });
435+
const refused = await protocol.saveMetaItem({ type: 'view', name, item: viewBody(name, 'Overlaid') }).then(() => undefined, (e) => e);
428436

429-
expect(saved.message).toBe(
430-
`Saved customization overlay (env-wide, state=active) — type=view, name=${name} [seq=${saved.seq}]`,
431-
);
432-
expect(rows('view', name).map((r) => r.package_id ?? null)).toEqual([null]);
433-
expect((await protocol.getMetaItem({ type: 'view', name })).item.label).toBe('Overlaid');
437+
closed(refused);
438+
expect(rows('view', name)).toEqual([]);
439+
expect((await protocol.getMetaItem({ type: 'view', name })).item.label).not.toBe('Overlaid');
434440
});
435441

436-
it('with an overlay row bound to the code package: the package-less save writes that row', async () => {
442+
it('with an overlay row bound to the code package: the package-less save is refused, and that row is untouched', async () => {
437443
const name = 'showcase_task_grid';
438444
// [#26708] The code package ships the object its view binds: a save
439445
// naming the (installed) package is judged against its closure.
440446
const { protocol, rows } = makeProtocol([
441447
packagedView(name),
442448
{ type: 'object', item: { name: 'task', _packageId: CODE_PACKAGE, fields: { name: { type: 'text' } } } },
443449
]);
444-
// The overlay a save naming the package writes (ADR-0005: an overlay of
445-
// a code-shipped item names the package it customizes).
450+
// A save naming the package names a package: not the write D11 closes.
446451
await protocol.saveMetaItem({ type: 'view', name, item: viewBody(name, 'Named'), packageId: CODE_PACKAGE });
447452

448-
const saved = await protocol.saveMetaItem({ type: 'view', name, item: viewBody(name, 'Unnamed') });
453+
const refused = await protocol.saveMetaItem({ type: 'view', name, item: viewBody(name, 'Unnamed') }).then(() => undefined, (e) => e);
449454

450-
expect(saved.message).toContain(`package=${CODE_PACKAGE}`);
455+
closed(refused);
451456
expect(rows('view', name).map((r) => r.package_id ?? null)).toEqual([CODE_PACKAGE]);
452-
expect((await protocol.getMetaItem({ type: 'view', name })).item.label).toBe('Unnamed');
457+
expect((await protocol.getMetaItem({ type: 'view', name })).item.label).toBe('Named');
453458
});
454459
});
455460

‎packages/objectql/src/environment-overlay-five-types.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ function overlayCatalogManifest(): Record<string, unknown> {
152152
id: PKG,
153153
name: 'overlay_catalog',
154154
version: PKG_VERSION,
155+
namespace: 'overlaycat',
155156
// [#24668] The object the view and the dataset bind to, shipped by the
156157
// package: the overlay save door refuses a list view bound to an object
157158
// that exists nowhere, and `probe_obj` was declared by nothing.

0 commit comments

Comments
 (0)