Skip to content

fix(teams): let editions override the per-instance organization limit - #13608

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/organization-limit-seam
Sep 10, 2026
Merged

ChiragAgg5k merged 1 commit into
mainfrom
fix/organization-limit-seam

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

#13585 made POST /teams on the console project refuse a second organization per instance. That policy is right for self-hosted, but Appwrite Cloud runs the same action and governs organizations through its billing plans, so every cloud E2E flow that creates a console team started failing with 403 organization_creation_prohibited, and CE's own E2E suites crashed inside the cloud pod (appwrite-labs/cloud#5755).

  • The console check moves into a protected isOrganizationLimited(Document $project): bool on the Teams Create action. The limit, its distributed lock and the unauthenticated-user guard all key off that method. Self-hosted behaviour is unchanged and there is no environment switch, so a self-hosted operator cannot turn the limit off; cloud overrides the method in its subclass, the same way it already overrides the membership Delete action.
  • Scope::createTeamFixture() calls the public create API first. A 201 is followed by the same authorized GET /teams/{id} and returned. Anything else must be 403 organization_creation_prohibited, and only then are the rows seeded through the registry. The registry path reads pools-cache, which cloud's bootstrap does not define, so it failed with No adapters provided whenever CE suites ran in cloud.

Coverage

The self-hosted policy is still covered by the fresh-instance run of TeamsConsoleClientTest::testCreateOrganization and by the 403 assertions in TeamsBase. The override path cannot be observed from this repository; it is exercised by the cloud E2E matrix (CE suites run inside cloud plus Tests\Cloud\E2E\General\UsageTest::testTenantIsolation, ProjectUsageTest, RealtimeOriginTest and others), which fails on 1ded023 and is run against this branch from appwrite-labs/cloud.

Verification

  • Pint and php -l on the changed files, git diff --check.
  • Cloud CI against this branch is linked from appwrite-labs/cloud.

@ChiragAgg5k
ChiragAgg5k force-pushed the fix/organization-limit-seam branch from 34b34c9 to 3c73c84 Compare September 10, 2026 12:36
@greptile-apps

greptile-apps Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness or repository-rule violations identified.

Summary

  • Extracts the organization-limit decision into a protected method used consistently by authorization, locking, and transactional checks.
  • Updates team fixture creation to prefer the public API and use direct registry seeding only after the expected organization-limit refusal.

Reviews (2) · Last reviewed commit: "fix(teams): let editions override the pe..."

The console organization limit from #13585 is right for self-hosted but Appwrite Cloud governs organizations through billing plans and runs the same action. The decision now lives in a protected method the cloud subclass overrides, so it cannot be switched off by configuration on a self-hosted instance. The console team fixture creates through the public API first and seeds rows only when the instance refuses, so CE suites also run inside the cloud pod.
@ChiragAgg5k
ChiragAgg5k force-pushed the fix/organization-limit-seam branch from 5c82e8d to adaecef Compare September 10, 2026 12:46
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/organization-limit-seam (after).

Metric Before After Change
🚀 Requests/sec 236.4 238.55 ⚪ +0.9%
⏱️ Latency P50 74.55 ms 74.07 ms ⚪ -0.6%
⏱️ Latency P95 171.85 ms 169.14 ms ⚪ -1.6%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 74.07 169.14 14,820 238.55 -2.71
Account 144.75 262.15 780 13.33 +5.71
TablesDB 71.7 132.24 8,060 133.17 +2.5
Storage 66.73 143.79 3,900 66.09 -5.88
Functions 107.23 200.05 2,080 35.95 -4.96

Top API waits (after)

API request Max wait (ms)
account.name.update 408.27
functions.variables.update 369.87
account.prefs.update 338.62
storage.files.create 321.84
functions.variables.delete 308.63

@ChiragAgg5k
ChiragAgg5k merged commit a30ebb2 into main Sep 10, 2026
88 of 89 checks passed
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.

3 participants