Skip to content

Improve database errors for studio#10934

Merged
ItzNotABug merged 5 commits into1.8.xfrom
database-errors
Dec 11, 2025
Merged

Improve database errors for studio#10934
ItzNotABug merged 5 commits into1.8.xfrom
database-errors

Conversation

@ItzNotABug
Copy link
Copy Markdown
Contributor

What does this PR do?

(Provide a description of what this PR does and why it's needed.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

Related PRs and Issues

  • (Related PR or issue)

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?

@ItzNotABug ItzNotABug self-assigned this Dec 11, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 11, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This pull request systematically adds parameterized error messaging throughout the Appwrite platform. The core changes include: (1) updating error definitions in app/config/errors.php to use %s placeholders for entity identifiers, (2) modifying the Exception class in src/Appwrite/Extend/Exception.php to accept an optional params array and format messages using sprintf when provided, and (3) updating approximately 40+ HTTP action/handler files across the database module to pass contextual identifiers (databaseId, collectionId, documentId, etc.) as params when throwing exceptions. Test files have been updated to reflect the new parameterized error message format. No functional logic changes occur beyond message formatting.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • app/config/errors.php: Verify consistency of %s placeholder placement and quotation formatting across 100+ error descriptions spanning multiple error categories. Confirm no unintended regressions in message structure.
  • src/Appwrite/Extend/Exception.php: Review sprintf formatting logic and ensure message composition correctly handles null messages with non-empty params vs. explicit messages.
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php: Contains new $currentDocumentId variable tracking logic distinct from other files; verify this novel pattern correctly propagates document context through the transaction closure.
  • Consistency across handler files: Spot-check a sample of the ~40+ modified action files (Collections/Attributes/, Documents/, Indexes/*, etc.) to confirm params arrays contain correct identifiers in consistent order.
  • Test file assertions: Verify all test assertions (legacy and TablesDB variants) correctly match new parameterized error message format, including proper quoting and ID substitution.
  • Localization implications: Consider impact on internationalization pipelines given the shift from static descriptions to dynamically formatted messages.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch database-errors

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61d1546 and 062233c.

📒 Files selected for processing (49)
  • app/config/errors.php (16 hunks)
  • src/Appwrite/Extend/Exception.php (2 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Action.php (7 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Delete.php (3 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Get.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/Relationship/Create.php (2 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Attributes/XList.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php (4 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php (2 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php (3 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php (3 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php (2 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Logs/XList.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php (4 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php (3 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Get.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php (5 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Get.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/XList.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Logs/XList.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Usage/Get.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/XList.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php (2 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Delete.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Get.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Logs/XList.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Delete.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Get.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Operations/Create.php (3 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php (4 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Update.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/Databases/Usage/Get.php (1 hunks)
  • src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Logs/XList.php (1 hunks)
  • tests/e2e/Services/Databases/Legacy/DatabasesBase.php (1 hunks)
  • tests/e2e/Services/Databases/Legacy/DatabasesCustomClientTest.php (2 hunks)
  • tests/e2e/Services/Databases/Legacy/DatabasesCustomServerTest.php (1 hunks)
  • tests/e2e/Services/Databases/TablesDB/DatabasesBase.php (1 hunks)
  • tests/e2e/Services/Databases/TablesDB/DatabasesCustomClientTest.php (2 hunks)
  • tests/e2e/Services/Databases/TablesDB/DatabasesCustomServerTest.php (1 hunks)
  • tests/e2e/Services/GraphQL/Legacy/AuthTest.php (1 hunks)
  • tests/e2e/Services/GraphQL/TablesDB/AuthTest.php (1 hunks)

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 11, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
libpng 1.6.51-r0 CVE-2025-66293 HIGH
libpng-dev 1.6.51-r0 CVE-2025-66293 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 11, 2025

✨ Benchmark results

  • Requests per second: 1,202
  • Requests with 200 status code: 216,431
  • P99 latency: 0.162921792

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 1,202 1,258
200 216,431 226,570
P99 0.162921792 0.164283078

@ItzNotABug ItzNotABug marked this pull request as ready for review December 11, 2025 11:28
@ItzNotABug ItzNotABug merged commit 72f86ce into 1.8.x Dec 11, 2025
39 of 40 checks passed
@ItzNotABug ItzNotABug deleted the database-errors branch December 11, 2025 11:28
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