OPER-128
[OPER-QA-2] Tester invitation flow — invite by email, resolve to TeamMembership
Band
MEDIUM
Suggested
Justin Cooke
Body
feature_id: FEAT-studio-qa-projects
## Context
External QA testers (Fiesta UAT: Ana Torres, Hannah Clement) must be invited via email and resolved to a Portico `TeamMembership` before they can be added as `QaTestProjectMember`. This ticket wires the invitation endpoint + resolution logic.
Reuses the existing Portico auth stack (NextAuth v5 + magic link). No new identity system.
## Acceptance Criteria
- `POST /api/studio/[team]/qa/projects/[id]/invite` accepts `{ email, role: 'LEAD' | 'RUNNER' | 'REVIEWER' }`
- Sends magic-link invitation via existing `@operant/email` template (new `qa-tester-invite.tsx`)
- On invitation acceptance (magic-link callback), creates a Portico `TeamMembership` if none exists, then upserts `QaTestProjectMember`
- Idempotent: re-inviting same email is a no-op if already a member
- Vitest coverage: (a) invite non-existing user → membership + project-member created; (b) invite existing user → project-member only; (c) re-invite is no-op; (d) invalid role rejected
- Manual smoke documented in PR: invite `[REDACTED-EMAIL]` from a test project, verify email received and acceptance flow lands both rows
Attachments
Loading attachments…
Comments
Loading comments…