Skip to content

feat(organizations): expose organization and permission group administration - #8102

Merged
waleedlatif1 merged 7 commits into
stagingfrom
codex/permission-groups-api
Sep 21, 2026
Merged

waleedlatif1 merged 7 commits into
stagingfrom
codex/permission-groups-api

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Expose permission groups and organization administration through shared application use cases, the public API, CLI, and MCP. Organization operations cover discovery, workspaces, member roles/removal, and invitation create/list/get/resend/revoke.
  • Keep organization roles separate from workspace permissions, preserve internal workspace-admin invitation access, and enforce current credential, role, and permission-group policies across surfaces.
  • Align CLI flags and identifiers: --default / --no-default, --user, --all-members, and user IDs for membership removal. Keep workspace discovery under organizations workspaces.
  • Protect invitation delivery, expiration, concurrent membership changes, pagination, and audit attribution; regenerate API and CLI documentation.
  • Preserve existing partial-success handling, successful role-update audits, and conflict responses during concurrent membership changes.

Type of Change

  • Feature
  • Bug fix

Testing

1,360 focused application and policy tests, 1,182 CLI tests, and 56 documentation tests passed (3 existing CLI tests skipped). All 47 repository audits, all workspace type checks, lint, generated-document checks, and the block-registry check passed. Cleanup completed with no findings. No database migrations or UI changes.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Sep 21, 2026 6:23pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the prior findings are resolved or withdrawn, and no actionable new regression remains.

Summary

This PR exposes organization and permission-group administration through shared application use cases, internal and public APIs, MCP, and the CLI. It also strengthens invitation and membership mutation behavior and regenerates the corresponding documentation.

  • Adds organization discovery, workspace, member, and invitation operations.
  • Adds permission-group CRUD and membership operations with bounded bulk processing.
  • Centralizes authorization, auditing, pagination, and presentation across API surfaces.
  • Preserves legacy membership-removal error contracts while allowing application use cases to propagate failures.
  • Adds database-time expiry protection for scoped invitation revocation.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI[CLI] --> Contracts[Shared API contracts]
  MCP[MCP] --> Contracts
  Internal[Internal API] --> Routes[Route adapters]
  Public[Public API v2] --> Routes
  Contracts --> Routes
  Routes --> UseCases[Authorized application use cases]
  UseCases --> Auth[Organization and permission-group authorization]
  UseCases --> Audit[Semantic audit]
  UseCases --> Managers[Domain managers]
  Managers --> DB[(Database)]
  Managers --> Delivery[Invitation delivery]
Loading

Reviews (8) · Last reviewed commit: "fix(organizations): preserve member admi..."

Comment thread apps/sim/lib/permission-groups/member-manager.ts Outdated
Comment thread packages/sim-cli/src/contract/commands.ts

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 51 files

Not reviewed (too large): apps/docs/openapi-v2-resources.json (~12,735 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread apps/sim/lib/permission-groups/group-manager.ts Outdated
Comment thread packages/sim-cli/src/contract/commands.ts
Comment thread apps/sim/lib/permission-groups/member-manager.ts
Comment thread apps/sim/lib/api/contracts/v2/openapi/permission-groups.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 54 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Not reviewed (too large): apps/docs/openapi-v2-resources.json (~12,735 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

Re-trigger cubic

@waleedlatif1 waleedlatif1 changed the title feat(permission-groups): expose administration through API CLI and MCP feat(organizations): expose organization and permission group administration Sep 21, 2026
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/sim/lib/api/contracts/organization.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile Please re-review the resolved contract-documentation finding against the current head. The thread reply cites the repository rule and audit implementation, which exclude nested arbitrary metadata from opaque-response annotations; the other cited comments are unchanged from staging.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 106 files

Not reviewed (too large): apps/docs/openapi-v2-resources.json (~14,826 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread apps/sim/lib/invitations/mutation-manager.ts
Comment thread apps/sim/lib/permission-groups/member-manager.ts
Comment thread apps/sim/lib/invitations/core.ts
Comment thread apps/sim/app/api/invitations/[id]/route.ts
Comment thread apps/sim/lib/invitations/application/mutations.ts Outdated
Comment thread apps/sim/lib/invitations/application/mutations.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/sim/lib/invitations/core.ts

@cubic-dev-ai cubic-dev-ai Bot 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.

1 issue found across 108 files

Confidence score: 3/5

  • apps/sim/lib/invitations/mutation-manager.ts: A policy change between preflight validation and prepareInvitationResend commit can allow a resend under stale admission, grant, or billing rules, creating a concrete authorization or billing consistency risk. Re-evaluate the relevant policies atomically at commit time or otherwise prevent stale-policy commits.

Not reviewed (too large): apps/docs/openapi-v2-resources.json (~14,826 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/lib/invitations/mutation-manager.ts">

<violation number="1" location="apps/sim/lib/invitations/mutation-manager.ts:40">
P2: When an invitation policy changes after these preflight checks but before `prepareInvitationResend` commits, the resend still succeeds under the stale policy. Re-evaluate the admission, grant, and billing policies inside the protected resend operation (or lock/version those policies) before sending the email.</violation>
</file>

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/invitations/mutation-manager.ts Outdated
Comment thread apps/sim/lib/invitations/send.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 115 files

Not reviewed (too large): apps/docs/openapi-v2-resources.json (~14,826 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/invitations/mutation-manager.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 115 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Not reviewed (too large): apps/docs/openapi-v2-resources.json (~14,826 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 666a971 into staging Sep 21, 2026
35 checks passed
@waleedlatif1
waleedlatif1 deleted the codex/permission-groups-api branch September 21, 2026 19:53

This branch was successfully deployed

1 active deployment
Preview b394cd68 Deployed Sep 21, 2026 by vercel[bot]
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.

1 participant