Skip to content

Commit 53ca1e7

Browse files
committed
test(rest), changeset: pin the other /layers refusal exits' candidates; declare the stored-row /published move
Two REST /layers exits now carry details.candidates through the route's catch: the bare action read weighing the package-less holder, and the exact qualifier of a package holding none. Each is pinned against the item read's candidates. The stale comment that said /layers carries the refusal's text only is corrected. The changeset's /published row adds a state. A name with a package-unbound active row, on a REST host with no objectQLProvider, was served that row (200) and is now refused 409. The dispatcher sentence now covers that state: it moves from the row to the code snapshot. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
1 parent 9dd398c commit 53ca1e7

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

‎.changeset/32622-layers-two-holders-candidates.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Metadata-protocol: none
1414

1515
- FROM: on a host that wires no engine for the REST door chain, `GET /meta/:type/:name/layers` (and `?layers=true`) answered 200 with the layers of the holder that registered first. TO: it answers `409 RESOURCE_CONFLICT` naming both holders as `details.candidates`.
1616
- FROM: in process, the protocol's `getMetaItemLayered({ type, name })` with no `packageId` resolved the holder that registered first. TO: it throws `PackageScopedNameRefusedError` (`RESOURCE_CONFLICT`, 409) naming both, as `getMetaItem` does.
17-
- FROM: on a REST host with no `objectQLProvider`, `GET /meta/:type/:name/published` went on past its overlay read to the published exit: what the host's metadata service `getPublished` answers, or `501 NOT_IMPLEMENTED` when the host resolves no metadata service. TO: it answers `409 RESOURCE_CONFLICT`, without `details.candidates`. The dispatcher's `/published` swallows the same refusal and still serves its snapshot.
17+
- FROM: on a REST host with no `objectQLProvider`, `GET /meta/:type/:name/published` served the name's package-unbound active row (200) when one stands. With no such row, it went on past its overlay read to the published exit: what the host's metadata service `getPublished` answers, or `501 NOT_IMPLEMENTED` when the host resolves no metadata service. TO: it answers `409 RESOURCE_CONFLICT`, without `details.candidates`. The dispatcher's `/published`, where its engine registry is not reachable, swallows the same refusal. With no such row it serves its snapshot as before. With one, it served that row and now serves the code snapshot instead.
1818

1919
**Not moved.** A name one package holds, and every read naming the package (`?package=`, `packageId`), answer as before. On a host whose door chain has an engine, `/layers` already refused 409; it now also names the holders. The save and delete doors do not move.
2020

‎packages/rest/src/meta-qualified-item-route.test.ts‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ describe('#32365 — the bare action read weighs the package-less holder and ser
834834
expect(messageOf(answer)).toContain('The platform\'s item binds it to object "contact"');
835835
const layers = await drive(LAYERS, { type: 'action', name: 'approve' });
836836
expect([layers.status, codeOf(layers)], JSON.stringify(layers.body)).toEqual([409, 'RESOURCE_CONFLICT']);
837-
// `/layers` and `/published` carry the refusal's text, not its candidates.
837+
// `/layers` carries the refusal's candidates too (#32622, pinned below); `/published` carries its text, not its candidates.
838838
const published = await drive(PUBLISHED, { type: 'action', name: 'approve' });
839839
expect([published.status, codeOf(published)], JSON.stringify(published.body)).toEqual([409, 'RESOURCE_CONFLICT']);
840840
expect(messageOf(published)).toContain(`package "${A}"`);
@@ -868,6 +868,40 @@ describe('#32365 — the bare action read weighs the package-less holder and ser
868868
});
869869
});
870870

871+
/**
872+
* [#32622, ADR-0150 D5] The two `/layers` refusal exits of this route that the
873+
* candidates option reaches beyond the two-holder read: the bare action read
874+
* weighing the package-less holder, and the exact qualifier of a package that
875+
* holds nothing. Each answers the plain read's `details.candidates`.
876+
*/
877+
describe('#32622 — the other `/layers` refusal exits carry `details.candidates`', () => {
878+
const LAYERS = '/api/v1/meta/:type/:name/layers';
879+
const pkg = (packageId: string) => ({ kind: 'package', packageId });
880+
const conflictOf = (answer: { status: number; body?: any }) =>
881+
[answer.status, codeOf(answer), answer.body?.details?.candidates];
882+
883+
it('the bare action read, the platform\'s item beside A\'s: `/layers` names A and the platform, as the item read does', async () => {
884+
const shipAction = (packageId: string | undefined, objectName: string) => registry.registerItem('action', {
885+
name: 'approve', label: packageId?.split('.').pop() ?? 'platform', type: 'script', objectName, target: 'approve',
886+
body: { language: 'js', source: 'return 1;', capabilities: [] },
887+
}, 'name' as never, packageId);
888+
shipAction(A, 'account');
889+
shipAction(undefined, 'contact');
890+
const plain = await drive(ITEM, { type: 'action', name: 'approve' });
891+
const layers = await drive(LAYERS, { type: 'action', name: 'approve' });
892+
expect(conflictOf(layers), JSON.stringify(layers.body)).toEqual([409, 'RESOURCE_CONFLICT', [pkg(A), { kind: 'platform' }]]);
893+
expect(layers.body?.details?.candidates).toEqual(plain.body?.details?.candidates);
894+
});
895+
896+
it('`/layers?package=` of a package that holds nothing: the holder, as the item read does', async () => {
897+
ship('page', 'home', A);
898+
const plain = await drive(ITEM, { type: 'page', name: 'home' }, { package: C });
899+
const layers = await drive(LAYERS, { type: 'page', name: 'home' }, { package: C });
900+
expect(conflictOf(layers), JSON.stringify(layers.body)).toEqual([409, 'RESOURCE_CONFLICT', [pkg(A)]]);
901+
expect(layers.body?.details?.candidates).toEqual(plain.body?.details?.candidates);
902+
});
903+
});
904+
871905
/**
872906
* [#32501, ADR-0150 D5, epic red line 2] An exact address reads one package,
873907
* and its answer names that package: its envelope (`_packageId`) and, on

0 commit comments

Comments
 (0)