Skip to content

Refactor command execution to use Utopia\Command - #11937

Draft
TorstenDittmann wants to merge 7 commits into
mainfrom
feat/command-execute-migration
Draft

TorstenDittmann wants to merge 7 commits into
mainfrom
feat/command-execute-migration

Conversation

@TorstenDittmann

Copy link
Copy Markdown
Contributor

Summary

  • pull in the utopia-php/console command-validation branch for a PoC and switch Appwrite command execution to Utopia\Command
  • migrate local Console::execute(...) call sites in build workers, certificate issuance, and affected test helpers away from shell-built strings
  • keep the remaining VCS clone command usage untouched until utopia-php/vcs exposes a structured command API

Testing

  • docker compose exec appwrite test tests/e2e/Services/Functions/FunctionsConsoleClientTest.php --filter=testFunctionDeploymentRetentionWithMaintenance
  • docker compose exec appwrite test tests/e2e/Services/Sites/SitesConsoleClientTest.php --filter=testSiteDeploymentRetentionWithMaintenance
  • docker compose exec appwrite test tests/e2e/Services/Functions/FunctionsCustomServerTest.php --filter=testCreateFunctionAndDeploymentFromTemplate
  • docker compose exec appwrite test tests/e2e/Services/Functions/FunctionsCustomServerTest.php --filter=testCreateFunctionAndDeploymentFromTemplateBranch
  • docker compose exec appwrite test tests/e2e/Services/Functions/FunctionsCustomServerTest.php --filter=testCreateFunctionAndDeploymentFromTemplateCommit
  • docker compose exec appwrite test tests/e2e/Services/Functions/FunctionsCustomServerTest.php --filter=testCreateDeploymentLarge
  • docker compose exec appwrite test tests/e2e/Services/Sites/SitesCustomServerTest.php --filter=testEmptySiteSource
  • docker compose exec appwrite test tests/e2e/Services/ProjectWebhooks/WebhooksCustomServerTest.php --filter=testCreateDeployment

@github-actions

github-actions Bot commented Apr 17, 2026 •

Copy link
Copy Markdown

🔄 PHP-Retry Summary

Flaky tests detected across commits:

Commit 03be7ad - 7 flaky tests
Test Retries Total Time Details
UsageTest::testPrepareDatabaseStatsTablesAPI 1 32.61s Logs
LegacyConsoleClientTest::testInvalidDocumentStructure 1 240.53s Logs
LegacyCustomClientTest::testAttributeResponseModels 1 240.55s Logs
LegacyCustomServerTest::testListDocumentsCacheBustedByAttributeChange 1 240.46s Logs
LegacyCustomServerTest::testEnforceCollectionPermissions 1 240.10s Logs
VectorsDBConsoleClientTest::testGetCollectionLogs 1 8ms Logs
DatabasesConsoleClientTest::testGetCollectionLogs 1 15ms Logs
Commit 31461c9 - 28 flaky tests
Test Retries Total Time Details
UsageTest::testFunctionsStats 1 10.23s Logs
UsageTest::testPrepareSitesStats 1 7ms Logs
UsageTest::testEmbeddingsTextUsageDoesNotBreakProjectUsage 1 7ms Logs
WebhooksCustomServerTest::testDeleteDeployment 1 16ms Logs
WebhooksCustomServerTest::testDeleteFunction 1 14ms Logs
WebhooksCustomServerTest::testCreateCollection 1 12ms Logs
WebhooksCustomServerTest::testCreateAttributes 1 11ms Logs
WebhooksCustomServerTest::testCreateDocument 1 15ms Logs
WebhooksCustomServerTest::testUpdateDocument 1 15ms Logs
WebhooksCustomServerTest::testDeleteDocument 1 13ms Logs
WebhooksCustomServerTest::testCreateTable 1 13ms Logs
WebhooksCustomServerTest::testCreateColumns 1 11ms Logs
WebhooksCustomServerTest::testCreateRow 1 16ms Logs
WebhooksCustomServerTest::testUpdateRow 1 11ms Logs
WebhooksCustomServerTest::testDeleteRow 1 12ms Logs
WebhooksCustomServerTest::testCreateStorageBucket 1 8ms Logs
WebhooksCustomServerTest::testUpdateStorageBucket 1 15ms Logs
WebhooksCustomServerTest::testCreateBucketFile 1 15ms Logs
WebhooksCustomServerTest::testUpdateBucketFile 1 7ms Logs
WebhooksCustomServerTest::testDeleteBucketFile 1 15ms Logs
WebhooksCustomServerTest::testDeleteStorageBucket 1 25ms Logs
WebhooksCustomServerTest::testCreateTeam 1 15ms Logs
WebhooksCustomServerTest::testUpdateTeam 1 16ms Logs
WebhooksCustomServerTest::testUpdateTeamPrefs 1 17ms Logs
WebhooksCustomServerTest::testDeleteTeam 1 8ms Logs
WebhooksCustomServerTest::testCreateTeamMembership 1 22ms Logs
WebhooksCustomServerTest::testDeleteTeamMembership 1 24ms Logs
WebhooksCustomServerTest::testWebhookAutoDisable 1 30ms Logs
Commit 5091861 - 8 flaky tests
Test Retries Total Time Details
UsageTest::testStorageStats 1 10.43s Logs
RealtimeConsoleClientTest::testIndexesCollectionAPI 1 120.09s Logs
RealtimeConsoleClientTest::testIndexesTablesAPI 1 120.08s Logs
RealtimeConsoleClientTest::testDeleteAttributeCollectionsAPI 1 120.08s Logs
RealtimeCustomClientQueryTest::testChannelActionFilterByDocumentId 1 30.13s Logs
RealtimeCustomClientQueryTest::testChannelActionFilterDeliversDeleteEvents 1 30.09s Logs
RealtimeCustomClientTest::testChannelsTablesDB 1 121.03s Logs
RealtimeCustomClientTest::testChannelMirrorEventsAcrossDatabasesAndTablesdb 1 120.49s Logs
Commit 2663e97 - 5 flaky tests
Test Retries Total Time Details
LegacyConsoleClientTest::testPatchAttribute 1 240.18s Logs
LegacyConsoleClientTest::testTimeout 1 129.09s Logs
LegacyConsoleClientTest::testSpatialRelationshipOneToOne 1 240.14s Logs
LegacyCustomClientTest::testUpsertDocument 1 240.90s Logs
LegacyCustomServerTest::testPatchAttribute 1 240.14s Logs
Commit 52ba0f4 - 2 flaky tests
Test Retries Total Time Details
RealtimeConsoleClientTest::testIndexesCollectionAPI 1 297ms Logs
RealtimeCustomClientTest::testChannelDatabase 1 17ms Logs

Note: Flaky test results are tracked for the last 5 commits

@github-actions

github-actions Bot commented May 25, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing 1.9.x (before) to feat/command-execute-migration (after).

Before

Scenario P50 (ms) P95 (ms) Requests RPS
API total 14.69 132.29 185 34.34
Account 25.11 174.09 35 7.1
TablesDB 14.27 22.25 35 8.61
Storage 12.15 53.34 75 18.27
Functions 22.25 33.58 40 9.91

After

Scenario P50 (ms) P95 (ms) Requests RPS
API total 14.37 135.79 185 32.82
Account 26.71 264.98 35 6.78
TablesDB 13.64 20.55 35 8.17
Storage 12.13 51.43 75 17.18
Functions 21.36 37.6 40 9.28

Delta

Scenario P95 delta (ms)
API total +3.5
Account +90.9
TablesDB -1.7
Storage -1.91
Functions +4.02
Top API waits
API request Max wait (ms)
account.sessions.email.create 696.73
account.create 264.82
account.password.update 172.82

@appwrite appwrite deleted a comment from blacksmith-sh Bot May 28, 2026
…-migration

# Conflicts:
#	src/Appwrite/Platform/Modules/Functions/Workers/Builds.php
@ChiragAgg5k
ChiragAgg5k changed the base branch from 1.9.x to main June 23, 2026 09:54
loks0n added a commit that referenced this pull request Sep 10, 2026
Bump utopia-php/console to ^0.2 and build every locally composed shell
command with Utopia\Command instead of concatenating escaped strings.
Plain commands now reach proc_open as an argument array (no shell), and
the one composite chain (the template commit-and-push in the builds
worker) is rendered by the library with every argument escaped.

Migrated call sites:

- src/Appwrite/Certificates/LetsEncrypt.php: certbot issuance
- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php: mkdir, mv,
  rsync, git config/checkout/add/commit/push chain, git rev-parse, rm
- src/Appwrite/Migration/Infrastructure/Version/V1.php: docker volume ls
  and the two docker run invocations that count and copy build artifacts
- tests/e2e: every tar packaging helper, docker exec/inspect/logs and the
  mkdir in the empty-site test

The two git clone commands in the builds worker are left as strings
because utopia-php/vcs still returns them as such.

utopia-php/database is bumped to 7.3.8, the first release that accepts
console 0.2.

Supersedes #11937 by @TorstenDittmann.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
loks0n added a commit that referenced this pull request Sep 10, 2026
Bump utopia-php/console to ^0.2 and build every locally composed shell
command with Utopia\Command instead of concatenating escaped strings.
Plain commands now reach proc_open as an argument array (no shell), and
the one composite chain (the template commit-and-push in the builds
worker) is rendered by the library with every argument escaped.

Migrated call sites:

- src/Appwrite/Certificates/LetsEncrypt.php: certbot issuance
- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php: mkdir, mv,
  rsync, git config/checkout/add/commit/push chain, git rev-parse, rm
- src/Appwrite/Migration/Infrastructure/Version/V1.php: docker volume ls
  and the two docker run invocations that count and copy build artifacts
- tests/e2e: every tar packaging helper, docker exec/inspect/logs and the
  mkdir in the empty-site test

The two git clone commands in the builds worker are left as strings
because utopia-php/vcs still returns them as such.

utopia-php/database is bumped to 7.3.8, the first release that accepts
console 0.2.

Supersedes #11937 by @TorstenDittmann.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
loks0n added a commit that referenced this pull request Sep 12, 2026
Bump utopia-php/console to ^0.2 and build every locally composed shell
command with Utopia\Command instead of concatenating escaped strings.
Plain commands now reach proc_open as an argument array (no shell), and
the one composite chain (the template commit-and-push in the builds
worker) is rendered by the library with every argument escaped.

Migrated call sites:

- src/Appwrite/Certificates/LetsEncrypt.php: certbot issuance
- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php: mkdir, mv,
  rsync, git config/checkout/add/commit/push chain, git rev-parse, rm
- src/Appwrite/Migration/Infrastructure/Version/V1.php: docker volume ls
  and the two docker run invocations that count and copy build artifacts
- tests/e2e: every tar packaging helper, docker exec/inspect/logs and the
  mkdir in the empty-site test

The two git clone commands in the builds worker are left as strings
because utopia-php/vcs still returns them as such.

utopia-php/database is bumped to 7.3.8, the first release that accepts
console 0.2.

Supersedes #11937 by @TorstenDittmann.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
loks0n added a commit that referenced this pull request Sep 14, 2026
Bump utopia-php/console to ^0.2 and build every locally composed shell
command with Utopia\Command instead of concatenating escaped strings.
Plain commands now reach proc_open as an argument array (no shell), and
the one composite chain (the template commit-and-push in the builds
worker) is rendered by the library with every argument escaped.

Migrated call sites:

- src/Appwrite/Certificates/LetsEncrypt.php: certbot issuance
- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php: mkdir, mv,
  rsync, git config/checkout/add/commit/push chain, git rev-parse, rm
- src/Appwrite/Migration/Infrastructure/Version/V1.php: docker volume ls
  and the two docker run invocations that count and copy build artifacts
- tests/e2e: every tar packaging helper, docker exec/inspect/logs and the
  mkdir in the empty-site test

The two git clone commands in the builds worker are left as strings
because utopia-php/vcs still returns them as such.

utopia-php/database is bumped to 7.3.8, the first release that accepts
console 0.2.

Supersedes #11937 by @TorstenDittmann.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

This branch has not been deployed

No deployments
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.

1 participant