Repository navigation
Enforce the self-hosted organization limit per instance - #13585
Conversation
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
|
|
@greptile review |
|
@greptile review Please reassess the two findings in light of the thread replies and the explicit PR constraints: no edition/environment bypass; database seeding is deliberate Arrange setup for legacy multi-organization state, with observable API assertions and separate fresh-instance creation coverage retained. No source changes have been made for these findings. |
|
Release sequencing: release the companion console PR https://github.com/appwrite/vibes/pull/326 first, then pin its published console image version in Docker Compose before shipping this backend restriction. The console image bump is pending the actual release tag; no unreleased version has been substituted. |
Cloud sets _APP_EDITION=cloud and governs organizations through billing plans, so the per-instance limit introduced in #13585 broke every cloud E2E flow that creates a console team through POST /teams. The limit and its distributed lock now apply only when the edition is self-hosted, and the console team fixture uses the public create API under any other edition instead of seeding rows through the self-hosted registry.
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.
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.
Summary
Enforce one console organization per self-hosted instance, rather than relying on the frontend restriction or an account-scoped limit that can be bypassed by signing up again.
teamscollection is empty, checked without caller permission filtering.409 general_resource_locked; it never falls back to unlocked creation.403 organization_creation_prohibitedwith invitation guidance once an organization exists._APP_LOCKING_ENABLED=disabled.Frontend guidance, retry suppression, and corrected self-hosting docs: https://github.com/appwrite/vibes/pull/326. This intentionally tightens the API policy beyond the console behavior discussed in vibes #251.
Tests and fixtures
The focused policy regression stays in the existing
TeamsConsoleClientTest.php; no new backend test file.Console organizations needed as prerequisites by existing tests are now seeded as pre-existing database fixtures, with a confirmed owner membership and user-cache invalidation. The fixture response is a real authorized
GET /teams/{id}(200), not a fabricated successful create response. Application teams still use the real create API (201). Existing permission, membership, project, and failure assertions remain; fixture setup no longer expects a prohibited console create to succeed.CI runs the fresh-instance policy method before parallel Teams tests seed legacy organizations.
_APP_E2E_FRESH_INSTANCEonly selects that test in the test runner; production code does not read it.Verification
Passing
_APP_LOCKING_ENABLED=disabledThe separately run policy test covers four concurrent requests across two accounts, exactly one created organization, owner rejection, and rejection for a newly registered account that sees zero organizations.
Additional PostgreSQL checks:
projectsCRUDgroup: 5 tests, 241 assertions passed (creation, transfer, listing, select queries, mock numbers).git diff --check: passed.Real self-hosted UI and API
Ran Playwright against a fresh isolated PostgreSQL instance, the companion frontend, a real mail worker, and a local mail catcher:
/accountwith persistent invitation guidance, including after reload. Authenticated API reads returned zero visible organizations/projects.First account:
Uninvited account after reload:
After accepting the email invitation:
Synthetic accounts only. These are application screenshots, not generated evidence pages. Usage collection was disabled in the isolated stack, hence “Usage unavailable.”
Known baseline failures / scope of verification
Services/Organizationsuite still has 7 failures. Reproduced failures using the pre-policy Teams handler and original test setup: it requests console teams in project-admin mode, which returns400 Admin mode is not allowed for console project. The suite also contains duplicated/v1URL prefixes. Its contract assertions were not removed or weakened to turn it green.