Skip to content

refactor(specs): drop the x-appwrite.idGenerator extension - #13742

Merged
ChiragAgg5k merged 2 commits into
mainfrom
refactor/remove-id-generator-extension
Sep 17, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
refactor/remove-id-generator-extension

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

What

Removes the x-appwrite.idGenerator key from the OpenAPI 3 producer. It was emitted on every CustomId parameter in src/Appwrite/SDK/Specification/Format/OpenAPI3.php.

Why

The key has a single constant value, "ID.unique", across all 88 sites in the canonical document, so it says nothing beyond "this parameter's validator was CustomId". An audit across every Appwrite repo found no consumer reading it — not the SDK generator, not vibes, not the console, MCP, or the Terraform provider. The only occurrences outside this repo are the published spec artifacts themselves.

Vibes, the one place the flag would plausibly matter, identifies creatable resource IDs from the schema description instead. isCreatableIdSchema() in src/lib/api-explorer/request-form.ts matches /(?:choose a custom .{0,40}? id|generate a random id|id\.unique\(\))/i, with a second copy in parse-spec.ts for sample values, and path and query parameters are classified as existing-resource references regardless of the description.

Comparing the two signals over the canonical document: 80 of the 88 idGenerator sites are already matched by that regex, and 7 of the remaining 8 are path parameters ({linkId}, {archiveId}, {policyId}, {documentId}, {userId}/sessions) that vibes excludes by rule and that only carry the key because CustomId doubles as a path validator. So no consumer behaviour changes.

This continues the OpenAPI3 standards cleanup tracked in appwrite-labs/cloud#5799: x-appwrite should hold only what OpenAPI cannot express, and a constant-valued flag with no reader does not qualify.

Testing

testOpenApiCustomIdBodyFieldIncludesIdGeneratorMetadata is renamed to testOpenApiCustomIdBodyFieldUsesGeneratedExample and keeps its remaining assertions: the <USER_ID> example derived from the parameter name, and no x-example. The idGenerator assertion is dropped along with the emission rather than inverted.

  • vendor/bin/phpunit tests/unit/SDK/Specification/FormatTest.php — 42 tests, 247 assertions, OK
  • composer lint — Pint passed
  • git grep -i idgenerator — no remaining hits

Follow-up, not in this PR

The audit turned up one genuine gap in the vibes regex that this PR deliberately leaves alone: POST /backups/restoration → newResourceId ("Destination resource ID. Omit to restore the archived resource in place…") is a creatable ID the regex does not match, and POST /organization/projects → projectId matches the regex but was never emitting idGenerator. Both are pre-existing and better fixed in vibes or in the parameter description than by keeping this extension.

The key is emitted on every CustomId parameter with the single constant
value "ID.unique", so it carries no information beyond "this validator
was CustomId", and an audit found no consumer reading it: not the SDK
generator, not vibes, not the console, MCP, or the Terraform provider.

Vibes classifies creatable resource IDs from the schema description
instead, matching /choose a custom … id|generate a random id|ID.unique\(\)/
in isCreatableIdSchema(), and treats every path and query parameter as an
existing-resource reference regardless. Of the 88 canonical sites, 80 are
already matched by that regex and 7 of the remaining 8 are path parameters
vibes excludes by rule, so removing the extension changes no consumer
behaviour.

This continues the OpenAPI3 standards cleanup: x-appwrite should hold only
what OpenAPI cannot express, and a constant-valued flag with no reader
does not qualify.
@greptile-apps

greptile-apps Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no outstanding actionable findings.

Summary

Removes the constant x-appwrite.idGenerator vendor extension from generated OpenAPI schemas for CustomId parameters while preserving generated examples.

  • Deletes emission of the unused idGenerator: ID.unique metadata.
  • Renames the CustomId format test to reflect its remaining generated-example assertions.
  • Removes the implementation-coupled assertion identified in the previous review.

Reviews (2) · Last reviewed commit: "test: keep the CustomId case asserting o..."

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → refactor/remove-id-generator-extension (after).

Metric Before After Change
🚀 Requests/sec 269.72 262.95 ⚪ -2.5%
⏱️ Latency P50 64.53 ms 66.39 ms ⚪ +2.9%
⏱️ Latency P95 150.92 ms 156.29 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 66.39 156.29 16,245 262.95 +5.37
Account 120.97 240.58 855 14.27 -0.84
TablesDB 63.95 121.52 8,835 145.03 +2.34
Storage 61.46 139.66 4,275 72.06 +3.81
Functions 94.78 190.79 2,280 39.04 +2.87

Top API waits (after)

API request Max wait (ms)
account.name.update 370.58
functions.create 355.6
storage.files.delete 321.78
functions.variables.create 316.37
storage.buckets.delete 313.28

@ChiragAgg5k
ChiragAgg5k merged commit 2427434 into main Sep 17, 2026
49 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the refactor/remove-id-generator-extension branch September 17, 2026 15:21
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