Skip to content

Commit fc6e8f7

Browse files
committed
wip(tests): fake stored grants keep their legacy id beside the name; no duplicate keys
Claude-Session: https://claude.ai/code/session_01MZuVPXoYeF1Pa3G4ERmTPz Co-authored-by: Claude <noreply@anthropic.com>
1 parent f768b83 commit fc6e8f7

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎packages/plugins/plugin-hono-server/src/current-user-endpoints-delegated-resolution.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const TABLES: Record<string, Row[]> = {
8989
sys_member: [{ user_id: USER, organization_id: ACTIVE_ORG, role: 'member' }],
9090
sys_user_position: [],
9191
sys_user_permission_set: [
92-
{ id: 'ups1', user_id: USER, permission_set: GRANTED, permission_set: GRANTED, organization_id: ACTIVE_ORG },
92+
{ id: 'ups1', user_id: USER, permission_set: GRANTED, organization_id: ACTIVE_ORG },
9393
],
9494
sys_position: [],
9595
sys_position_permission_set: [],

‎packages/plugins/plugin-hono-server/src/current-user-endpoints-execution-context-envelope.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const TABLES: Record<string, Row[]> = {
9090
sys_member: [{ user_id: USER, organization_id: ACTIVE_ORG, role: 'member' }],
9191
sys_user_position: [],
9292
sys_user_permission_set: [
93-
{ id: 'ups1', user_id: USER, permission_set: GRANTED, permission_set: GRANTED, organization_id: ACTIVE_ORG },
93+
{ id: 'ups1', user_id: USER, permission_set: GRANTED, organization_id: ACTIVE_ORG },
9494
],
9595
sys_position: [],
9696
sys_position_permission_set: [],

‎packages/plugins/plugin-security/src/delegated-admin-gate.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,27 +366,27 @@ describe('DelegatedAdminGate — direct grants (sys_user_permission_set)', () =>
366366
});
367367

368368
it('a grant naming an allowlisted set may be revoked by the delegate — whatever its id says', async () => {
369-
storedGrant({ permission_set: 'finance_admin', permission_set: 'sales_user' });
369+
storedGrant({ permission_set_id: 'ps_fin', permission_set: 'sales_user' });
370370
await expect(remove()).resolves.toBeUndefined();
371371
});
372372

373373
it('a grant naming a set outside the allowlist is refused — whatever its id says', async () => {
374-
storedGrant({ permission_set: 'sales_user', permission_set: 'finance_admin' });
374+
storedGrant({ permission_set_id: 'ps_sales', permission_set: 'finance_admin' });
375375
await expect(remove()).rejects.toThrow(/'finance_admin' is not in the scope's allowlist/);
376376
});
377377

378378
it('a grant that names NO set is refused: the delegate cannot be shown to hold authority over it', async () => {
379-
storedGrant({ permission_set: 'sales_user', permission_set: null });
379+
storedGrant({ permission_set_id: 'ps_sales', permission_set: null });
380380
await expect(remove()).rejects.toThrow(/names no permission set/);
381381
});
382382

383383
it('a grant naming a set the security catalog does not hold is refused', async () => {
384-
storedGrant({ permission_set: 'sales_user', permission_set: 'sales_user_retired' });
384+
storedGrant({ permission_set_id: 'ps_sales', permission_set: 'sales_user_retired' });
385385
await expect(remove()).rejects.toThrow(/is not in the security catalog/);
386386
});
387387

388388
it('an update keeping the set is judged by the stored name; one re-pointing the id by the new id', async () => {
389-
storedGrant({ permission_set: 'sales_user', permission_set: 'sales_user' });
389+
storedGrant({ permission_set_id: 'ps_sales', permission_set: 'sales_user' });
390390
await expect(h.gate.assert({
391391
object: 'sys_user_permission_set', operation: 'update',
392392
data: { id: 'g1', reason: 'renewed' }, context: h.ctxOf('delegate'),

‎packages/rest/src/single-kernel-isolated-session-org-claim-matrix.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ function makeQl() {
183183
// reading's discipline. With one shared grant, only the organization
184184
// claim can separate the arms.
185185
sys_user_permission_set: [
186-
{ user_id: 'u_member', permission_set: 'shared_access', permission_set: 'shared_access' },
187-
{ user_id: 'u_exmember', permission_set: 'shared_access', permission_set: 'shared_access' },
186+
{ user_id: 'u_member', permission_set_id: 'ps_shared', permission_set: 'shared_access' },
187+
{ user_id: 'u_exmember', permission_set_id: 'ps_shared', permission_set: 'shared_access' },
188188
],
189189
sys_permission_set: [
190190
{ id: 'ps_shared', name: 'shared_access', system_permissions: ['manage_metadata', 'studio.access'] },

0 commit comments

Comments
 (0)