Skip to content

[codex] Move static SDKs off platform specs#11664

Merged
ChiragAgg5k merged 2 commits into1.9.xfrom
codex/static-sdk-platform-1-9-x
Mar 28, 2026
Merged

[codex] Move static SDKs off platform specs#11664
ChiragAgg5k merged 2 commits into1.9.xfrom
codex/static-sdk-platform-1-9-x

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

Summary

This updates SDK generation so agent-skills and cursor-plugin no longer depend on platform Swagger specs.

What changed

  • added a new static SDK platform and moved agent-skills and cursor-plugin into it
  • switched static SDK generation to read the spec format from app/config/sdks.php and use StaticSpec
  • removed the deprecated Markdown SDK from config and deleted its changelog entry
  • added an explicit success log after SDK/example generation so latest example runs end cleanly
  • included the composer.lock update for utopia-php/dns 1.6.5 -> 1.6.6

Why

agent-skills and cursor-plugin do not use the platform-specific generated specs, so keeping them tied to console Swagger generation was unnecessary. Moving them to a static platform removes that dependency and makes the generation path clearer.

Impact

  • php app/cli.php sdks --platform=static --sdk=agent-skills --version=latest --git=no --mode=examples now works without requiring generated Swagger files
  • php app/cli.php sdks --platform=static --sdk=cursor-plugin --version=latest --git=no --mode=examples now works the same way
  • the deprecated Markdown SDK is no longer selectable from the SDK config

Validation

  • php -l app/init/constants.php
  • php -l app/config/sdks.php
  • php -l src/Appwrite/Platform/Tasks/SDKs.php
  • php app/cli.php sdks --platform=static --sdk=agent-skills --version=latest --git=no --mode=examples
  • php app/cli.php sdks --platform=static --sdk=cursor-plugin --version=latest --git=no --mode=examples
  • php app/cli.php sdks --platform=console --sdk=cli --version=latest --git=no --mode=examples

@ChiragAgg5k ChiragAgg5k marked this pull request as ready for review March 28, 2026 11:57
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 28, 2026

📝 Walkthrough

Walkthrough

This change introduces a new SDK platform called "static" to replace the Markdown SDK support within the console platform. The update adds a new APP_SDK_PLATFORM_STATIC constant and platform configuration, moves the agent-skills and cursor-plugin SDKs from the console platform to this new static platform, and removes markdown SDK handling. The SDK generation task is updated to support StaticSpec for static platform SDKs instead of swagger-based specifications, with modified output logging to differentiate between examples-only and full SDK generation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Additional notes

The changes involve coordination across three files: constant definition, configuration restructuring, and task logic updates. The key complexity lies in the conditional spec handling logic in SDKs.php where SDK generation now branches based on the spec field ('static' vs. 'swagger2'), requiring careful verification that the StaticSpec path is correctly implemented and integrated with existing platform handling.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: moving static SDKs (agent-skills and cursor-plugin) from platform-specific Swagger specs to a new static platform, which aligns with the primary objective of the changeset.
Description check ✅ Passed The description comprehensively explains what changed, why it was done, and the impact, directly relating to the modifications in the three affected files and the overall goal of decoupling static SDKs from platform specs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/static-sdk-platform-1-9-x

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 28, 2026

Greptile Summary

This PR cleanly decouples agent-skills and cursor-plugin from the platform-specific Swagger spec pipeline by introducing a new APP_SDK_PLATFORM_STATIC platform. The core change in SDKs.php reads a spec field from each SDK's config entry (defaulting to swagger2) and, for 'static' SDKs, skips spec-file loading entirely and constructs a StaticSpec instance (which exists in appwrite/sdk-generator 1.14.0 at the pinned commit). The deprecated Markdown SDK is removed cleanly from both config and code, and a post-generation success log is added.

  • APP_SDK_PLATFORM_STATIC constant is properly defined in constants.php and correctly appended to SDKs::getPlatforms() alongside the existing spec-based platforms from Specs::getPlatforms().
  • The $specFormat === 'static' ternary is safe: $spec is initialised to null and never passed to Swagger2 when the static branch is taken.
  • Specs::getPlatforms() (which drives Swagger file generation) is not changed, so existing spec generation is unaffected.
  • The only minor concern is that realpath() is called on source and changelog paths that don't exist yet, resulting in false values — harmless for source, gracefully handled for changelog in normal mode, but could surface if AI changelog writing is triggered.
  • The utopia-php/dns bump (1.6.5 → 1.6.6) is a straightforward patch update.

Confidence Score: 5/5

Safe to merge — all changes are well-scoped, the new static platform path is logically correct, and no existing generation flows are affected.

All findings are P2: the realpath() on not-yet-existing paths is cosmetic for source and handled gracefully for changelog in the normal (non-AI) code path. No P0/P1 issues were identified. The StaticSpec class is confirmed present in the pinned sdk-generator 1.14.0 commit, the ternary spec-selection logic is correct, and the removal of the Markdown SDK is clean with no dangling references.

No files require special attention; the minor realpath() note in app/config/sdks.php is the only item worth a follow-up.

Important Files Changed

Filename Overview
src/Appwrite/Platform/Tasks/SDKs.php Core task logic updated to support a new static platform: reads spec field from SDK config (defaulting to swagger2), skips spec-file loading for static SDKs, constructs a StaticSpec instance in place of Swagger2, removes the deprecated Markdown language import/case, and adds a post-generation success log.
app/config/sdks.php Removes the deprecated markdown SDK entry from the console platform, introduces a new top-level APP_SDK_PLATFORM_STATIC platform block, and moves agent-skills and cursor-plugin into it with updated source paths and an explicit 'spec' => 'static' field.
app/init/constants.php Adds the single constant APP_SDK_PLATFORM_STATIC = 'static' alongside the existing platform constants; straightforward and correct.
docs/sdks/markdown/CHANGELOG.md File deleted as part of removing the deprecated Markdown SDK; no remaining references to it in the codebase.
composer.lock Bump of utopia-php/dns from 1.6.5 to 1.6.6; only references (source URL, dist URL, commit hash, support URL, timestamp) are updated — no dependency tree changes.

Comments Outside Diff (1)

  1. app/config/sdks.php, line 275-281 (link)

    P2 realpath() on not-yet-existing paths returns false

    Both source and changelog are evaluated eagerly via \realpath() at config-load time. If app/sdks/static-agent-skills or docs/sdks/agent-skills/CHANGELOG.md don't exist on disk yet (e.g. on a clean checkout before any generation has run), realpath() returns false and both keys hold false rather than a path string.

    source is never read back in the generation path, so this is purely cosmetic there. changelog is handled gracefully when the generation loop checks ($changelog) ? — a falsy value falls back to '# Change Log'. However, if AI changelog generation is enabled it calls $this->updateChangelogFile($language['changelog'], ...) with false as the first argument, which could surface an unexpected error.

    The same pattern exists for cursor-plugin (lines 295–301).

    Substituting a plain string path and letting the code handle absence at runtime would be more resilient:

Reviews (1): Last reviewed commit: "chore: update composer lock" | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 28, 2026

🔄 PHP-Retry Summary

Flaky tests detected across commits:

Commit be50318 - 6 flaky tests
Test Retries Total Time Details
UsageTest::testVectorsDBStats 1 10.04s Logs
LegacyConsoleClientTest::testUpsertDocument 1 245.61s Logs
LegacyConsoleClientTest::testOneToManyRelationship 1 240.90s Logs
LegacyCustomClientTest::testListDocumentsWithCache 1 415ms Logs
LegacyCustomServerTest::testListDocumentsWithCache 1 864ms Logs
LegacyTransactionsCustomServerTest::testUpdateDocument 1 240.59s Logs

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/config/sdks.php (1)

267-267: ⚠️ Potential issue | 🟡 Minor

Use canonical browser URLs in url.

In src/Appwrite/Platform/Tasks/SDKs.php, Line 205 builds release links from {$language['url']}/releases, and Line 472 exposes url as the public repo link. Keeping the clone suffix here produces non-canonical ...git/releases URLs in generated output. Keep .git only in gitUrl.

💡 Suggested fix
-                'url' => 'https://github.com/appwrite/agent-skills.git',
+                'url' => 'https://github.com/appwrite/agent-skills',

-                'url' => 'https://github.com/appwrite/cursor-plugin.git',
+                'url' => 'https://github.com/appwrite/cursor-plugin',

Also applies to: 287-287

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/config/sdks.php` at line 267, The repo URL entries include the ".git"
clone suffix which causes non-canonical release and public links; update the
SDKs configuration so the 'url' values are the browser-facing repository URLs
(remove the trailing ".git") while keeping the cloneable address only in
'gitUrl' (leave 'gitUrl' with ".git"); locate the SDKs class that builds release
links (the SDKs task that concatenates "{$language['url']}/releases") and
replace the '.git' suffixed 'url' entries (e.g., the 'url' keys currently ending
with ".git") with their canonical browser equivalents, ensuring any code that
expects the clone URL uses 'gitUrl' instead.
🧹 Nitpick comments (1)
src/Appwrite/Platform/Tasks/SDKs.php (1)

177-178: Let the platform provide the default spec format.

static is now modeled as a platform, but this still defaults per SDK to swagger2. If a future entry is added under APP_SDK_PLATFORM_STATIC without its own 'spec' => 'static', Lines 184-187 will start looking for swagger2-{$version}-static.json. Reading $platform['spec'] first would remove that drift.

♻️ Suggested direction
-                $specFormat = $language['spec'] ?? 'swagger2';
+                $specFormat = $language['spec'] ?? $platform['spec'] ?? 'swagger2';

Then set 'spec' => 'static' once on the APP_SDK_PLATFORM_STATIC block in app/config/sdks.php.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Appwrite/Platform/Tasks/SDKs.php` around lines 177 - 178, Currently $spec
is defaulted from $language['spec'] to 'swagger2' causing platform-level spec
(e.g., $platform['spec']) to be ignored; change the lookup to prefer
$platform['spec'] first, then $language['spec'], then fallback to 'swagger2' so
platforms like APP_SDK_PLATFORM_STATIC can supply 'static' as the default.
Update the code that sets $spec (refer to the variables $platform and $language
inside the SDK generation flow in SDKs.php) to check $platform['spec'] ??
$language['spec'] ?? 'swagger2' and keep the rest of the logic unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Appwrite/Platform/Tasks/SDKs.php`:
- Around line 450-460: The code instantiates a missing class StaticSpec when
specFormat === 'static' (inside the SDK construction near SDK, specFormat and
Swagger2 usage); this will cause a fatal error because Appwrite\Spec\StaticSpec
is not provided by the current dependencies. Fix by replacing the StaticSpec
instantiation with an available spec implementation or implement a local
StaticSpec class: either update dependency to a version that provides
Appwrite\Spec\StaticSpec and update imports, or create a new
Appwrite\Spec\StaticSpec class locally (matching the constructor signature used
here: title, description, version, licenseName, licenseURL) and import it where
SDK is constructed so the ternary branch uses a valid class when specFormat ===
'static'.

---

Outside diff comments:
In `@app/config/sdks.php`:
- Line 267: The repo URL entries include the ".git" clone suffix which causes
non-canonical release and public links; update the SDKs configuration so the
'url' values are the browser-facing repository URLs (remove the trailing ".git")
while keeping the cloneable address only in 'gitUrl' (leave 'gitUrl' with
".git"); locate the SDKs class that builds release links (the SDKs task that
concatenates "{$language['url']}/releases") and replace the '.git' suffixed
'url' entries (e.g., the 'url' keys currently ending with ".git") with their
canonical browser equivalents, ensuring any code that expects the clone URL uses
'gitUrl' instead.

---

Nitpick comments:
In `@src/Appwrite/Platform/Tasks/SDKs.php`:
- Around line 177-178: Currently $spec is defaulted from $language['spec'] to
'swagger2' causing platform-level spec (e.g., $platform['spec']) to be ignored;
change the lookup to prefer $platform['spec'] first, then $language['spec'],
then fallback to 'swagger2' so platforms like APP_SDK_PLATFORM_STATIC can supply
'static' as the default. Update the code that sets $spec (refer to the variables
$platform and $language inside the SDK generation flow in SDKs.php) to check
$platform['spec'] ?? $language['spec'] ?? 'swagger2' and keep the rest of the
logic unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 870c898f-bef2-4557-8a00-9706e305e2e0

📥 Commits

Reviewing files that changed from the base of the PR and between f2c8500 and be50318.

⛔ Files ignored due to path filters (2)
  • composer.lock is excluded by !**/*.lock
  • docs/sdks/markdown/CHANGELOG.md is excluded by !docs/sdks/**
📒 Files selected for processing (3)
  • app/config/sdks.php
  • app/init/constants.php
  • src/Appwrite/Platform/Tasks/SDKs.php

@github-actions
Copy link
Copy Markdown

✨ Benchmark results

  • Requests per second: 1,918
  • Requests with 200 status code: 345,259
  • P99 latency: 0.099522094

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 1,918 1,281
200 345,259 230,586
P99 0.099522094 0.174070384

@ChiragAgg5k ChiragAgg5k merged commit c5b9ac3 into 1.9.x Mar 28, 2026
81 of 83 checks passed
@ChiragAgg5k ChiragAgg5k deleted the codex/static-sdk-platform-1-9-x branch March 28, 2026 14:52
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