Conversation
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tests/e2e/Services/Databases/Legacy/DatabasesBase.php`:
- Around line 2438-2456: The test calls the single-document endpoint but asserts
list-style response fields (documents/total); change the request to the list
endpoint so the response shape matches the assertions: replace the path
'/databases/' . $databaseId . '/collections/' . $document['$collectionId'] .
'/documents/' . $document['$id'] with the list path '/databases/' . $databaseId
. '/collections/' . $document['$collectionId'] . '/documents' while keeping the
same query payload using Query::equal('$sequence', [$sequence])->toString(),
then keep the existing response handling (use $response['body']['documents'][0],
assert total, title, releaseYear, and $sequence) and ensure status-code
assertion remains on $response['headers']['status-code'].
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tests/e2e/Services/Databases/Legacy/DatabasesBase.php`:
- Around line 2431-2436: The test casts $sequence to string which conflicts with
the validator expecting Database::VAR_INTEGER; change the cast in
DatabasesBase.php so $sequence is an integer (use (int) or intval) before it's
used in Query::equal() and related assertions, ensuring Query::equal() receives
an integer type consistent with
src/Appwrite/Utopia/Database/Validator/Queries/Base.php.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/Appwrite/Utopia/Request/Filters/V22.php`:
- Line 34: The variable $internals declared in V22.php is unused; remove the
unused declaration (delete the line that sets $internals = false) from the
method in class V22 to clean up dead code and avoid unused-variable warnings.
In `@tests/e2e/Services/Databases/Legacy/DatabasesBase.php`:
- Around line 2463-2467: Remove the debug output var_dump($response) from the
test; delete the var_dump($response) call and replace it with an appropriate
assertion against $response (for example confirm structure, non-null, or
expected keys/values) in the same test method so CI output is clean and the test
still verifies behavior.
♻️ Duplicate comments (1)
tests/e2e/Services/Databases/Legacy/DatabasesBase.php (1)
2431-2436: Cast$sequenceto int before querying.
Query::equal('$sequence', …)should receive an integer; the string cast can still trip validation.✅ Proposed fix
- $sequence = (string)$response['body']['$sequence']; + $sequence = (int)$response['body']['$sequence'];
🧹 Nitpick comments (1)
src/Appwrite/Utopia/Request/Filters/V22.php (1)
39-43: Consider usingQuery::TYPE_SELECTconstant for consistency.Using the constant instead of the string literal
'select'improves maintainability and aligns with codebase conventions.♻️ Proposed change
- if ($query->getMethod() === 'select') { + if ($query->getMethod() === Query::TYPE_SELECT) {
# Conflicts: # composer.lock
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/Appwrite/Utopia/Request/Filters/V22.php`:
- Around line 23-31: The parse method's unused $model parameter triggers PHPMD
warnings; add an explicit PHPMD suppression on the parse method to silence the
"UnusedFormalParameter" warning (e.g. add a docblock above public function
parse(array $content, string $model): array with
`@SuppressWarnings`(PHPMD.UnusedFormalParameter) or
`@SuppressWarnings`("PHPMD.UnusedFormalParameter") so the signature remains
unchanged but lint noise is suppressed).
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@app/controllers/api/messaging.php`:
- Line 1142: The GraphQL type mapper is missing a case for the Queries Types
validator, causing it to fall through to the default string type; update the
switch in src/Appwrite/GraphQL/Types/Mapper.php (the GraphQL Mapper switch
statement) to add a case for
\Appwrite\Utopia\Database\Validator\Queries\Types::class and return
Type::listOf(Type::string()) (same style as the other Query validators' cases)
so that the validator maps to a list of strings instead of a single string.
| )) | ||
| ->param('providerId', '', new UID(), 'Provider ID.') | ||
| ->param('queries', [], new Queries([new Limit(), new Offset()]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true) | ||
| ->param('queries', [], new Types([Query::TYPE_LIMIT, Query::TYPE_OFFSET]), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset', true) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Check if Types validator is handled in GraphQL Mapper
rg -n "Types::class" src/Appwrite/GraphQL/Types/Mapper.php
# List all Queries validators in Mapper to see what's present
rg -n "Validator\\\\Queries" src/Appwrite/GraphQL/Types/Mapper.php -A 1Repository: appwrite/appwrite
Length of output: 1891
🏁 Script executed:
# Check what the Types validator class is and where it's defined
fd -e php -x rg -l "class Types" {} + | grep -i validator | head -5Repository: appwrite/appwrite
Length of output: 43270
🏁 Script executed:
# Examine the Mapper.php switch statement context around validators
rg -n "switch.*getClassName\|case.*Validator.*Queries\|default:" src/Appwrite/GraphQL/Types/Mapper.php -B 2 -A 2Repository: appwrite/appwrite
Length of output: 43
🏁 Script executed:
# Get the full context of the switch statement in Mapper.php
rg -n "switch.*getClassName\|case\|default\|return Type" src/Appwrite/GraphQL/Types/Mapper.php -A 1 -B 1 | head -100Repository: appwrite/appwrite
Length of output: 43
🏁 Script executed:
# Look for the entire getType method to understand the flow
sed -n '280,330p' src/Appwrite/GraphQL/Types/Mapper.phpRepository: appwrite/appwrite
Length of output: 3030
🏁 Script executed:
# Check if Types validator has been imported or used elsewhere in Mapper
cat src/Appwrite/GraphQL/Types/Mapper.php | grep -i "types" -nRepository: appwrite/appwrite
Length of output: 538
🏁 Script executed:
# Examine the Types validator class to confirm its purpose
cat src/Appwrite/Utopia/Database/Validator/Queries/Types.phpRepository: appwrite/appwrite
Length of output: 3233
🏁 Script executed:
# Verify the exact usage in messaging.php line 1142
sed -n '1140,1145p' app/controllers/api/messaging.phpRepository: appwrite/appwrite
Length of output: 585
🏁 Script executed:
# Check other log endpoints mentioned to confirm the pattern
rg -n "Types\(\[Query::TYPE_LIMIT, Query::TYPE_OFFSET\]\)" app/controllers/api/Repository: appwrite/appwrite
Length of output: 2515
Add Types validator to GraphQL Mapper switch statement.
The Types validator class is used in 8 endpoints across 5 API files (messaging.php, vcs.php, teams.php, users.php, account.php) but is not included in the switch statement in src/Appwrite/GraphQL/Types/Mapper.php. It will fall through to the default case and return Type::string() instead of the expected Type::listOf(Type::string()), causing GraphQL type mismatches for these endpoints.
Add a case for \Appwrite\Utopia\Database\Validator\Queries\Types::class in the Mapper that returns Type::listOf(Type::string()) alongside the other Query validators.
🤖 Prompt for AI Agents
In `@app/controllers/api/messaging.php` at line 1142, The GraphQL type mapper is
missing a case for the Queries Types validator, causing it to fall through to
the default string type; update the switch in
src/Appwrite/GraphQL/Types/Mapper.php (the GraphQL Mapper switch statement) to
add a case for \Appwrite\Utopia\Database\Validator\Queries\Types::class and
return Type::listOf(Type::string()) (same style as the other Query validators'
cases) so that the validator maps to a list of strings instead of a single
string.
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