Skip to content

Commit a2fcede

Browse files
fix(plugin-auth)!: invite-member refuses a blank role 400 ROLE_NOT_FOUND and writes no invitation (#29296)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9DaM83BgA4HT94MMubC7A8L)_ Fixes #29158 Clause-②: no (narrowing) — measured: on base `104cd1a5` a blank role (`""`, whitespace only) on `POST /api/v1/auth/organization/invite-member` answered 200 and stored the invitation, in single and walled `group`; on this head it is refused 400 `ROLE_NOT_FOUND` and no row is written. Nothing is widened. Metadata-protocol: none — measured: no schema key, accepted metadata value or metadata type moves; the diff touches no `packages/spec/**`. Skills-docs: none — the narrowing is an HTTP door's accept set, not anything a metadata author writes; no skill names a blank invitation role. ## 维护者速读 - 改了什么:邀请成员接口遇到空角色(空串、纯空格、或角色列表里的空项)时直接拒绝,返回 400 ROLE_NOT_FOUND,不写邀请记录。 - 为什么改:以前空角色会被放行并存下一条角色为空的邀请;在多组织部署里被邀请人接受后成了没有组织角色的成员,读不到该读的数据,管理员也看不出原因。 - 风险与回滚:只拒不放宽,也不会把空角色默认成 member;已存在的空角色邀请不改动。回滚即 revert 本 PR。 - 先看:`packages/plugins/plugin-auth/src/auth-manager-organization-plugin.ts`(beforeCreateInvitation 新增的拒绝分支),`invite-role-not-found-code.ts`(判空与文案)。 - 两分钟验证:`pnpm --filter @objectstack/plugin-auth exec vitest run src/accept-invitation-adopt-membership.test.ts`,预期 17 个全部通过,其中 7 个是新的空角色用例。 - 需要你做的:无,席位落地。 ## What changes - `beforeCreateInvitation` (`auth-manager-organization-plugin.ts`) refuses a blank role first, after the cloud-managed refusal and before the invitation role cap and the placement gate: `APIError('BAD_REQUEST', { code: 'ROLE_NOT_FOUND', message })`. The hook runs before `adapter.createInvitation`, so no `sys_invitation` row is written. - `invite-role-not-found-code.ts` gains `hasBlankInvitationRoleEntry` and `blankInvitationRoleRefusal`. Blank means the whole value is empty or whitespace (`""`, `" "`, `[]`) or one entry of a role list is (`"member,"`, `",admin"`, `["member", ""]`). The message keeps the vendor's `ROLE_NOT_FOUND: ` prefix and says the invitation role is empty. - `invitation-role-cap.ts`: comment only. Its "not a reachable invitation shape" note on an empty role was false; it now points at the blank refusal that runs first. - No new error code (the door's existing `ROLE_NOT_FOUND`), no `packages/spec/**` edit, no change to which non-blank roles are accepted, no default to `member`, no better-auth or overrides change. ## Tests - `packages/plugins/plugin-auth/src/accept-invitation-adopt-membership.test.ts`: new `#29158` block on the real `AuthManager` and better-auth route. Six blank shapes are refused 400 `ROLE_NOT_FOUND` with the empty-role sentence and zero rows; a delegated admin's blank role answers `ROLE_NOT_FOUND` (not the cap's 403); control: the owner inviting `admin` is still 200 with the role stored. - `packages/qa/dogfood/test/invitation-blank-role-refusal.dogfood.test.ts` (new): the composed CRM stack in `single` and walled `group` (`multiTenant: 'posture-only'`, the issuer owns a second organization). `""`, `" "` and `"member,"` are refused 400 `ROLE_NOT_FOUND` with no row; control `member` is 200 with one pending row; a guard asserts the posture. - No existing test needed an edit. ## Acceptance notes - On the composed stack, `"member,"` (and `",admin"`) was ALREADY refused on base, by the `sys_invitation.role` select validator: 400 `VALIDATION_FAILED` (`invalid_option`), no row. On this head the same request answers 400 `ROLE_NOT_FOUND` instead. Same status, same zero rows, a different code; only `""` and whitespace-only were accepted on base. Named in the report's open questions. - Other doors that write `sys_invitation.role`: none found. `admin-import-users` writes the admin plugin's user role, never an invitation, and drops a blank one. The data API serves `sys_invitation` as `get`/`list` only. A resend (`resend: true`) of an already pending invitation renews its expiry and keeps the stored role, before this hook, so it writes no role; a resend with no pending row creates a new invitation and meets this refusal. - Invitations already stored with a blank role are not rewritten; acceptance is not changed. ## Verification <details><summary>Premise on base 104cd1a (both postures, composed stack)</summary> The three gate files restored to base, plugin-auth rebuilt, a throwaway probe (not committed) on the CRM stack: - single: `""` → 200, row `role: ''` pending; the invitee signs up and accepts → 200, `sys_member.role` `member` (the sign-up's row is kept), invitation `['', 'accepted']`. `" "` → 200, row `role: ' '`. `"member,"` → 400 `VALIDATION_FAILED`. `"superuser"` → 400 `ROLE_NOT_FOUND`. - group: `""` → 200, row `role: ''`; accept → 200, `sys_member.role` `''`, invitation `['', 'accepted']`. `" "` → 200. `"member,"` → 400 `VALIDATION_FAILED`. `"superuser"` → 400 `ROLE_NOT_FOUND`. - On base the new pins are red: unit 7 failed / 10 passed (17); dogfood 6 failed / 6 passed. </details> <details><summary>Ablation of the negative pins</summary> `node scripts/ablation-replace.mjs --anchor "if (blankRole) {" --replacement "if (blankRole && process.env.ABLATION_29158_GUARD === 'on') {"`, plugin-auth rebuilt, `ablation-dist-preflight.mjs` saw the marker in 2 dist files. Unit: 7 failed / 10 passed (`expected 200 to be 400`, body `"role":""`). Dogfood: 6 failed / 4 passed, every blank case in both postures. Restored with `git checkout HEAD -- …`: `git status --porcelain` empty, `git diff HEAD` 0 bytes, blob hash equal to HEAD, rebuilt, preflight `--absent`: marker absent from all 20 built files. A first attempt used a comment marker that the bundler strips; its preflight failed, so that reading was discarded and the run was redone with the string marker. </details> <details><summary>Suites, gates, lint (head 8d01f7c, after merging main)</summary> - `pnpm --filter @objectstack/plugin-auth typecheck`: exit 0. - `pnpm --filter @objectstack/plugin-auth exec vitest run`: Test Files 208 passed (208), Tests 3618 passed, 10 skipped. - eslint (`--no-inline-config`) over `packages/plugins/plugin-auth` and the new dogfood file: exit 0. - `dispatch-gates --commands`: 65 derived, 65 run with exit 0, reconciled with `--ran`: "65 run, 0 NOT-MEASURED, 0 UNRUN (a DERIVED zero)". Two stopped at a prerequisite on the first pass and were rerun green: `check-plugin-teardown-shape --self-test` (shallow clone, pinned fixture commit fetched) and `check:dual-build-cjs-loads` (7 packages outside the closure built first). - Full dogfood (`pnpm --filter @objectstack/dogfood test`): lock VERDICT command-exit 0; Test Files 390 passed, 3 skipped (393); Tests 3225 passed, 28 skipped (3253). </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmPVewfGaEY1hNx6XpK)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5901871 commit a2fcede

6 files changed

Lines changed: 264 additions & 2 deletions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
---
4+
5+
fix(plugin-auth)!: `invite-member` refuses a blank role 400 `ROLE_NOT_FOUND`, the way it refuses an unknown one, and writes no invitation (#29158)
6+
7+
Clause-②: no (narrowing) — `POST /api/v1/auth/organization/invite-member` with a blank role (`""`, whitespace only, or an empty role array) answered 200 and stored the invitation; it is now refused 400 `ROLE_NOT_FOUND`. A role list with an empty entry (`"member,"`) was already refused 400 `VALIDATION_FAILED` by the `sys_invitation.role` select validator, and now answers 400 `ROLE_NOT_FOUND`. Nothing is widened.
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export or type of the spec changes: the invite door now refuses a role value that names no role, with the code it already answers for an unknown role, so there is nothing for a migration to rewrite and no tombstone. -->
11+
12+
**BREAKING** accept-set narrowing at the invite door (`@objectstack/plugin-auth`).
13+
14+
- **Before.** better-auth's role check splits the role list and drops empty entries before it looks for unknown names, so a blank role named no unknown role and passed. A blank value (`""`, whitespace only, an empty role array) was then stored as the invitation's role (`role: ''`). A role list with an empty entry (`"member,"`) was refused 400 `VALIDATION_FAILED` (`invalid_option`) by the `sys_invitation.role` select validator, and was stored only on a composition without the ObjectQL validator. Under a walled `group` posture, accepting it wrote a membership with no organization role, whose holder read less than a member and gave the administrator no reason why. An unknown role such as `superuser` was already refused 400 `ROLE_NOT_FOUND`.
15+
- **Now.** The framework's `beforeCreateInvitation` refuses a blank role first, before the invitation role cap and before any row is written: 400, `code: 'ROLE_NOT_FOUND'`, and a message that says the invitation role is empty. A blank role is refused, never defaulted to `member`.
16+
- **Unchanged.** Every named role is judged as before: the vocabulary, the role cap's three refusals and the placement gate. A resend of an invitation that is already pending keeps the stored role, as before.
17+
- **Who sees it.** A script or form that invites with an empty role: it now gets the refusal instead of an invitation outside the role vocabulary. Invitations already stored with a blank role are not rewritten.
18+
- **Who sees it, by code.** A client branching on `error.code` sees `VALIDATION_FAILED` become `ROLE_NOT_FOUND` for a role list with a blank entry; the status (400) and the absence of a row are unchanged.
19+
20+
**The remedy.** Send the organization role the invitee joins with, for example `member`.

‎packages/plugins/plugin-auth/src/accept-invitation-adopt-membership.test.ts‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,3 +515,81 @@ describe('#24750 — invite-member refuses an unknown role with the ADR-0112 cod
515515
expect(membersOf(engine, DEFAULT_ORG, colleague.userId)[0]!.role).toBe('member');
516516
});
517517
});
518+
519+
describe('#29158 — invite-member refuses a blank role 400 ROLE_NOT_FOUND, like an unknown one', () => {
520+
// better-auth's role check splits the role list and drops empty entries, so a
521+
// blank role yields no unknown role and the vendor would store it verbatim
522+
// (`sys_invitation.role = ''`); under a wall, accepting that invitation writes
523+
// a membership with no organization role. The framework's
524+
// `beforeCreateInvitation` refuses it before any row exists — and never
525+
// defaults it to `member`.
526+
beforeEach(() => {
527+
vi.spyOn(console, 'info').mockImplementation(() => {});
528+
vi.spyOn(console, 'warn').mockImplementation(() => {});
529+
});
530+
531+
afterEach(() => {
532+
vi.restoreAllMocks();
533+
});
534+
535+
const BLANK_ROLES: ReadonlyArray<[string, unknown]> = [
536+
['an empty string', ''],
537+
['a whitespace-only string', ' '],
538+
['an empty entry at the end of a role list', 'member,'],
539+
['an empty entry at the start of a role list', ',admin'],
540+
['an empty entry in a role array', ['member', '']],
541+
['an empty role array', []],
542+
];
543+
544+
for (const [label, role] of BLANK_ROLES) {
545+
it(`${label} is refused 400 ROLE_NOT_FOUND, the message says the role is empty, and no invitation row exists`, async () => {
546+
const { engine, manager, owner } = await bootWithOwner();
547+
const email = 'qa-blank-role@example.com';
548+
549+
const res = await post(
550+
manager,
551+
'/organization/invite-member',
552+
{ email, role, organizationId: DEFAULT_ORG },
553+
owner.cookie,
554+
);
555+
const text = await res.clone().text();
556+
expect(res.status, text).toBe(400);
557+
const body: any = await res.json();
558+
expect(body.code).toBe('ROLE_NOT_FOUND');
559+
expect(body.message).toMatch(/^ROLE_NOT_FOUND: the invitation role is empty/);
560+
expect(invitationsFor(engine, email)).toHaveLength(0);
561+
});
562+
}
563+
564+
it('a delegated admin\'s blank role answers ROLE_NOT_FOUND too — the blank refusal runs before the role cap', async () => {
565+
const { engine, manager } = await bootWithOwner();
566+
const delegate = await signUp(manager, engine, 'delegate.blank@example.com');
567+
setRole(engine, DEFAULT_ORG, delegate.userId, 'delegated_admin');
568+
569+
const res = await post(
570+
manager,
571+
'/organization/invite-member',
572+
{ email: 'qa-delegate-blank@example.com', role: '', organizationId: DEFAULT_ORG },
573+
delegate.cookie,
574+
);
575+
const text = await res.clone().text();
576+
expect(res.status, text).toBe(400);
577+
expect(((await res.json()) as any).code).toBe('ROLE_NOT_FOUND');
578+
expect(invitationsFor(engine, 'qa-delegate-blank@example.com')).toHaveLength(0);
579+
});
580+
581+
it('CONTROL: a named role is unchanged — the owner invites an admin, 200 and the role stored as sent', async () => {
582+
const { engine, manager, owner } = await bootWithOwner();
583+
584+
const ok = await post(
585+
manager,
586+
'/organization/invite-member',
587+
{ email: 'qa-list@example.com', role: 'admin', organizationId: DEFAULT_ORG },
588+
owner.cookie,
589+
);
590+
expect(ok.status, await ok.clone().text()).toBe(200);
591+
const rows = invitationsFor(engine, 'qa-list@example.com');
592+
expect(rows).toHaveLength(1);
593+
expect(rows[0]!.role).toBe('admin');
594+
});
595+
});

‎packages/plugins/plugin-auth/src/auth-manager-organization-plugin.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ import { buildOrganizationPluginSchema } from './auth-schema-config.js';
8181
import { CLOUD_MANAGED_REFUSAL_CODE, CLOUD_MANAGED_REFUSAL_MESSAGES } from './cloud-managed.js';
8282
import { invitationAcceptPath } from './invitation-link-action.js';
8383
import { invitationRoleCapFailure, isPlainMemberInvitation } from './invitation-role-cap.js';
84+
import { blankInvitationRoleRefusal } from './invite-role-not-found-code.js';
8485
import { invitationRoleLabel } from './invitation-role-label.js';
8586
import { applyDeclaredInvitationVerificationToListing } from './list-user-invitations-verification.js';
8687
import { resolveMembershipLimitOption } from './membership-limit.js';
@@ -339,6 +340,19 @@ export async function buildOrganizationPlugin(this: OrganizationPluginHost) {
339340
code: CLOUD_MANAGED_REFUSAL_CODE,
340341
});
341342
}
343+
// [#29158] A blank role — `""`, whitespace, or an empty entry in a
344+
// role list — names no role, so it is refused like an unknown one:
345+
// 400 `ROLE_NOT_FOUND`, before the role cap and before any row is
346+
// written. better-auth's own check drops empty entries, so without
347+
// this the invitation is stored with `role: ''` and, under a wall, its
348+
// acceptance writes a membership with no organization role. Refused,
349+
// never defaulted to `member`.
350+
const blankRole = blankInvitationRoleRefusal(invitation?.role);
351+
if (blankRole) {
352+
const { APIError } = await import('better-auth/api');
353+
throw new APIError('BAD_REQUEST', { message: blankRole.message, code: blankRole.code });
354+
}
355+
342356
const inviterUserId = inviter?.id ?? inviter?.userId ?? null;
343357
const organizationId = organization?.id ?? invitation?.organizationId;
344358

‎packages/plugins/plugin-auth/src/invitation-role-cap.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@ export function invitationRoleCapFailure(
184184
issuerRole: unknown,
185185
): InvitationRoleCapRefusal | null {
186186
const requested = parseOrgRoles(requestedRole);
187-
// No role at all: better-auth's body schema requires one, so this is not a
188-
// reachable invitation shape. Nothing to cap — the route rejects it upstream.
187+
// No role at all: nothing to cap. A blank role IS reachable — better-auth's
188+
// body schema accepts `""` and its role check drops empty entries — and it is
189+
// refused before this cap is asked (`blankInvitationRoleRefusal`,
190+
// `invite-role-not-found-code.ts`), so a blank entry never reaches a verdict here.
189191
if (requested.length === 0) return null;
190192
if (isPlainMemberInvitation(requestedRole)) return null;
191193

‎packages/plugins/plugin-auth/src/invite-role-not-found-code.ts‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,44 @@ export async function codeInviteRoleNotFound(ctx: any): Promise<void> {
6666
if (typeof message !== 'string' || !message.startsWith(VENDOR_MESSAGE_PREFIX)) return;
6767
throw new APIError('BAD_REQUEST', { code: ROLE_NOT_FOUND_CODE, message });
6868
}
69+
70+
/** A refusal this module answers on the invite door: the ADR-0112 code and the sentence. */
71+
export interface InviteRoleRefusal {
72+
readonly code: typeof ROLE_NOT_FOUND_CODE;
73+
readonly message: string;
74+
}
75+
76+
/**
77+
* Does the requested role value carry a BLANK entry — the whole value empty or
78+
* whitespace-only (`""`, `" "`, `[]`), or one empty entry in a role list
79+
* (`"member,"`, `["member", ""]`)?
80+
*
81+
* better-auth's role check splits the list and drops empty entries before it
82+
* looks for unknown names, so a blank entry yields no unknown role and the
83+
* vendor writes the raw value: `sys_invitation.role = ''` (or `'member,'`).
84+
* Under a walled group, accepting such an invitation writes a membership with
85+
* no organization role. A blank entry names no role in the ADR-0108
86+
* vocabulary, so it is refused exactly like an unknown one — never defaulted
87+
* to `member`, which would be a product choice and not a refusal.
88+
*/
89+
export function hasBlankInvitationRoleEntry(requestedRole: unknown): boolean {
90+
const flat = Array.isArray(requestedRole) ? requestedRole.join(',') : requestedRole;
91+
if (typeof flat !== 'string') return false;
92+
return flat.split(',').some((entry) => entry.trim().length === 0);
93+
}
94+
95+
/**
96+
* The refusal for a blank invitation role, or `null` when every entry names a
97+
* role. Same code and status family as the vendor's unknown-role refusal
98+
* (`400 ROLE_NOT_FOUND`), with a sentence that says the role is empty. Asked
99+
* in `beforeCreateInvitation`, so no invitation row is written.
100+
*/
101+
export function blankInvitationRoleRefusal(requestedRole: unknown): InviteRoleRefusal | null {
102+
if (!hasBlankInvitationRoleEntry(requestedRole)) return null;
103+
return {
104+
code: ROLE_NOT_FOUND_CODE,
105+
message:
106+
`${VENDOR_MESSAGE_PREFIX}the invitation role is empty — name the organization role ` +
107+
`the invitee joins with; a blank role, or an empty entry in a role list, names no role.`,
108+
};
109+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
//
3+
// [#29158] `POST /auth/organization/invite-member` refuses a BLANK role the way
4+
// it refuses an unknown one — 400 `ROLE_NOT_FOUND`, and no `sys_invitation`
5+
// row — in both postures the defect was measured in.
6+
//
7+
// better-auth's own role check splits the role list and drops empty entries, so
8+
// a blank role yields no unknown role: on `main` before this the door answered
9+
// 200 and stored `role: ''`, and on a walled `group` boot the invitee's
10+
// acceptance wrote a `sys_member` row with no organization role. The
11+
// framework's `beforeCreateInvitation` now refuses it before any row exists;
12+
// it never defaults the role to `member`.
13+
//
14+
// Why a dogfood beside the unit pins: only the composed stack runs the vendor
15+
// route, the framework hook and the ObjectQL write together, on both postures.
16+
17+
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
18+
import crmStack from '@objectstack/example-crm';
19+
import { bootStack, type VerifyStack } from '@objectstack/verify';
20+
21+
const SYS = { context: { isSystem: true } };
22+
23+
for (const posture of ['single', 'group'] as const) {
24+
describe(`[#29158] ${posture}: invite-member refuses a blank role 400 ROLE_NOT_FOUND`, () => {
25+
let stack: VerifyStack;
26+
let ql: any;
27+
let token: string;
28+
let orgId: string;
29+
const previous = process.env.OS_TENANCY_POSTURE;
30+
31+
const invitationsFor = async (email: string): Promise<Record<string, unknown>[]> =>
32+
ql.find('sys_invitation', { where: { email }, ...SYS });
33+
34+
beforeAll(async () => {
35+
process.env.OS_TENANCY_POSTURE = posture;
36+
stack = await bootStack(crmStack as never, posture === 'single' ? {} : { multiTenant: 'posture-only' });
37+
const adminToken = await stack.signIn();
38+
ql = await stack.kernel.getServiceAsync<any>('objectql');
39+
40+
if (posture === 'single') {
41+
// The seeded admin owns the Default Organization the boot created.
42+
token = adminToken;
43+
const [org] = await ql.find('sys_organization', { where: { slug: 'default' }, limit: 1, ...SYS });
44+
expect(org?.id, 'the boot created the Default Organization').toBeTruthy();
45+
orgId = String(org.id);
46+
return;
47+
}
48+
49+
// Walled: the admin creates a second organization and owns it — the
50+
// issuer the card measured is the owner of an organization other than
51+
// the Default one.
52+
token = adminToken;
53+
const created = await stack.apiAs(token, 'POST', '/auth/organization/create', {
54+
name: 'Blank Role Org',
55+
slug: 'blank-role-org',
56+
});
57+
expect(created.status, `organization/create: ${await created.clone().text()}`).toBe(200);
58+
orgId = String(((await created.json()) as { id?: string }).id ?? '');
59+
expect(orgId).not.toBe('');
60+
}, 180_000);
61+
62+
afterAll(async () => {
63+
await stack?.stop?.();
64+
if (previous === undefined) delete process.env.OS_TENANCY_POSTURE;
65+
else process.env.OS_TENANCY_POSTURE = previous;
66+
});
67+
68+
it('guard: the boot runs the posture under test', async () => {
69+
const tenancy = await stack.kernel.getServiceAsync<{ posture: string; degraded: boolean }>('tenancy');
70+
expect(tenancy.posture).toBe(posture);
71+
expect(tenancy.degraded).toBe(false);
72+
});
73+
74+
const BLANK_ROLES = [
75+
['an empty role', ''],
76+
['a whitespace-only role', ' '],
77+
['an empty entry in a role list', 'member,'],
78+
] as const;
79+
for (const [label, role] of BLANK_ROLES) {
80+
it(`${label} is refused 400 ROLE_NOT_FOUND and leaves no invitation row`, async () => {
81+
const email = `blank-${posture}-${BLANK_ROLES.findIndex(([, r]) => r === role)}@dogfood.test`;
82+
const res = await stack.apiAs(token, 'POST', '/auth/organization/invite-member', {
83+
email,
84+
role,
85+
organizationId: orgId,
86+
});
87+
const text = await res.clone().text();
88+
expect(res.status, text).toBe(400);
89+
const body = JSON.parse(text) as { code?: string; error?: { code?: string } };
90+
expect(body.code ?? body.error?.code, text).toBe('ROLE_NOT_FOUND');
91+
expect(await invitationsFor(email)).toEqual([]);
92+
}, 60_000);
93+
}
94+
95+
it('CONTROL: a named role is unchanged — 200 and one pending row carrying it', async () => {
96+
const email = `named-${posture}@dogfood.test`;
97+
const res = await stack.apiAs(token, 'POST', '/auth/organization/invite-member', {
98+
email,
99+
role: 'member',
100+
organizationId: orgId,
101+
});
102+
expect(res.status, await res.clone().text()).toBe(200);
103+
const rows = await invitationsFor(email);
104+
expect(rows.map((r) => [r.role, r.status])).toEqual([['member', 'pending']]);
105+
}, 60_000);
106+
});
107+
}

0 commit comments

Comments
 (0)