Skip to content

Feat/site msg backup migrations#2

Open
DhirenMhatre wants to merge 3 commits into
1.9.xfrom
feat/site-msg-backup-migrations
Open

Feat/site msg backup migrations#2
DhirenMhatre wants to merge 3 commits into
1.9.xfrom
feat/site-msg-backup-migrations

Conversation

@DhirenMhatre
Copy link
Copy Markdown

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?

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Policy Check Failed

✗ 3/3 policy checks failed:

• Need 2 more approval(s) (0/2) — comment LGTM or approve via review
• Missing ticket reference (expected: JIRA-, ENG-, #*)
• 2 code file(s) changed but no test files added


To merge this PR:

  1. Address the failed checks listed above
  2. Ensure branch protection requires the codity/policy-check status

Configure policies in your dashboard

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

PR Summary

What Changed

  • Added migration support for Sites and Messaging resources in the Appwrite migration system.
  • Added comprehensive E2E tests covering full migration workflows with cleanup.
  • Fixed missing adapter field in site creation document.

Key Changes by Area

Migration System: Extended MigrationReport model with 7 new resource type counters for sites, deployments, variables, providers, topics, subscribers, and messages. Added API key permissions for these resources in the Migrations worker.

Sites Module: Fixed Create.php to include the adapter field that was missing from the site creation document model.

Test Infrastructure: Added packageSite() helper methods across test base classes with 5MB size limit validation. Added full E2E test coverage for Sites and Messaging migrations including cleanup of source and destination projects.

Files Changed

File Changes Summary
composer.json Switched utopia-php/migration to dev branch dev-feat-message-migration with VCS repository
composer.lock Updated lock file for new dependency version
src/Appwrite/Platform/Workers/Migrations.php Added API key permissions for sites, providers, topics, subscribers, messages, and targets
src/Appwrite/Utopia/Response/Model/MigrationReport.php Added 7 new resource type counters for Sites and Messaging resources
tests/e2e/Services/Migrations/MigrationsBase.php Added testAppwriteMigrationSite() and testAppwriteMigrationMessaging() with packageSite() helper

Review Focus Areas

  • Verify the adapter field fix in Create.php:26-201 handles all site creation scenarios correctly.
  • Check that new API key permissions in Migrations.php:316-330 cover all required resource operations.
  • Review test cleanup logic ensures no orphaned resources in source/destination projects.

Architecture

Design Decisions: Using a dev branch dependency (dev-feat-message-migration) is intentional to coordinate with upstream migration library changes. The adapter field omission was a model/schema mismatch that is now fixed.

Risks: The dev branch dependency introduces instability. This is intentional for feature development but should be switched to stable before release. Test cleanup logic is critical. Missing cleanup would leak resources in CI environments.

Merge Status

NOT MERGEABLE — PR Score 57/100, below threshold (50)

  • [H1] 2 CRITICAL security vulnerabilities found (CODITY_JSON_AWS_SECR, CODITY_JSON_AWS_SECR)
  • [H2] 3 critical dependency CVEs detected
  • [H3] 1 high-risk (strong copyleft) license detected

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 21, 2026

Greptile Summary

This PR extends Appwrite's migration system to support two new resource categories — Sites (with deployments and variables) and Messaging (providers, topics, subscribers, messages) — by bumping the utopia-php/migration library to a new dev branch, adding the corresponding API key scopes in the worker, exposing new counts in the migration report model, and adding e2e tests for both flows.

  • composer.json / composer.lock: utopia-php/migration is switched from the stable 1.6.* tag to the dev-feat-message-migration branch, which introduces a VCS repository override and a dev stability flag — this is not suitable for a production release without a tagged version.
  • Migrations.php / MigrationReport.php: New scopes (sites, providers, topics, subscribers, messages, targets) are added to the internally-generated API key, and matching count fields are added to the migration report response model.
  • MigrationsBase.php: Two new e2e test methods cover site and messaging migration flows, but Resource::TYPE_SUBSCRIBER is omitted from the statusCounters assertion loop and is never verified on the destination project.

Confidence Score: 3/5

Not safe to merge as-is — the dependency is pinned to a mutable dev branch and the subscriber migration is untested in both the status assertion and destination verification.

Two concerns stand out: composer.json swaps a stable tagged release for a dev branch that can change at any time, making reproducible builds impossible and potentially pulling in unreviewed upstream code. The new messaging e2e test also skips asserting the subscriber's migration outcome entirely — neither the statusCounters check nor any destination API call covers it — so a regression in subscriber migration would go undetected.

composer.json (dev branch dependency) and tests/e2e/Services/Migrations/MigrationsBase.php (subscriber coverage gap) need attention before merging.

Important Files Changed

Filename Overview
composer.json Switches utopia-php/migration from stable 1.6.* to dev-feat-message-migration branch, adding a VCS repository override and prefer-stable: true — a dev branch reference is volatile and not production-ready.
composer.lock Lockfile updated to reflect the new dev-branch commit for utopia-php/migration; no other package changes.
src/Appwrite/Platform/Workers/Migrations.php Adds sites, providers, topics, subscribers, messages, and targets scopes to the internally-generated API key used during migration — straightforward scope additions matching the new resource types.
src/Appwrite/Utopia/Response/Model/MigrationReport.php Adds report fields for site, site_deployment, site_variable, provider, topic, subscriber, and message resource counts; no target count field, which may be intentional if targets migrate with users.
tests/e2e/Services/Migrations/MigrationsBase.php Adds e2e tests for site and messaging migrations; subscriber status counter is missing from the assertion loop and subscriber is never verified on the destination, leaving migration failures undetected.

Sequence Diagram

sequenceDiagram
    participant Test as E2E Test
    participant Src as Source Project (API)
    participant Worker as Migration Worker
    participant Dst as Destination Project (API)

    Test->>Src: POST /sites
    Test->>Src: POST /messaging/providers/sendgrid
    Test->>Src: POST /messaging/topics
    Test->>Src: POST /users
    Test->>Src: "POST /messaging/topics/{id}/subscribers"
    Test->>Src: POST /messaging/messages/email

    Test->>Worker: performMigrationSync(resources, endpoint, apiKey)
    Worker->>Worker: generateAPIKey with sites/messaging scopes
    Worker->>Src: Fetch all resources
    Worker->>Dst: Create all resources
    Worker-->>Test: Migration result

    Test->>Dst: "GET /sites/{id}"
    Test->>Dst: "GET /messaging/providers/{id}"
    Test->>Dst: "GET /messaging/topics/{id}"
    Test->>Dst: "GET /messaging/messages/{id}"
    Note over Test,Dst: Subscriber NOT verified on destination
Loading

Reviews (1): Last reviewed commit: "added messaging migration support and E2..." | Re-trigger Greptile

Resource::TYPE_MESSAGE,
], $result['resources']);

foreach ([Resource::TYPE_USER, Resource::TYPE_PROVIDER, Resource::TYPE_TOPIC, Resource::TYPE_MESSAGE] as $resource) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Resource::TYPE_SUBSCRIBER is included in the migration resources and a subscriber is created and tracked via $subscriberId, yet it is omitted from the foreach assertion loop that validates statusCounters. A subscriber migration failure (errors, warnings, non-zero pending count) would silently pass this test, giving a false green signal.

Suggested change
foreach ([Resource::TYPE_USER, Resource::TYPE_PROVIDER, Resource::TYPE_TOPIC, Resource::TYPE_MESSAGE] as $resource) {
foreach ([Resource::TYPE_USER, Resource::TYPE_PROVIDER, Resource::TYPE_TOPIC, Resource::TYPE_SUBSCRIBER, Resource::TYPE_MESSAGE] as $resource) {

Comment thread composer.json
"utopia-php/logger": "0.6.*",
"utopia-php/messaging": "0.20.*",
"utopia-php/migration": "1.6.*",
"utopia-php/migration": "dev-feat-message-migration",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Dev branch locked into production dependency

dev-feat-message-migration is an unstable branch reference — Composer resolves it to whatever HEAD points to on that branch at install time. Any unreviewed commit pushed to that branch between now and a fresh composer install would silently change the exact code running in production. This also requires the "repositories" VCS override and forces stability-flags to 20 (dev), loosening the stability guarantees for the whole project. This should be replaced with a tagged, stable release once the upstream branch is merged.

Comment on lines +1245 to +1255
private function packageSite(string $site): CURLFile
{
$stdout = '';
$stderr = '';
$folderPath = realpath(__DIR__ . '/../../../resources/sites') . "/$site";
$tarPath = "$folderPath/code.tar.gz";

Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr);

return new CURLFile($tarPath, 'application/x-gzip', \basename($tarPath));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 No error check after tar command

Console::execute() is called to create the archive, but its return value and $stderr are never inspected. If tar fails (e.g. the resources/sites/static directory doesn't exist in CI), the function silently returns a CURLFile pointing to a non-existent path, causing the subsequent site deployment call to fail with a confusing error rather than surfacing the real packaging problem.

Comment on lines +1156 to +1186
// Verify provider on destination
$response = $this->client->call(Client::METHOD_GET, '/messaging/providers/' . $providerId, [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getDestinationProject()['$id'],
'x-appwrite-key' => $this->getDestinationProject()['apiKey'],
]);

$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals($providerId, $response['body']['$id']);
$this->assertEquals('Test SendGrid Provider', $response['body']['name']);

// Verify topic on destination
$response = $this->client->call(Client::METHOD_GET, '/messaging/topics/' . $topicId, [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getDestinationProject()['$id'],
'x-appwrite-key' => $this->getDestinationProject()['apiKey'],
]);

$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals($topicId, $response['body']['$id']);
$this->assertEquals('Test Topic', $response['body']['name']);

// Verify message on destination
$response = $this->client->call(Client::METHOD_GET, '/messaging/messages/' . $messageId, [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getDestinationProject()['$id'],
'x-appwrite-key' => $this->getDestinationProject()['apiKey'],
]);

$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals($messageId, $response['body']['$id']);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Subscriber not verified on destination

After migration, the test verifies the provider, topic, message, and (implicitly) the user on the destination, but never fetches and asserts the migrated subscriber. Since the subscriber assertion was also omitted from the statusCounters loop, there is currently no signal if subscriber migration is broken end-to-end.

Comment thread composer.json
"utopia-php/logger": "0.6.*",
"utopia-php/messaging": "0.20.*",
"utopia-php/migration": "1.6.*",
"utopia-php/migration": "dev-feat-message-migration",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security High

Pinning a production dependency to a mutable dev branch makes builds non-reproducible and allows unreviewed upstream commits to be pulled; pin a tagged release or immutable commit reference instead.

Suggested change
"utopia-php/migration": "dev-feat-message-migration",
"utopia-php/migration": "1.6.*",
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert json developer with deep knowledge of security, performance, and best practices.

### Context

File: composer.json
Lines: 69-69
Issue Type: security-high
Severity: high

Issue Description:
Pinning a production dependency to a mutable dev branch makes builds non-reproducible and allows unreviewed upstream commits to be pulled; pin a tagged release or immutable commit reference instead.

Current Code:
        "utopia-php/migration": "dev-feat-message-migration",

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow json best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---


Like Dislike Create Issue Jira

Comment thread composer.json
Comment on lines +113 to +118
"repositories": [
{
"type": "vcs",
"url": "https://github.com/utopia-php/migration.git"
}
],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Medium

Adding a direct VCS repository bypasses Packagist trust and can silently change the fetched package source; restrict this to an immutable reference or remove the custom repository for production builds.

Suggested change
"repositories": [
{
"type": "vcs",
"url": "https://github.com/utopia-php/migration.git"
}
],
"repositories": [],
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert json developer with deep knowledge of security, performance, and best practices.

### Context

File: composer.json
Lines: 113-118
Issue Type: security-medium
Severity: medium

Issue Description:
Adding a direct VCS repository bypasses Packagist trust and can silently change the fetched package source; restrict this to an immutable reference or remove the custom repository for production builds.

Current Code:
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/utopia-php/migration.git"
        }
    ],

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow json best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---


Like Dislike Create Issue Jira

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Security Scan Summary

Metric Value
Vulnerabilities Critical: 2
Overall Risk High
Files Scanned 5

Fix critical security issues before merging

Scan completed in 37.1s

View vulnerability details (2 items)

1. CODITY_JSON_AWS_SECR (CWE-798) CRITICAL

File: composer.lock (line 712)
Category: Secrets

JSON/YAML config contains a 40-char AWS-secret-shaped value (contains '/', mixed case) under a custom key name. Field name does not launder a credential.

Fix: Remove the hardcoded/obfuscated credential from source. Load credentials from environment variables or a secrets manager at runtime.


2. CODITY_JSON_AWS_SECR (CWE-798) CRITICAL

File: composer.lock (line 5489)
Category: Secrets

JSON/YAML config contains a 40-char AWS-secret-shaped value (contains '/', mixed case) under a custom key name. Field name does not launder a credential.

Fix: Remove the hardcoded/obfuscated credential from source. Load credentials from environment variables or a secrets manager at runtime.


Security scan powered by Codity.ai

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Dependency vulnerability scanning

Metric Value
Vulnerabilities Found 7
Scanner composer audit
View vulnerability details (7 items)

1. google/protobuf 4.33.5

CVE: GHSA-p2gh-cfq4-4wjc
Severity: HIGH
Fixed in: 4.33.6

Protobuf: Denial of Service issue through malicious messages containing negative varints or deep recursion


2. phpseclib/phpseclib 3.0.49

CVE: GHSA-3qpq-r242-jqj7
Severity: CRITICAL
Fixed in: 1.0.29

phpseclib has a CVE-2024-27355 mitigation bypass — OID amplification DoS in ASN1::decodeOID()


3. phpseclib/phpseclib 3.0.49

CVE: GHSA-94g3-g5v7-q4jg
Severity: MEDIUM
Fixed in: 3.0.50

phpseclib's AES-CBC unpadding susceptible to padding oracle timing attack


4. phpseclib/phpseclib 3.0.49

CVE: GHSA-r854-jrxh-36qx
Severity: MEDIUM
Fixed in: 1.0.28

phpseclib has a variable-time HMAC comparison in SSH2::get_binary_packet() using != instead of hash_equals()


5. webonyx/graphql-php 14.11.10

CVE: GHSA-68jq-c3rv-pcrr
Severity: MEDIUM
Fixed in: 15.31.5

graphql-php is affected by a Denial of Service via quadratic complexity in OverlappingFieldsCanBeMerged validation


6. webonyx/graphql-php 14.11.10

CVE: GHSA-fc86-6rv6-2jpm
Severity: CRITICAL
Fixed in: 15.32.2

webonyx/graphql-php has quadratic validation cost in OverlappingFieldsCanBeMerged via inline fragments


7. webonyx/graphql-php 14.11.10

CVE: GHSA-r7cg-qjjm-xhqq
Severity: CRITICAL
Fixed in: 15.32.3

webonyx/graphql-php has unbounded recursion in parser that causes stack overflow on crafted nested input

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

License Compliance Scan

Metric Value
Packages Scanned 145
High Risk (Strong Copyleft) 1
Medium Risk (Weak Copyleft) 3
Low Risk (Permissive) 141
Unknown License 0

Strong copyleft licenses detected - review before merging

Weak copyleft licenses found - verify compatibility

High Risk Licenses - 1 packages

GPL-2.0-or-later (1 packages):

  • enshrined/svg-sanitize 0.22.0
Medium Risk Licenses - 3 packages

LGPL-2.1-only (1 packages):

  • phpmailer/phpmailer 6.9.1

LGPL-2.1-or-later (1 packages):

  • php-amqplib/php-amqplib 3.7.4

LGPL-3.0-or-later (1 packages):

  • matomo/device-detector 6.4.8

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Code Quality Report — test-org-codity/appwrite · PR #2

Scanned: 2026-05-21 13:52 UTC | Score: 41/100 | Provider: github

Executive Summary

Severity Count
Critical 0
High 1
Medium 3
Low 35
Top Findings

[CQ-LLM-002] tests/e2e/Services/Migrations/MigrationsBase.php:898 (Documentation · HIGH)

Issue: The new test method lacks a docstring explaining its purpose and functionality.
Suggestion: Add a docstring to the testAppwriteMigrationSite method to describe what the test is verifying.

public function testAppwriteMigrationSite(): void

[CQ-LLM-001] src/Appwrite/Utopia/Response/Model/MigrationReport.php:54 (Complexity · MEDIUM)

Issue: The constructor method is becoming complex due to multiple addRule calls, which may increase cyclomatic complexity.
Suggestion: Consider refactoring the addRule calls into a separate method to reduce complexity.

->addRule(Resource::TYPE_SITE, [...])

[CQ-LLM-003] tests/e2e/Services/Migrations/MigrationsBase.php:898 (Maintainability · MEDIUM)

Issue: The test method contains hard-coded values for API keys and project IDs, which can lead to maintenance issues.
Suggestion: Consider using constants or configuration files to manage these values.

'x-appwrite-key' => $this->getProject()['apiKey']

[CQ-LLM-004] tests/e2e/Services/Migrations/MigrationsBase.php:898 (Error_Handling · MEDIUM)

Issue: The test method does not handle potential exceptions from API calls, which could lead to unhandled errors.
Suggestion: Implement try-catch blocks around API calls to handle exceptions gracefully.

$this->client->call(Client::METHOD_POST, '/sites', [...])

[CQ-009] composer.lock:4475 (Style · LOW)

Issue: Line exceeds 120 characters (124 chars)
Suggestion: Break long lines into multiple lines for readability

                "url": "https://api.github.com/repos/utopia-php/migration/zipball/69c3eb0f2ebe256863ea394692279665b84b9e...

[CQ-002] composer.lock:4504 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"Utopia\\Tests\\": "tests/Migration"

[CQ-002] composer.lock:4509 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpunit"

[CQ-002] composer.lock:4512 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint --test"

[CQ-002] composer.lock:4515 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint"

[CQ-002] composer.lock:4518 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpstan analyse --level 3 src tests --memory-limit 2G"

Per-File Breakdown

File Critical High Medium Low Total
composer.lock 0 0 0 8 8
src/Appwrite/Utopia/Response/Model/MigrationReport.php 0 0 1 3 4
tests/e2e/Services/Migrations/MigrationsBase.php 0 1 2 24 27

Recommendations

  1. Resolve High severity issues, especially error handling gaps and performance bottlenecks.
  • Run automated tests after applying fixes to verify no regressions.

@DhirenMhatre
Copy link
Copy Markdown
Author

@codity review

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Policy Check Failed

✗ 3/3 policy checks failed:

• Need 2 more approval(s) (0/2) — comment LGTM or approve via review
• Missing ticket reference (expected: JIRA-, ENG-, #*)
• 2 code file(s) changed but no test files added


To merge this PR:

  1. Address the failed checks listed above
  2. Ensure branch protection requires the codity/policy-check status

Configure policies in your dashboard

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

PR Summary

What Changed

  • Added support for migrating Sites and Messaging resources between Appwrite projects.
  • Updated migration worker permissions and API response models to handle new resource types.
  • Added comprehensive E2E tests with proper cleanup for both source and destination projects.

Key Changes by Area

Migration Worker: Added API key permissions for sites, providers, topics, subscribers, messages, and targets in src/Appwrite/Platform/Workers/Migrations.php:316-330.

API Response Model: Extended MigrationReport with fields for sites, deployments, variables, messaging providers, topics, subscribers, and messages in src/Appwrite/Utopia/Response/Model/MigrationReport.php:56-97.

Dependency Management: Switched utopia-php/migration from stable 1.6.* to dev branch dev-feat-message-migration with VCS repository configuration in composer.json.

Test Coverage: Added testAppwriteMigrationSite() and testAppwriteMigrationMessaging() with full CRUD operations and cleanup logic in tests/e2e/Services/Migrations/MigrationsBase.php:901-1255.

Files Changed

File Changes Summary
composer.json Switched migration library to dev branch with VCS repo config
composer.lock Updated lockfile for new dependency version
src/Appwrite/Platform/Workers/Migrations.php Added API key permissions for new resource types
src/Appwrite/Utopia/Response/Model/MigrationReport.php Added migration report fields for sites and messaging resources
tests/e2e/Services/Migrations/MigrationsBase.php Added comprehensive E2E tests with cleanup for sites and messaging

Review Focus Areas

  • Verify dev branch dependency is acceptable for this merge target.
  • Check that cleanup logic in tests properly handles partial failures.
  • Confirm new API permissions follow least-privilege principles.

Architecture

Design Decisions: Using a dev branch dependency is intentional to access unreleased migration features. The parallel cleanup pattern in tests (source and destination) trades test runtime for isolation.

Risks: Dev branch dependency introduces instability. Acceptable if this PR targets a feature branch, but should block production releases.

Merge Status

NOT MERGEABLE — PR Score 47/100, below threshold (50)

  • [H1] 2 CRITICAL security vulnerabilities found (CODITY_JSON_AWS_SECR, CODITY_JSON_AWS_SECR)
  • [H2] 3 critical dependency CVEs detected
  • [H3] 1 high-risk (strong copyleft) license detected
  • [H4] PR quality score (47) is below merge floor (50)

Comment thread composer.lock
{
"name": "utopia-php/migration",
"version": "1.6.1",
"version": "dev-feat-message-migration",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security High

This lockfile now pins utopia-php/migration to a mutable dev branch, so replace it with a tagged stable release or an exact commit constraint in composer.json and regenerate the lockfile.

Also reported at: composer.json L69

Suggested change
"version": "dev-feat-message-migration",
"version": "1.6.1",
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert json developer with deep knowledge of security, performance, and best practices.

### Context

File: composer.lock
Lines: 4467-4467
Issue Type: security-high
Severity: high

Issue Description:
This lockfile now pins `utopia-php/migration` to a mutable dev branch, so replace it with a tagged stable release or an exact commit constraint in composer.json and regenerate the lockfile.

_Also reported at: `composer.json` L69_

Current Code:
            "version": "dev-feat-message-migration",

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow json best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---


Like Dislike Create Issue Jira

Comment thread composer.lock
Comment on lines +8906 to +8908
"stability-flags": {
"utopia-php/migration": 20
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Medium

Allowing unstable packages via a stability flag weakens supply chain guarantees, so remove the flag and lock to a stable tagged version.

Suggested change
"stability-flags": {
"utopia-php/migration": 20
},
"stability-flags": [],
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert json developer with deep knowledge of security, performance, and best practices.

### Context

File: composer.lock
Lines: 8906-8908
Issue Type: security-medium
Severity: medium

Issue Description:
Allowing unstable packages via a stability flag weakens supply chain guarantees, so remove the flag and lock to a stable tagged version.

Current Code:
    "stability-flags": {
        "utopia-php/migration": 20
    },

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow json best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---


Like Dislike Create Issue Jira

Comment on lines +1147 to +1154
foreach ([Resource::TYPE_USER, Resource::TYPE_PROVIDER, Resource::TYPE_TOPIC, Resource::TYPE_MESSAGE] as $resource) {
$this->assertArrayHasKey($resource, $result['statusCounters']);
$this->assertEquals(0, $result['statusCounters'][$resource]['error']);
$this->assertEquals(0, $result['statusCounters'][$resource]['pending']);
$this->assertEquals(1, $result['statusCounters'][$resource]['success']);
$this->assertEquals(0, $result['statusCounters'][$resource]['processing']);
$this->assertEquals(0, $result['statusCounters'][$resource]['warning']);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional Medium

The migrated subscriber resource is requested but never validated in statusCounters, so this test can pass even when subscriber migration fails; include TYPE_SUBSCRIBER in the assertions.

Suggested fix
        foreach ([Resource::TYPE_USER, Resource::TYPE_PROVIDER, Resource::TYPE_TOPIC, Resource::TYPE_SUBSCRIBER, Resource::TYPE_MESSAGE] as $resource) {
            $this->assertArrayHasKey($resource, $result['statusCounters']);
            $this->assertEquals(0, $result['statusCounters'][$resource]['error']);
            $this->assertEquals(0, $result['statusCounters'][$resource]['pending']);
            $this->assertEquals(1, $result['statusCounters'][$resource]['success']);
            $this->assertEquals(0, $result['statusCounters'][$resource]['processing']);
            $this->assertEquals(0, $result['statusCounters'][$resource]['warning']);
        }
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert php developer with deep knowledge of security, performance, and best practices.

### Context

File: tests/e2e/Services/Migrations/MigrationsBase.php
Lines: 1147-1154
Issue Type: functional-medium
Severity: medium

Issue Description:
The migrated subscriber resource is requested but never validated in statusCounters, so this test can pass even when subscriber migration fails; include TYPE_SUBSCRIBER in the assertions.

Current Code:
        foreach ([Resource::TYPE_USER, Resource::TYPE_PROVIDER, Resource::TYPE_TOPIC, Resource::TYPE_MESSAGE] as $resource) {
            $this->assertArrayHasKey($resource, $result['statusCounters']);
            $this->assertEquals(0, $result['statusCounters'][$resource]['error']);
            $this->assertEquals(0, $result['statusCounters'][$resource]['pending']);
            $this->assertEquals(1, $result['statusCounters'][$resource]['success']);
            $this->assertEquals(0, $result['statusCounters'][$resource]['processing']);
            $this->assertEquals(0, $result['statusCounters'][$resource]['warning']);
        }

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow php best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---


Like Dislike Create Issue Jira

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Security Scan Summary

Metric Value
Vulnerabilities Critical: 2
Overall Risk High
Files Scanned 5

Fix critical security issues before merging

Scan completed in 34.9s

View vulnerability details (2 items)

1. CODITY_JSON_AWS_SECR (CWE-798) CRITICAL

File: composer.lock (line 712)
Category: Secrets

JSON/YAML config contains a 40-char AWS-secret-shaped value (contains '/', mixed case) under a custom key name. Field name does not launder a credential.

Fix: Remove the hardcoded/obfuscated credential from source. Load credentials from environment variables or a secrets manager at runtime.


2. CODITY_JSON_AWS_SECR (CWE-798) CRITICAL

File: composer.lock (line 5489)
Category: Secrets

JSON/YAML config contains a 40-char AWS-secret-shaped value (contains '/', mixed case) under a custom key name. Field name does not launder a credential.

Fix: Remove the hardcoded/obfuscated credential from source. Load credentials from environment variables or a secrets manager at runtime.


Security scan powered by Codity.ai

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Dependency vulnerability scanning

Metric Value
Vulnerabilities Found 7
Scanner composer audit
View vulnerability details (7 items)

1. google/protobuf 4.33.5

CVE: GHSA-p2gh-cfq4-4wjc
Severity: HIGH
Fixed in: 4.33.6

Protobuf: Denial of Service issue through malicious messages containing negative varints or deep recursion


2. phpseclib/phpseclib 3.0.49

CVE: GHSA-3qpq-r242-jqj7
Severity: CRITICAL
Fixed in: 1.0.29

phpseclib has a CVE-2024-27355 mitigation bypass — OID amplification DoS in ASN1::decodeOID()


3. phpseclib/phpseclib 3.0.49

CVE: GHSA-94g3-g5v7-q4jg
Severity: MEDIUM
Fixed in: 3.0.50

phpseclib's AES-CBC unpadding susceptible to padding oracle timing attack


4. phpseclib/phpseclib 3.0.49

CVE: GHSA-r854-jrxh-36qx
Severity: MEDIUM
Fixed in: 1.0.28

phpseclib has a variable-time HMAC comparison in SSH2::get_binary_packet() using != instead of hash_equals()


5. webonyx/graphql-php 14.11.10

CVE: GHSA-68jq-c3rv-pcrr
Severity: MEDIUM
Fixed in: 15.31.5

graphql-php is affected by a Denial of Service via quadratic complexity in OverlappingFieldsCanBeMerged validation


6. webonyx/graphql-php 14.11.10

CVE: GHSA-fc86-6rv6-2jpm
Severity: CRITICAL
Fixed in: 15.32.2

webonyx/graphql-php has quadratic validation cost in OverlappingFieldsCanBeMerged via inline fragments


7. webonyx/graphql-php 14.11.10

CVE: GHSA-r7cg-qjjm-xhqq
Severity: CRITICAL
Fixed in: 15.32.3

webonyx/graphql-php has unbounded recursion in parser that causes stack overflow on crafted nested input

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

License Compliance Scan

Metric Value
Packages Scanned 145
High Risk (Strong Copyleft) 1
Medium Risk (Weak Copyleft) 3
Low Risk (Permissive) 141
Unknown License 0

Strong copyleft licenses detected - review before merging

Weak copyleft licenses found - verify compatibility

High Risk Licenses - 1 packages

GPL-2.0-or-later (1 packages):

  • enshrined/svg-sanitize 0.22.0
Medium Risk Licenses - 3 packages

LGPL-2.1-only (1 packages):

  • phpmailer/phpmailer 6.9.1

LGPL-2.1-or-later (1 packages):

  • php-amqplib/php-amqplib 3.7.4

LGPL-3.0-or-later (1 packages):

  • matomo/device-detector 6.4.8

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Code Quality Report — test-org-codity/appwrite · PR #2

Scanned: 2026-05-21 14:08 UTC | Score: 41/100 | Provider: github

Executive Summary

Severity Count
Critical 0
High 1
Medium 3
Low 36
Top Findings

[CQ-LLM-002] src/Appwrite/Utopia/Response/Model/MigrationReport.php:54 (Duplication · HIGH)

Issue: Multiple addRule calls for similar resource types may indicate duplication.
Suggestion: Create a loop or a mapping structure to handle similar resource types to adhere to DRY principles.

->addRule(Resource::TYPE_SITE, [...])

[CQ-LLM-001] src/Appwrite/Utopia/Response/Model/MigrationReport.php:54 (Complexity · MEDIUM)

Issue: The constructor method is becoming complex due to multiple addRule calls, which may increase cyclomatic complexity.
Suggestion: Consider refactoring the addRule calls into a separate method to reduce complexity.

->addRule(Resource::TYPE_SITE, [...])

[CQ-LLM-003] tests/e2e/Services/Migrations/MigrationsBase.php:898 (Error_Handling · MEDIUM)

Issue: The test does not handle potential exceptions from the client calls, which could lead to unhandled errors.
Suggestion: Wrap client calls in try-catch blocks to handle exceptions gracefully.

$site = $this->client->call(Client::METHOD_POST, '/sites', [...]);

[CQ-LLM-005] tests/e2e/Services/Migrations/MigrationsBase.php:898 (Maintainability · MEDIUM)

Issue: Hard-coded values for API keys and project IDs reduce maintainability and testability.
Suggestion: Consider using configuration files or environment variables to manage sensitive data.

'x-appwrite-key' => $this->getProject()['apiKey']

[CQ-009] composer.lock:4475 (Style · LOW)

Issue: Line exceeds 120 characters (124 chars)
Suggestion: Break long lines into multiple lines for readability

                "url": "https://api.github.com/repos/utopia-php/migration/zipball/69c3eb0f2ebe256863ea394692279665b84b9e...

[CQ-002] composer.lock:4504 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"Utopia\\Tests\\": "tests/Migration"

[CQ-002] composer.lock:4509 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpunit"

[CQ-002] composer.lock:4512 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint --test"

[CQ-002] composer.lock:4515 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint"

[CQ-002] composer.lock:4518 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpstan analyse --level 3 src tests --memory-limit 2G"

Per-File Breakdown

File Critical High Medium Low Total
composer.lock 0 0 0 8 8
src/Appwrite/Utopia/Response/Model/MigrationReport.php 0 1 1 3 5
tests/e2e/Services/Migrations/MigrationsBase.php 0 0 2 25 27

Recommendations

  1. Resolve High severity issues, especially error handling gaps and performance bottlenecks.
  • Run automated tests after applying fixes to verify no regressions.

@DhirenMhatre
Copy link
Copy Markdown
Author

@codity review

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Policy Check Failed

✗ 3/3 policy checks failed:

• Need 2 more approval(s) (0/2) — comment LGTM or approve via review
• Missing ticket reference (expected: JIRA-, ENG-, #*)
• 2 code file(s) changed but no test files added


To merge this PR:

  1. Address the failed checks listed above
  2. Ensure branch protection requires the codity/policy-check status

Configure policies in your dashboard

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

PR Summary

What Changed

  • Added migration support for Sites and Messaging resources to the migration system.
  • Added comprehensive E2E tests covering site deployments and messaging workflows.
  • Fixed missing adapter field in site creation.

Key Changes by Area

Migration System: Extended API key scopes in Migrations.php:316-330 to include sites and messaging permissions. Added report fields for sites, deployments, variables, providers, topics, subscribers, and messages in MigrationReport.php:56-97.

E2E Testing: Added testAppwriteMigrationSite() and testAppwriteMigrationMessaging() with full resource lifecycle testing and cleanup. Added packageSite() helper for test archive creation.

Sites: Fixed site document creation in Create.php:26-201 to include the adapter field.

Dependencies: Switched utopia-php/migration to dev branch dev-feat-message-migration in composer.json.

Files Changed

File Changes Summary
composer.json Switched migration library to dev branch with VCS repo config
composer.lock Updated lock file for dependency change
src/Appwrite/Platform/Workers/Migrations.php Added sites and messaging API key scopes
src/Appwrite/Utopia/Response/Model/MigrationReport.php Added migration report fields for new resource types
tests/e2e/Services/Migrations/MigrationsBase.php Added E2E tests for sites and messaging migrations with cleanup

Review Focus Areas

  • Verify adapter field fix in site creation handles all edge cases.
  • Check that packageSite() in MigrationsBase.php intentionally omits the 5MB size check present in ProxyBase.php.
  • Confirm messaging test cleanup properly handles dependent resources (users, targets).

Architecture

Design Decisions: The packageSite() helper duplicates archive logic from ProxyBase.php without the size check. This appears intentional for test flexibility but creates maintenance overhead. The dev branch dependency indicates this is pre-release work.

Risks: Using a dev branch dependency (dev-feat-message-migration) in production code is an intentional risk for this PR phase. The duplicate packageSite() implementation risks drift from the canonical version in ProxyBase.php.

Merge Status

NOT MERGEABLE — PR Score 47/100, below threshold (50)

  • [H2] 3 critical dependency CVEs detected
  • [H3] 1 high-risk (strong copyleft) license detected
  • [H4] PR quality score (47) is below merge floor (50)

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Security Scan Summary

Metric Value
Vulnerabilities Critical: 0
Overall Risk Clean
Files Scanned 5

No critical security issues detected

Scan completed in 34.6s

Security scan powered by Codity.ai

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Dependency vulnerability scanning

Metric Value
Vulnerabilities Found 7
Scanner composer audit
View vulnerability details (7 items)

1. google/protobuf 4.33.5

CVE: GHSA-p2gh-cfq4-4wjc
Severity: HIGH
Fixed in: 4.33.6

Protobuf: Denial of Service issue through malicious messages containing negative varints or deep recursion


2. phpseclib/phpseclib 3.0.49

CVE: GHSA-3qpq-r242-jqj7
Severity: CRITICAL
Fixed in: 1.0.29

phpseclib has a CVE-2024-27355 mitigation bypass — OID amplification DoS in ASN1::decodeOID()


3. phpseclib/phpseclib 3.0.49

CVE: GHSA-94g3-g5v7-q4jg
Severity: MEDIUM
Fixed in: 3.0.50

phpseclib's AES-CBC unpadding susceptible to padding oracle timing attack


4. phpseclib/phpseclib 3.0.49

CVE: GHSA-r854-jrxh-36qx
Severity: MEDIUM
Fixed in: 1.0.28

phpseclib has a variable-time HMAC comparison in SSH2::get_binary_packet() using != instead of hash_equals()


5. webonyx/graphql-php 14.11.10

CVE: GHSA-68jq-c3rv-pcrr
Severity: MEDIUM
Fixed in: 15.31.5

graphql-php is affected by a Denial of Service via quadratic complexity in OverlappingFieldsCanBeMerged validation


6. webonyx/graphql-php 14.11.10

CVE: GHSA-fc86-6rv6-2jpm
Severity: CRITICAL
Fixed in: 15.32.2

webonyx/graphql-php has quadratic validation cost in OverlappingFieldsCanBeMerged via inline fragments


7. webonyx/graphql-php 14.11.10

CVE: GHSA-r7cg-qjjm-xhqq
Severity: CRITICAL
Fixed in: 15.32.3

webonyx/graphql-php has unbounded recursion in parser that causes stack overflow on crafted nested input

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

License Compliance Scan

Metric Value
Packages Scanned 145
High Risk (Strong Copyleft) 1
Medium Risk (Weak Copyleft) 3
Low Risk (Permissive) 141
Unknown License 0

Strong copyleft licenses detected - review before merging

Weak copyleft licenses found - verify compatibility

High Risk Licenses - 1 packages

GPL-2.0-or-later (1 packages):

  • enshrined/svg-sanitize 0.22.0
Medium Risk Licenses - 3 packages

LGPL-2.1-only (1 packages):

  • phpmailer/phpmailer 6.9.1

LGPL-2.1-or-later (1 packages):

  • php-amqplib/php-amqplib 3.7.4

LGPL-3.0-or-later (1 packages):

  • matomo/device-detector 6.4.8

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Code Quality Report — test-org-codity/appwrite · PR #2

Scanned: 2026-05-21 17:01 UTC | Score: 41/100 | Provider: github

Executive Summary

Severity Count
Critical 0
High 1
Medium 3
Low 36
Top Findings

[CQ-LLM-002] tests/e2e/Services/Migrations/MigrationsBase.php:898 (Duplication · HIGH)

Issue: Repeated calls to the client with similar parameters for creating sites, deployments, and variables indicate potential duplication.
Suggestion: Extract the repeated client call logic into a separate method to adhere to DRY principles.

$this->client->call(Client::METHOD_POST, '/sites', [...]);

[CQ-LLM-001] src/Appwrite/Utopia/Response/Model/MigrationReport.php:54 (Complexity · MEDIUM)

Issue: The constructor method is becoming complex due to multiple addRule calls.
Suggestion: Consider refactoring the constructor to reduce complexity, possibly by extracting the rule definitions into a separate method.

->addRule(Resource::TYPE_SITE, [...])
->addRule(Resource::TYPE_SITE_DEPLOYMENT, [...])
->addRule(Resource::TYPE_SITE_VARIABLE, [...])

[CQ-LLM-003] tests/e2e/Services/Migrations/MigrationsBase.php:900 (Error_Handling · MEDIUM)

Issue: The code does not handle potential errors from the client calls, which could lead to unhandled exceptions.
Suggestion: Add error handling for the client calls to ensure that exceptions are caught and handled appropriately.

$this->client->call(Client::METHOD_POST, '/sites', [...]);

[CQ-LLM-005] tests/e2e/Services/Migrations/MigrationsBase.php:900 (Maintainability · MEDIUM)

Issue: Hard-coded values for API keys and project IDs reduce maintainability and flexibility.
Suggestion: Consider using configuration files or environment variables to manage sensitive information like API keys.

'x-appwrite-key' => $this->getProject()['apiKey']

[CQ-009] composer.lock:4475 (Style · LOW)

Issue: Line exceeds 120 characters (124 chars)
Suggestion: Break long lines into multiple lines for readability

                "url": "https://api.github.com/repos/utopia-php/migration/zipball/69c3eb0f2ebe256863ea394692279665b84b9e...

[CQ-002] composer.lock:4504 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"Utopia\\Tests\\": "tests/Migration"

[CQ-002] composer.lock:4509 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpunit"

[CQ-002] composer.lock:4512 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint --test"

[CQ-002] composer.lock:4515 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint"

[CQ-002] composer.lock:4518 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpstan analyse --level 3 src tests --memory-limit 2G"

Per-File Breakdown

File Critical High Medium Low Total
composer.lock 0 0 0 8 8
src/Appwrite/Utopia/Response/Model/MigrationReport.php 0 0 1 3 4
tests/e2e/Services/Migrations/MigrationsBase.php 0 1 2 25 28

Recommendations

  1. Resolve High severity issues, especially error handling gaps and performance bottlenecks.
  • Run automated tests after applying fixes to verify no regressions.

@DhirenMhatre
Copy link
Copy Markdown
Author

@codity review

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

Policy Check Failed

✗ 3/3 policy checks failed:

• Need 2 more approval(s) (0/2) — comment LGTM or approve via review
• Missing ticket reference (expected: JIRA-, ENG-, #*)
• 2 code file(s) changed but no test files added


To merge this PR:

  1. Address the failed checks listed above
  2. Ensure branch protection requires the codity/policy-check status

Configure policies in your dashboard

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 21, 2026

PR Summary

What Changed

  • Adds migration support for Sites and Messaging resources in the Appwrite migration system.
  • Updates migration library to dev branch with new resource type support.
  • Adds comprehensive E2E tests covering site deployments, variables, and messaging resources.

Key Changes by Area

Migration System: Extended Migrations.php worker with API key permissions for sites, providers, topics, subscribers, messages, and targets. Updated MigrationReport.php with counters for all new resource types.

Site Management: Fixed repository linking in Create.php to use resourceType => 'site' when Git provider is configured.

Testing: Added testAppwriteMigrationSite() and testAppwriteMigrationMessaging() E2E tests with helper methods for site packaging and deployment duplication.

Files Changed

File Changes Summary
composer.json Switched utopia-php/migration to dev branch dev-feat-message-migration with VCS repo config
composer.lock Updated lock file for new migration dependency version
src/Appwrite/Platform/Workers/Migrations.php Added API key permissions for sites, providers, topics, subscribers, messages, targets (lines 316-326)
src/Appwrite/Utopia/Response/Model/MigrationReport.php Added migration report counters for sites, deployments, variables, providers, topics, subscribers, messages (lines 56-84)
tests/e2e/Services/Migrations/MigrationsBase.php Added E2E tests for site and messaging migrations with helper methods (lines 421-430, 901-1258)

Review Focus Areas

  • Verify resourceType => 'site' change in site creation doesn't break existing Git integrations.
  • Check that new API key permissions in migration worker cover all required messaging operations.
  • Review E2E test coverage for edge cases in deployment variable migration.

Architecture

Design Decisions: Using a dev branch dependency (dev-feat-message-migration) is intentional and temporary. The resourceType fix aligns site repository linking with other resource types.

Risks: Dev branch dependency may introduce instability. This is intentional and should be switched to stable release before production deployment.

Merge Status

NOT MERGEABLE — PR Score 27/100, below threshold (50)

  • [H2] 3 critical dependency CVEs detected
  • [H3] 1 high-risk (strong copyleft) license detected
  • [H4] PR quality score (27) is below merge floor (50)
  • [H5] 5 HIGH-severity inline review findings need resolution (threshold: 3)

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Policy Check Failed

✗ 3/3 policy checks failed:

• Need 2 more approval(s) (0/2) — comment LGTM or approve via review
• Missing ticket reference (expected: JIRA-, ENG-, #*)
• 2 code file(s) changed but no test files added


To merge this PR:

  1. Address the failed checks listed above
  2. Ensure branch protection requires the codity/policy-check status

Configure policies in your dashboard

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

PR Summary

What Changed

  • Added migration support for Sites and Messaging resources in Appwrite.
  • Updated migration worker permissions and API response models to include new resource types.
  • Added comprehensive E2E tests for site and messaging migration flows.

Key Changes by Area

Migration Worker: Added API key permissions for sites, providers, topics, subscribers, messages, and targets in src/Appwrite/Platform/Workers/Migrations.php:316-328.

API Response Model: Added 7 new resource type counters (site, site deployment, site variable, provider, topic, subscriber, message) to MigrationReport.php:56-97.

E2E Tests: Added testAppwriteMigrationSite() and testAppwriteMigrationMessaging() with supporting helpers and cleanup logic.

Files Changed

File Changes Summary
composer.json Switched utopia-php/migration to dev branch dev-feat-message-migration with VCS repo config
composer.lock Updated lockfile for new migration dependency
src/Appwrite/Platform/Workers/Migrations.php Added API key permissions for 7 new resource types
src/Appwrite/Utopia/Response/Model/MigrationReport.php Added 7 new resource type counter constants
tests/e2e/Services/Migrations/MigrationsBase.php Added site and messaging migration E2E tests with packageSite() helper

Review Focus Areas

  • Shell command injection risk in packageSite() at MigrationsBase.php:1252 (unescaped $folderPath in Console::execute).
  • Test cleanup logic ensures no resource leakage between source/destination projects.

Architecture

Risks: The packageSite() helper uses unescaped shell interpolation. This is an unintentional risk that should be fixed before merge.

Merge Status

NOT MERGEABLE — PR Score 23/100, below threshold (50)

  • [H2] 3 critical dependency CVEs detected
  • [H3] 1 high-risk (strong copyleft) license detected
  • [H4] PR quality score (23) is below merge floor (50)
  • [H5] 1 CRITICAL inline review finding need resolution
  • [H6] Code quality raw score (39) is below merge floor (40)

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Nitpicks (Low Priority)

Found 1 low-priority suggestions for code improvement

Click to expand nitpicks

tests/e2e/Services/Migrations/MigrationsBase.php (line 1252)

Robustness Low

The new packageSite() helper shells out with an unescaped interpolated path: Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr);. If the resources path contains spaces or shell metacharacters, the command will fail and the site migration test will not create the archive it later uploads, making the test brittle on otherwise valid checkouts.

Code Suggestion or Comments
Console::execute("cd " . escapeshellarg($folderPath) . " && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr);
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert bash developer with deep knowledge of security, performance, and best practices.

### Context

File: tests/e2e/Services/Migrations/MigrationsBase.php
Lines: 1252-1252
Issue Type: robustness-low
Severity: low

Issue Description:
The new `packageSite()` helper shells out with an unescaped interpolated path: `Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr);`. If the resources path contains spaces or shell metacharacters, the command will fail and the site migration test will not create the archive it later uploads, making the test brittle on otherwise valid checkouts.

Current Code:
Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr);

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow bash best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---



Like Dislike

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Security Scan Summary

Metric Value
Vulnerabilities Critical: 0
Overall Risk Clean
Files Scanned 5

No critical security issues detected

Scan completed in 31.8s

Security scan powered by Codity.ai

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Dependency vulnerability scanning

Metric Value
Vulnerabilities Found 12
Scanner composer audit
Top 10 Vulnerabilities (12 total found)

1. google/protobuf 4.33.5

CVE: GHSA-p2gh-cfq4-4wjc
Severity: HIGH
Fixed in: 4.33.6

Protobuf: Denial of Service issue through malicious messages containing negative varints or deep recursion


2. phpseclib/phpseclib 3.0.49

CVE: GHSA-3qpq-r242-jqj7
Severity: CRITICAL
Fixed in: 1.0.29

phpseclib has a CVE-2024-27355 mitigation bypass — OID amplification DoS in ASN1::decodeOID()


3. phpseclib/phpseclib 3.0.49

CVE: GHSA-94g3-g5v7-q4jg
Severity: MEDIUM
Fixed in: 3.0.50

phpseclib's AES-CBC unpadding susceptible to padding oracle timing attack


4. phpseclib/phpseclib 3.0.49

CVE: GHSA-r854-jrxh-36qx
Severity: MEDIUM
Fixed in: 1.0.28

phpseclib has a variable-time HMAC comparison in SSH2::get_binary_packet() using != instead of hash_equals()


5. webonyx/graphql-php 14.11.10

CVE: GHSA-68jq-c3rv-pcrr
Severity: MEDIUM
Fixed in: 15.31.5

graphql-php is affected by a Denial of Service via quadratic complexity in OverlappingFieldsCanBeMerged validation


6. webonyx/graphql-php 14.11.10

CVE: GHSA-fc86-6rv6-2jpm
Severity: CRITICAL
Fixed in: 15.32.2

webonyx/graphql-php has quadratic validation cost in OverlappingFieldsCanBeMerged via inline fragments


7. webonyx/graphql-php 14.11.10

CVE: GHSA-r7cg-qjjm-xhqq
Severity: CRITICAL
Fixed in: 15.32.3

webonyx/graphql-php has unbounded recursion in parser that causes stack overflow on crafted nested input


8. twig/twig 3.14.2

CVE: GHSA-24x9-r6q4-q93w
Severity: HIGH
Fixed in: 3.26.0

Twig: template_from_string() escapes a SourcePolicy-driven sandbox via synthesized template name


9. twig/twig 3.14.2

CVE: GHSA-4j38-f5cw-54h7
Severity: MEDIUM
Fixed in: 3.26.0

Twig: The spaceless filter implicitly marks its output as safe


10. twig/twig 3.14.2

CVE: GHSA-7fxw-r6jv-74c8
Severity: HIGH
Fixed in: 3.26.0

Twig: {% sandbox %}{% include %} skips checkSecurity() on cached templates (incomplete fix for CVE-2024-45411)


2 more vulnerabilities not shown. Update dependencies to fix these issues.

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

License Compliance Scan

Metric Value
Packages Scanned 145
High Risk (Strong Copyleft) 1
Medium Risk (Weak Copyleft) 3
Low Risk (Permissive) 141
Unknown License 0

Strong copyleft licenses detected - review before merging

Weak copyleft licenses found - verify compatibility

High Risk Licenses - 1 packages

GPL-2.0-or-later (1 packages):

  • enshrined/svg-sanitize 0.22.0
Medium Risk Licenses - 3 packages

LGPL-2.1-only (1 packages):

  • phpmailer/phpmailer 6.9.1

LGPL-2.1-or-later (1 packages):

  • php-amqplib/php-amqplib 3.7.4

LGPL-3.0-or-later (1 packages):

  • matomo/device-detector 6.4.8

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Code Quality Report — test-org-codity/appwrite · PR #2

Scanned: 2026-05-22 19:23 UTC | Score: 39/100 | Provider: github

Executive Summary

Severity Count
Critical 0
High 1
Medium 4
Low 36
Top Findings

[CQ-LLM-003] tests/e2e/Services/Migrations/MigrationsBase.php:898 (Error_Handling · HIGH)

Issue: The test does not handle potential exceptions from the client calls, which could lead to unhandled errors.
Suggestion: Wrap client calls in try-catch blocks to handle exceptions gracefully.

$site = $this->client->call(Client::METHOD_POST, '/sites', [...]);

[CQ-LLM-001] src/Appwrite/Utopia/Response/Model/MigrationReport.php:54 (Complexity · MEDIUM)

Issue: The constructor is becoming complex due to multiple addRule calls, which may increase cyclomatic complexity.
Suggestion: Consider refactoring the addRule calls into a separate method to reduce complexity.

->addRule(Resource::TYPE_SITE, [...])

[CQ-LLM-002] src/Appwrite/Utopia/Response/Model/MigrationReport.php:54 (Duplication · MEDIUM)

Issue: Multiple addRule calls have similar structures, indicating potential duplication.
Suggestion: Create a helper function to handle the repetitive addRule calls to adhere to DRY principles.

->addRule(Resource::TYPE_SITE, [...])

[CQ-LLM-004] tests/e2e/Services/Migrations/MigrationsBase.php:898 (Performance · MEDIUM)

Issue: Multiple calls to the client in a loop may lead to performance issues due to potential N+1 query problems.
Suggestion: Batch requests where possible to reduce the number of calls to the client.

$this->client->call(Client::METHOD_POST, '/sites', [...]);

[CQ-LLM-006] tests/e2e/Services/Migrations/MigrationsBase.php:898 (Maintainability · MEDIUM)

Issue: Hard-coded values in the test may lead to maintainability issues if they need to be changed in the future.
Suggestion: Define constants for hard-coded values to improve maintainability.

'name' => 'Test Site',

[CQ-009] composer.lock:4475 (Style · LOW)

Issue: Line exceeds 120 characters (124 chars)
Suggestion: Break long lines into multiple lines for readability

                "url": "https://api.github.com/repos/utopia-php/migration/zipball/69c3eb0f2ebe256863ea394692279665b84b9e...

[CQ-002] composer.lock:4504 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"Utopia\\Tests\\": "tests/Migration"

[CQ-002] composer.lock:4509 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpunit"

[CQ-002] composer.lock:4512 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint --test"

[CQ-002] composer.lock:4515 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint"

Per-File Breakdown

File Critical High Medium Low Total
composer.lock 0 0 0 8 8
src/Appwrite/Utopia/Response/Model/MigrationReport.php 0 0 2 3 5
tests/e2e/Services/Migrations/MigrationsBase.php 0 1 2 25 28

Recommendations

  1. Resolve High severity issues, especially error handling gaps and performance bottlenecks.
  • Run automated tests after applying fixes to verify no regressions.

@DhirenMhatre
Copy link
Copy Markdown
Author

@codity review

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Policy Check Failed

✗ 3/3 policy checks failed:

• Need 2 more approval(s) (0/2) — comment LGTM or approve via review
• Missing ticket reference (expected: JIRA-, ENG-, #*)
• 2 code file(s) changed but no test files added


To merge this PR:

  1. Address the failed checks listed above
  2. Ensure branch protection requires the codity/policy-check status

Configure policies in your dashboard

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

PR Summary

What Changed

  • Added migration support for Sites and Messaging resources (providers, topics, subscribers, messages).
  • Added comprehensive E2E tests covering full migration flows for both resource types.
  • Fixed missing adapter field in site creation that broke deployment workflows.

Key Changes by Area

Migration Engine: Extended MigrationReport model with 7 new resource counters and added API key permissions for sites and messaging resources in the migration worker.

Sites: Fixed Create.php to include the adapter field in site documents. Added packageSite() helper and deployment duplication methods to support migration testing.

Messaging: New migration coverage for SendGrid providers, topics, subscribers, and draft email messages with user-target resolution.

Testing: Added testAppwriteMigrationSite() and testAppwriteMigrationMessaging() with full project teardown cleanup.

Files Changed

File Changes Summary
composer.json Switched utopia-php/migration to dev branch dev-feat-message-migration; added VCS repository
composer.lock Updated lock file for new migration package version
src/Appwrite/Platform/Workers/Migrations.php Added API key permissions for sites, providers, topics, subscribers, messages, targets
src/Appwrite/Utopia/Response/Model/MigrationReport.php Added 7 new resource type counters for sites and messaging
tests/e2e/Services/Migrations/MigrationsBase.php Added E2E tests for site and messaging migrations; added packageSite() helper

Review Focus Areas

  • Verify the adapter field fix in site creation handles all edge cases.
  • Check that messaging migration properly resolves user targets between source and destination projects.
  • Confirm dev branch dependency on utopia-php/migration is intentional and tracked for stable release.

Architecture

Design Decisions: Using a dev branch dependency for the migration package is intentional to access unreleased messaging features. The packageSite() helper mirrors existing packageFunction() patterns for consistency.

Risks: Dev branch dependency creates stability risk until utopia-php/migration releases formally. Messaging migration requires user existence in destination project for target resolution. This is acceptable for test environments but needs validation in production migration scenarios.

Merge Status

NOT MERGEABLE — PR Score 25/100, below threshold (50)

  • [H2] 3 critical dependency CVEs detected
  • [H3] 1 high-risk (strong copyleft) license detected
  • [H4] PR quality score (25) is below merge floor (50)
  • [H5] 1 CRITICAL inline review finding need resolution

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Security Scan Summary

Metric Value
Vulnerabilities Critical: 0
Overall Risk Clean
Files Scanned 5

No critical security issues detected

Scan completed in 29.3s

Security scan powered by Codity.ai

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Dependency vulnerability scanning

Metric Value
Vulnerabilities Found 12
Scanner composer audit
Top 10 Vulnerabilities (12 total found)

1. google/protobuf 4.33.5

CVE: GHSA-p2gh-cfq4-4wjc
Severity: HIGH
Fixed in: 4.33.6

Protobuf: Denial of Service issue through malicious messages containing negative varints or deep recursion


2. phpseclib/phpseclib 3.0.49

CVE: GHSA-3qpq-r242-jqj7
Severity: CRITICAL
Fixed in: 1.0.29

phpseclib has a CVE-2024-27355 mitigation bypass — OID amplification DoS in ASN1::decodeOID()


3. phpseclib/phpseclib 3.0.49

CVE: GHSA-94g3-g5v7-q4jg
Severity: MEDIUM
Fixed in: 3.0.50

phpseclib's AES-CBC unpadding susceptible to padding oracle timing attack


4. phpseclib/phpseclib 3.0.49

CVE: GHSA-r854-jrxh-36qx
Severity: MEDIUM
Fixed in: 1.0.28

phpseclib has a variable-time HMAC comparison in SSH2::get_binary_packet() using != instead of hash_equals()


5. webonyx/graphql-php 14.11.10

CVE: GHSA-68jq-c3rv-pcrr
Severity: MEDIUM
Fixed in: 15.31.5

graphql-php is affected by a Denial of Service via quadratic complexity in OverlappingFieldsCanBeMerged validation


6. webonyx/graphql-php 14.11.10

CVE: GHSA-fc86-6rv6-2jpm
Severity: CRITICAL
Fixed in: 15.32.2

webonyx/graphql-php has quadratic validation cost in OverlappingFieldsCanBeMerged via inline fragments


7. webonyx/graphql-php 14.11.10

CVE: GHSA-r7cg-qjjm-xhqq
Severity: CRITICAL
Fixed in: 15.32.3

webonyx/graphql-php has unbounded recursion in parser that causes stack overflow on crafted nested input


8. twig/twig 3.14.2

CVE: GHSA-24x9-r6q4-q93w
Severity: HIGH
Fixed in: 3.26.0

Twig: template_from_string() escapes a SourcePolicy-driven sandbox via synthesized template name


9. twig/twig 3.14.2

CVE: GHSA-4j38-f5cw-54h7
Severity: MEDIUM
Fixed in: 3.26.0

Twig: The spaceless filter implicitly marks its output as safe


10. twig/twig 3.14.2

CVE: GHSA-7fxw-r6jv-74c8
Severity: HIGH
Fixed in: 3.26.0

Twig: {% sandbox %}{% include %} skips checkSecurity() on cached templates (incomplete fix for CVE-2024-45411)


2 more vulnerabilities not shown. Update dependencies to fix these issues.

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

License Compliance Scan

Metric Value
Packages Scanned 145
High Risk (Strong Copyleft) 1
Medium Risk (Weak Copyleft) 3
Low Risk (Permissive) 141
Unknown License 0

Strong copyleft licenses detected - review before merging

Weak copyleft licenses found - verify compatibility

High Risk Licenses - 1 packages

GPL-2.0-or-later (1 packages):

  • enshrined/svg-sanitize 0.22.0
Medium Risk Licenses - 3 packages

LGPL-2.1-only (1 packages):

  • phpmailer/phpmailer 6.9.1

LGPL-2.1-or-later (1 packages):

  • php-amqplib/php-amqplib 3.7.4

LGPL-3.0-or-later (1 packages):

  • matomo/device-detector 6.4.8

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Code Quality Report — test-org-codity/appwrite · PR #2

Scanned: 2026-05-22 19:45 UTC | Score: 41/100 | Provider: github

Executive Summary

Severity Count
Critical 0
High 1
Medium 3
Low 36
Top Findings

[CQ-LLM-003] tests/e2e/Services/Migrations/MigrationsBase.php:900 (Error_Handling · HIGH)

Issue: Swallowed exceptions in the testAppwriteMigrationSite method could lead to unhandled errors.
Suggestion: Implement proper error handling to catch and log exceptions during API calls.

+        $this->assertEquals(201, $site['headers']['status-code'], 'Create site failed: ' . json_encode($site['body'], JSON_PRETTY_PRINT));

[CQ-LLM-001] src/Appwrite/Platform/Workers/Migrations.php:314 (Complexity · MEDIUM)

Issue: The function generateAPIKey has increased cyclomatic complexity due to the addition of multiple permission strings.
Suggestion: Consider refactoring the permission strings into a separate method or data structure to reduce complexity.

+                'sites.read',
+                'sites.write',
+                'providers.read',
+                'providers.write',
+                'topics.read',
+                'topics.write',
+                'subscribers.read',
+                'subscribers.write',
+                'messages.read',
+                'messages.write',
+                'targets.read',
+                'targets.write',

[CQ-LLM-005] tests/e2e/Services/Migrations/MigrationsBase.php:900 (Maintainability · MEDIUM)

Issue: Hard-coded values in the testAppwriteMigrationSite method reduce maintainability.
Suggestion: Define constants for status codes and other repeated values to improve maintainability.

+        $this->assertEquals(201, $site['headers']['status-code'], 'Create site failed: ' . json_encode($site['body'], JSON_PRETTY_PRINT));

[CQ-LLM-004] tests/e2e/Services/Migrations/MigrationsBase.php:910 (Performance · MEDIUM)

Issue: Potential N+1 query issue when fetching project details multiple times in the testAppwriteMigrationSite method.
Suggestion: Cache the project details to avoid multiple calls to getProject() within the same method.

+            'x-appwrite-project' => $this->getProject()['$id'],
+            'x-appwrite-key' => $this->getProject()['apiKey'],

[CQ-009] composer.lock:4475 (Style · LOW)

Issue: Line exceeds 120 characters (124 chars)
Suggestion: Break long lines into multiple lines for readability

                "url": "https://api.github.com/repos/utopia-php/migration/zipball/69c3eb0f2ebe256863ea394692279665b84b9e...

[CQ-002] composer.lock:4504 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"Utopia\\Tests\\": "tests/Migration"

[CQ-002] composer.lock:4509 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpunit"

[CQ-002] composer.lock:4512 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint --test"

[CQ-002] composer.lock:4515 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint"

[CQ-002] composer.lock:4518 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpstan analyse --level 3 src tests --memory-limit 2G"

Per-File Breakdown

File Critical High Medium Low Total
composer.lock 0 0 0 8 8
src/Appwrite/Platform/Workers/Migrations.php 0 0 1 0 1
src/Appwrite/Utopia/Response/Model/MigrationReport.php 0 0 0 4 4
tests/e2e/Services/Migrations/MigrationsBase.php 0 1 2 24 27

Recommendations

  1. Resolve High severity issues, especially error handling gaps and performance bottlenecks.
  • Run automated tests after applying fixes to verify no regressions.

@DhirenMhatre
Copy link
Copy Markdown
Author

@codity review

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Policy Check Failed

✗ 3/3 policy checks failed:

• Need 2 more approval(s) (0/2) — comment LGTM or approve via review
• Missing ticket reference (expected: JIRA-, ENG-, #*)
• 2 code file(s) changed but no test files added


To merge this PR:

  1. Address the failed checks listed above
  2. Ensure branch protection requires the codity/policy-check status

Configure policies in your dashboard

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

PR Summary

What Changed

  • Added Sites and Messaging resource support to the Appwrite migration system, including API permissions, report counters, and E2E test coverage.
  • Switched utopia-php/migration dependency to a dev branch to access new migration resource types.

Key Changes by Area

Migration System: Added API key permissions for sites, providers, topics, subscribers, messages, and targets in Migrations.php:316-326. Added report counters for all new resource types in MigrationReport.php:56-97.

Testing: Added comprehensive E2E tests for site and messaging migrations in MigrationsBase.php:901-1259, including cleanup logic and a packageSite() helper for creating deployment packages.

Dependencies: Updated composer.json and composer.lock to use utopia-php/migration:dev-feat-message-migration instead of stable 1.6.*.

Files Changed

File Changes Summary
composer.json Switched utopia-php/migration from 1.6.* to dev-feat-message-migration
composer.lock Updated lock file for new migration dependency version
src/Appwrite/Platform/Workers/Migrations.php Added API key permissions for sites and messaging resources
src/Appwrite/Utopia/Response/Model/MigrationReport.php Added migration report counters for sites and messaging resources
tests/e2e/Services/Migrations/MigrationsBase.php Added E2E tests for site and messaging migrations with cleanup logic

Review Focus Areas

  • Verify dev branch dependency is acceptable for production or has a plan to switch back to stable.
  • Check that new API permissions in Migrations.php cover all required operations for sites and messaging.
  • Review test cleanup logic ensures no orphaned resources between source and destination projects.

Architecture

Design Decisions: Using a dev branch dependency is intentional to access unreleased migration features. This is a temporary state pending upstream release.

Risks: Dev branch dependency introduces instability and makes builds non-reproducible. This is an intentional short-term tradeoff that should be tracked for resolution before release.

Merge Status

NOT MERGEABLE — PR Score 32/100, below threshold (50)

  • [H2] 3 critical dependency CVEs detected
  • [H3] 1 high-risk (strong copyleft) license detected
  • [H4] PR quality score (32) is below merge floor (50)
  • [H5] 1 CRITICAL inline review finding need resolution

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Security Scan Summary

Metric Value
Vulnerabilities Critical: 0
Overall Risk Clean
Files Scanned 5

No critical security issues detected

Scan completed in 31.4s

Security scan powered by Codity.ai

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Dependency vulnerability scanning

Metric Value
Vulnerabilities Found 12
Scanner composer audit
Top 10 Vulnerabilities (12 total found)

1. google/protobuf 4.33.5

CVE: GHSA-p2gh-cfq4-4wjc
Severity: HIGH
Fixed in: 4.33.6

Protobuf: Denial of Service issue through malicious messages containing negative varints or deep recursion


2. phpseclib/phpseclib 3.0.49

CVE: GHSA-3qpq-r242-jqj7
Severity: CRITICAL
Fixed in: 1.0.29

phpseclib has a CVE-2024-27355 mitigation bypass — OID amplification DoS in ASN1::decodeOID()


3. phpseclib/phpseclib 3.0.49

CVE: GHSA-94g3-g5v7-q4jg
Severity: MEDIUM
Fixed in: 3.0.50

phpseclib's AES-CBC unpadding susceptible to padding oracle timing attack


4. phpseclib/phpseclib 3.0.49

CVE: GHSA-r854-jrxh-36qx
Severity: MEDIUM
Fixed in: 1.0.28

phpseclib has a variable-time HMAC comparison in SSH2::get_binary_packet() using != instead of hash_equals()


5. webonyx/graphql-php 14.11.10

CVE: GHSA-68jq-c3rv-pcrr
Severity: MEDIUM
Fixed in: 15.31.5

graphql-php is affected by a Denial of Service via quadratic complexity in OverlappingFieldsCanBeMerged validation


6. webonyx/graphql-php 14.11.10

CVE: GHSA-fc86-6rv6-2jpm
Severity: CRITICAL
Fixed in: 15.32.2

webonyx/graphql-php has quadratic validation cost in OverlappingFieldsCanBeMerged via inline fragments


7. webonyx/graphql-php 14.11.10

CVE: GHSA-r7cg-qjjm-xhqq
Severity: CRITICAL
Fixed in: 15.32.3

webonyx/graphql-php has unbounded recursion in parser that causes stack overflow on crafted nested input


8. twig/twig 3.14.2

CVE: GHSA-24x9-r6q4-q93w
Severity: HIGH
Fixed in: 3.26.0

Twig: template_from_string() escapes a SourcePolicy-driven sandbox via synthesized template name


9. twig/twig 3.14.2

CVE: GHSA-4j38-f5cw-54h7
Severity: MEDIUM
Fixed in: 3.26.0

Twig: The spaceless filter implicitly marks its output as safe


10. twig/twig 3.14.2

CVE: GHSA-7fxw-r6jv-74c8
Severity: HIGH
Fixed in: 3.26.0

Twig: {% sandbox %}{% include %} skips checkSecurity() on cached templates (incomplete fix for CVE-2024-45411)


2 more vulnerabilities not shown. Update dependencies to fix these issues.

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

License Compliance Scan

Metric Value
Packages Scanned 145
High Risk (Strong Copyleft) 1
Medium Risk (Weak Copyleft) 3
Low Risk (Permissive) 141
Unknown License 0

Strong copyleft licenses detected - review before merging

Weak copyleft licenses found - verify compatibility

High Risk Licenses - 1 packages

GPL-2.0-or-later (1 packages):

  • enshrined/svg-sanitize 0.22.0
Medium Risk Licenses - 3 packages

LGPL-2.1-only (1 packages):

  • phpmailer/phpmailer 6.9.1

LGPL-2.1-or-later (1 packages):

  • php-amqplib/php-amqplib 3.7.4

LGPL-3.0-or-later (1 packages):

  • matomo/device-detector 6.4.8

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Code Quality Report — test-org-codity/appwrite · PR #2

Scanned: 2026-05-22 20:18 UTC | Score: 53/100 | Provider: github

Executive Summary

Severity Count
Critical 0
High 0
Medium 0
Low 35
Top Findings

[CQ-009] composer.lock:4475 (Style · LOW)

Issue: Line exceeds 120 characters (124 chars)
Suggestion: Break long lines into multiple lines for readability

                "url": "https://api.github.com/repos/utopia-php/migration/zipball/69c3eb0f2ebe256863ea394692279665b84b9e...

[CQ-002] composer.lock:4504 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"Utopia\\Tests\\": "tests/Migration"

[CQ-002] composer.lock:4509 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpunit"

[CQ-002] composer.lock:4512 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint --test"

[CQ-002] composer.lock:4515 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint"

[CQ-002] composer.lock:4518 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpstan analyse --level 3 src tests --memory-limit 2G"

[CQ-008] composer.lock:4536 (Maintainability · LOW)

Issue: Magic number 2026 in code
Suggestion: Extract to a named constant

"time": "2026-02-20T08:14:06+00:00"

[CQ-008] composer.lock:8907 (Maintainability · LOW)

Issue: Magic number 20 in code
Suggestion: Extract to a named constant

"utopia-php/migration": 20

[CQ-008] src/Appwrite/Utopia/Response/Model/MigrationReport.php:72 (Maintainability · LOW)

Issue: Magic number 10 in code
Suggestion: Extract to a named constant

'example' => 10,

[CQ-008] src/Appwrite/Utopia/Response/Model/MigrationReport.php:84 (Maintainability · LOW)

Issue: Magic number 10 in code
Suggestion: Extract to a named constant

'example' => 10,

Per-File Breakdown

File Critical High Medium Low Total
composer.lock 0 0 0 8 8
src/Appwrite/Utopia/Response/Model/MigrationReport.php 0 0 0 3 3
tests/e2e/Services/Migrations/MigrationsBase.php 0 0 0 24 24

Recommendations

  • Run automated tests after applying fixes to verify no regressions.

@DhirenMhatre
Copy link
Copy Markdown
Author

@codity review

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Policy Check Failed

✗ 3/3 policy checks failed:

• Need 2 more approval(s) (0/2) — comment LGTM or approve via review
• Missing ticket reference (expected: JIRA-, ENG-, #*)
• 2 code file(s) changed but no test files added


To merge this PR:

  1. Address the failed checks listed above
  2. Ensure branch protection requires the codity/policy-check status

Configure policies in your dashboard

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

PR Summary

What Changed

  • Added Sites and Messaging resources to the Appwrite migration system, including sites, deployments, variables, providers, topics, subscribers, and messages.
  • Switched utopia-php/migration dependency to a dev branch to access new migration features.
  • Added comprehensive E2E tests covering full migration workflows with cleanup for both resource types.

Key Changes by Area

Migration System: Extended Migrations.php worker with new API key permissions for sites and messaging resources.

API Response: Added migration report fields in MigrationReport.php to track counts for all new resource types.

Testing: Added testAppwriteMigrationSite() and testAppwriteMigrationMessaging() with full lifecycle coverage including cleanup.

Files Changed

File Changes Summary
composer.json Switched utopia-php/migration to dev branch dev-feat-message-migration with VCS repo config
composer.lock Updated lockfile for new dependency version
src/Appwrite/Platform/Workers/Migrations.php Added API key permissions for sites, providers, topics, subscribers, messages, and targets
src/Appwrite/Utopia/Response/Model/MigrationReport.php Added report fields for sites, deployments, variables, providers, topics, subscribers, and messages
tests/e2e/Services/Migrations/MigrationsBase.php Added E2E tests for site and messaging migration workflows

Review Focus Areas

  • Dependency risk: The dev branch dependency (composer.json:69) makes builds non-reproducible. This needs pinning before merge or a plan to switch to a tagged release.
  • Permission scope: Verify new API key permissions in Migrations.php:316-330 cover all required operations without over-provisioning.
  • Test cleanup: Confirm E2E tests properly clean up resources in both source and destination projects to avoid test pollution.

Architecture

Design Decisions: Using a dev branch dependency is intentional to access unreleased migration features. This is a temporary state pending upstream release.

Risks: The dev branch dependency is an intentional but significant risk (confidence: 96%). Builds will break if the branch is rebased or deleted. Mitigation requires either pinning to an exact commit or coordinating with upstream for a tagged release before this code reaches production.

Merge Status

NOT MERGEABLE — PR Score 32/100, below threshold (50)

  • [H2] 3 critical dependency CVEs detected
  • [H3] 1 high-risk (strong copyleft) license detected
  • [H4] PR quality score (32) is below merge floor (50)
  • [H5] 1 CRITICAL inline review finding need resolution

Comment thread composer.lock
Comment on lines +4467 to +4476
"version": "dev-feat-message-migration",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "c5c7544d02d2418536d41050794050132f247d62"
"reference": "69c3eb0f2ebe256863ea394692279665b84b9e10"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/c5c7544d02d2418536d41050794050132f247d62",
"reference": "c5c7544d02d2418536d41050794050132f247d62",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/69c3eb0f2ebe256863ea394692279665b84b9e10",
"reference": "69c3eb0f2ebe256863ea394692279665b84b9e10",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security High

This lockfile now pulls a dev branch for utopia-php/migration, so pin it to a tagged stable release or an exact commit in composer.json without lowering stability.

Suggested fix
            "version": "1.6.1",
            "source": {
                "type": "git",
                "url": "https://github.com/utopia-php/migration.git",
                "reference": "c5c7544d02d2418536d41050794050132f247d62"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/utopia-php/migration/zipball/c5c7544d02d2418536d41050794050132f247d62",
                "reference": "c5c7544d02d2418536d41050794050132f247d62",
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert json developer with deep knowledge of security, performance, and best practices.

### Context

File: composer.lock
Lines: 4467-4476
Issue Type: security-high
Severity: high

Issue Description:
This lockfile now pulls a dev branch for utopia-php/migration, so pin it to a tagged stable release or an exact commit in composer.json without lowering stability.

Current Code:
            "version": "dev-feat-message-migration",
            "source": {
                "type": "git",
                "url": "https://github.com/utopia-php/migration.git",
                "reference": "69c3eb0f2ebe256863ea394692279665b84b9e10"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/utopia-php/migration/zipball/69c3eb0f2ebe256863ea394692279665b84b9e10",
                "reference": "69c3eb0f2ebe256863ea394692279665b84b9e10",

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow json best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---


Like Dislike Create Issue Jira

Comment thread composer.lock
Comment on lines +8906 to +8909
"stability-flags": {
"utopia-php/migration": 20
},
"prefer-stable": true,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security High

Lowering dependency stability for only this package allows pre-release code into production builds, so keep stable-only resolution unless this is explicitly isolated to non-production development.

Suggested fix
    "stability-flags": [],
    "prefer-stable": false,
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert json developer with deep knowledge of security, performance, and best practices.

### Context

File: composer.lock
Lines: 8906-8909
Issue Type: security-high
Severity: high

Issue Description:
Lowering dependency stability for only this package allows pre-release code into production builds, so keep stable-only resolution unless this is explicitly isolated to non-production development.

Current Code:
    "stability-flags": {
        "utopia-php/migration": 20
    },
    "prefer-stable": true,

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow json best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---


Like Dislike Create Issue Jira

Comment on lines +1252 to +1254
Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr);

return new CURLFile($tarPath, 'application/x-gzip', \basename($tarPath));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional Medium

The helper builds and returns a tarball without checking whether Console::execute succeeded or whether the archive was created, so add a failure check before returning the CURLFile.

Suggested fix
        Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr);

        if (!is_file($tarPath) || filesize($tarPath) === 0) {
            throw new \RuntimeException('Failed to package site: ' . $stderr);
        }

        return new CURLFile($tarPath, 'application/x-gzip', \basename($tarPath));
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert php developer with deep knowledge of security, performance, and best practices.

### Context

File: tests/e2e/Services/Migrations/MigrationsBase.php
Lines: 1252-1254
Issue Type: functional-medium
Severity: medium

Issue Description:
The helper builds and returns a tarball without checking whether `Console::execute` succeeded or whether the archive was created, so add a failure check before returning the `CURLFile`.

Current Code:
        Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr);

        return new CURLFile($tarPath, 'application/x-gzip', \basename($tarPath));

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow php best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---


Like Dislike Create Issue Jira

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Nitpicks (Low Priority)

Found 1 low-priority suggestions for code improvement

Click to expand nitpicks

composer.json (line 69)

Functional Low

Using a dev branch for a runtime dependency makes builds non-reproducible; pin this package to a tagged release or an exact commit reference.

Also reported at: composer.json L113–L118

Code Suggestion or Comments
"utopia-php/migration": "1.6.*",
Prompt for AI assistance

Copy the prompt below and paste it into ChatGPT, Claude, or any LLM:

You are an expert json developer with deep knowledge of security, performance, and best practices.

### Context

File: composer.json
Lines: 69-69
Issue Type: functional-low
Severity: low

Issue Description:
Using a dev branch for a runtime dependency makes builds non-reproducible; pin this package to a tagged release or an exact commit reference.

_Also reported at: `composer.json` L113–L118_

Current Code:
        "utopia-php/migration": "dev-feat-message-migration",

---

### Instructions

1. Fix the issue described above
2. Maintain the exact indentation and code style from the original
3. Follow json best practices and language-specific idioms
4. Ensure the fix addresses the root cause, not just the symptoms
5. Add brief inline comments explaining the fix if needed

### Constraints

- Do not change functionality beyond fixing the identified issue
- Preserve existing variable names and function signatures unless they are part of the problem
- Ensure the fix is production-ready

---



Like Dislike

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Security Scan Summary

Metric Value
Vulnerabilities Critical: 0
Overall Risk Clean
Files Scanned 5

No critical security issues detected

Scan completed in 30.8s

Security scan powered by Codity.ai

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Dependency vulnerability scanning

Metric Value
Vulnerabilities Found 12
Scanner composer audit
Top 10 Vulnerabilities (12 total found)

1. google/protobuf 4.33.5

CVE: GHSA-p2gh-cfq4-4wjc
Severity: HIGH
Fixed in: 4.33.6

Protobuf: Denial of Service issue through malicious messages containing negative varints or deep recursion


2. phpseclib/phpseclib 3.0.49

CVE: GHSA-3qpq-r242-jqj7
Severity: CRITICAL
Fixed in: 1.0.29

phpseclib has a CVE-2024-27355 mitigation bypass — OID amplification DoS in ASN1::decodeOID()


3. phpseclib/phpseclib 3.0.49

CVE: GHSA-94g3-g5v7-q4jg
Severity: MEDIUM
Fixed in: 3.0.50

phpseclib's AES-CBC unpadding susceptible to padding oracle timing attack


4. phpseclib/phpseclib 3.0.49

CVE: GHSA-r854-jrxh-36qx
Severity: MEDIUM
Fixed in: 1.0.28

phpseclib has a variable-time HMAC comparison in SSH2::get_binary_packet() using != instead of hash_equals()


5. webonyx/graphql-php 14.11.10

CVE: GHSA-68jq-c3rv-pcrr
Severity: MEDIUM
Fixed in: 15.31.5

graphql-php is affected by a Denial of Service via quadratic complexity in OverlappingFieldsCanBeMerged validation


6. webonyx/graphql-php 14.11.10

CVE: GHSA-fc86-6rv6-2jpm
Severity: CRITICAL
Fixed in: 15.32.2

webonyx/graphql-php has quadratic validation cost in OverlappingFieldsCanBeMerged via inline fragments


7. webonyx/graphql-php 14.11.10

CVE: GHSA-r7cg-qjjm-xhqq
Severity: CRITICAL
Fixed in: 15.32.3

webonyx/graphql-php has unbounded recursion in parser that causes stack overflow on crafted nested input


8. twig/twig 3.14.2

CVE: GHSA-24x9-r6q4-q93w
Severity: HIGH
Fixed in: 3.26.0

Twig: template_from_string() escapes a SourcePolicy-driven sandbox via synthesized template name


9. twig/twig 3.14.2

CVE: GHSA-4j38-f5cw-54h7
Severity: MEDIUM
Fixed in: 3.26.0

Twig: The spaceless filter implicitly marks its output as safe


10. twig/twig 3.14.2

CVE: GHSA-7fxw-r6jv-74c8
Severity: HIGH
Fixed in: 3.26.0

Twig: {% sandbox %}{% include %} skips checkSecurity() on cached templates (incomplete fix for CVE-2024-45411)


2 more vulnerabilities not shown. Update dependencies to fix these issues.

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

License Compliance Scan

Metric Value
Packages Scanned 145
High Risk (Strong Copyleft) 1
Medium Risk (Weak Copyleft) 3
Low Risk (Permissive) 141
Unknown License 0

Strong copyleft licenses detected - review before merging

Weak copyleft licenses found - verify compatibility

High Risk Licenses - 1 packages

GPL-2.0-or-later (1 packages):

  • enshrined/svg-sanitize 0.22.0
Medium Risk Licenses - 3 packages

LGPL-2.1-only (1 packages):

  • phpmailer/phpmailer 6.9.1

LGPL-2.1-or-later (1 packages):

  • php-amqplib/php-amqplib 3.7.4

LGPL-3.0-or-later (1 packages):

  • matomo/device-detector 6.4.8

Powered by Codity.ai · Docs

@codity-dm
Copy link
Copy Markdown

codity-dm Bot commented May 22, 2026

Code Quality Report — test-org-codity/appwrite · PR #2

Scanned: 2026-05-22 20:37 UTC | Score: 53/100 | Provider: github

Executive Summary

Severity Count
Critical 0
High 0
Medium 0
Low 35
Top Findings

[CQ-009] composer.lock:4475 (Style · LOW)

Issue: Line exceeds 120 characters (124 chars)
Suggestion: Break long lines into multiple lines for readability

                "url": "https://api.github.com/repos/utopia-php/migration/zipball/69c3eb0f2ebe256863ea394692279665b84b9e...

[CQ-002] composer.lock:4504 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"Utopia\\Tests\\": "tests/Migration"

[CQ-002] composer.lock:4509 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpunit"

[CQ-002] composer.lock:4512 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint --test"

[CQ-002] composer.lock:4515 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/pint"

[CQ-002] composer.lock:4518 (Complexity · LOW)

Issue: Deep nesting detected (depth ~5)
Suggestion: Extract nested blocks into helper functions

"./vendor/bin/phpstan analyse --level 3 src tests --memory-limit 2G"

[CQ-008] composer.lock:4536 (Maintainability · LOW)

Issue: Magic number 2026 in code
Suggestion: Extract to a named constant

"time": "2026-02-20T08:14:06+00:00"

[CQ-008] composer.lock:8907 (Maintainability · LOW)

Issue: Magic number 20 in code
Suggestion: Extract to a named constant

"utopia-php/migration": 20

[CQ-008] src/Appwrite/Utopia/Response/Model/MigrationReport.php:72 (Maintainability · LOW)

Issue: Magic number 10 in code
Suggestion: Extract to a named constant

'example' => 10,

[CQ-008] src/Appwrite/Utopia/Response/Model/MigrationReport.php:84 (Maintainability · LOW)

Issue: Magic number 10 in code
Suggestion: Extract to a named constant

'example' => 10,

Per-File Breakdown

File Critical High Medium Low Total
composer.lock 0 0 0 8 8
src/Appwrite/Utopia/Response/Model/MigrationReport.php 0 0 0 3 3
tests/e2e/Services/Migrations/MigrationsBase.php 0 0 0 24 24

Recommendations

  • Run automated tests after applying fixes to verify no regressions.

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