Skip to content

refactor(auth): consume Utopia OAuth2 clients and validators - #13227

Draft
eldadfux wants to merge 5 commits into
cursor/use-utopia-phrase-1299from
cursor/use-utopia-auth-clients-1299
Draft

refactor(auth): consume Utopia OAuth2 clients and validators#13227
eldadfux wants to merge 5 commits into
cursor/use-utopia-phrase-1299from
cursor/use-utopia-auth-clients-1299

Conversation

@eldadfux

@eldadfux eldadfux commented Aug 15, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Switches Appwrite off the in-tree Auth OAuth2 adapters and validators, which now live in Utopia:

  • OAuth2 login, callback, VCS installs, and Project credential checks use Utopia\Auth\OAuth2\Providers\* via Appwrite\Auth\OAuth2Client (injects _APP_OPENSSL_KEY_V1 for PKCE and the Appwrite user agent).
  • Password / personal-data / mock-number validators import Utopia\Auth\Validator\*.
  • Phone params use published Utopia\Validator\Phone (E.164). knownCallingCode is not on validators 0.5.0; restore it after that API is released.
  • Deletes src/Appwrite/Auth/OAuth2* and src/Appwrite/Auth/Validator/*. Keeps Key and MFA.
  • Contributor tutorial for new providers points at packages/auth in the Utopia monorepo.

Stacked on #13226 (Phrase). Depends on utopia-php/monorepo#137.

Unpublished packages

No vendored tarballs. Composer consumes the in-flight auth branch the way Utopia Split Dev documents:

"utopia-php/auth": "dev-cursor/auth-validators-oauth2-1299 as 0.10.999"

from the existing github.com/utopia-php/auth VCS repository (Packagist already lists that branch). utopia-php/validators stays on published ^0.5 (0.5.0).

To also consume the unpublished CallingCode Phone API, dispatch Split Dev on the monorepo branch for validators, then switch that constraint to dev-cursor/auth-validators-oauth2-1299 as 0.5.999 and pass knownCallingCode: true again.

Before merge, replace the auth alias with a released Packagist constraint (^0.11 or whatever the tag is).

Tests

Removed Appwrite unit tests that only re-ran library behavior now covered in Utopia:

  • Password, PasswordDictionary, PasswordStrength, PersonalData, EmailWhitelistpackages/auth/tests/Auth/Validator/
  • Phonepackages/validators/tests/Validator/PhoneTest.php

tests/unit/Auth/KeyTest.php stays. Appwrite E2E and Project/VCS unit tests that exercise Appwrite wiring stay.

Projects E2E testUpdateMockNumbers expects the Utopia Phone description (between 7 and 15 digits).

Related PRs and Issues

Open in Web Open in Cursor 

Switch account, VCS, and Project OAuth2 flows to
Utopia\Auth\OAuth2\Provider adapters, and password/phone input rules to
Utopia\Auth\Validator plus Phone(knownCallingCode: true).

Appwrite keeps Key, MFA, and a thin OAuth2Client helper that injects
_APP_OPENSSL_KEY_V1 and the Appwrite user agent. Adapter unit tests move
with the library.

Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Composer cannot resolve utopia-php/auth ^0.11 or the CallingCode Phone
API from Packagist yet. Point auth at the split-dev snapshot on the
mirror and validators at a small dist tarball of the monorepo package so
Checks, Image, and Build can install.

Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown

✨ Benchmark results

Comparing cursor/use-utopia-phrase-1299 (before) → cursor/use-utopia-auth-clients-1299 (after).

Metric Before After Change
🚀 Requests/sec 166.51 163.74 -1.7%
⏱️ Latency P50 86.51 ms 88.53 ms +2.3%
⏱️ Latency P95 297.19 ms 303.45 ms +2.1%
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 88.53 303.45 10,203 163.74 +6.26
Account 159.72 400.83 537 8.99 +1.24
TablesDB 84.79 275.65 5,549 90.46 +10.74
Storage 79.91 276.88 2,685 45.9 -5.33
Functions 136.92 379.13 1,432 25.04 +28.95

Top API waits (after)

API request Max wait (ms)
account.name.update 1,145.33
functions.variables.delete 991.49
functions.specifications.list 913.71
functions.variables.update 888.57
storage.files.download 839.47

cursoragent and others added 3 commits August 16, 2026 08:07
Mock-number 400 responses now use the library description (7–15 digits)
instead of the old Appwrite Phone wording.

Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Password, dictionary, strength, personal-data, and email-whitelist
coverage lives in utopia-php/auth. Phone coverage lives in
utopia-php/validators. Keep KeyTest, which still exercises Appwrite code.

Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
Replace the package-type tar.gz pins with the documented Split Dev
consume path: utopia-php/auth is required as
dev-cursor/auth-validators-oauth2-1299 as 0.10.999 from the VCS
mirror. Validators stays on published 0.5.0, so Phone params no longer
pass knownCallingCode (that flag is not in 0.5.0).

Co-authored-by: Eldad A. Fux <eldadfux@users.noreply.github.com>
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