Skip to content

fix(sdks): expose migrations to server SDKs - #14882

Merged
ChiragAgg5k merged 2 commits into
mainfrom
feat/migrations-server-sdk
Oct 23, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
feat/migrations-server-sdk

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Migrations endpoints declare only console authentication in SDK metadata, so server SDK generation omits the entire service. This also prevents the Go-based CLI from offering migration commands.

Add AuthType::KEY alongside AuthType::ADMIN on all 16 Migrations methods. Runtime authentication already accepts project API keys with migrations.read or migrations.write; these declarations make the generated SDK surface reflect that support.

Test Plan

  • Pint passed for the Migrations HTTP module.
  • Targeted PHPStan level 4 passed using locked dependencies. The temporary targeted configuration disables unmatched-ignore reporting because the repository's test-only ignore does not match a source-only run; no source errors are suppressed.
  • Regenerated CE 2.6.x specs and verified 16 Migrations operations in both server and console specs, and none in the client spec. Generated specs and examples are ignored artifacts, so they are not committed here.
  • Generated Go SDK compiled and its Migrations, models, client and organization tests passed during the release preparation in Cloud.
  • Generated CLI compiled and its full Go test suite passed against the local Go SDK candidate.
  • Live API-key migration E2E was not run. Existing Migrations E2E coverage uses the console client.

Related PRs and Issues

Prerequisite for the planned Go SDK v7.15.0 and CLI 28.9.0 releases with Migrations support. Cloud's overridden Appwrite migration report declaration needs the matching change when it consumes this CE update.

Checklist

  • Read the contributing guidelines.
  • Regenerated API specs locally; generated artifacts are ignored and SDK releases follow separately.

Related: appwrite-labs/cloud#6667

@luxor-code-review

luxor-code-review Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 1 medium

📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to

🟡 Medium — No e2e test rejects key without migrations scope · MigrationsBase.php:203–264 · file not in diff

// tests/e2e/Services/Migrations/MigrationsBase.php
203	    public function performMigrationSync(array $body): array
204	    {
205	        $migration = $this->client->call(Client::METHOD_POST, '/migrations/appwrite', [
206	            'content-type' => 'application/json',
207	            'x-appwrite-project' => $this->getDestinationProject()['$id'],
208	            'x-appwrite-key' => $this->getDestinationProject()['apiKey'],
209	        ], $body);
210	
211	        $this->assertEquals(202, $migration['headers']['status-code'], $migration['body']['message'] ?? '');
212	        $this->assertNotEmpty($migration['body']);
213	        $this->assertNotEmpty($migration['body']['$id']);
214	

The patch makes the migrations routes key-authenticatable (src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Appwrite/Create.php:53 and siblings), but no e2e test asserts that an API key lacking migrations.write/migrations.read is rejected (401/403) on them. All key-authenticated calls in tests/e2e/Services/Migrations/MigrationsBase.php use the ProjectCustom provisioned key, whose scope list already includes both migrations scopes. A regression that lets any key (e.g. one with only health.read) create, list, or delete migrations would not be caught by CI.

🧹 Nitpicks (1) — 🟢 1 low
  • 🟢 Report endpoints require migrations.write, blocking read-only keys (Get.php:38) — The Report/Get actions for Appwrite, Supabase, NHost and Firebase migrations require the migrations.write scope, while sibling Get and XList migration routes require migrations.read (src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Appwrite/Report/Get.php:38).

The change grants API-key access to the Migrations API uniformly: every route now lists AuthType::KEY before AuthType::ADMIN, with runtime scope enforcement unchanged (migrations.read/migrations.write already exist and are pinned in app/config/scopes/lock.json). Response models filter stored source credentials, so key-based access does not expose them.

Files Change
src/Appwrite/Platform/Modules/Migrations/Http/Migrations/** (all 16 action files) Auth metadata updated from [AuthType::ADMIN] to [AuthType::KEY, AuthType::ADMIN] on list/get/create/update/delete/retry, all source creates, and the four report endpoints and CSV/JSON import/export routes.
tests/e2e/Services/Migrations/MigrationsBase.php Existing e2e coverage still exercises these routes; no key-without-scope rejection test exists yet (see findings).

Reviewed commit: 712725d

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 23, 2026
@ghost

ghost commented Oct 23, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The new server parameter locks match the existing console entries and the endpoint declarations.

Adds API-key authentication metadata alongside admin authentication to the 16 Migrations methods, exposing the service in generated server SDKs while retaining its console SDK surface. The parameter-order lock now records the server SDK method signatures as well.

Latest changes: The newest commit adds all 16 Migrations method parameter lists to the server section of the SDK parameter lock.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 2
File Change
src/Appwrite/Platform/Modules/Migrations/Http/Migrations/**/*.php Adds API-key auth metadata to the 16 Migrations SDK method declarations while retaining admin auth.
app/config/sdks/parameters.lock.json Locks the parameter order for all 16 Migrations methods in the server SDK.

Reviewed the commits since 712725d · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Tier S · Looks good to merge. Summary

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

6 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (3)
  • php.appwrite.secret-compare-timing (1)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@ChiragAgg5k
ChiragAgg5k merged commit 1467f65 into main Oct 23, 2026
65 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the feat/migrations-server-sdk branch October 23, 2026 08:48
@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → feat/migrations-server-sdk (after).

Metric Before After Change
🚀 Requests/sec 162.57 174.62 🟢 +7.4%
⏱️ Latency P50 105.38 ms 100.47 ms ⚪ -4.7%
⏱️ Latency P95 249.26 ms 233.6 ms 🟢 -6.3%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 100.47 233.6 11,400 174.62 -15.66
Account 179.2 350.23 600 9.95 -2.26
TablesDB 96.68 178.39 6,200 98.61 -16.27
Storage 92.59 216.52 3,000 49.23 -42.84
Functions 140.12 267.3 1,600 26.87 -8.9

Top API waits (after)

API request Max wait (ms)
account.name.update 626.45
functions.variables.update 538.15
functions.create 509.35
storage.files.create 503.58
storage.buckets.create 502.75

Tapraj-Pathak pushed a commit to Tapraj-Pathak/appwrite that referenced this pull request Oct 24, 2026
…r-sdk

fix(sdks): expose migrations to server SDKs

(cherry picked from commit 1467f65)
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