Skip to content

Commit bd7b467

Browse files
committed
test(plugin-security): the #20580 pin compiles under tsconfig.test.json
Claude-Session: https://claude.ai/code/session_01XY5uCwTjZj7884yYtyur4H Co-authored-by: Claude <noreply@anthropic.com>
1 parent cf18f3e commit bd7b467

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎packages/plugins/plugin-security/src/explain-removed-member-principal.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ async function boot(makeDriver: () => Driver, posture: TenancyPosture) {
231231

232232
type Rig = Awaited<ReturnType<typeof boot>>;
233233

234-
const sorted = (xs: readonly string[]) => [...xs].sort();
234+
/** Resolution order is not what is compared: the two faces build different contexts. */
235+
const sorted = (xs: readonly string[] | undefined) => [...(xs ?? [])].sort();
235236
const crudOf = (d: ExplainDecision) => d.layers.find((l) => l.layer === 'object_crud')?.verdict;
236237
const DENIED = { code: 'PERMISSION_DENIED', status: 403 };
237238

@@ -242,7 +243,7 @@ const DENIED = { code: 'PERMISSION_DENIED', status: 403 };
242243
* precondition asserts.
243244
*/
244245
function withRig(makeDriver: () => Driver, posture: TenancyPosture) {
245-
const state: { rig?: Rig; warn?: ReturnType<typeof vi.spyOn> } = {};
246+
const state: { rig?: Rig; warn?: { mock: { calls: unknown[][] }; mockRestore: () => void } } = {};
246247
beforeAll(async () => {
247248
state.warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
248249
state.rig = await boot(makeDriver, posture);
@@ -255,8 +256,8 @@ function withRig(makeDriver: () => Driver, posture: TenancyPosture) {
255256
rig: () => state.rig!,
256257
droppedClaimLines: () =>
257258
(state.warn?.mock.calls ?? [])
258-
.map((args) => String(args[0]))
259-
.filter((line) => line.includes('Session organization claim dropped')),
259+
.map((args: unknown[]) => String(args[0]))
260+
.filter((line: string) => line.includes('Session organization claim dropped')),
260261
};
261262
}
262263

@@ -268,7 +269,7 @@ describe.each(DRIVERS)('[#20580] %s', (_driver, makeDriver) => {
268269
const removed = await r.rig().enforce(USER_REMOVED);
269270
const member = await r.rig().enforce(USER_MEMBER);
270271
expect(removed.tenantId).toBeUndefined();
271-
expect(r.droppedClaimLines().some((line) => line.includes(USER_REMOVED))).toBe(true);
272+
expect(r.droppedClaimLines().some((line: string) => line.includes(USER_REMOVED))).toBe(true);
272273
expect(member.tenantId).toBe(ALPHA);
273274
// The set is resolvable at all: without this, the negative pins below
274275
// would pass for want of a grant, not because the claim was vetted.

0 commit comments

Comments
 (0)