Skip to content

Chore: Upgrade SDK to new platforms API#2965

Merged
HarshMN2345 merged 4 commits intomainfrom
chore-upgrade-sdk
Apr 8, 2026
Merged

Chore: Upgrade SDK to new platforms API#2965
HarshMN2345 merged 4 commits intomainfrom
chore-upgrade-sdk

Conversation

@Meldiron
Copy link
Copy Markdown
Contributor

@Meldiron Meldiron commented Apr 8, 2026

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 8, 2026

Greptile Summary

This PR migrates the Appwrite Console's platforms and API-keys management to use the new SDK project-scoped API (sdk.forProject()), replacing the older console-scoped API (sdk.forConsole.projects.*). Platform types are consolidated from granular identifiers (e.g., apple-ios, flutter-android) into unified types (apple, android, web, windows, linux), and CRUD operations are split into type-specific methods (e.g., createApplePlatform, updateAndroidPlatform).

Key changes:

  • src/lib/helpers/platform.ts — new AnyPlatform union type, updated getPlatformInfo switch, and new getPlatformIdentifier helper
  • All platform create/update/delete calls migrated to sdk.forProject().project.* with explicit platformId: ID.unique() supplied by the caller
  • API-key CRUD (createKey, updateKey, deleteKey, listKeys, getKey) migrated similarly with caller-supplied keyId
  • Dead component files deleted — previous review concern addressed
  • updateName switch now has a default branch that throws — previous review concern addressed
  • createFlutterPlatform switch now has a default branch — previous review concern addressed
  • Bug fix: android.svelte button was previously disabled when key === $platform.hostname (wrong comparison); now correctly compares applicationId === ($platform as Models.PlatformAndroid).applicationId

Confidence Score: 5/5

This PR is safe to merge — it is a well-executed, mechanical API migration with no new logic bugs introduced.

All three concerns raised in previous review threads have been resolved: dead component files are deleted, the updateName switch has a default throw branch, and the createFlutterPlatform switch has a default throw branch. The API migration itself is consistent across all 40 files. The android.svelte disabled-button comparison bug is also incidentally fixed. No new P0/P1 issues were found.

No files require special attention.

Vulnerabilities

No security concerns identified. Auto-generated API keys created in migration flows are scoped to read-only operations, consistent with the existing implementation.

Important Files Changed

Filename Overview
src/lib/helpers/platform.ts Adds AnyPlatform union type, rewrites getPlatformInfo as a strict switch, and introduces getPlatformIdentifier helper — clean, well-typed refactor.
src/routes/(console)/project-[region]-[project]/overview/platforms/[platform]/+page@project-[region]-[project].svelte Migrates updateName to type-specific API calls; removes dead platform components from the types map; adds a default throw branch addressing the previous review concern.
src/routes/(console)/project-[region]-[project]/overview/platforms/+page.svelte Simplifies PlatformTypes map to new unified types, renames getPlatformInfo to getPlatformIcon (now includes Linux/Windows icons), and migrates deletePlatform to project-scoped SDK.
src/routes/(console)/project-[region]-[project]/overview/platforms/createFlutter.svelte Migrates Flutter platform creation to type-specific API methods; flutter-macos correctly maps to createApplePlatform (Apple bundle identifier); adds default throw branch.
src/routes/(console)/project-[region]-[project]/overview/platforms/wizard/store.ts Replaces Partial<Models.Platform> with an explicit PlatformFormData type; adds key field, removes store/$id fields — matches new API requirements.
src/routes/(console)/project-[region]-[project]/overview/platforms/[platform]/android.svelte Fixes longstanding disabled-button bug (was comparing key to hostname); migrates to updateAndroidPlatform with correct applicationId field.
src/routes/(console)/project-[region]-[project]/settings/migrations/+page.svelte Migrates auto-generated migration API key creation to project-scoped SDK with caller-supplied keyId; no functional changes to scopes.
src/routes/(console)/organization-[organization]/settings/BAA.svelte Removes hardcoded key: 'baa' from createBaaAddon call — the new API infers the key from the endpoint.

Reviews (3): Last reviewed commit: "AI review fixes" | Re-trigger Greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 8, 2026

Tip:

Greploops — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.

Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.

@HarshMN2345 HarshMN2345 merged commit f8b015f into main Apr 8, 2026
3 of 4 checks passed
@HarshMN2345 HarshMN2345 deleted the chore-upgrade-sdk branch April 8, 2026 16:31
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.

2 participants