Skip to content

Commit 29a58bb

Browse files
committed
test(dogfood): the showcase's customization commit is taken in its pair
The control drafted into the read-only showcase itself, which the save door now refuses naming the pair. It asserts that refusal, then writes the same customization into the pair, declared, and pins its commit's revert through the pair's own path and through no other. Claude-Session: https://claude.ai/code/session_01ADHkmTBQhj1HBQsdAopiJ8 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 88f062f commit 29a58bb

1 file changed

Lines changed: 25 additions & 9 deletions

File tree

‎packages/qa/dogfood/test/package-commit-revert-path-package.dogfood.test.ts‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,20 @@
3030
// reverting it through the showcase's own path removes the overlay. That is
3131
// the undo of an ADR-0131 D6 customization, which `POST /packages/:id/revert`
3232
// also answers for a read-only package (stored rows first), so the commit
33-
// doors take no read-only guard; the last case pins it.
33+
// doors take no read-only guard.
34+
//
35+
// [#28905, ADR-0146 D1] That draft naming the read-only showcase itself is
36+
// refused now (`403 NOT_OVERRIDABLE`, naming its `.custom` pair), so a fresh
37+
// boot can no longer give the showcase such a commit; one recorded before
38+
// keeps its revert, as the commit doors still take no read-only guard. The
39+
// last case pins the refusal, then the same customization written where D1
40+
// puts it, the showcase's pair: its commit reverts through the pair's own
41+
// path, and through no other.
3442

3543
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
3644
import { type VerifyStack } from '@objectstack/verify';
3745
import { bootShowcase } from './showcase-boot.js';
46+
import { declaredOverride, ensurePair, inPair } from './customization-pair.js';
3847

3948
const SHOWCASE = 'com.example.showcase';
4049
const OVERLAY = 'showcase_task.default';
@@ -154,26 +163,33 @@ describe('dogfood: package commit revert and rollback act only on a commit of th
154163
expect(await isServed('cmtpb_first')).toBe(true);
155164
});
156165

157-
it('control: a read-only package\'s overlay commit reverts through its own path, and through no other', async () => {
158-
const saved = await call('PUT', `/meta/view/${OVERLAY}?mode=draft&package=${SHOWCASE}`, {
166+
it('control: the showcase\'s customization commit, in its pair, reverts through the pair\'s own path, and through no other', async () => {
167+
const view = {
159168
name: OVERLAY, object: 'showcase_task', viewKind: 'list', label: 'Overlay probe',
160169
config: { type: 'grid', columns: [{ field: 'title' }] },
161-
});
170+
};
171+
// [#28905] The draft naming the read-only showcase itself is closed, naming its pair.
172+
const named = await call('PUT', `/meta/view/${OVERLAY}?mode=draft&package=${SHOWCASE}`, view);
173+
expect(named.status, JSON.stringify(named.json)).toBe(403);
174+
expect(JSON.stringify(named.json)).toContain(`?package=${SHOWCASE}.custom`);
175+
176+
const pair = await ensurePair(stack, admin, SHOWCASE);
177+
const saved = await call('PUT', inPair(`/meta/view/${OVERLAY}?mode=draft`, SHOWCASE), declaredOverride(view, SHOWCASE, '0.1.0'));
162178
expect(saved.status, JSON.stringify(saved.json)).toBe(200);
163-
const published = await call('POST', `/packages/${SHOWCASE}/publish-drafts`, {});
179+
const published = await call('POST', `/packages/${pair}/publish-drafts`, {});
164180
expect(published.status, JSON.stringify(published.json)).toBe(200);
165-
const before = await commitsOf(SHOWCASE);
181+
const before = await commitsOf(pair);
166182
expect(before[0]).toMatchObject({ operation: 'apply', id: published.json?.data?.commitId });
167183

168184
const cross = await call('POST', `/packages/${B}/commits/${before[0].id}/revert`, {});
169185
expect(cross.status, JSON.stringify(cross.json)).toBe(404);
170-
expect(await commitsOf(SHOWCASE)).toEqual(before);
186+
expect(await commitsOf(pair)).toEqual(before);
171187

172-
const res = await call('POST', `/packages/${SHOWCASE}/commits/${before[0].id}/revert`, {});
188+
const res = await call('POST', `/packages/${pair}/commits/${before[0].id}/revert`, {});
173189
expect(res.status, JSON.stringify(res.json)).toBe(200);
174190
expect(res.json?.data).toMatchObject({
175191
success: true, revertedCount: 1, reverted: [{ type: 'view', name: OVERLAY, action: 'removed' }],
176192
});
177-
expect(await commitsOf(SHOWCASE)).toHaveLength(before.length + 1);
193+
expect(await commitsOf(pair)).toHaveLength(before.length + 1);
178194
});
179195
});

0 commit comments

Comments
 (0)