Skip to content

fix: record SDK names on API keys regardless of case - #13940

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/terraform-sdk-name
Sep 28, 2026
Merged

ChiragAgg5k merged 1 commit into
mainfrom
fix/terraform-sdk-name

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

What does this PR do?

API keys record which SDKs used them in their sdks attribute, but for standard keys nothing was ever recorded from a real SDK.

  • Case mismatch: the servers allowlist is lowercased (go, node.js, python, …) and the WhiteList validator is strict, but x-sdk-name was checked as sent. Every generated SDK sends a display name (Go, Node.js, Python), so none matched. The existing e2e test only passed because it sent lowercase names by hand. The header is now lowercased before validation, which also keeps Python and python from being recorded twice.
  • Terraform: the Terraform provider now sends x-sdk-name: Terraform instead of the Go SDK's Go (feat: identify requests as the Terraform provider, not the Go SDK terraform-provider-appwrite#52, released in v2.2.0). The allowlist only held generated server SDKs from app/config/sdks.php, and adding an entry there would also add it to SDK generation. It now also includes a new APP_SDK_INTEGRATIONS constant, which currently holds terraform.

Test Plan

  • Extended the API key test in ProjectsConsoleClientTest to send Go, Terraform and Python as real clients do. It asserts that the key records go and terraform and that Python doesn't duplicate python. The added assertions fail without the lowercasing.
  • Pint and PHPStan pass on the changed files.

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs? (No API metadata changes.)

SDKs send display names like Go and Node.js while the allowlist is lowercase and checked strictly, so standard keys never recorded an SDK. Also accept terraform, which the provider now reports instead of Go.
@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Normalizes SDK name recording on API keys.

The PR appears safe to merge; no outstanding finding or new actionable issue was identified.

Summary

The PR lowercases reported SDK names before recording them on API keys and accepts Terraform as a server-side integration.

  • Extends the API-key e2e test to check mixed-case names and case-insensitive deduplication.

Reviews (2) · Last reviewed commit: "fix: record SDK names on API keys regard..."

@ChiragAgg5k
ChiragAgg5k deleted the fix/terraform-sdk-name branch September 28, 2026 11:31
@ChiragAgg5k
ChiragAgg5k restored the fix/terraform-sdk-name branch September 28, 2026 11:31
@ChiragAgg5k ChiragAgg5k reopened this Sep 28, 2026
@hansi-codes

hansi-codes Bot commented Sep 28, 2026

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The changed allowlist and normalization behavior match the intended SDK names, and the expanded test exercises recording and deduplication.

This change normalizes SDK names from request headers before validating and recording them on API keys. It also adds Terraform to the server SDK allowlist and extends the API-key e2e test to cover display-name casing and deduplication.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 4
File Change
app/controllers/shared/api.php Lowercases the SDK header before allowlist validation and recording.
app/init/constants.php Defines the supported non-generated SDK integration names.
app/init/resources.php Adds integrations to the server SDK allowlist.
tests/e2e/Services/Projects/ProjectsConsoleClientTest.php Covers Go and Terraform recording and confirms a repeat Python name is deduplicated.

Reviewed 3dae848 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@hansi-codes hansi-codes Bot 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 5bfb4b1 into main Sep 28, 2026
60 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/terraform-sdk-name branch September 28, 2026 11:34
@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/terraform-sdk-name (after).

Metric Before After Change
🚀 Requests/sec 174.93 200.75 🟢 +14.8%
⏱️ Latency P50 97.13 ms 86.15 ms 🟢 -11.3%
⏱️ Latency P95 233.6 ms 203.03 ms 🟢 -13.1%
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 86.15 203.03 12,540 200.75 -30.57
Account 161.59 313.85 660 11.21 -52.67
TablesDB 83.41 159.51 6,820 111.35 -29.04
Storage 79.25 162.59 3,300 55.6 -31.92
Functions 126.99 235.45 1,760 30.4 -31.8

Top API waits (after)

API request Max wait (ms)
storage.buckets.create 500.02
account.prefs.update 436.79
functions.create 426.57
account.name.update 425.79
tablesdb.rows.delete 389.2

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