Skip to content

chore: remove sdk deprecation warnings#10408

Merged
abnegate merged 9 commits into1.8.xfrom
update-warning
Sep 1, 2025
Merged

chore: remove sdk deprecation warnings#10408
abnegate merged 9 commits into1.8.xfrom
update-warning

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

@ChiragAgg5k ChiragAgg5k commented Aug 29, 2025

What does this PR do?

new warning:

Route /v1/databases/:databaseId/collections/:collectionId/documents is deprecated since 1.8.0. Please use `tablesDB.listRows` instead. See: https://appwrite.io/docs/references/cloud/server-rest/tablesDB#listRows

Test Plan

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?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 29, 2025

📝 Walkthrough

Walkthrough

The PR removes the deprecation-warning assembly and emission logic from app/controllers/general.php (the code that computed SDK-derived deprecation details and appended them to $warnings, including the corresponding block in App::get('/robots.txt')). The deprecation pathway that would emit X-Appwrite-Warning is no longer executed; no other routing, error handling, or response logic was changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • ItzNotABug
  • abnegate
  • loks0n

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bc18f9d and 7600edb.

📒 Files selected for processing (1)
  • app/controllers/general.php (0 hunks)
💤 Files with no reviewable changes (1)
  • app/controllers/general.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: E2E Service Test (Webhooks)
  • GitHub Check: E2E Service Test (Projects)
  • GitHub Check: E2E Service Test (Teams)
  • GitHub Check: E2E Service Test (Locale)
  • GitHub Check: E2E Service Test (Realtime)
  • GitHub Check: E2E Service Test (Databases/TablesDB)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: E2E Service Test (Console)
  • GitHub Check: E2E Service Test (Avatars)
  • GitHub Check: E2E Service Test (Dev Keys)
  • GitHub Check: E2E Service Test (Site Screenshots)
  • GitHub Check: E2E General Test
  • GitHub Check: Unit Test
  • GitHub Check: Benchmark
  • GitHub Check: scan
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-warning

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c7bbb6a and 262be06.

📒 Files selected for processing (1)
  • app/controllers/general.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/controllers/general.php (2)
src/Appwrite/SDK/Method.php (1)
  • getDeprecated (191-194)
src/Appwrite/SDK/Deprecated.php (2)
  • getReplaceWith (28-31)
  • getSince (20-23)
🔇 Additional comments (1)
app/controllers/general.php (1)

1081-1084: No multi-dot replaceWith patterns found. All current replaceWith values contain exactly one dot; no changes required.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 29, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
golang.org/x/crypto v0.31.0 CVE-2025-22869 HIGH
golang.org/x/oauth2 v0.24.0 CVE-2025-22868 HIGH
stdlib 1.22.10 CVE-2025-47907 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 29, 2025

✨ Benchmark results

  • Requests per second: 1,239
  • Requests with 200 status code: 223,094
  • P99 latency: 0.155082926

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 1,239 1,006
200 223,094 181,192
P99 0.155082926 0.196545489

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: 0

🧹 Nitpick comments (1)
app/controllers/general.php (1)

1078-1088: Avoid empty “Please use …” and incorrect docs path when headers are absent; build message/link conditionally with safe fallbacks

Using default 'rest'/'server' makes the “Route …” prefix always chosen and can yield a broken link when replaceWith is empty. Build the anchor and link only when replacement exists, detect header presence with empty defaults, fall back to server-rest, and sanitize the final header value.

-                $deprecatedMethod = $sdkItems[0]->getDeprecated();
-
-                $replaceWith = $deprecatedMethod->getReplaceWith();
-                if ($replaceWith) {
-                    $replaceWith = preg_replace('/\./', '#', $replaceWith, 1);
-                }
-                $sdkName = $request->getHeader('x-sdk-name', 'rest');
-                $sdkPlatform = $request->getHeader('x-sdk-platform', 'server');
-                $deprecatedReplaceWithLink = 'https://appwrite.io/docs/references/cloud/' . $sdkPlatform . '-' . strtolower($sdkName) . '/' . $replaceWith;
-
-                $deprecationWarning = (!empty($sdkName) ? 'Route ' . $route->getPath() : 'Method `' . $sdkItems[0]->getNamespace() . '.' . $sdkItems[0]->getMethodName() . '`') . ' is deprecated since ' . $deprecatedMethod->getSince() . '. Please use `' . $deprecatedMethod->getReplaceWith() . '` instead. See: ' . $deprecatedReplaceWithLink;
+                $deprecated = $sdkItems[0]->getDeprecated();
+
+                $replaceWithRaw = $deprecated->getReplaceWith();
+                $anchor = $replaceWithRaw ? preg_replace('/\./', '#', $replaceWithRaw, 1) : '';
+
+                // Detect actual header presence; use sane fallback for docs section
+                $sdkName = $request->getHeader('x-sdk-name', '');
+                $sdkPlatform = $request->getHeader('x-sdk-platform', '');
+                $docsSection = (!empty($sdkName) && !empty($sdkPlatform))
+                    ? ($sdkPlatform . '-' . strtolower($sdkName))
+                    : 'server-rest';
+
+                $deprecatedReplaceWithLink = 'https://appwrite.io/docs/references/cloud/' . $docsSection . ($anchor ? '/' . $anchor : '');
+
+                $prefix = !empty($sdkName)
+                    ? ('Route ' . $route->getPath())
+                    : ('Method `' . $sdkItems[0]->getNamespace() . '.' . $sdkItems[0]->getMethodName() . '`');
+
+                $deprecationWarning = $prefix . ' is deprecated since ' . $deprecated->getSince() . '.';
+                if (!empty($replaceWithRaw)) {
+                    $deprecationWarning .= ' Please use `' . $replaceWithRaw . '` instead.';
+                }
+                $deprecationWarning .= ' See: ' . $deprecatedReplaceWithLink;
+                // Defensive: prevent header injection via unexpected control chars in metadata
+                $deprecationWarning = preg_replace('/[\r\n]+/', ' ', $deprecationWarning);
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 674d928 and 2710282.

📒 Files selected for processing (1)
  • app/controllers/general.php (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ChiragAgg5k
PR: appwrite/appwrite#10408
File: app/controllers/general.php:0-0
Timestamp: 2025-08-29T15:29:23.250Z
Learning: In app/controllers/general.php, the deprecation warning logic is safely implemented: it first checks isDeprecated() for all SDK items (which returns $this->deprecated !== null), and only when all are deprecated does it call getDeprecated(). This logical flow guarantees that getDeprecated() cannot return null in that context, making additional null checks unnecessary.
📚 Learning: 2025-08-29T15:29:23.250Z
Learnt from: ChiragAgg5k
PR: appwrite/appwrite#10408
File: app/controllers/general.php:0-0
Timestamp: 2025-08-29T15:29:23.250Z
Learning: In app/controllers/general.php, the deprecation warning logic is safely implemented: it first checks isDeprecated() for all SDK items (which returns $this->deprecated !== null), and only when all are deprecated does it call getDeprecated(). This logical flow guarantees that getDeprecated() cannot return null in that context, making additional null checks unnecessary.

Applied to files:

  • app/controllers/general.php
📚 Learning: 2025-08-29T15:29:23.250Z
Learnt from: ChiragAgg5k
PR: appwrite/appwrite#10408
File: app/controllers/general.php:0-0
Timestamp: 2025-08-29T15:29:23.250Z
Learning: In the Appwrite codebase, when SDK methods are marked as deprecated (isDeprecated() returns true), the getDeprecated() method is guaranteed to return valid deprecation metadata objects, not null. The deprecation checking logic first verifies isDeprecated() before accessing getDeprecated(), providing implicit null-safety.

Applied to files:

  • app/controllers/general.php
🧬 Code graph analysis (1)
app/controllers/general.php (3)
src/Appwrite/SDK/Method.php (3)
  • getDeprecated (191-194)
  • getNamespace (128-131)
  • getMethodName (138-141)
src/Appwrite/SDK/Deprecated.php (2)
  • getReplaceWith (28-31)
  • getSince (20-23)
src/Appwrite/Utopia/Request.php (1)
  • getHeader (195-199)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: E2E Service Test (Messaging)
  • GitHub Check: E2E Service Test (Storage)
  • GitHub Check: E2E Service Test (Webhooks)
  • GitHub Check: E2E Service Test (Health)
  • GitHub Check: E2E Service Test (Sites)
  • GitHub Check: E2E Service Test (Locale)
  • GitHub Check: E2E Service Test (Tokens)
  • GitHub Check: E2E Service Test (Databases/TablesDB)
  • GitHub Check: E2E Service Test (GraphQL)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: E2E Service Test (Avatars)
  • GitHub Check: E2E Service Test (Site Screenshots)
  • GitHub Check: E2E Service Test (Dev Keys)
  • GitHub Check: Unit Test
  • GitHub Check: E2E General Test
  • GitHub Check: Benchmark
  • GitHub Check: scan

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2710282 and 4ee0c12.

📒 Files selected for processing (1)
  • app/controllers/general.php (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ChiragAgg5k
PR: appwrite/appwrite#10408
File: app/controllers/general.php:0-0
Timestamp: 2025-08-29T15:29:23.250Z
Learning: In app/controllers/general.php, the deprecation warning logic is safely implemented: it first checks isDeprecated() for all SDK items (which returns $this->deprecated !== null), and only when all are deprecated does it call getDeprecated(). This logical flow guarantees that getDeprecated() cannot return null in that context, making additional null checks unnecessary.
📚 Learning: 2025-08-29T15:29:23.250Z
Learnt from: ChiragAgg5k
PR: appwrite/appwrite#10408
File: app/controllers/general.php:0-0
Timestamp: 2025-08-29T15:29:23.250Z
Learning: In app/controllers/general.php, the deprecation warning logic is safely implemented: it first checks isDeprecated() for all SDK items (which returns $this->deprecated !== null), and only when all are deprecated does it call getDeprecated(). This logical flow guarantees that getDeprecated() cannot return null in that context, making additional null checks unnecessary.

Applied to files:

  • app/controllers/general.php
📚 Learning: 2025-08-29T15:29:23.250Z
Learnt from: ChiragAgg5k
PR: appwrite/appwrite#10408
File: app/controllers/general.php:0-0
Timestamp: 2025-08-29T15:29:23.250Z
Learning: In the Appwrite codebase, when SDK methods are marked as deprecated (isDeprecated() returns true), the getDeprecated() method is guaranteed to return valid deprecation metadata objects, not null. The deprecation checking logic first verifies isDeprecated() before accessing getDeprecated(), providing implicit null-safety.

Applied to files:

  • app/controllers/general.php
🧬 Code graph analysis (1)
app/controllers/general.php (3)
src/Appwrite/SDK/Method.php (3)
  • getDeprecated (191-194)
  • getNamespace (128-131)
  • getMethodName (138-141)
src/Appwrite/SDK/Deprecated.php (2)
  • getReplaceWith (28-31)
  • getSince (20-23)
src/Appwrite/Utopia/Request.php (1)
  • getHeader (195-199)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
  • GitHub Check: Benchmark
  • GitHub Check: E2E Service Test (Storage)
  • GitHub Check: E2E Service Test (Teams)
  • GitHub Check: E2E Service Test (Webhooks)
  • GitHub Check: E2E Service Test (Messaging)
  • GitHub Check: E2E Service Test (Users)
  • GitHub Check: E2E Service Test (Realtime)
  • GitHub Check: E2E Service Test (Proxy)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: E2E Service Test (Sites)
  • GitHub Check: E2E Service Test (GraphQL)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (FunctionsSchedule)
  • GitHub Check: E2E Service Test (Databases/Legacy)
  • GitHub Check: E2E Service Test (Console)
  • GitHub Check: E2E Service Test (Databases/TablesDB)
  • GitHub Check: E2E General Test

@ChiragAgg5k ChiragAgg5k changed the title chore: improve deprecation warning chore: remove sdk deprecation warnings Sep 1, 2025
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 (2)
app/controllers/general.php (2)

1055-1055: Expose X-Appwrite-Warning for browsers (CORS).

Without exposing this header, web clients can’t read the deprecation warning.

Apply:

-            ->addHeader('Access-Control-Expose-Headers', 'X-Appwrite-Session, X-Fallback-Cookies')
+            ->addHeader('Access-Control-Expose-Headers', 'X-Appwrite-Session, X-Fallback-Cookies, X-Appwrite-Warning')

1165-1169: Mirror CORS expose for OPTIONS preflight.

Keep OPTIONS consistent so UAs know the warning header is readable.

Apply:

-            ->addHeader('Access-Control-Expose-Headers', 'X-Appwrite-Session, X-Fallback-Cookies')
+            ->addHeader('Access-Control-Expose-Headers', 'X-Appwrite-Session, X-Fallback-Cookies, X-Appwrite-Warning')
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4ee0c12 and bc18f9d.

📒 Files selected for processing (1)
  • app/controllers/general.php (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: ChiragAgg5k
PR: appwrite/appwrite#10408
File: app/controllers/general.php:0-0
Timestamp: 2025-08-29T15:29:23.250Z
Learning: In app/controllers/general.php, the deprecation warning logic is safely implemented: it first checks isDeprecated() for all SDK items (which returns $this->deprecated !== null), and only when all are deprecated does it call getDeprecated(). This logical flow guarantees that getDeprecated() cannot return null in that context, making additional null checks unnecessary.
📚 Learning: 2025-08-29T15:29:23.250Z
Learnt from: ChiragAgg5k
PR: appwrite/appwrite#10408
File: app/controllers/general.php:0-0
Timestamp: 2025-08-29T15:29:23.250Z
Learning: In app/controllers/general.php, the deprecation warning logic is safely implemented: it first checks isDeprecated() for all SDK items (which returns $this->deprecated !== null), and only when all are deprecated does it call getDeprecated(). This logical flow guarantees that getDeprecated() cannot return null in that context, making additional null checks unnecessary.

Applied to files:

  • app/controllers/general.php
📚 Learning: 2025-08-29T15:29:23.250Z
Learnt from: ChiragAgg5k
PR: appwrite/appwrite#10408
File: app/controllers/general.php:0-0
Timestamp: 2025-08-29T15:29:23.250Z
Learning: In the Appwrite codebase, when SDK methods are marked as deprecated (isDeprecated() returns true), the getDeprecated() method is guaranteed to return valid deprecation metadata objects, not null. The deprecation checking logic first verifies isDeprecated() before accessing getDeprecated(), providing implicit null-safety.

Applied to files:

  • app/controllers/general.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: E2E Service Test (Migrations)
  • GitHub Check: E2E Service Test (Webhooks)
  • GitHub Check: E2E Service Test (Projects)
  • GitHub Check: E2E Service Test (Messaging)
  • GitHub Check: E2E Service Test (Proxy)
  • GitHub Check: E2E Service Test (Realtime)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: E2E Service Test (Sites)
  • GitHub Check: E2E Service Test (Locale)
  • GitHub Check: E2E Service Test (Console)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (Avatars)
  • GitHub Check: E2E Service Test (Dev Keys)
  • GitHub Check: E2E Service Test (Databases/Legacy)
  • GitHub Check: E2E Service Test (Databases/TablesDB)
  • GitHub Check: E2E Service Test (Site Screenshots)
  • GitHub Check: E2E General Test
  • GitHub Check: Unit Test
  • GitHub Check: scan

Comment on lines +1067 to +1102
// $sdk = $route->getLabel('sdk', false);
// $sdkItems = is_array($sdk) ? $sdk : (!empty($sdk) ? [$sdk] : []);
// if (!empty($sdkItems) && count($sdkItems) > 0) {
// $allDeprecated = true;
// foreach ($sdkItems as $sdkItem) {
// if (!$sdkItem->isDeprecated()) {
// $allDeprecated = false;
// break;
// }
// }
// if ($allDeprecated) {
// $deprecatedMethod = $sdkItems[0]->getDeprecated();

// $replaceWith = $deprecatedMethod->getReplaceWith();
// if ($replaceWith) {
// $replaceWith = preg_replace('/\./', '#', $replaceWith, 1);
// }

// $sdkNameHeader = strtolower($request->getHeader('x-sdk-name', ''));
// $sdkPlatformHeader = strtolower($request->getHeader('x-sdk-platform', ''));

// $sdkExists = !empty($sdkNameHeader);
// $sdkName = $sdkExists ? $sdkNameHeader : 'rest';
// $sdkPlatform = !empty($sdkPlatformHeader) ? $sdkPlatformHeader : 'server';

// $deprecatedReplaceWithLink = 'https://appwrite.io/docs/references/cloud/' . $sdkPlatform . '-' . $sdkName . '/' . $replaceWith;

// $deprecationWarning = (
// !$sdkExists
// ? 'Route ' . $route->getPath()
// : 'Method `' . $sdkItems[0]->getNamespace() . '.' . $sdkItems[0]->getMethodName() . '`'
// ) . ' is deprecated since ' . $deprecatedMethod->getSince() . '. Please use `' . $deprecatedMethod->getReplaceWith() . '` instead. See: ' . $deprecatedReplaceWithLink;

// $warnings[] = $deprecationWarning;
// }
// }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Deprecation warnings are fully disabled; PR objective not met. Reinstate warning for the specific route.

Commenting out this block stops emitting any X-Appwrite-Warning. Add a minimal, explicit warning for the target route to satisfy the PR description.

Apply:

-        /** @var \Appwrite\SDK\Method $sdk */
-        // $sdk = $route->getLabel('sdk', false);
-        // $sdkItems = is_array($sdk) ? $sdk : (!empty($sdk) ? [$sdk] : []);
-        // if (!empty($sdkItems) && count($sdkItems) > 0) {
-        //     $allDeprecated = true;
-        //     foreach ($sdkItems as $sdkItem) {
-        //         if (!$sdkItem->isDeprecated()) {
-        //             $allDeprecated = false;
-        //             break;
-        //         }
-        //     }
-        //     if ($allDeprecated) {
-        //         $deprecatedMethod = $sdkItems[0]->getDeprecated();
-
-        //         $replaceWith = $deprecatedMethod->getReplaceWith();
-        //         if ($replaceWith) {
-        //             $replaceWith = preg_replace('/\./', '#', $replaceWith, 1);
-        //         }
-
-        //         $sdkNameHeader = strtolower($request->getHeader('x-sdk-name', ''));
-        //         $sdkPlatformHeader = strtolower($request->getHeader('x-sdk-platform', ''));
-
-        //         $sdkExists = !empty($sdkNameHeader);
-        //         $sdkName = $sdkExists ? $sdkNameHeader : 'rest';
-        //         $sdkPlatform = !empty($sdkPlatformHeader) ? $sdkPlatformHeader : 'server';
-
-        //         $deprecatedReplaceWithLink = 'https://appwrite.io/docs/references/cloud/' . $sdkPlatform . '-' . $sdkName . '/' . $replaceWith;
-
-        //         $deprecationWarning = (
-        //             !$sdkExists
-        //             ? 'Route ' . $route->getPath()
-        //             : 'Method `' . $sdkItems[0]->getNamespace() . '.' . $sdkItems[0]->getMethodName() . '`'
-        //         ) . ' is deprecated since ' . $deprecatedMethod->getSince() . '. Please use `' . $deprecatedMethod->getReplaceWith() . '` instead. See: ' . $deprecatedReplaceWithLink;
-
-        //         $warnings[] = $deprecationWarning;
-        //     }
-        // }
+        // Emit explicit deprecation warning for legacy Documents list route
+        $routePath = $route->getPath();
+        $deprecatedRoutePatterns = [
+            '/v1/databases/{databaseId}/collections/{collectionId}/documents',
+            '/v1/databases/:databaseId/collections/:collectionId/documents',
+        ];
+        if (\in_array($routePath, $deprecatedRoutePatterns, true)) {
+            $warnings[] = 'Route /v1/databases/:databaseId/collections/:collectionId/documents is deprecated since 1.8.0. Please use `tablesDB.listRows` instead. See: https://appwrite.io/docs/references/cloud/server-rest/tablesDB#listRows';
+        }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In app/controllers/general.php around lines 1067-1102 the entire deprecation
warning block was commented out, disabling X-Appwrite-Warning; restore a minimal
explicit warning for the current route by re-enabling logic that inspects the
route's 'sdk' label, checks if all listed SDK items are deprecated, retrieves
the deprecated metadata (since and replaceWith), normalizes x-sdk-name /
x-sdk-platform headers (lowercase, default to 'rest'/'server' when missing),
build the replacement doc link (replace first '.' with '#' in replaceWith) and
append a single concise deprecation string to $warnings[] (use route path when
no SDK header, otherwise include SDK namespace.method), keeping the code minimal
and only adding the one warning for the target route.

Comment on lines +1067 to +1078
// $sdk = $route->getLabel('sdk', false);
// $sdkItems = is_array($sdk) ? $sdk : (!empty($sdk) ? [$sdk] : []);
// if (!empty($sdkItems) && count($sdkItems) > 0) {
// $allDeprecated = true;
// foreach ($sdkItems as $sdkItem) {
// if (!$sdkItem->isDeprecated()) {
// $allDeprecated = false;
// break;
// }
// }
// if ($allDeprecated) {
// $deprecatedMethod = $sdkItems[0]->getDeprecated();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's remove code instead of leaving it commented, if we need it back, we can get it from git history

@abnegate abnegate merged commit b46d22a into 1.8.x Sep 1, 2025
41 checks passed
@abnegate abnegate deleted the update-warning branch September 1, 2025 08:00
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.

3 participants