Skip to content

feat(specs): replace optional security extension with alternatives - #13543

Merged
ChiragAgg5k merged 4 commits into
mainfrom
clo-4377-optional
Sep 9, 2026
Merged

ChiragAgg5k merged 4 commits into
mainfrom
clo-4377-optional

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Owner-approved scope deferral

The owner approved deferring the remaining pre-existing schema issues and continuing this migration. Strict full-document validation still fails on the documented custom-array schemas; that failure is deferred, not fixed or passing. No additional schema-cleanup work is included in this rollout.

Proceed with the optional-security migration's review/CI and coordinated producer → Cloud/specs → generator release steps. Keep the temporary producer dependency pin and SDK compatibility/release sequencing explicit; this deferral is not approval to disable checks or merge unrelated fixes.


Latest verification — includes enum-default fix #13545 (now merged)

Cloud head 12abbfeab6fd35ddccb669cd43cf8d55eb407068 locks producer integration commit e36198300f0efe854d442526253ae2b7eab2c2fb, which includes #13545's code.

  • Both non-publishing workflows passed: 2.0.x, latest.
  • Artifacts are byte-identical: SHA256 eb9761f869119e57c2f01e3eca3ec12e5bcda9e87ec5bfc8f6750bc4190d1001.
  • Comparison against the preceding object-default-fixed artifacts shows exactly 15 invalid enum defaults removed, and no other parsed differences. Includes timezone, screenshot output, runtime/adapter, locale, encryption, password version, and region defaults.
  • Producer formatter suite passed: 41 tests, 244 assertions, plus targeted Pint.
  • Strict validation still fails on both artifacts: [] is not of type 'string'. The same failure category exists in the published document.
  • A recursive schema scan finds 10 string schemas with empty-array defaults: OAuth2 resource on authorize GET/POST, device authorization, PAR, and token; WAF conditions on bypass, challenge, deny, rate-limit, and redirect creation. Their source validators declare arrays (Multiple(..., TYPE_ARRAY) and WAF Conditions), but the producer's fallback maps them to string. Removing defaults alone would hide the underlying type mismatch.

No PRs merged by this verification, no spec publication or deployment. The release gate remains blocked on these custom-array schema mappings and the previously listed SDK compatibility checks. Earlier sections below are historical evidence.


Latest verification — includes merged #13544

Producer #13543 now includes main through f66db6e969 (merged object-default fix); head e4d63346abff7a70f04c820862b2d285e66b2595. Cloud #5716 locks that producer commit at Cloud head 6f68bc428.

  • Producer formatter tests: 39 tests, 222 assertions, passing; targeted Pint passes.
  • Cloud composer validate --no-check-publish passes; only the server-ce lock reference changed.
  • Non-publishing specs workflows passed: 2.0.x, latest.
  • Both artifacts are byte-identical: SHA256 a5fad5d320ab9592181451b7c479f5d85f603f6d895a829f353374fea81694bb.
  • Compared with the previous genuine candidate artifacts, exactly 16 defaults changed from [] to {}, with no other parsed differences. The optional-security migration is unchanged.
  • Strict openapi-spec-validator now gets past the empty-object-default failure but fails on screenshot timezone: GET /avatars/screenshots, parameter index 9, has default: "" outside its titled oneOf timezone enum. This field is unchanged from the previous artifact. Full spec validation remains blocked, not passing.
  • No specs were published or deployments performed. Historical verification below refers to earlier commits/artifacts; SDK output parity has not been rerun after the object-default fix.

Summary

Part of CLO-4377: replace security-scheme x-appwrite.optional with standard security alternatives.

  • Emit the existing base authentication requirement, followed by an alternative that includes supplemental location credentials (currently ImpersonateUserId).
  • Preserve the existing AND grouping of base credentials, project binding, platform availability, and x-appwrite.auth example configuration.
  • Remove optional from the three impersonation scheme definitions on all platforms. Keep the definitions; do not introduce operation references for Email/Phone.
  • Document the location-auth metadata contract and cover canonical/client/server/console output.

The current producer emits OpenAPI 3 only; there is no Swagger 2 emitter here to update.

Coordination / rollout

Companion generator PR: appwrite/sdk-generator#1891.

The generator uses the standard-security methods released in utopia-php/openapi#11, version 0.2.2. API security remains separate from platform-specific SDK example configuration.

Keep this draft until genuine Cloud generation and structural/output baseline comparisons are complete. Promote the producer and publish canonical 2.0.x/latest before releasing the generator that removes legacy handling. Also verify the deployed generator against the replacement specs before publication. No specs publishing, Cloud promotion, or releases were performed.

Verification

  • vendor/bin/phpunit tests/unit/SDK/Specification/FormatTest.php — passed: 37 tests, 204 assertions.
  • vendor/bin/pint --test src/Appwrite/Platform/Tasks/Specs.php src/Appwrite/SDK/Method.php src/Appwrite/SDK/Specification/Format/OpenAPI3.php tests/unit/SDK/Specification/FormatTest.php — passed.
  • git diff --check — passed.

Tests exercise the producer formatter with real route/SDK metadata, including optional location auth on all platforms and unchanged single-alternative non-location auth. The companion generator's PHP mock-API e2e passes, but that is not Appwrite authentication runtime verification.

Cloud workflow verification

Cloud #5716 pins this producer branch. Non-publishing specs runs passed for 2.0.x and latest. A controlled parent-commit run isolates the migration from current-main drift.

Against that genuine baseline, the only parsed differences are the 3 scheme optional removals and 16 security-array replacements (including Cloud invoice download/view). Both versions produce identical bytes, SHA256 5454c86362e1ee39d0eaa0d1f1282d965b334041824bc047336fe262a6c27740; 1,022 operations, 77 aliases, 16 schemes. PHP client/server/console full generated trees match old-generator/old-spec versus new-generator/new-spec.

Remaining: strict OpenAPI validation fails on an object schema with default: [], identically in the published spec. Current generation also has independent OAuth/DNS changes versus the published 1,020-operation spec; those require publication review. Cross-language parity, deployed-generator compatibility, Appwrite impersonation runtime e2e, and full-project static analysis remain incomplete. No screenshots apply to these nonvisual changes.

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → clo-4377-optional (after).

Metric Before After Change
🚀 Requests/sec 218.22 215.11 ⚪ -1.4%
⏱️ Latency P50 80.15 ms 81.8 ms ⚪ +2.1%
⏱️ Latency P95 186.98 ms 188.73 ms ⚪ +0.9%
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 81.8 188.73 13,680 215.11 +1.75
Account 160.3 270.12 720 11.99 -0.16
TablesDB 78.73 142.82 7,440 119.28 +9.28
Storage 75.84 165.01 3,600 59.64 -2.24
Functions 117.8 227.2 1,920 32.52 +3.29

Top API waits (after)

API request Max wait (ms)
account.prefs.update 384.32
account.name.update 367.93
storage.buckets.create 362.6
functions.create 355.65
tablesdb.rows.update 339.07

@ChiragAgg5k
ChiragAgg5k marked this pull request as ready for review September 8, 2026 18:54
@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable correctness, security, or repository-rule violations were identified.

Summary

  • Emits base authentication as one alternative and base authentication plus location credentials as another.
  • Preserves project binding and platform-specific authentication requirements.
  • Removes x-appwrite.optional from impersonation scheme definitions.
  • Recursively validates defaults against composed and array enum schemas.
  • Adds formatter coverage across canonical, client, server, console, query-parameter, and request-body output.

@ChiragAgg5k
ChiragAgg5k merged commit b821805 into main Sep 9, 2026
46 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the clo-4377-optional branch September 9, 2026 08:20
@ChiragAgg5k ChiragAgg5k mentioned this pull request Sep 10, 2026
2 of 4 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.

2 participants