Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded two new platform error constants and their HTTP mappings. Removed the legacy Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Greptile SummaryThis PR refactors the platform management API from admin-only endpoints in Key issues found:
Confidence Score: 1/5
Important Files Changed
Reviews (3): Last reviewed commit: "fix multi-model conditions" | Re-trigger Greptile |
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php
Outdated
Show resolved
Hide resolved
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php
Outdated
Show resolved
Hide resolved
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Update.php
Show resolved
Hide resolved
✨ Benchmark results
⚡ Benchmark Comparison
|
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (5)
src/Appwrite/Utopia/Response/Filters/V21.php (1)
55-64: Misleading comment and potential over-application of transformation.The comment on line 57 mentions "httpUser, httpPass, store removed" but no corresponding
unset()calls exist—these are handled at the model level (seePlatformApp::filter()), not in this filter.Additionally,
parsePlatform()is applied uniformly to bothMODEL_PLATFORM_WEBandMODEL_PLATFORM_APPitems. Web platforms don't have anidentifierfield (they usehostname), so theidentifier -> keymapping only applies to app platforms. The null coalescing handles this gracefully, but consider:
- Removing or correcting the misleading comment
- Adding a brief comment explaining the null coalescing handles platform type differences
📝 Suggested clarification
protected function parsePlatform(array $content): array { - // httpUser, httpPass, store removed - - // identifier -> key + // Map 'identifier' back to 'key' for backward compatibility. + // App platforms have 'identifier'; web platforms don't, so we fallback to existing 'key'. $content['key'] = $content['identifier'] ?? $content['key'] ?? null; unset($content['identifier']); return $content; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Response/Filters/V21.php` around lines 55 - 64, Update parsePlatform() in V21.php to remove or correct the misleading "httpUser, httpPass, store removed" comment (those unsets are done in PlatformApp::filter()), and replace it with a brief note that the identifier->key mapping uses null coalescing to safely handle both MODEL_PLATFORM_APP (which may have identifier) and MODEL_PLATFORM_WEB (which uses hostname), so no additional unsets are required; reference parsePlatform() and PlatformApp::filter() in the comment for clarity.src/Appwrite/Utopia/Database/Validator/Queries/Platforms.php (1)
11-11: Address the TODO comment for API consistency.The TODO indicates that the API should name this field
identifierinstead ofkey. This should be tracked and addressed before the API becomes public to avoid breaking changes later.Would you like me to open an issue to track this API naming inconsistency?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Database/Validator/Queries/Platforms.php` at line 11, Change the API field name from 'key' to 'identifier' in the Platforms validator by replacing the string 'key' in Validator/Queries/Platforms.php and then update all related spots that reference this symbol: validation rules, DTOs/models, serializers, database schema/migrations, unit/integration tests, and API docs. To avoid breaking consumers, add a backward-compatible normalization step (e.g., in the request normalization or a function like normalizePlatformInput) that accepts the deprecated 'key' and maps it to 'identifier' while emitting a deprecation warning/log, and include a migration note and test that both 'key' (deprecated) and 'identifier' are accepted until the old name is removed.src/Appwrite/Utopia/Request/Filters/V21.php (1)
14-38: Add regression coverage for the new platform V21 mappings.This switch now defines the backward-compatibility contract for platform create/update/list requests, and the PR objective says no tests were added yet. A small matrix around
platformIddefaulting,key→identifier,storestripping, and the defaultqueriesbranch would catch most regressions here.Also applies to: 93-121
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Request/Filters/V21.php` around lines 14 - 38, Add regression tests covering the V21 platform mappings: for project.createWebPlatform/project.createAppPlatform and project.updateWebPlatform/project.updateAppPlatform ensure fillPlatformId behavior (platformId defaulting), that 'store' is removed, and 'key' is migrated to 'identifier' (including when identifier already exists). Also add tests for project.listPlatforms to assert preservePlatformsQueries behavior for default queries. Target the code paths that invoke fillPlatformId and preservePlatformsQueries so changes to those methods or these switch cases will be caught.src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Get.php (1)
76-84: Avoid using the Create actions as the platform-type registry.
Getnow depends onWeb\Create::getSupportedTypes()/App\Create::getSupportedTypes(), whilePlatformWebandPlatformAppalready keep their own lists. If one copy changes without the others, a valid platform can start failing here withGENERAL_UNKNOWN. Please move this mapping behind a shared helper or the response models.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Get.php` around lines 76 - 84, The Get handler currently uses WebPlatformCreate::getSupportedTypes() and AppPlatformCreate::getSupportedTypes() to decide the response model, which duplicates the platform-type registry and risks drift; replace that dependency with the canonical source (PlatformWeb and PlatformApp) or a new shared registry/helper: call PlatformWeb::getSupportedTypes() and PlatformApp::getSupportedTypes() (or create a PlatformTypes::getWebTypes()/getAppTypes() helper and use it here) and map those results to Response::MODEL_PLATFORM_WEB / Response::MODEL_PLATFORM_APP, throwing the same Exception only if the type is absent from the shared registry.src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.php (1)
56-69: Parameter name inconsistency:totalvs$includeTotal.The param is defined as
totalon line 56, but the action method parameter is$includeTotalon line 69. While the framework likely handles this mapping, maintaining consistent naming improves readability.♻️ Suggested rename for consistency
- ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) + ->param('includeTotal', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.php` around lines 56 - 69, Rename the action method parameter to match the declared param name to improve clarity: change the method signature in XList::action to use $total (or alternatively rename the param declaration from 'total' to 'includeTotal') so both sides match; update all uses inside the action() implementation to reference the chosen name (e.g., XList::action(array $queries, bool $total, ...)) and ensure dependency injection mapping via ->param('total', ...) stays consistent with this identifier.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php`:
- Around line 109-112: The code computes $platformId (using ($platformId ==
'unique()') ? ID::unique() : $platformId) but then discards it by passing
ID::unique() again when constructing the Document; update the Document creation
to use the previously resolved $platformId (i.e., set '$id' => $platformId) so
user-provided IDs are honored and only generate a new ID when $platformId was
the 'unique()' sentinel; check the Document instantiation site (variable
$platform) and remove the extra ID::unique() call.
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Update.php`:
- Around line 82-85: The update Document in Update.php incorrectly uses
'identifier' instead of the schema field 'key'; update the $updates = new
Document([...]) construction in the Update class/method to set 'key' =>
$identifier (or rename the variable to $key if appropriate) so the database
field matches the schema used in App/Create.php and the update actually persists
the identifier value.
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php`:
- Around line 100-103: The code computes $platformId but then discards it by
calling ID::unique() when constructing the Document; update the Document
creation in Create.php (the new Document([... '$id' => ...]) call) to use the
previously computed $platformId (keeping the existing ($platformId ==
'unique()') ? ID::unique() : $platformId logic) so user-supplied IDs are
preserved and only the literal 'unique()' string generates a new ID.
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.php`:
- Around line 57-58: The update handler is always including hostname (from the
->param('hostname', ...) declaration) in the $updates payload which clears the
stored value when the client omits that field; change the logic that builds the
$updates Document so it only adds 'hostname' when the request actually provided
it (i.e., check presence/nullity of the incoming param before adding to
$updates), and apply the same conditional inclusion to the other optional fields
referenced around lines 83-86 so partial updates only send changed attributes.
- Around line 77-81: The Web update route currently allows any platform for the
project, which lets app platform IDs be processed; update the validation in
Update.php after retrieving $platform (via $authorization->skip and
$dbForPlatform->getDocument) to also check the platform's stored 'type'
attribute against the allowed web types (the set used to serialize to
MODEL_PLATFORM_WEB) and reject non-web types by throwing
Exception::PLATFORM_NOT_FOUND (or an appropriate error) if the type is not in
the web-supported set; ensure this check occurs before any hostname
write/serialization logic that uses MODEL_PLATFORM_WEB.
In `@src/Appwrite/Utopia/Response.php`:
- Around line 249-251: The Project model references a removed constant
Response::MODEL_PLATFORM; update the rule definition in
src/Appwrite/Utopia/Response/Model/Project.php where addRule('platforms', ...)
is configured to use the existing constant Response::MODEL_PLATFORM_LIST instead
of Response::MODEL_PLATFORM so the platforms rule points to the correct model
constant (replace Response::MODEL_PLATFORM with Response::MODEL_PLATFORM_LIST in
the addRule call).
In `@src/Appwrite/Utopia/Response/Model/PlatformApp.php`:
- Around line 38-44: The enum definitions in the Platform models wrap
getSupportedTypes() in an extra array, producing a nested array; update the
'type' rule in both PlatformApp and PlatformWeb so the 'enum' value is the flat
array returned by $this->getSupportedTypes() (i.e., change 'enum' =>
[$this->getSupportedTypes()] to 'enum' => $this->getSupportedTypes()) so
consumers receive ['value1','value2'] instead of [['value1','value2']]; modify
the rule in the methods that build the schema where the 'type' rule is defined
(referencing the getSupportedTypes() call and the 'enum' key).
In `@src/Appwrite/Utopia/Response/Model/PlatformList.php`:
- Around line 13-17: Update the description text for the 'total' rule in
PlatformList so it correctly reflects that platforms belong to a project, not a
table: locate the addRule call for 'total' in class PlatformList (the rule entry
with 'type' => self::TYPE_INTEGER and 'example' => 5) and change the
'description' value from "Total number of platforms in the given table." to
"Total number of platforms in the given project."
In `@src/Appwrite/Utopia/Response/Model/PlatformWeb.php`:
- Around line 27-33: The enum rule for the 'type' field incorrectly wraps
$this->getSupportedTypes() inside another array (creating a nested array) in
PlatformWeb.php (within the rule block that calls ->addRule('type', ...)), which
breaks validation; change the 'enum' value to use the flat array returned by
getSupportedTypes() (i.e., 'enum' => $this->getSupportedTypes()), and apply the
same fix to the identical pattern in PlatformApp.php so both use the flat list
rather than an array-wrapped list.
---
Nitpick comments:
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Get.php`:
- Around line 76-84: The Get handler currently uses
WebPlatformCreate::getSupportedTypes() and
AppPlatformCreate::getSupportedTypes() to decide the response model, which
duplicates the platform-type registry and risks drift; replace that dependency
with the canonical source (PlatformWeb and PlatformApp) or a new shared
registry/helper: call PlatformWeb::getSupportedTypes() and
PlatformApp::getSupportedTypes() (or create a
PlatformTypes::getWebTypes()/getAppTypes() helper and use it here) and map those
results to Response::MODEL_PLATFORM_WEB / Response::MODEL_PLATFORM_APP, throwing
the same Exception only if the type is absent from the shared registry.
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.php`:
- Around line 56-69: Rename the action method parameter to match the declared
param name to improve clarity: change the method signature in XList::action to
use $total (or alternatively rename the param declaration from 'total' to
'includeTotal') so both sides match; update all uses inside the action()
implementation to reference the chosen name (e.g., XList::action(array $queries,
bool $total, ...)) and ensure dependency injection mapping via ->param('total',
...) stays consistent with this identifier.
In `@src/Appwrite/Utopia/Database/Validator/Queries/Platforms.php`:
- Line 11: Change the API field name from 'key' to 'identifier' in the Platforms
validator by replacing the string 'key' in Validator/Queries/Platforms.php and
then update all related spots that reference this symbol: validation rules,
DTOs/models, serializers, database schema/migrations, unit/integration tests,
and API docs. To avoid breaking consumers, add a backward-compatible
normalization step (e.g., in the request normalization or a function like
normalizePlatformInput) that accepts the deprecated 'key' and maps it to
'identifier' while emitting a deprecation warning/log, and include a migration
note and test that both 'key' (deprecated) and 'identifier' are accepted until
the old name is removed.
In `@src/Appwrite/Utopia/Request/Filters/V21.php`:
- Around line 14-38: Add regression tests covering the V21 platform mappings:
for project.createWebPlatform/project.createAppPlatform and
project.updateWebPlatform/project.updateAppPlatform ensure fillPlatformId
behavior (platformId defaulting), that 'store' is removed, and 'key' is migrated
to 'identifier' (including when identifier already exists). Also add tests for
project.listPlatforms to assert preservePlatformsQueries behavior for default
queries. Target the code paths that invoke fillPlatformId and
preservePlatformsQueries so changes to those methods or these switch cases will
be caught.
In `@src/Appwrite/Utopia/Response/Filters/V21.php`:
- Around line 55-64: Update parsePlatform() in V21.php to remove or correct the
misleading "httpUser, httpPass, store removed" comment (those unsets are done in
PlatformApp::filter()), and replace it with a brief note that the
identifier->key mapping uses null coalescing to safely handle both
MODEL_PLATFORM_APP (which may have identifier) and MODEL_PLATFORM_WEB (which
uses hostname), so no additional unsets are required; reference parsePlatform()
and PlatformApp::filter() in the comment for clarity.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2cdd31e7-32dc-4ad5-9297-b86bd20d5a11
📒 Files selected for processing (23)
app/config/errors.phpapp/controllers/api/projects.phpapp/init/models.phpsrc/Appwrite/Extend/Exception.phpsrc/Appwrite/Network/Platform.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Update.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Delete.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Get.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.phpsrc/Appwrite/Platform/Modules/Project/Services/Http.phpsrc/Appwrite/Utopia/Database/Validator/Queries/Platforms.phpsrc/Appwrite/Utopia/Request/Filters/V21.phpsrc/Appwrite/Utopia/Response.phpsrc/Appwrite/Utopia/Response/Filters/V21.phpsrc/Appwrite/Utopia/Response/Model/Platform.phpsrc/Appwrite/Utopia/Response/Model/PlatformApp.phpsrc/Appwrite/Utopia/Response/Model/PlatformBase.phpsrc/Appwrite/Utopia/Response/Model/PlatformList.phpsrc/Appwrite/Utopia/Response/Model/PlatformWeb.phpsrc/Appwrite/Utopia/Response/Model/Webhook.php
💤 Files with no reviewable changes (3)
- src/Appwrite/Utopia/Response/Model/Webhook.php
- src/Appwrite/Utopia/Response/Model/Platform.php
- app/controllers/api/projects.php
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php
Outdated
Show resolved
Hide resolved
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Update.php
Show resolved
Hide resolved
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php
Outdated
Show resolved
Hide resolved
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.php
Outdated
Show resolved
Hide resolved
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.php
Show resolved
Hide resolved
|
@greptile |
🔄 PHP-Retry SummaryFlaky tests detected across commits: Commit
|
| Test | Retries | Total Time | Details |
|---|---|---|---|
UsageTest::testVectorsDBStats |
1 | 10.42s | Logs |
FunctionsScheduleTest::testCreateScheduledAtExecution |
1 | 127.41s | Logs |
Commit 094cd18 - 2 flaky tests
| Test | Retries | Total Time | Details |
|---|---|---|---|
UsageTest::testVectorsDBStats |
1 | 10.11s | Logs |
FunctionsScheduleTest::testCreateScheduledAtExecution |
1 | 132.61s | Logs |
Commit a06aaaf - 2 flaky tests
| Test | Retries | Total Time | Details |
|---|---|---|---|
UsageTest::testVectorsDBStats |
1 | 10.05s | Logs |
FunctionsScheduleTest::testCreateScheduledAtExecution |
1 | 127.14s | Logs |
Commit ae99d59 - 3 flaky tests
| Test | Retries | Total Time | Details |
|---|---|---|---|
UsageTest::testVectorsDBStats |
1 | 10.12s | Logs |
TablesDBCustomServerTest::testOrQueries |
1 | 240.62s | Logs |
TablesDBACIDTest::testDurability |
1 | 240.51s | Logs |
Commit 0d6d6a0 - 3 flaky tests
| Test | Retries | Total Time | Details |
|---|---|---|---|
UsageTest::testVectorsDBStats |
1 | 10.60s | Logs |
TablesDBConsoleClientTest::testTimeout |
1 | 121.90s | Logs |
TablesDBCustomClientTest::testTimeout |
1 | 121.07s | Logs |
Note: Flaky test results are tracked for the last 5 commits
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php (1)
1-1: Consider adding strict type declaration.Per coding guidelines, strict type declarations should be used where applicable. Adding
declare(strict_types=1);after the opening PHP tag improves type safety.Suggested change
<?php + +declare(strict_types=1); namespace Appwrite\Platform\Modules\Project\Http\Project\Platforms\App;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php` at line 1, Add a strict types declaration to the PHP file by inserting declare(strict_types=1); immediately after the opening <?php tag in Create.php so the Create class and its functions enforce strict typing; ensure it appears before any namespace or use statements to comply with PHP requirements.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Appwrite/Utopia/Response/Model/Project.php`:
- Around line 185-188: The union resolver cannot discriminate platform instances
because PlatformWeb and PlatformApp inherit an empty conditions array; update
the PlatformWeb and PlatformApp model classes to define a conditions array that
checks the document's "type" value: in PlatformWeb set conditions to match
["web","flutter-web","react-native-web"] and in PlatformApp set conditions to
match
["flutter-ios","flutter-android","flutter-linux","flutter-macos","flutter-windows","apple-ios","apple-macos","apple-watchos","apple-tvos","android","unity","react-native-ios","react-native-android"];
ensure these are assigned to the models' conditions property (used by
Response::union resolver that iterates $rule['type'] and calls
$this->getModel(...)->conditions) so the serializer can resolve the correct
model for the platforms union.
---
Nitpick comments:
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php`:
- Line 1: Add a strict types declaration to the PHP file by inserting
declare(strict_types=1); immediately after the opening <?php tag in Create.php
so the Create class and its functions enforce strict typing; ensure it appears
before any namespace or use statements to comply with PHP requirements.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 140df0b0-2a04-4d26-beb2-78194f1cac8e
📒 Files selected for processing (10)
app/config/errors.phpsrc/Appwrite/Extend/Exception.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Update.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.phpsrc/Appwrite/Utopia/Response/Model/PlatformApp.phpsrc/Appwrite/Utopia/Response/Model/PlatformList.phpsrc/Appwrite/Utopia/Response/Model/PlatformWeb.phpsrc/Appwrite/Utopia/Response/Model/Project.php
✅ Files skipped from review due to trivial changes (2)
- src/Appwrite/Extend/Exception.php
- src/Appwrite/Utopia/Response/Model/PlatformList.php
🚧 Files skipped from review as they are similar to previous changes (6)
- src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php
- src/Appwrite/Utopia/Response/Model/PlatformApp.php
- src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Update.php
- src/Appwrite/Utopia/Response/Model/PlatformWeb.php
- src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Update.php
- app/config/errors.php
|
@greptile |
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Update.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
🧹 Nitpick comments (4)
src/Appwrite/Utopia/Response/Model/PlatformApp.php (2)
78-82: Fix incorrect PHPDoc comment.The PHPDoc says "Get Collection" but this is the
filter()method that transforms document attributes./** - * Get Collection + * Filter document attributes for API response. * - * `@return` Document + * `@param` Document $document + * `@return` Document The filtered document */ public function filter(Document $document): Document🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Response/Model/PlatformApp.php` around lines 78 - 82, The PHPDoc above the filter() method is incorrect; replace the description "Get Collection" with a correct summary like "Filter/transform document attributes" (or similar) and ensure the PHPDoc accurately describes the filter(Document $document): Document behavior and return type Document to match the method signature; update any param/return annotations to reference Document and briefly state that this method maps/transforms document attributes before returning.
1-8: Consider adding strict type declaration.Similar to
PlatformBase, this file would benefit fromdeclare(strict_types=1);.<?php + +declare(strict_types=1); namespace Appwrite\Utopia\Response\Model;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Response/Model/PlatformApp.php` around lines 1 - 8, Add a strict types declaration to this file by inserting declare(strict_types=1); immediately after the opening <?php tag and before the namespace declaration so PlatformApp uses strict typing like PlatformBase; update the top of src/Appwrite/Utopia/Response/Model/PlatformApp.php to include this declaration to enforce strict scalar type checks for the model code (e.g., class symbols in this file such as the PlatformApp model).src/Appwrite/Utopia/Response/Model/PlatformWeb.php (1)
1-7: Consider adding strict type declaration.<?php + +declare(strict_types=1); namespace Appwrite\Utopia\Response\Model;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Response/Model/PlatformWeb.php` around lines 1 - 7, Add a strict types declaration to this PHP file by inserting declare(strict_types=1); immediately after the opening <?php tag in src/Appwrite/Utopia/Response/Model/PlatformWeb.php so the file (and the PlatformWeb class and any functions/methods within) will enforce strict typing at runtime.src/Appwrite/Utopia/Response/Model/PlatformBase.php (1)
1-6: Consider adding strict type declaration.The file is missing
declare(strict_types=1);which is recommended per coding guidelines for PHP files where applicable.<?php + +declare(strict_types=1); namespace Appwrite\Utopia\Response\Model;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Response/Model/PlatformBase.php` around lines 1 - 6, Add a strict types declaration to this PHP file by inserting declare(strict_types=1); immediately after the opening <?php tag in src/Appwrite/Utopia/Response/Model/PlatformBase.php so that the namespace Appwrite\Utopia\Response\Model and the Model/PlatformBase class (or any functions/types in this file) are evaluated under strict typing rules.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/Appwrite/Utopia/Response/Model/PlatformApp.php`:
- Around line 78-82: The PHPDoc above the filter() method is incorrect; replace
the description "Get Collection" with a correct summary like "Filter/transform
document attributes" (or similar) and ensure the PHPDoc accurately describes the
filter(Document $document): Document behavior and return type Document to match
the method signature; update any param/return annotations to reference Document
and briefly state that this method maps/transforms document attributes before
returning.
- Around line 1-8: Add a strict types declaration to this file by inserting
declare(strict_types=1); immediately after the opening <?php tag and before the
namespace declaration so PlatformApp uses strict typing like PlatformBase;
update the top of src/Appwrite/Utopia/Response/Model/PlatformApp.php to include
this declaration to enforce strict scalar type checks for the model code (e.g.,
class symbols in this file such as the PlatformApp model).
In `@src/Appwrite/Utopia/Response/Model/PlatformBase.php`:
- Around line 1-6: Add a strict types declaration to this PHP file by inserting
declare(strict_types=1); immediately after the opening <?php tag in
src/Appwrite/Utopia/Response/Model/PlatformBase.php so that the namespace
Appwrite\Utopia\Response\Model and the Model/PlatformBase class (or any
functions/types in this file) are evaluated under strict typing rules.
In `@src/Appwrite/Utopia/Response/Model/PlatformWeb.php`:
- Around line 1-7: Add a strict types declaration to this PHP file by inserting
declare(strict_types=1); immediately after the opening <?php tag in
src/Appwrite/Utopia/Response/Model/PlatformWeb.php so the file (and the
PlatformWeb class and any functions/methods within) will enforce strict typing
at runtime.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fb7a8990-884b-4a23-8d79-e995e68c81b6
📒 Files selected for processing (4)
src/Appwrite/Utopia/Response.phpsrc/Appwrite/Utopia/Response/Model/PlatformApp.phpsrc/Appwrite/Utopia/Response/Model/PlatformBase.phpsrc/Appwrite/Utopia/Response/Model/PlatformWeb.php
🚧 Files skipped from review as they are similar to previous changes (1)
- src/Appwrite/Utopia/Response.php
There was a problem hiding this comment.
🧹 Nitpick comments (4)
src/Appwrite/Utopia/Response/Model/PlatformWeb.php (1)
1-8: Adddeclare(strict_types=1);to the new response model.This class introduces typed methods on a new public model, so it should opt into strict typing at the file boundary.
♻️ Suggested change
<?php + +declare(strict_types=1); namespace Appwrite\Utopia\Response\Model;As per coding guidelines,
**/*.php: Use strict type declarations where applicable.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Response/Model/PlatformWeb.php` around lines 1 - 8, Add a strict types declaration to the new response model file by inserting declare(strict_types=1); immediately after the opening <?php tag in the file containing the class PlatformWeb (the PlatformWeb class file that extends PlatformBase), so the file opts into strict typing for its typed public methods.app/init/models.php (1)
337-339: Please add one regression test around the split platform registrations.These registrations are now the wiring that makes mixed
platformslists resolve toPlatformWebvsPlatformApp. A small serialization/spec test with one web platform and one app platform would protect the new public contract from drifting.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/init/models.php` around lines 337 - 339, Add a regression test that asserts mixed platform entries deserialize/resolve to the correct concrete models: ensure Response::setModel registrations for PlatformWeb, PlatformApp, and PlatformList continue to split mixed "platforms" lists into PlatformWeb vs PlatformApp instances; create a spec that serializes a payload with one web platform and one app platform, runs the same parsing/resolution used by the application, and asserts the resulting collection contains one PlatformWeb and one PlatformApp (use the same factory/parse method your app uses to ensure the public contract is exercised).src/Appwrite/Utopia/Response/Model/PlatformApp.php (2)
1-9: Adddeclare(strict_types=1);here too.This is another new typed model file, so it should follow the same strict-typing boundary as the rest of the PHP surface.
♻️ Suggested change
<?php + +declare(strict_types=1); namespace Appwrite\Utopia\Response\Model;As per coding guidelines,
**/*.php: Use strict type declarations where applicable.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Response/Model/PlatformApp.php` around lines 1 - 9, This PHP model file is missing the strict types declaration; add declare(strict_types=1); as the first statement after the opening <?php tag in the file that defines the PlatformApp class (class PlatformApp extends PlatformBase) so the file follows the project's strict-typing guideline.
78-83: Fix thefilter()PHPDoc.The current block still says
Get Collection, which no longer describes this method and omits the$documentparameter.♻️ Suggested change
- /** - * Get Collection - * - * `@return` Document - */ + /** + * Normalize app platform documents for the public API response. + * + * `@param` Document $document + * + * `@return` Document + */As per coding guidelines,
**/*.php: Include comprehensive PHPDoc comments.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Utopia/Response/Model/PlatformApp.php` around lines 78 - 83, Update the PHPDoc for the method filter(Document $document): Document to accurately describe its behavior (it filters/transforms a Document) and add the missing `@param` annotation for $document with the Document type and a brief description plus a clear `@return` Document description; locate the PHPDoc immediately above the filter(Document $document): Document method and replace the incorrect "Get Collection" summary with a concise description and the two annotations.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/init/models.php`:
- Around line 337-339: Add a regression test that asserts mixed platform entries
deserialize/resolve to the correct concrete models: ensure Response::setModel
registrations for PlatformWeb, PlatformApp, and PlatformList continue to split
mixed "platforms" lists into PlatformWeb vs PlatformApp instances; create a spec
that serializes a payload with one web platform and one app platform, runs the
same parsing/resolution used by the application, and asserts the resulting
collection contains one PlatformWeb and one PlatformApp (use the same
factory/parse method your app uses to ensure the public contract is exercised).
In `@src/Appwrite/Utopia/Response/Model/PlatformApp.php`:
- Around line 1-9: This PHP model file is missing the strict types declaration;
add declare(strict_types=1); as the first statement after the opening <?php tag
in the file that defines the PlatformApp class (class PlatformApp extends
PlatformBase) so the file follows the project's strict-typing guideline.
- Around line 78-83: Update the PHPDoc for the method filter(Document
$document): Document to accurately describe its behavior (it filters/transforms
a Document) and add the missing `@param` annotation for $document with the
Document type and a brief description plus a clear `@return` Document description;
locate the PHPDoc immediately above the filter(Document $document): Document
method and replace the incorrect "Get Collection" summary with a concise
description and the two annotations.
In `@src/Appwrite/Utopia/Response/Model/PlatformWeb.php`:
- Around line 1-8: Add a strict types declaration to the new response model file
by inserting declare(strict_types=1); immediately after the opening <?php tag in
the file containing the class PlatformWeb (the PlatformWeb class file that
extends PlatformBase), so the file opts into strict typing for its typed public
methods.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 60239fd6-c767-43d8-be4e-a476a88820c2
📒 Files selected for processing (6)
app/config/errors.phpapp/init/models.phpsrc/Appwrite/Extend/Exception.phpsrc/Appwrite/Utopia/Response.phpsrc/Appwrite/Utopia/Response/Model/PlatformApp.phpsrc/Appwrite/Utopia/Response/Model/PlatformWeb.php
✅ Files skipped from review due to trivial changes (1)
- src/Appwrite/Extend/Exception.php
🚧 Files skipped from review as they are similar to previous changes (2)
- src/Appwrite/Utopia/Response.php
- app/config/errors.php
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
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)
tests/e2e/Services/Projects/ProjectsConsoleClientTest.php (2)
3751-3925:⚠️ Potential issue | 🟠 MajorMissing explicit compatibility assertion for newly introduced platform type mapping.
The new platform-type surface (including react-native-web) isn’t asserted here under
1.8.0compatibility mode. Givensrc/Appwrite/Utopia/Response/Filters/V21.php(Line 11-20, Line 55-66) currently normalizes fields but does not transformtype, this is a backward-compatibility gap in test coverage.Please add create/get/update assertions for the new type in legacy response format to lock expected
typevalues for 1.8 clients.Also applies to: 3957-4100, 4110-4280
3754-4525:⚠️ Potential issue | 🟠 MajorDefault response contract coverage regressed to legacy-only path.
By forcing
x-appwrite-response-format: 1.8.0on all platform CRUD calls, these tests no longer exercise the default (current) platform response contract introduced in this PR. That leaves the new public platform API path unguarded in e2e.Please keep these legacy assertions, but add at least one CRUD flow without the legacy header to validate the current response models as well.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/Services/Projects/ProjectsConsoleClientTest.php` around lines 3754 - 4525, The tests currently force the legacy response contract by always sending the 'x-appwrite-response-format: 1.8.0' header for platform CRUD paths; keep those legacy assertions but add at least one full CRUD flow that omits that header so the default/current platform response contract is exercised. Locate the platform create/get/update/delete sequences (e.g., calls via $this->client->call in setupProjectWithPlatform() or the testDeleteProjectPlatform / testGetProjectPlatform / testUpdateProjectPlatform methods) and add a new platform lifecycle: POST (create) without 'x-appwrite-response-format', assert the new/current response fields, then GET, PUT, and DELETE that platform also without the legacy header, asserting expected status codes and the current response model at each step.
🧹 Nitpick comments (8)
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.php (3)
27-30: Add return type declaration togetName()method.The method lacks a return type declaration. For consistency with strict typing practices:
Proposed fix
- public static function getName() + public static function getName(): string { return 'listProjectPlatforms'; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.php` around lines 27 - 30, The getName() method in class XList currently lacks a return type; update the method signature for getName() to declare a string return type (i.e., ensure getName(): string) so it consistently enforces strict typing and returns 'listProjectPlatforms' as before.
56-57: Parameter name mismatch:totalvs$includeTotal.The param is named
'total'(line 57) but the corresponding action method parameter is$includeTotal(line 70). While the framework may map by position, inconsistent naming reduces readability and maintainability. Consider aligning them:Option A: Rename the action parameter to match
public function action( array $queries, - bool $includeTotal, + bool $total, Document $project, Response $response, Database $dbForPlatform, Authorization $authorization, ) {Then update the usage on line 110:
- $total = $includeTotal ? $authorization->skip(fn () => $dbForPlatform->count('platforms', $filterQueries, APP_LIMIT_COUNT)) : 0; + $totalCount = $total ? $authorization->skip(fn () => $dbForPlatform->count('platforms', $filterQueries, APP_LIMIT_COUNT)) : 0;Option B: Rename the param to match
- ->param('total', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true) + ->param('includeTotal', true, new Boolean(true), 'When set to false, the total count returned will be 0 and will not be calculated.', true)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.php` around lines 56 - 57, The declared request parameter name 'total' in XList.php is inconsistent with the action method parameter $includeTotal; choose one naming approach and make them match to improve readability: either rename the action method parameter $includeTotal to $total (in the XList action signature and all uses, e.g., the place around line 70 and usage around line 110) or rename the param declaration from 'total' to 'includeTotal' (in the ->param(...) call that references Platforms::ALLOWED_ATTRIBUTES), ensuring both the param name and the action method signature are identical and updating any call sites or docstrings accordingly.
65-75: Consider adding return type and comprehensive PHPDoc.The action method lacks a return type declaration, and the PHPDoc only documents the
$queriesparameter. For better documentation and type safety, consider expanding:Proposed enhancement
/** * `@param` array<string> $queries + * `@param` bool $includeTotal + * `@param` Document $project + * `@param` Response $response + * `@param` Database $dbForPlatform + * `@param` Authorization $authorization + * `@return` void */ public function action( array $queries, bool $includeTotal, Document $project, Response $response, Database $dbForPlatform, Authorization $authorization, - ) { + ): void {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.php` around lines 65 - 75, The action method in class XList (method name: action) is missing a return type declaration and has incomplete PHPDoc (only $queries documented); update the docblock to document all parameters (queries, includeTotal, project, response, dbForPlatform, authorization) with proper types (array<string>, bool, Document, Response, Database, Authorization) and add a precise `@return` annotation for the actual return type, then add the corresponding PHP return type declaration to the method signature to match the `@return` (e.g., : Response or : array|Response|null as appropriate) so IDEs and static analyzers can validate usage.tests/e2e/Services/Projects/ProjectsBase.php (1)
154-252: Typos in variable names: "Fultter" should be "Flutter".The variable names contain consistent typos throughout the file:
$platformFultteriOSId→$platformFlutteriOSId$platformFultterAndroidId→$platformFlutterAndroidId$platformFultterWebId→$platformFlutterWebIdWhile this doesn't affect functionality, it reduces code readability. Consider fixing these in a follow-up since they exist throughout the file (including the cached array keys on lines 256-258).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/Services/Projects/ProjectsBase.php` around lines 154 - 252, The variables for Flutter platforms contain typos—rename $platformFultteriOSId, $platformFultterAndroidId, and $platformFultterWebId to $platformFlutteriOSId, $platformFlutterAndroidId, and $platformFlutterWebId respectively, and update every usage (including the cached array keys mentioned around the later block) to use the corrected names so references like the POST response assignments and any subsequent reads use the new identifiers consistently.src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php (1)
1-27: Missing strict type declaration.PSR-12 recommends using strict type declarations for PHP files. Consider adding
declare(strict_types=1);after the opening PHP tag.Additionally, the class extends
Appwrite\Platform\Modules\Compute\Base(line 8) but this is a Project module endpoint. Verify this is the intended base class, as it may be more appropriate to extend a base class from the Project module for consistency.🛠️ Suggested improvement
<?php + +declare(strict_types=1); namespace Appwrite\Platform\Modules\Project\Http\Project\Platforms\Web;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php` around lines 1 - 27, Add a strict types declaration by inserting declare(strict_types=1); immediately after the opening <?php tag in this file, and verify the class inheritance: the Create class currently extends Appwrite\Platform\Modules\Compute\Base (imported as Base) which looks incorrect for a Project module endpoint — either change the use/import to the Project module base (e.g., Appwrite\Platform\Modules\Project\Base) and update the class extends accordingly, or confirm that Compute\Base is intentional and remove/adjust the misleading import/comment; ensure any related use statements (use Appwrite\Platform\Modules\Compute\Base) are updated to match the chosen base.tests/e2e/Services/Projects/ProjectsConsoleClientTest.php (1)
3754-4525: Extract platform legacy headers to a helper to reduce drift.The same legacy header block is repeated many times; a small helper will reduce copy/paste errors and make future response-format migrations safer.
Refactor sketch
+ private function platformHeaders(bool $legacy = true): array + { + return array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $legacy ? [ + 'x-appwrite-response-format' => '1.8.0', + ] : [], $this->getHeaders()); + }Then replace repeated
array_merge([...], $this->getHeaders())blocks in platform tests withplatformHeaders().🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/Services/Projects/ProjectsConsoleClientTest.php` around lines 3754 - 4525, Extract the repeated legacy header array_merge([...], $this->getHeaders()) into a helper method (e.g., platformHeaders()) in this test class and replace each occurrence in platform-related tests (methods like setupProjectWithPlatform(), setupProjectData(), testListProjectPlatform(), testGetProjectPlatform(), testUpdateProjectPlatform(), testDeleteProjectPlatform()) with a call to platformHeaders(); implement platformHeaders() to accept an optional array of overrides (merge defaults like 'content-type','x-appwrite-project','x-appwrite-response-format' with $this->getHeaders() and any passed overrides) so every client->call uses platformHeaders() instead of duplicating the array_merge.src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php (2)
1-2: Add strict type declaration.Per coding guidelines, PHP files should use strict type declarations where applicable.
<?php + +declare(strict_types=1); namespace Appwrite\Platform\Modules\Project\Http\Project\Platforms\App;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php` around lines 1 - 2, This PHP file is missing a strict types declaration; add declare(strict_types=1); immediately after the opening <?php tag in src Appwrite Platform Modules Project Http Project Platforms App Create.php (the file containing the Create class) so the Create class and any functions in this file are evaluated under strict typing rules.
31-34: Add return type declaration.The
getName()method should have a return type hint for PSR-12 compliance.- public static function getName() + public static function getName(): string { return 'createProjectAppPlatform'; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php` around lines 31 - 34, The getName() method lacks a return type declaration; update the public static function getName() in the Create class to declare and return a string (add a ": string" return type) so it matches PSR-12 and accurately types the returned value 'createProjectAppPlatform'.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php`:
- Around line 167-169: The Create action mutates $platform after persist by
calling $platform->setAttribute('hostname', '') when $isDeprecatedRequest is
false, causing a create response that differs from subsequent GETs (DB stores
hostname as null); remove the post-creation mutation
($platform->setAttribute('hostname', '')) and instead ensure hostname
normalization is handled consistently either by persisting an empty string at
write time or (preferred) converting null→'' in the response layer (e.g., in the
Platform response formatter / toArray / ProjectResponseModel) so create and read
responses match.
---
Outside diff comments:
In `@tests/e2e/Services/Projects/ProjectsConsoleClientTest.php`:
- Around line 3754-4525: The tests currently force the legacy response contract
by always sending the 'x-appwrite-response-format: 1.8.0' header for platform
CRUD paths; keep those legacy assertions but add at least one full CRUD flow
that omits that header so the default/current platform response contract is
exercised. Locate the platform create/get/update/delete sequences (e.g., calls
via $this->client->call in setupProjectWithPlatform() or the
testDeleteProjectPlatform / testGetProjectPlatform / testUpdateProjectPlatform
methods) and add a new platform lifecycle: POST (create) without
'x-appwrite-response-format', assert the new/current response fields, then GET,
PUT, and DELETE that platform also without the legacy header, asserting expected
status codes and the current response model at each step.
---
Nitpick comments:
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.php`:
- Around line 1-2: This PHP file is missing a strict types declaration; add
declare(strict_types=1); immediately after the opening <?php tag in src Appwrite
Platform Modules Project Http Project Platforms App Create.php (the file
containing the Create class) so the Create class and any functions in this file
are evaluated under strict typing rules.
- Around line 31-34: The getName() method lacks a return type declaration;
update the public static function getName() in the Create class to declare and
return a string (add a ": string" return type) so it matches PSR-12 and
accurately types the returned value 'createProjectAppPlatform'.
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.php`:
- Around line 1-27: Add a strict types declaration by inserting
declare(strict_types=1); immediately after the opening <?php tag in this file,
and verify the class inheritance: the Create class currently extends
Appwrite\Platform\Modules\Compute\Base (imported as Base) which looks incorrect
for a Project module endpoint — either change the use/import to the Project
module base (e.g., Appwrite\Platform\Modules\Project\Base) and update the class
extends accordingly, or confirm that Compute\Base is intentional and
remove/adjust the misleading import/comment; ensure any related use statements
(use Appwrite\Platform\Modules\Compute\Base) are updated to match the chosen
base.
In `@src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.php`:
- Around line 27-30: The getName() method in class XList currently lacks a
return type; update the method signature for getName() to declare a string
return type (i.e., ensure getName(): string) so it consistently enforces strict
typing and returns 'listProjectPlatforms' as before.
- Around line 56-57: The declared request parameter name 'total' in XList.php is
inconsistent with the action method parameter $includeTotal; choose one naming
approach and make them match to improve readability: either rename the action
method parameter $includeTotal to $total (in the XList action signature and all
uses, e.g., the place around line 70 and usage around line 110) or rename the
param declaration from 'total' to 'includeTotal' (in the ->param(...) call that
references Platforms::ALLOWED_ATTRIBUTES), ensuring both the param name and the
action method signature are identical and updating any call sites or docstrings
accordingly.
- Around line 65-75: The action method in class XList (method name: action) is
missing a return type declaration and has incomplete PHPDoc (only $queries
documented); update the docblock to document all parameters (queries,
includeTotal, project, response, dbForPlatform, authorization) with proper types
(array<string>, bool, Document, Response, Database, Authorization) and add a
precise `@return` annotation for the actual return type, then add the
corresponding PHP return type declaration to the method signature to match the
`@return` (e.g., : Response or : array|Response|null as appropriate) so IDEs and
static analyzers can validate usage.
In `@tests/e2e/Services/Projects/ProjectsBase.php`:
- Around line 154-252: The variables for Flutter platforms contain typos—rename
$platformFultteriOSId, $platformFultterAndroidId, and $platformFultterWebId to
$platformFlutteriOSId, $platformFlutterAndroidId, and $platformFlutterWebId
respectively, and update every usage (including the cached array keys mentioned
around the later block) to use the corrected names so references like the POST
response assignments and any subsequent reads use the new identifiers
consistently.
In `@tests/e2e/Services/Projects/ProjectsConsoleClientTest.php`:
- Around line 3754-4525: Extract the repeated legacy header array_merge([...],
$this->getHeaders()) into a helper method (e.g., platformHeaders()) in this test
class and replace each occurrence in platform-related tests (methods like
setupProjectWithPlatform(), setupProjectData(), testListProjectPlatform(),
testGetProjectPlatform(), testUpdateProjectPlatform(),
testDeleteProjectPlatform()) with a call to platformHeaders(); implement
platformHeaders() to accept an optional array of overrides (merge defaults like
'content-type','x-appwrite-project','x-appwrite-response-format' with
$this->getHeaders() and any passed overrides) so every client->call uses
platformHeaders() instead of duplicating the array_merge.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1c4c05b4-030e-46e9-ade1-5f4a4f8bdf9a
📒 Files selected for processing (13)
src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Create.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Update.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Delete.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Get.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Web/Create.phpsrc/Appwrite/Platform/Modules/Project/Http/Project/Platforms/XList.phpsrc/Appwrite/SDK/Specification/Format.phpsrc/Appwrite/SDK/Specification/Format/OpenAPI3.phpsrc/Appwrite/SDK/Specification/Format/Swagger2.phpsrc/Appwrite/Utopia/Response/Filters/V21.phpsrc/Appwrite/Utopia/Response/Model/PlatformApp.phptests/e2e/Services/Projects/ProjectsBase.phptests/e2e/Services/Projects/ProjectsConsoleClientTest.php
🚧 Files skipped from review as they are similar to previous changes (5)
- src/Appwrite/Utopia/Response/Filters/V21.php
- src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Get.php
- src/Appwrite/Utopia/Response/Model/PlatformApp.php
- src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/Delete.php
- src/Appwrite/Platform/Modules/Project/Http/Project/Platforms/App/Update.php
What does this PR do?
Platform APIs to be public under Project API
Test Plan
Related PRs and Issues
x
Checklist