Skip to content

test(sdk): lock SDK parameter order so reorders fail CI - #14469

Merged
ChiragAgg5k merged 2 commits into
mainfrom
feat/sdk-parameter-order-lock
Oct 14, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
feat/sdk-parameter-order-lock

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

SDKs pass arguments positionally, so a param declared in the wrong place silently shifts released callers (#14423, #14467). This locks the order and fails CI when it changes.

app/config/sdks/parameters.lock.json records each method per platform, in SDK order: path/query before body, required first, then as declared, which matches the generator.

"server": {
    "messaging.updateSMS": ["messageId", "topics", "users", "targets", "content", "draft", "scheduledAt"],

tests/unit/SDK/ParametersTest.php loads every route and checks:

Change Result
reorder or remove a locked param, or remove a method fail: breaking; update the lock only if intended
new param ahead of locked ones fail: make it optional and declare it last
new method, or param appended last fail until added to the lock (the message prints the exact entry)
SDK method 'messaging.updateSMS' (console) has new param 'foo' ahead of existing ones.
Locked:  messageId, topics, users, targets, content, draft, scheduledAt
Current: messageId, topics, users, targets, foo, content, draft, scheduledAt
SDKs order params required first, then as declared. Make 'foo' optional and declare it last, then append it in app/config/sdks/parameters.lock.json.

The lock was seeded from main and checked against the released SDKs: it matches node 29.3.1 (server) and web 28.3.0 (client). Console 19.0.0 shipped the reordered messaging and OAuth2 signatures that #14467 reverted. The lock keeps the server order, so the next console SDK release moves those 15 methods back. The console app passes objects, not positional args, so it isn't affected.

Seen red: with #14467 reverted, the test fails on messaging.createEmail (shown above for an injected param).

Closes #14470

SDKs pass arguments positionally, so declaring a new param ahead of an existing one, or reordering existing ones, silently shifts released callers onto the wrong params. The lock records every SDK method's order per platform; the test fails on a reorder, a removal or a new param placed ahead of existing ones, and asks for new methods and appended params to be added.
@luxor-code-review

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

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


This PR introduces a contract lock for the SDK generator's positional parameter order: a new per-platform lockfile for client/server/console and a unit test that mirrors Format::getMethodParameters() ordering against live registered routes, failing with actionable messages when released orders change or new methods are missing from the lock.

Files Change
app/config/sdks/parameters.lock.json New lockfile pinning the positional parameter order of every SDK method, keyed by auth platform.
tests/unit/SDK/ParametersTest.php New unit test that recomputes parameter order from routes (mirroring the generator) and asserts released orders are preserved and all current methods are locked.

No findings met the reporting threshold; reviewers confirmed route-bootstrap parity, platform keying, hidden/deprecated param handling, and alias matching as sound.

Reviewed commit: 3af8660

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

19 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (12)
  • php.appwrite.secret-compare-timing (5)
  • 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.

@ghost

ghost commented Oct 14, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

Adds a per-platform lock for SDK method parameter order and a unit test that derives current parameter lists from registered routes and checks them against that lock. The SDK specification formatter now exposes the same requiredness rule used by generation so the test also reproduces SDK-required parameter ordering, including the web-platform hostname override.

Latest changes: The latest commit extracts the hostname-requiredness override into Format::isRequired() and uses it when deriving locked parameter order, keeping the test aligned with generated SDK signatures.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 3
File Change
app/config/sdks/parameters.lock.json Records the locked SDK method parameter order per platform.
src/Appwrite/SDK/Specification/Format.php Shares SDK parameter requiredness logic, including the hostname override, with the contract test.
tests/unit/SDK/ParametersTest.php Uses the shared requiredness logic to derive the parameter order checked against the lock.

Reviewed the commits since 3af8660 · 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 A · See the inline comments. Summary

Comment thread tests/unit/SDK/ParametersTest.php Resolved
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → feat/sdk-parameter-order-lock (after).

Metric Before After Change
🚀 Requests/sec 186.68 175.23 🔴 -6.1%
⏱️ Latency P50 91.6 ms 98.68 ms 🔴 +7.7%
⏱️ Latency P95 217.83 ms 229.78 ms 🔴 +5.5%
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 98.68 229.78 11,229 175.23 +11.95
Account 182.1 367.98 591 9.8 +4.28
TablesDB 95.2 175.2 6,107 97.75 +18.98
Storage 93.1 194.63 2,955 48.69 +12.72
Functions 142.44 278.14 1,576 26.52 +12.61

Top API waits (after)

API request Max wait (ms)
storage.files.delete 519.93
account.prefs.update 480.2
functions.create 473.79
account.name.update 470.07
functions.variables.create 452.04

The spec forces hostname to required on createWebPlatform and updateWebPlatform, so SDKs list it ahead of optional params. The lock test read the route flag instead and would have flagged an optional param declared before hostname as breaking.

@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

@ChiragAgg5k
ChiragAgg5k merged commit c0a2e43 into main Oct 14, 2026
68 checks passed
abnegate added a commit that referenced this pull request Oct 14, 2026
Bring in the description schema attribute (#14471) and the SDK parameter
order lock (#14469). The collection configs on this branch declare
attributes with typed Attribute value objects, so main's array-shaped
description entries are ported as Attribute::string(size: 1024, default: '')
in the same positions; the V25 steps already go through the typed
createAttributeFromCollection helpers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ChiragAgg5k ChiragAgg5k mentioned this pull request Oct 21, 2026
6 tasks
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.

Lock SDK parameter order so reorders fail CI

1 participant