BOLT-1613: Admin cross-org invite mutation + UI
completedAgent: sergey-engineer
Priority: 1
Branch:
havoc/bolt-1613-admin-invite-domainPR: #13533
Linear: BOLT-1613
BOLT-1613: Allow inviting people to any org from admin.texturehq.com (super-admin-only tool).
Branch: havoc/bolt-1613-admin-invite-any-org
Backend (domains/identity):
- New mutation `adminCreateInvitation(input: AdminCreateInvitationInput!): Invitation! @requireSuperAdmin`
- typeDefs.graphql: add input AdminCreateInvitationInput { organizationId: ID!, email: String!, role: Role! } + mutation field
- resolver at src/graphql/resolvers/invitation/mutations/adminCreateInvitation.ts, modeled on createInvitation.ts but:
- no reliance on context.authenticationContext.claims.organization (comes from input.organizationId instead)
- super-admin gating handled entirely by @requireSuperAdmin directive (see createOrganizationAffiliation.ts / enablePack.ts for the pattern)
- reuse invitationService.create(...) (domains/identity/src/services/invitation/create.ts) passing organizationId from input, userId = caller's subjectId
- writeAuditLog with action "invitation.adminCreate"
- register in src/graphql/resolvers/mutation/index.ts
- regenerate supergraph schema: cd domains/identity && yarn subgraph:print (writes infra/supergraph-gateway/schemas/identity.graphql) && yarn graphql:types:generate
- add resolver test (auth-gating: non-super-admin rejected; happy path creates invitation + audit log)
Frontend (apps/admin):
- Add "Invite Member" UI to Members section of app/(shell)/organizations/[id]/page.tsx
- New component e.g. components/InviteMemberDialog.tsx or inline form (follow AffiliatedOrganizationsManagement.tsx pattern: Select/TextField + Button, success/error Notice)
- New hook hooks/useAdminInviteMember.ts wrapping the AdminCreateInvitation mutation (graphql() codegen tag like useOrganizationPacks.ts)
- Role select: USER / ADMIN / VIEWER / OPERATOR (see Role enum, identity typeDefs.graphql ~line 1960)
- Run codegen for admin app after backend schema lands: cd apps/admin && yarn graphql:types:generate (check package.json script name)
Done when: lint+typecheck+tests pass locally; PR opened; CI green; DeepSource clean; Sergey-reviewed. Post PR link to Slack #bots-havoc thread.
Event Timeline
created
progress
knip CI failure fixed (unused exported AdminInvitationData interface -> made non-exported). Pushed commit 24710fb171. Watching CI for green.
progress
DeepSource cyclomatic-complexity failure fixed (OrganizationDetailPage was at 40/very-high after invite feature added inline). Extracted InviteMemberForm component. Pushed commit 0684428a29. Watching CI for green.
status_change
in_progress → completed
progress
Pushed vitest configuration updates (deduping React and inlining @texturehq/edges context dependencies) across all edges packages to resolve duplicate React instance crashes during CI. CI watch updated and monitoring PR 13534.