Skip to content

Commit 563552a

Browse files
committed
test(cli): the composed control verifies two shipped sets on the served boot (WIP)
Claude-Session: https://claude.ai/code/session_01Q9PZ5Pzqcus4woVvTZwWNU Co-authored-by: Claude <noreply@anthropic.com>
1 parent eb96bd4 commit 563552a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎packages/cli/src/utils/organization-ownership-apply.served-catalog.integration.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ async function ceremony(posture: string, db: Database.Database): Promise<Organiz
130130
// The plan the operator reviewed: the one this run computes.
131131
reviewedPlan: { file: 'plan.json', generatedAt: '2026-10-14T00:00:00Z', database: 'v17', inventoryDigest: inventoryDigest(), posture },
132132
catalog,
133+
// What the command hands it: the boot's own answer for the security plugin.
134+
securityPlugin: stack.composition.securityPlugin,
133135
// No view is served here: the form-withdrawal carry has nothing to judge.
134136
views: { list: async () => [] },
135137
lock: { verdict: async () => ({ editable: true }) },
@@ -160,6 +162,22 @@ describe('the ownership ceremony resolves bindings against what a started kernel
160162
expect(conversion.blockers.join('\n')).not.toContain('everyone');
161163
}, CASE_TIMEOUT_MS);
162164

165+
it('control: the boot composed the plugin, and the rewrite verifies grants of two shipped sets, 2 of 2', async () => {
166+
expect(stack.composition.securityPlugin).toEqual({ composed: true });
167+
const db = new Database(join(dir, 'shipped.db'));
168+
db.exec(`
169+
CREATE TABLE sys_organization (id TEXT PRIMARY KEY, slug TEXT);
170+
INSERT INTO sys_organization VALUES ('org_default', 'default');
171+
CREATE TABLE sys_user_permission_set (id TEXT PRIMARY KEY, organization_id TEXT, user_id TEXT, permission_set TEXT);
172+
INSERT INTO sys_user_permission_set VALUES
173+
('grant_admin', 'org_default', 'usr_admin', 'admin_full_access'),
174+
('grant_nobypass', 'org_default', 'usr_admin', 'organization_admin_no_bypass');
175+
`);
176+
const rewrite = step(await ceremony('single', db), 'rewrite');
177+
expect(rewrite.blockers).toEqual([]);
178+
expect(rewrite).toMatchObject({ status: 'done', summary: { grants: 2, verified: 2 } });
179+
}, CASE_TIMEOUT_MS);
180+
163181
it('walled: the rewrite gate blocks on the undeclared position, and not on everyone', async () => {
164182
const report = await ceremony('isolated', v17Database('walled'));
165183
expect(step(report, 'authored-conversion').status).toBe('done');

0 commit comments

Comments
 (0)