Add OAuth providers migration#191
Conversation
…nto add-oauth-providers-migration
Greptile SummaryThis PR adds full OAuth2 provider migration support between Appwrite instances, covering all 40 providers. It introduces a clean three-tier class hierarchy (
Confidence Score: 3/5The core migration logic is sound but the Apple branch has a concrete data mutation flaw that should be fixed before merging. The Apple branch in
Important Files Changed
Reviews (10): Last reviewed commit: "OAuth2: DRY secret merge, surface unmapp..." | Re-trigger Greptile |
…oved oAuthProviders off Models\Project)
… broken sign-in flow)
… non-secret fields
…atus counter size limit)
- Destination: dispatch via explicit case Resource::TYPE_OAUTH2_PROVIDER instead of default + instanceof - Source: count in report() directly like sibling resources (drop try/catch), and move the in_array guard inside the export try - Harden mergeAppleSecret/mergeJsonSecret against non-array decoded JSON - Fix stale OAuth2Provider docblock (single shared TYPE, not per-subclass)
- mergeAppleSecret now delegates to mergeJsonSecret (one merge implementation) - exportOAuth2Providers surfaces providers with no Resource class as non-fatal errors instead of dropping them silently - report() counts only migratable providers; fix the misleading enabled comment - use elseif for the mutually-exclusive provider-shape branches - add AppwriteOAuth2SecretTest (secret-merge) and OAuth2ProviderTransferTest (transfer round-trip via MockSource/MockDestination)
Summary
TYPE_OAUTH_PROVIDERStoGROUP_AUTH_RESOURCESfor migrating the project's OAuth2 provider configuration map.Sources/Appwrite) reads$project->oAuthProvidersand emits oneOAuthProviderssingleton carryingkey/enabled/appIdfor each provider.Destinations/Appwrite) merges the entries into the project doc'soAuthProvidersmap as flat{key}Enabled/{key}Appidkeys viadbForPlatform(mirrors the destination path used byauth-methods/policies).{key}Secretis intentionally not migrated — the source API never exposes secrets and the destination user must re-enter them post-migration. Same caveat as the SMTP password handling.GROUP_AUTH(notGROUP_INTEGRATIONS) — OAuth providers are auth methods that happen to use external identity providers; same group asTYPE_AUTH_METHODSandTYPE_POLICIES.Test plan
testAppwriteMigrationOAuthProviders(in appwrite/appwrite) passes