Skip to content

Add project variable migration support#12313

Open
premtsd-code wants to merge 3 commits into
add-api-key-migrationfrom
add-project-variable-migration
Open

Add project variable migration support#12313
premtsd-code wants to merge 3 commits into
add-api-key-migrationfrom
add-project-variable-migration

Conversation

@premtsd-code
Copy link
Copy Markdown
Contributor

Summary

Stacks on #12308. Adds the project-variable rule to MigrationReport so the wizard can show the source's project-variable count. Pins utopia-php/migration to the matching dev branch.

Cross-repo

Reports project-variable counts in MigrationReport and points the
migration lib pin at the add-project-variable-migration dev branch.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 14, 2026

Greptile Summary

This PR stacks on the API-key migration branch and wires up project-variable as a migratable resource type. The utopia-php/migration dependency is bumped to the dev-add-project-variable-migration branch, MigrationReport gains a new TYPE_PROJECT_VARIABLE integer rule, and a comprehensive e2e test covers both plain and secret variable round-trips.

  • MigrationReport.php — adds one rule entry for TYPE_PROJECT_VARIABLE, consistent with every other resource type already present.
  • MigrationsBase.php — new testAppwriteMigrationProjectVariable creates uniquely-keyed variables on the source, runs a migration, asserts success counters, then verifies the plain variable round-trips its value and the secret variable's value is not leaked to the destination.

Confidence Score: 5/5

The changes are narrow and additive — one new response model rule and one new e2e test — with no modifications to existing migration logic or API contracts.

All changed code follows the patterns established by the API-key migration that this PR stacks on. The model change is a one-liner rule addition, and the test exercises both the happy path and the security-relevant secret-value masking behaviour. No existing paths are altered.

The destination variable list fetch in MigrationsBase.php is not paginated; if the destination project accumulates enough variables the test could produce a false negative.

Important Files Changed

Filename Overview
src/Appwrite/Utopia/Response/Model/MigrationReport.php Adds TYPE_PROJECT_VARIABLE rule with integer type, default 0, and example 5 — consistent with all neighbouring rules.
tests/e2e/Services/Migrations/MigrationsBase.php Adds testAppwriteMigrationProjectVariable — creates plain + secret variables on the source, runs migration, asserts counters and destination values. Destination list fetch is not paginated, matching the existing API-key test pattern.
composer.json Bumps utopia-php/migration from dev-add-api-key-migration to dev-add-project-variable-migration branch and adds a VCS repository entry to resolve the dev branch (already flagged in a previous thread).
composer.lock Lock file regenerated to track the new branch commit (3376bed); also gains autoload-dev and scripts sections from the upstream package's composer.json.

Reviews (3): Last reviewed commit: "Add E2E test for project variable migrat..." | Re-trigger Greptile

Comment thread composer.json
Comment on lines 113 to +120
},
"config": {
"platform": {
},
"platform": {},
"allow-plugins": {
"php-http/discovery": true,
"tbachert/spi": true
}
}
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 VCS repository entry should not be committed long-term

The repositories block added here points directly to the GitHub VCS source for utopia-php/migration. This is needed to resolve the dev branch now, but if this entry is still present when the stack lands on main, production builds will pull from a branch that may eventually be deleted (or may diverge unexpectedly). Standard practice is to remove the VCS override once the package is published to Packagist and the dependency is pinned to a stable release. Please ensure this block is cleaned up before the final merge to the main branch.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 2026

✨ Benchmark results

Comparing add-api-key-migration (before) to add-project-variable-migration (after).

Before

Scenario P50 (ms) P95 (ms) Requests RPS
API total 13.99 132.1 185 35.21
Account 26.3 153.85 35 7.32
TablesDB 13.12 19.6 35 8.9
Storage 11.25 52.27 75 18.7
Functions 21.24 33.79 40 10.07

After

Scenario P50 (ms) P95 (ms) Requests RPS
API total 15.41 135.86 185 32.97
Account 24.57 214.17 35 6.81
TablesDB 13.52 21.97 35 8.12
Storage 12.38 53.57 75 17.09
Functions 21.19 36.93 40 9.22

Delta

Scenario P95 delta (ms)
API total +3.77
Account +60.33
TablesDB +2.37
Storage +1.3
Functions +3.14
Top API waits
API request Max wait (ms)
account.sessions.email.create 661.75
account.create 214.05
account.password.update 167.01

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 2026

🔄 PHP-Retry Summary

Flaky tests detected across commits:

Commit d64d7ec - 4 flaky tests
Test Retries Total Time Details
UsageTest::testFunctionsStats 1 10.20s Logs
UsageTest::testPrepareSitesStats 1 7ms Logs
UsageTest::testEmbeddingsTextUsageDoesNotBreakProjectUsage 1 5ms Logs
LegacyConsoleClientTest::testNotEndsWith 1 240.67s Logs
Commit 176d916 - 4 flaky tests
Test Retries Total Time Details
UsageTest::testFunctionsStats 1 10.20s Logs
UsageTest::testPrepareSitesStats 1 7ms Logs
UsageTest::testEmbeddingsTextUsageDoesNotBreakProjectUsage 1 4ms Logs
LegacyCustomServerTest::testOrQueries 1 240.71s Logs
Commit 2c12417 - 4 flaky tests
Test Retries Total Time Details
UsageTest::testFunctionsStats 1 10.18s Logs
UsageTest::testPrepareSitesStats 1 7ms Logs
UsageTest::testEmbeddingsTextUsageDoesNotBreakProjectUsage 1 4ms Logs
LegacyCustomServerTest::testTimeout 1 128.22s Logs

Covers plain + secret variables, asserts secret value is not exfiltrated
through the migration (source SDK strips it, destination writes empty).
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