Repository navigation
chore: absorb migration into packages/migration - #14503
Conversation
Add Email Templates migration
Replace the per-provider class hierarchy (OAuth2Provider base + StandardProvider/WithEndpointProvider + ~40 one-line subclasses) with a single OAuth2Provider class driven by a `providerKey => non-secret fields` map. Addresses review feedback to have one class for all providers. - Source dispatch: drop the 42-entry class registry + oauth2ClassFor(); build providers via OAuth2Provider::fromArray($key, $payload). - Destination dispatch: replace the instanceof chain with a key check (Apple) + data-driven settings routing for endpoint/tenant/prompt. - The field map doubles as a secret allow-list: only declared non-secret fields are copied off the listOAuth2Providers payload, so a future upstream secret field cannot leak into the migration. Net 44 fewer files. Pint, PHPStan level 3, and the Unit suite all pass.
- Remove unused getSetting(); getDestinationAppId/SecretFields cover all callers. - getDestinationAppId() now returns ?string (null when unset), so the destination drops its duplicate isEmptyOAuth2Setting() helper and isConfigured() reads as `enabled || appId !== null`. - Document the PROVIDERS target/key routing so adding a provider is self-explanatory.
getStatusCounters() seeds a status bucket only for requested resource types and guards the non-row branch with isset(). The row/document branch had no such guard: a row/document count aggregated into the cache for a type that was not requested would auto-vivify $status[$type], read an unseeded 'pending' key (emitting an "Undefined array key" warning) and leave a phantom, non-empty entry that survives the empty-bucket prune. Downstream this surfaced as a flaky assertEmpty($statusCounters) after an otherwise clean migration. Add the same isset() guard the non-row branch already uses so unrequested row/document counts are ignored. Co-Authored-By: Claude Opus 4.8 <[email protected]>
fix: ignore unrequested row/document types in status counters
Add OAuth providers migration
Update PHP SDK to 26
Bump utopia-php/database to ^6.0.0 (drops the Swoole PDOProxy dependency). Database 6.0 requires utopia-php/cache ^3.0, so the lock modernizes accordingly; migration already runs against this dep set via appwrite. No code changes — migration uses the high-level Database API. Co-authored-by: Claude Opus 4.8 <[email protected]>
* read Appwrite table, attribute, and index metadata from the database-specific connection * add regression coverage for split DocumentsDB report counts
This reverts commit 5b616a0.
…-metadata Revert "Fix split database metadata reads"
…e-cascades Fix Appwrite migration runtime cascades
Feat: Support appwrite oauth
Revert "Feat: Support appwrite oauth"
🟢 Tier S · Ready to merge
This PR absorbs Latest changes: The latest commits replace the Supabase fixture's role password hashes with NULL and add
📂 Walkthrough · 8
Reviewed the commits since |
- The README example passes NHost its six constructor arguments, runs the transfer it creates, and uses the Local destination, which needs no database handles. The PHP requirement is 8.5, as the manifest says. - .env.example uses the names bin/MigrationCLI.php reads, including the destination's project internal ID. - The Postgres healthchecks connect over TCP: during initialisation the image's temporary server listens only on its socket, so a socket check passed before the fixtures had loaded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
updateBackups.sh read the unprefixed SUPABASE_TEST_* and NHOST_TEST_* names that .env.example no longer defines, sourced .env from a path the move to tests/fixtures broke, and wrote a dump.sql nothing loads. It now reads the SOURCE_*_TEST_* names the CLI uses, resolves .env from its own directory, and writes the 1_globals.sql and 2_main.sql pair the fixture databases load at start-up. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pg_dumpall --globals-only writes each role's password hash, and the fixture refresh commits its output, so the refresh now passes --no-role-passwords. The Supabase globals fixture already carried seven SCRAM hashes for the source project's internal roles; they become PASSWORD NULL, which is what that flag writes. The e2e tier connects as postgres, whose password the compose file sets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Moves
utopia-php/migrationintopackages/migration, so Appwrite loads it directly. This is section 2 of #14255 (wave 6 of #13828) and followsrfc/monorepo.md. The mirror head isc8b9ba5: the3.1.2release that Appwrite already locks, plus utopia-php/migration#229, the resolver and redirect controls merged today. That puts Appwrite on mirror head, as step 3 of the playbook requires.Add 'packages/migration/' from commit 'c8b9ba5…'chore(migration): mirror plumbingmirror.yml, README banner, and the mirror's workflows,pint.jsonandcomposer.lockremovedrefactor: load migration from packages/feat(migration): migrate what sdk-for-php 30.4 can writestyle(migration): strip trailing blank lines from .env.examplegit diff --checkfix(migration): run the e2e tier under the root toolchainpackages/for the toolchain autoloader; a mock with no expectations becomes a stubStep A
src/Migration/*,Utopia\Migration\→src/Migrationsrc/*,Utopia\Migration\→src/tests/Migration/Unit/*,Utopia\Tests\Unit\tests/*,Utopia\Migration\Tests\tests/Migration/E2E/*tests/E2E/,Utopia\Migration\Tests\E2E\(Supabase and NHost from the package compose file)tests/Migration/resourcestests/fixtures.tests/resourcesand thetests/Resourcessuite collide on case-insensitive filesystemsphpunit.xmlE2EandUnitsuitesunitistestsminustests/E2Eandtests/fixtures;e2eistests/E2Ephpstan.neonsrcandtests, scanningbin/MigrationCLI.phprector.phpsrcandtestsuntil phase 8, as database doesThe package also gets a few small fixes so it runs under the root
packagessuite and the standalone run alike:vendor/.bin/MigrationCLI.phploads the package autoloader only when one is installed.E2E runs inside the compose network through
tests/e2e.shonappwrite/base:2.1.0, the same pattern as database. Three compose changes support it:supabase-dbandnhost-dbgainpg_isreadyhealthchecks, sodocker compose up --waitcovers their start-up. The mirror's CI usedsleep 5.Dockerfile.absorbonly keeps Dockerfiles that adockerfile:key names, and it deleted this one.testsstage in that Dockerfile is gone, because the package no longer has a lock to install from.utopia-php/dsnis dropped fromrequire: nothing in the package uses it. #14255 had planned to bump it to^1.0instead.sdk-for-php 30.4
Run against Packagist, the package resolves
appwrite/appwrite30.4.0. The mirror locked 30.2.2.AppwriteSdkCoverageTestexists to fail when the SDK can write something migration does not carry, and it flagged 11 items. Commit 4 migrates all of them from an Appwrite source to an Appwrite destination:Teams::createMembership(membershipId)Messaging::createTopic(qos, expiry)Topiccarries both; the source reads them from the topic modelMessaging::createEmail(replyToEmail, replyToName)Messaging::createPush(channelId)updatePasswordPwnedPolicy,updatePasswordRotationPolicyPoliciescarries both, written toauths.passwordPwnedandauths.passwordRotationlike the other policies. A source that predates them leaves the destination's values in placeupdatePasskeyPolicyPoliciescarries the relying party ID intoauths.passkeyRpId. Passkeys are bound to the RP ID they were registered under, so while any user on the destination holds a passkey, the destination keeps its own RP ID. The policy endpoint enforces the same rulecreateEnvironment,updateEnvironmentproject-environmentresource (see below)An environment is a Cloud feature: a separate project billed under its parent. Its ID is a project ID, unique across the platform, so on a Cloud-to-Cloud move the source usually still holds it. Each environment is therefore created under a new ID and matched by name on reruns. Its own resources belong to a different project and are not part of it. A host without the environments route (
400or404) reports none as a source and skips them as a destination.MigrationReportgains the count.To make these calls, the root
appwrite/appwriterequirement moves from^30.2.2to^30.4.0.Lock
utopia-php/migrationappwrite/appwritehalaxa/json-machinemoves into the rootrequireat the version already locked. Nothing else in the lock changes.Validation
bin/monorepo validatebin/monorepo check migrationbin/monorepo test migration(registry-resolved), unit tierbin/monorepo test migration, e2e tierphpunit --testsuite packages --filter 'Utopia\\Migration'under the root autoloaderUtopia\Migrationcomposer validate --no-check-publishbin/monorepo split migration --dry-run6214295b, fast-forwards from the mirror headc8b9ba5AppwritePoliciesTestand two of its assertions fail with the policy writes or the passkey guard removed;AppwriteSdkCoverageTestfails against 30.4 without commit 4Baseline: 1,716 findings. 1,453 are in
src, nearly all arguments and offset access on themixedSDK, REST and PDO results the sources read. 263 are in its tests. They are listed under phase 8 in the RFC.Not verified: the full Appwrite e2e matrix on this branch. CI runs it.
Merge and follow-up
Merge with a merge commit (
absorblabel). A squash drops thegit-subtree-*annotation and orphans the package from its mirror.The absorb ran with
--skip-ruleset. The mirror already has amainruleset (id18701583: no deletion, no force push, PRs required), but its bypass list has only the organization admin and repository role 5, not the split app4016286.Splitcannot push to the mirror until the app is added. Adding it is a repository settings change, so it is left to a maintainer:That command is idempotent on an existing package and normalises the ruleset to the canonical config.
After merging:
Splitpushes toutopia-php/migrationutopia-php/migrationrequirement and take it throughserver-ce(#14255)None of them is ported here. A PR that targets
mainand is still wanted gets reopened againstpackages/migration/src/, whose paths have lost theMigration/segment. #237 targets2.0.x, a version branch that stays on the mirror. The mirror also has two open issues, #88 and #64.🤖 Generated with Claude Code