Skip to content

Managed profile team access and invitation feature - #1364

Open
gianfra-t wants to merge 11 commits into
stagingfrom
feat/managed-profile-team-access
Open

Managed profile team access and invitation feature#1364
gianfra-t wants to merge 11 commits into
stagingfrom
feat/managed-profile-team-access

Conversation

@gianfra-t

Copy link
Copy Markdown
Contributor

Summary

  • Add child-scoped Manager and Read-only memberships while preserving immutable ownership and owner-only lifecycle actions.
  • Add email invitations with seven-day expiry, explicit verified-email acceptance, and transactional audit history.
  • Add dashboard Team management, invitation acceptance, role-aware controls, and child API-key administration.
  • Enforce live membership permissions across bearer sessions and API credentials; require secret credentials for child ramp mutations.
  • Update OpenAPI, integration guides, and security specifications.

@netlify

netlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy Preview for vortexfi canceled.

Name Link
🔨 Latest commit 64116cf
🔍 Latest deploy log https://app.netlify.com/projects/vortexfi/deploys/6a9f699b94953000094e6472

@netlify

netlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy Preview for vortex-sandbox ready!

Name Link
🔨 Latest commit 64116cf
🔍 Latest deploy log https://app.netlify.com/projects/vortex-sandbox/deploys/6a9f699b76ec55000821760f
😎 Deploy Preview https://deploy-preview-1364--vortex-sandbox.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy Preview for vrtx-dashboard ready!

Name Link
🔨 Latest commit 64116cf
🔍 Latest deploy log https://app.netlify.com/projects/vrtx-dashboard/deploys/6a9f699be1b77d00084ab6eb
😎 Deploy Preview https://deploy-preview-1364--vrtx-dashboard.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new deferred database invariant can break managed-profile provisioning during a rolling deployment.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds managed-profile team memberships, invitation acceptance, role-aware authorization, dashboard controls, and corresponding contracts/security documentation.

Changes:

  • Introduces manager/read-only memberships with audited invitations.
  • Enforces membership capabilities across sessions and credentials.
  • Adds Team management UI, tests, OpenAPI, and security documentation.

Review finding: Migration 069’s owner-membership trigger is incompatible with older API instances during rolling deployment and must be staged separately.

File summaries
File Description
apps/api/src/database/migrations/069-create-managed-profile-memberships.ts Adds membership schema and invariants.
apps/api/src/database/migrations/070-email-notification-direct-recipients.ts Supports invitation-email recipients.
apps/api/src/database/managed-profile-memberships-schema.test.ts Tests database membership constraints.
apps/api/src/api/services/managed-profile-membership.service.ts Implements invitations and membership lifecycle.
apps/api/src/api/services/managed-profile-lifecycle.service.ts Returns membership-aware managed profiles.
apps/api/src/api/middlewares/managedProfileAuth.ts Enforces delegated capabilities.
apps/api/src/api/routes/v1/managed-profile-memberships.route.ts Exposes membership endpoints.
apps/api/src/api/routes/v1/ramp.route.ts Enforces child ramp authentication.
apps/api/src/api/services/email/managed-profile-membership-invitation.ts Creates invitation emails.
apps/api/src/api/services/email/notification.service.ts Delivers direct-recipient notifications.
apps/dashboard/src/components/managed-profiles/Team.tsx Adds Team management UI.
apps/dashboard/src/routes/member-invitations.$invitationId.tsx Adds invitation acceptance flow.
apps/dashboard/src/hooks/useManagedProfileBootstrap.ts Refreshes live membership state.
docs/api/openapi/vortex.openapi.json Documents the public API contract.
docs/security-spec/01-auth/managed-profile-memberships.md Defines membership security invariants.
docs/security-spec/03-ramp-engine/recipient-transfers.md Documents delegated recipient permissions.
docs/security-spec/07-operations/client-observability.md Defines invitation telemetry restrictions.
docs/security-spec/07-operations/notifications.md Documents direct invitation email behavior.
docs/README.md Updates the documentation index.
Review details
  • Files reviewed: 144/146 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +304 to +308
affected_member_profile_ids := ARRAY[OLD.id, NEW.id];
END IF;
END IF;

IF EXISTS (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale, migration was modified. Must be rechecked.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The migration breaks managed-profile provisioning during rolling deployment, and invitation creation holds database locks across an external authentication request.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

apps/api/src/database/migrations/069-create-managed-profile-memberships.ts:353

  • This deferred trigger makes migration 069 incompatible with still-running pre-PR API instances. After the migration commits, a legacy provisioning transaction still inserts an active managed_profiles row but does not insert managed_profile_memberships; its commit therefore fails with 23514. Because migrations run at API startup, a rolling deployment can break managed-profile creation until every old instance is drained. Stage the invariant (for example, deploy dual-writing code before enabling the trigger, or add the constraint in a later gated migration) so old and new instances can coexist during rollout.
  • Files reviewed: 151/157 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +299 to +302
// Local email is only a hint: it may belong to someone else since the member
// changed their login. An unconfirmed lookup must not veto an email-bound invite;
// acceptance still requires the current verified principal and checks membership.
const current = await SupabaseAuthService.getUserProfile(existingProfile.id).catch(() => null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants