Skip to content

Add SMTP migration#187

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

Add SMTP migration#187
premtsd-code wants to merge 9 commits into
add-policies-migrationfrom
add-smtp-migration

Conversation

@premtsd-code
Copy link
Copy Markdown
Contributor

Adds the project SMTP configuration as a new settings resource. Source reads via the typed Project::get() model; destination writes the project doc's smtp map directly (read-then-merge to preserve destination password — source API never exposes it). Stacks on top of #186.

Adds a single SMTP settings resource carrying the project's custom SMTP
configuration. Source reads via the typed Project model
(Project::get()->smtp*); destination writes the smtp attribute on the
project document directly, matching the pattern used by the other 5
settings resources.

Password is intentionally not migrated — the source API only exposes
smtpPassword as an empty string (write-only field). The destination's
existing password is preserved via read-then-merge of the smtp map.
@premtsd-code premtsd-code changed the base branch from main to add-policies-migration May 21, 2026 06:39
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 21, 2026

Greptile Summary

This PR introduces SMTP configuration as a new TYPE_SMTP singleton resource within the GROUP_INTEGRATIONS group, supporting Appwrite-to-Appwrite migration of project-level SMTP settings. Password is intentionally excluded from migration (the source API never exposes it), and the destination uses a read-then-merge strategy to preserve any password already stored there.

  • New SMTP resource class (Resources/Settings/SMTP.php) models all non-secret SMTP fields with proper defaults and follows the existing Resource contract.
  • Source (exportSMTP) reads from the typed Project::get() model and correctly reports the resource count as a fixed 1 for this singleton; error handling uses the (int) $e->getCode() ?: Exception::CODE_INTERNAL pattern consistently.
  • Destination (createSMTP) mirrors the createProtocols/createServices read-then-merge pattern and is correctly wired into the integration dispatch switch with status promotion handled by the outer dispatcher.

Confidence Score: 5/5

Safe to merge — the change is a well-scoped singleton migration following established patterns throughout the codebase, with no correctness issues found.

The SMTP resource registration is complete and consistent across Resource.php, Transfer.php, source, destination, and mock adapters. The read-then-merge write strategy mirrors how protocols and services are already handled. Error handling and status promotion follow the same conventions as peer resource types.

No files require special attention.

Important Files Changed

Filename Overview
src/Migration/Resources/Settings/SMTP.php New singleton resource class for SMTP config; correctly omits password, uses sensible defaults, and follows the established Resource contract.
src/Migration/Sources/Appwrite.php Adds exportSMTP() and wires it into exportGroupIntegrations; report hardcodes count to 1 (correct for singleton); error handling properly uses the (int) cast and CODE_INTERNAL fallback.
src/Migration/Destinations/Appwrite.php createSMTP uses read-then-merge to preserve the destination's stored password; pattern mirrors createProtocols/createServices; status is promoted to SUCCESS by the outer dispatcher.
src/Migration/Resource.php TYPE_SMTP constant added and registered in the full type list alongside webhook, consistent with existing type ordering.
src/Migration/Transfer.php TYPE_SMTP added to GROUP_INTEGRATIONS_RESOURCES and the export/import resource arrays; no issues found.
tests/Migration/Unit/Adapters/MockDestination.php MockDestination updated to support TYPE_SMTP alongside other integration resource types.
tests/Migration/Unit/Adapters/MockSource.php MockSource updated to expose TYPE_SMTP as a supported resource type.

Reviews (8): Last reviewed commit: "Merge branch 'add-policies-migration' in..." | Re-trigger Greptile

Comment thread src/Migration/Destinations/Appwrite.php
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