Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds parent-resource status checks in the Appwrite migration destination: before importing env vars, deployments, site env vars, and site deployments the code validates parent function/site status and throws exceptions when parent status is Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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 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 |
Use the resources array to determine whether to export only the active deployment or all deployments. When deployment/site-deployment resource type is included, export all deployments instead of only the active one.
PHP booleans become '1'/'' in multipart/form-data but the API expects 'true'/'false' strings. The non-chunked function deployment path was already correct; this fixes the chunked function deployment and both site deployment paths.
…stination When a function or site already exists in the destination, the API returns 409 and the parent resource is marked as error. Previously, deployments for that parent would still be imported, creating duplicates. Now importDeployment and importSiteDeployment check the parent status and throw an error if it failed.
589dd29 to
928e7c8
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/Migration/Sources/Appwrite.php`:
- Around line 1521-1522: $exportOnlyActive is being set when
Resource::TYPE_DEPLOYMENT is not requested but currently code falls back to
paginated listing and exports all deployments for resources (functions/sites)
that lack an active deployment; change the callers and exportDeployments logic
so that when $exportOnlyActive is true you only export deployments explicitly
referenced by an active deployment ID and never fall back to the full paginated
export: detect resources (functions/sites) with no activeDeploymentId and skip
exporting their deployments (do not call the paginated listing), and ensure the
same change is applied to the second occurrence around the lines mentioned (the
other $exportOnlyActive usage).
| $exportOnlyActive = !\in_array(Resource::TYPE_DEPLOYMENT, $resources); | ||
| $this->exportDeployments($batchSize, $exportOnlyActive); |
There was a problem hiding this comment.
$exportOnlyActive mode can still export all deployments when no active deployment exists.
When Line 1521 / Line 1551 set active-only mode, functions/sites without an active deployment ID currently fall through to paginated listing and export all deployments. That breaks the include-inactive contract for this edge case.
🔧 Proposed fix
--- a/src/Migration/Sources/Appwrite.php
+++ b/src/Migration/Sources/Appwrite.php
@@
- if ($exportOnlyActive && $func->getActiveDeployment()) {
- $deployment = $this->functions->getDeployment($func->getId(), $func->getActiveDeployment());
+ if ($exportOnlyActive) {
+ $activeDeploymentId = $func->getActiveDeployment();
+ if (empty($activeDeploymentId)) {
+ continue; // active-only mode: nothing to export for this function
+ }
+
+ $deployment = $this->functions->getDeployment($func->getId(), $activeDeploymentId);
@@
continue;
}
@@
- if ($exportOnlyActive && $site->getActiveDeployment()) {
- $deployment = $this->sites->getDeployment($site->getId(), $site->getActiveDeployment());
+ if ($exportOnlyActive) {
+ $activeDeploymentId = $site->getActiveDeployment();
+ if (empty($activeDeploymentId)) {
+ continue; // active-only mode: nothing to export for this site
+ }
+
+ $deployment = $this->sites->getDeployment($site->getId(), $activeDeploymentId);
@@
continue;
}Also applies to: 1551-1552
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/Migration/Sources/Appwrite.php` around lines 1521 - 1522,
$exportOnlyActive is being set when Resource::TYPE_DEPLOYMENT is not requested
but currently code falls back to paginated listing and exports all deployments
for resources (functions/sites) that lack an active deployment; change the
callers and exportDeployments logic so that when $exportOnlyActive is true you
only export deployments explicitly referenced by an active deployment ID and
never fall back to the full paginated export: detect resources (functions/sites)
with no activeDeploymentId and skip exporting their deployments (do not call the
paginated listing), and ensure the same change is applied to the second
occurrence around the lines mentioned (the other $exportOnlyActive usage).
Summary
activateparam to string'true'/'false'for multipart form-data requestsTest plan
Summary by CodeRabbit