Conversation
# Conflicts: # composer.lock
📝 WalkthroughWalkthroughThe PR changes Databases HTTP action class inheritance and corresponding Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (4)
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. Comment |
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
✨ Benchmark results
⚡ Benchmark Comparison
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php (4)
5641-5644: Avoid hand-written JSON for operators; build with json_encode (safer, clearer).Hand-typed JSON strings are brittle and include an empty 'attribute'. Build via arrays to ensure valid JSON and omit unused keys.
@@ - 'data' => [ - 'items' => '{"method":"arrayRemove","attribute":"","values":["item2"]}' - ] + 'data' => [ + 'items' => json_encode(['method' => 'arrayRemove', 'values' => ['item2']]) + ] @@ - 'data' => [ - 'items' => '{"method":"arrayInsert","attribute":"","values":[2,"newItem"]}' - ] + 'data' => [ + 'items' => json_encode(['method' => 'arrayInsert', 'values' => [2, 'newItem']]) + ]See next comment for confirming TablesDB expects 'column' vs inferring from context.
Also applies to: 5655-5657
5765-5767: Same refactor for bulk createOperations operator payloads.@@ - 'data' => [ - 'tags' => '{"method":"arrayRemove","attribute":"","values":["javascript"]}' - ] + 'data' => [ + 'tags' => json_encode(['method' => 'arrayRemove', 'values' => ['javascript']]) + ] @@ - 'data' => [ - 'tags' => '{"method":"arrayAppend","attribute":"","values":["go","rust"]}' - ] + 'data' => [ + 'tags' => json_encode(['method' => 'arrayAppend', 'values' => ['go', 'rust']]) + ]Also applies to: 5775-5776
5891-5895: Same refactor for multiple-operators test; also removes empty 'attribute'.@@ - 'data' => [ - 'list1' => '{"method":"arrayPrepend","attribute":"","values":["z"]}' - ] + 'data' => [ + 'list1' => json_encode(['method' => 'arrayPrepend', 'values' => ['z']]) + ] @@ - 'data' => [ - 'list2' => '{"method":"arrayAppend","attribute":"","values":["w"]}' - ] + 'data' => [ + 'list2' => json_encode(['method' => 'arrayAppend', 'values' => ['w']]) + ] @@ - 'data' => [ - 'list3' => '{"method":"arrayRemove","attribute":"","values":["3"]}' - ] + 'data' => [ + 'list3' => json_encode(['method' => 'arrayRemove', 'values' => ['3']]) + ]Also applies to: 5902-5905, 5913-5916
5610-5612: Optional: Replace fixed sleeps with a short poll to reduce flakiness/time.Use a small polling helper to wait for column readiness (timeout/backoff) instead of sleep(2/3).
I can draft a polling helper if desired.
Also applies to: 5729-5731, 5860-5861
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Action.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php(2 hunks)tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-10-02T10:16:48.075Z
Learnt from: abnegate
Repo: appwrite/appwrite PR: 10023
File: src/Appwrite/Databases/TransactionState.php:174-219
Timestamp: 2025-10-02T10:16:48.075Z
Learning: In `src/Appwrite/Databases/TransactionState.php`, the `listDocuments` method intentionally applies queries only to the initial database fetch of committed documents. Transaction state changes (creates, updates, deletes) are then overlaid on top of the filtered committed set without re-evaluating the queries against the final merged result. This is the intended behavior for transaction-aware document listing.
Applied to files:
src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php
📚 Learning: 2025-06-19T09:20:03.312Z
Learnt from: ItzNotABug
Repo: appwrite/appwrite PR: 9693
File: src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php:57-59
Timestamp: 2025-06-19T09:20:03.312Z
Learning: In table-related endpoints (such as `src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php`), parameter descriptions should use "table" and "row" terminology instead of "collection" and "document" for clarity and consistency.
Applied to files:
src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php
📚 Learning: 2025-05-10T04:12:13.037Z
Learnt from: ItzNotABug
Repo: appwrite/appwrite PR: 9693
File: src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Delete.php:85-86
Timestamp: 2025-05-10T04:12:13.037Z
Learning: The class `Appwrite\Platform\Modules\Databases\Http\Databases\Collections\Indexes\Action` defines a method `getGrantParentNotFoundException()` which is used to handle cases where a parent resource (like a database collection) is not found.
Applied to files:
src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Action.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php
🧬 Code graph analysis (5)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Update.php (1)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php (1)
parseOperators(36-87)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Action.php (2)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php (2)
Action(11-88)setHttpPath(20-26)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php (2)
Action(12-395)setHttpPath(24-44)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php (2)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php (2)
Action(11-88)setHttpPath(20-26)src/Appwrite/Platform/Modules/Databases/Http/Databases/Transactions/Action.php (2)
Action(7-66)setHttpPath(14-20)
tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php (2)
tests/e2e/Client.php (1)
Client(8-342)tests/e2e/Scopes/Scope.php (1)
getHeaders(145-145)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php (2)
src/Appwrite/Extend/Exception.php (1)
Exception(7-464)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Action.php (2)
Action(12-395)setHttpPath(24-44)
⏰ 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). (3)
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: scan
🔇 Additional comments (1)
tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php (1)
5636-5645: ****The code correctly follows the Appwrite TablesDB pattern. For array operators in transactions, the operator object does not need a separate "column" key—the target column is inferred from the field key in the row payload. The payload structure with
'items' => '{"method":"arrayRemove",...}'is correct:itemsspecifies the target column, and the operator operates on it. The empty'attribute'field is part of the expected operator schema for array operators. No changes needed.Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
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(2 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(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php(2 hunks)src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: abnegate
Repo: appwrite/appwrite PR: 10023
File: src/Appwrite/Databases/TransactionState.php:174-219
Timestamp: 2025-10-02T10:16:48.075Z
Learning: In `src/Appwrite/Databases/TransactionState.php`, the `listDocuments` method intentionally applies queries only to the initial database fetch of committed documents. Transaction state changes (creates, updates, deletes) are then overlaid on top of the filtered committed set without re-evaluating the queries against the final merged result. This is the intended behavior for transaction-aware document listing.
Learnt from: ItzNotABug
Repo: appwrite/appwrite PR: 9693
File: src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php:57-59
Timestamp: 2025-06-19T09:20:03.312Z
Learning: In table-related endpoints (such as `src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php`), parameter descriptions should use "table" and "row" terminology instead of "collection" and "document" for clarity and consistency.
📚 Learning: 2025-10-02T10:16:48.075Z
Learnt from: abnegate
Repo: appwrite/appwrite PR: 10023
File: src/Appwrite/Databases/TransactionState.php:174-219
Timestamp: 2025-10-02T10:16:48.075Z
Learning: In `src/Appwrite/Databases/TransactionState.php`, the `listDocuments` method intentionally applies queries only to the initial database fetch of committed documents. Transaction state changes (creates, updates, deletes) are then overlaid on top of the filtered committed set without re-evaluating the queries against the final merged result. This is the intended behavior for transaction-aware document listing.
Applied to files:
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php
📚 Learning: 2025-06-19T09:20:03.312Z
Learnt from: ItzNotABug
Repo: appwrite/appwrite PR: 9693
File: src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php:57-59
Timestamp: 2025-06-19T09:20:03.312Z
Learning: In table-related endpoints (such as `src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php`), parameter descriptions should use "table" and "row" terminology instead of "collection" and "document" for clarity and consistency.
Applied to files:
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.phpsrc/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php
🧬 Code graph analysis (4)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php (1)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php (1)
parseOperators(36-96)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php (1)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php (1)
parseOperators(36-96)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php (1)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php (1)
parseOperators(36-96)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php (1)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php (1)
parseOperators(36-96)
⏰ 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). (1)
- GitHub Check: scan
🔇 Additional comments (12)
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php (2)
121-123: LGTM: Conditional operator parsing is correct.Skipping operator parsing when a transaction is present ensures that operators are evaluated at commit time rather than at staging time, which is the correct behavior for transactional consistency.
307-307: LGTM: Event queue reset for staged operations.Resetting the event queue after staging prevents premature event emission for transactional operations. Events will be emitted when the transaction is committed.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php (1)
155-156: LGTM: Event queue reset for staged increment operation.Correctly resets the event queue after staging to prevent premature event emission.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php (2)
110-112: LGTM: Conditional operator parsing per document.Correctly applies conditional operator parsing to each document in the bulk operation, maintaining consistency with single-document upsert behavior.
154-155: LGTM: Event queue reset for bulk staged operation.Prevents bulk events from being emitted for staged operations.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php (1)
155-156: LGTM: Event queue reset for staged decrement operation.Correctly resets the event queue after staging to prevent premature event emission, consistent with increment operations.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php (1)
415-416: LGTM: Event queue reset for staged create operations.Correctly resets the event queue after staging for both single and bulk create operations, preventing premature event emission.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php (2)
110-112: LGTM: Conditional operator parsing for bulk updates.Correctly defers operator parsing when operating within a transaction, ensuring operators are evaluated at commit time with the final document state.
179-180: LGTM: Event queue reset for bulk staged updates.Prevents bulk update events from being emitted for staged operations.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php (1)
179-180: LGTM: Event queue reset for staged delete operation.Correctly resets the event queue after staging to prevent premature delete event emission.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php (2)
115-117: LGTM: Conditional operator parsing for updates.Correctly skips operator parsing when operating within a transaction, deferring evaluation until commit time.
306-308: LGTM: Event queue reset for staged update operation.Correctly resets the event queue after staging to prevent premature event emission for the update operation.
src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php
Show resolved
Hide resolved
# Conflicts: # composer.lock
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: abnegate
Repo: appwrite/appwrite PR: 10023
File: src/Appwrite/Databases/TransactionState.php:174-219
Timestamp: 2025-10-02T10:16:48.075Z
Learning: In `src/Appwrite/Databases/TransactionState.php`, the `listDocuments` method intentionally applies queries only to the initial database fetch of committed documents. Transaction state changes (creates, updates, deletes) are then overlaid on top of the filtered committed set without re-evaluating the queries against the final merged result. This is the intended behavior for transaction-aware document listing.
Learnt from: ItzNotABug
Repo: appwrite/appwrite PR: 9693
File: src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php:57-59
Timestamp: 2025-06-19T09:20:03.312Z
Learning: In table-related endpoints (such as `src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php`), parameter descriptions should use "table" and "row" terminology instead of "collection" and "document" for clarity and consistency.
📚 Learning: 2025-06-19T09:20:03.312Z
Learnt from: ItzNotABug
Repo: appwrite/appwrite PR: 9693
File: src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php:57-59
Timestamp: 2025-06-19T09:20:03.312Z
Learning: In table-related endpoints (such as `src/Appwrite/Platform/Modules/Databases/Http/Databases/Tables/Update.php`), parameter descriptions should use "table" and "row" terminology instead of "collection" and "document" for clarity and consistency.
Applied to files:
tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php
🧬 Code graph analysis (1)
tests/e2e/Services/Databases/TablesDB/Transactions/TransactionsBase.php (2)
tests/e2e/Client.php (1)
Client(8-342)tests/e2e/Scopes/Scope.php (1)
getHeaders(145-145)
⏰ 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). (3)
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: scan
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
Checklist