Skip to content

Add Custom Domains migration#188

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

Add Custom Domains migration#188
premtsd-code wants to merge 9 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 adds custom-domain proxy-rule migration between Appwrite projects. It introduces a Rule resource, a GROUP_DOMAINS group, full cursor-paginated export from the source's Proxy service, and dispatch to the four createAPIRule / createFunctionRule / createSiteRule / createRedirectRule endpoints on the destination, with auto-generated rules skipped and 409 conflicts surfaced as warnings.

  • Rule resource & group wiring (Resource.php, Transfer.php, Source.php) — clean and consistent with the existing group pattern; GROUP_DOMAINS is correctly added to extractServices().
  • Source export (Sources/Appwrite.php) — cursor pagination mirrors other exporters; reportDomains counts all rules including auto-generated ones, so the pre-migration estimate will be higher than the rules actually imported.
  • Destination import (Destinations/Appwrite.php) — rule-type dispatch is clear; the redirect branch's fallback of FUNCTIONMODEL when deploymentResourceType is empty was flagged in a previous review pass.

Confidence Score: 5/5

Safe to merge; the only new finding is a cosmetic count mismatch in the pre-migration report that does not affect migration correctness.

The core migration path — export, transfer, and import of proxy rules — is functionally correct. The one new finding (inflated rule count in reportDomains) affects only the progress estimate shown to the user, not the actual rules created on the destination.

src/Migration/Sources/Appwrite.php (reportDomains) and src/Migration/Destinations/Appwrite.php (createRule redirect branch) warrant a second look before the E2E test run.

Important Files Changed

Filename Overview
src/Migration/Resources/Domains/Rule.php New value-object for proxy rules; well-structured with correct defaults and JSON serialisation.
src/Migration/Sources/Appwrite.php Adds exportGroupDomains/exportRules with cursor pagination; reportDomains counts all rules including auto-generated ones that will be skipped, inflating the pre-migration estimate.
src/Migration/Destinations/Appwrite.php Adds importDomainsResource/createRule; redirect rule resourceType/resourceId handling for empty deploymentResourceType already flagged separately.
src/Migration/Transfer.php Adds GROUP_DOMAINS constant, GROUP_DOMAINS_RESOURCES, and extractServices() arm correctly.
src/Migration/Source.php Adds abstract exportGroupDomains and wires it into the export dispatch; consistent with existing pattern.
src/Migration/Resource.php Adds TYPE_RULE constant and registers it in the all-types list; clean.
tests/Migration/Unit/Adapters/MockSource.php Adds exportGroupDomains and TYPE_RULE to supported resources; correctly mirrors the pattern used by other groups.
tests/Migration/Unit/Adapters/MockDestination.php Adds TYPE_RULE to supported types list; correct.

Reviews (7): Last reviewed commit: "Merge branch 'add-smtp-migration' into a..." | 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