Skip to content

Fix effective SDK platform availability in OpenAPI specs - #13502

Merged
ChiragAgg5k merged 3 commits into
mainfrom
fix-CLO-4377-openapi-platform-availability
Sep 6, 2026
Merged

ChiragAgg5k merged 3 commits into
mainfrom
fix-CLO-4377-openapi-platform-availability

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Fixes x-appwrite.platforms to match actual SDK availability:

  • Removes server from OAuth2 session creation and usage events/gauges, where it is hidden.
  • Adds the missing server platform to presence update/upsert.
  • Adds platforms to individual method aliases so their availability is explicit.

This does not consolidate the three specs or change their filenames. Existing generated SDK output is unchanged.

Spec changes

Excerpts below omit unrelated fields.

OAuth2 session creation

GET /account/sessions/oauth2/{provider} already excludes server SDKs; its metadata now agrees:

 "x-appwrite": {
-  "platforms": ["console", "client", "server"]
+  "platforms": ["console", "client"]
 }

Usage events/gauges similarly change from ["console", "server"] to ["console"].

Presence update — server spec

 "operationId": "presencesUpdate",
 "x-appwrite": {
-  "platforms": ["client", "console"],
+  "platforms": ["client", "console", "server"],
   "methods": [
     {
       "name": "update",
       "namespace": "presences",
+      "platforms": ["server"],
       "required": ["presenceId", "userId"]
     }
   ]
 }

Presence update — client spec

 "operationId": "presencesUpdate",
 "x-appwrite": {
-  "platforms": ["client", "console"],
+  "platforms": ["client", "console", "server"],
   "methods": [
     {
       "name": "update",
       "namespace": "presences",
+      "platforms": ["client", "console"],
       "required": ["presenceId"]
     }
   ]
 }

The userId requirements are unchanged. The new metadata identifies the existing variants.

Validation

  • Regenerated client, server, and console specs; confirmed only the intended platform metadata changed.
  • Regenerated all 22 configured SDK targets: 14,899 files are byte-identical before and after.
  • Existing tests pass: 33 tests, 170 assertions. Formatting and targeted static checks pass.

Related to CLO-4377.

@greptile-apps

greptile-apps Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR aligns OpenAPI platform metadata and route selection with effective SDK availability.

  • Centralizes the standard authentication-to-SDK-platform mapping on AuthType.
  • Stores resolved platform membership on each SDK method and applies hidden-platform and namespace filtering consistently.
  • Deduplicates routes selected through multiple eligible method aliases.
  • Emits explicit platform availability for individual method aliases.
  • Updates formatter fixtures to remain eligible for console specifications.

Confidence Score: 5/5

The PR appears safe to merge; no new correctness or security defects were identified, though the existing non-blocking request for focused availability regression coverage remains outstanding.

The current changes consistently use effective method platforms during route selection and OpenAPI emission without breaking the formatter’s route iteration. The previous request for focused tests remains unresolved because the test changes only add console authentication to existing fixtures and still do not assert client/server eligibility, hidden methods, aliases, custom mappings, or emitted platform metadata.

Important Files Changed

Filename Overview
src/Appwrite/Platform/Tasks/Specs.php Resolves method platforms before generation, filters routes by effective availability, and deduplicates routes with multiple eligible aliases.
src/Appwrite/SDK/AuthType.php Defines the standard mapping from authentication types to client, server, and console SDK platforms.
src/Appwrite/SDK/Method.php Adds resolved platform state and consistently applies hidden-platform and namespace exclusions.
src/Appwrite/SDK/Specification/Format/OpenAPI3.php Uses effective method availability for operation filtering and emits platform metadata for aliases.
tests/unit/SDK/Specification/FormatTest.php Makes existing formatter fixtures console-eligible, but does not add the focused platform-availability assertions requested in the existing review thread.

Reviews (2): Last reviewed commit: "refactor(specs): keep platform eligibili..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix-CLO-4377-openapi-platform-availability (after).

Metric Before After Change
🚀 Requests/sec 183.65 186.36 ⚪ +1.5%
⏱️ Latency P50 96.3 ms 95.56 ms ⚪ -0.8%
⏱️ Latency P95 217.33 ms 209.55 ms ⚪ -3.6%
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 95.56 209.55 11,571 186.36 -7.78
Account 179.71 299.8 609 10.1 -18.51
TablesDB 95.74 166.81 6,293 102.91 -6.64
Storage 80.79 178.87 3,045 52.06 +1.32
Functions 130.72 254.07 1,624 28.47 -8.94

Top API waits (after)

API request Max wait (ms)
account.name.update 480.29
functions.delete 451.44
tablesdb.rows.delete 426.17
functions.variables.update 393.62
functions.variables.delete 393

@ChiragAgg5k
ChiragAgg5k merged commit 6c9ce08 into main Sep 6, 2026
87 of 88 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix-CLO-4377-openapi-platform-availability branch September 6, 2026 17:37
NIKHIL0VERMA pushed a commit to NIKHIL0VERMA/Godot-Appwrite-SDK that referenced this pull request Sep 13, 2026
Appwrite publishes one OpenAPI document per SDK platform, with the generator trusting each to be pre-filtered. appwrite/appwrite#13502 made the operation-level `x-appwrite.platforms` the effective availability and gave every method alias its own list, which lets one canonical document drive all three platforms once the generator selects from it.

The generator now skips operations, aliases and security schemes whose `platforms` exclude `sdk.platform`. A missing list, or no platform, means available everywhere, and unknown names such as Cloud's `manager` never match. `example.php` sets the platform for every target, as production already does. Regenerating every target from the current client, server and console documents is byte-identical.

Shape checks move out of the Docker e2e tests into a `Generation` suite that generates the fixture for every language and platform and checks the trees against declarative tables: excluded fixtures never appear, platform-bound fixtures appear on their platforms alone, enums are declared, Go model comments carry no HTML entities. The e2e suite keeps only runtime behavior.

Related to CLO-4377.
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