Skip to content

Add Custom Domains migration#188

Open
premtsd-code wants to merge 6 commits into
add-smtp-migrationfrom
add-custom-domains-migration
Open

Add Custom Domains migration#188
premtsd-code wants to merge 6 commits into
add-smtp-migrationfrom
add-custom-domains-migration

Conversation

@premtsd-code
Copy link
Copy Markdown
Contributor

Summary

  • Adds a new GROUP_DOMAINS resource group with Resource::TYPE_RULE for migrating custom-domain proxy rules.
  • Source (Sources/Appwrite) lists rules via the console SDK's Proxy service, paginated with cursor.
  • Destination (Destinations/Appwrite) dispatches to the SDK's four proxy-rule create endpoints (createAPIRule, createFunctionRule, createSiteRule, createRedirectRule) based on the rule's type + deploymentResourceType.
  • Auto-generated .appwrite.network rules are skipped — they're recreated automatically when the parent Function/Site is migrated.
  • Cross-project domain uniqueness conflicts (409) are surfaced as STATUS_WARNING rather than aborting the migration, since the source must release the domain first.
  • Stubbed exportGroupDomains in Firebase / NHost / JSON / CSV sources to satisfy the new abstract method.

Test plan

  • CI lints + tests green
  • E2E testAppwriteMigrationCustomDomains (in appwrite/appwrite) passes

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 21, 2026

Greptile Summary

This PR introduces custom-domains migration by adding a new GROUP_DOMAINS group backed by a Rule resource, wiring up paginated export from the Appwrite proxy source, and dispatching to the four proxy-rule create endpoints (createAPIRule, createFunctionRule, createSiteRule, createRedirectRule) in the destination. Auto-generated .appwrite.network rules are skipped at the destination, and 409 conflicts surface as warnings rather than hard failures.

  • Rule resource class, GROUP_DOMAINS/GROUP_DOMAINS_RESOURCES constants, and exportGroupDomains abstract method added across source/destination/transfer layers; all existing sources receive a "Not Implemented" stub.
  • exportRules uses cursor-based pagination following the same pattern as existing exportUsers/exportTeams methods; createRule branches on type (api, redirect, deployment) with appropriate skip/warning paths.

Confidence Score: 5/5

Safe to merge; the new domains migration path is well-isolated and follows established patterns throughout the codebase.

No new defects are introduced. The source export, resource model, and destination dispatch are all correctly wired. The only pre-existing gap (GROUP_SETTINGS absent from extractServices) predates this PR and is not made worse here. The redirect-rule fallback for empty deploymentResourceType was flagged in a prior review cycle.

src/Migration/Destinations/Appwrite.php — specifically the redirect-rule branch (already discussed in a previous review round).

Important Files Changed

Filename Overview
src/Migration/Resources/Domains/Rule.php New Rule resource class for custom-domain proxy rules; clean implementation with typed properties, complete getters, and consistent fromArray/jsonSerialize pair.
src/Migration/Sources/Appwrite.php Adds exportGroupDomains/exportRules with cursor pagination; logic is consistent with existing patterns but reportDomains counts all rules (including skipped auto-generated ones), which may overstate expected migration totals in progress reports.
src/Migration/Destinations/Appwrite.php Adds importDomainsResource/createRule; redirect-rule branch unconditionally passes resourceId+resourceType even when deploymentResourceType is empty, and the api-rule branch ignores the returned response from createAPIRule entirely.
src/Migration/Transfer.php Adds GROUP_DOMAINS constant, GROUP_DOMAINS_RESOURCES array, and the corresponding case in extractServices(); all wired up correctly.
src/Migration/Resource.php Adds TYPE_RULE constant and registers it in ALL_PUBLIC_RESOURCES; straightforward addition.
src/Migration/Source.php Adds abstract exportGroupDomains method, getDomainsBatchSize(), and routes the GROUP_DOMAINS case in the export dispatch; clean addition.
tests/Migration/Unit/Adapters/MockSource.php Adds exportGroupDomains stub in MockSource; follows the exact same pattern as existing group stubs.
src/Migration/Sources/Firebase.php Stub exportGroupDomains that throws 'Not implemented'; consistent with other unsupported source methods.
src/Migration/Sources/NHost.php Stub exportGroupDomains that throws 'Not Implemented'; consistent with other unsupported source methods.
src/Migration/Sources/CSV.php Stub exportGroupDomains that throws 'Not Implemented'; consistent with other unsupported source methods.
src/Migration/Sources/JSON.php Stub exportGroupDomains that throws 'Not Implemented'; consistent with other unsupported source methods.

Reviews (5): Last reviewed commit: "Merge remote-tracking branch 'origin/add..." | Re-trigger Greptile

Comment thread src/Migration/Transfer.php
- Transfer::extractServices match was missing GROUP_SETTINGS; callers
  hit the default 'No service group found' branch even though
  GROUP_SETTINGS_RESOURCES exists.
- Destination's redirect-rule fanout called ProxyResourceType::FUNCTION()
  which the SDK generator renames to FUNCTIONMODEL() because FUNCTION is
  a PHP reserved keyword. Underlying value is still 'function'.
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