Repository navigation
chore: absorb orchestration into packages/orchestration - #14054
Conversation
+ Added a detach parameter to the execute() function + Added tests for detach parameter
Co-authored-by: kodumbeats <[email protected]>
Co-authored-by: kodumbeats <[email protected]>
Added `CONTRIBUTING.md` file
Co-authored-by: Christy Jacob <[email protected]>
Co-authored-by: Christy Jacob <[email protected]>
Co-authored-by: Christy Jacob <[email protected]>
Co-authored-by: Christy Jacob <[email protected]>
Co-authored-by: Christy Jacob <[email protected]>
Co-authored-by: Christy Jacob <[email protected]>
Co-authored-by: Christy Jacob <[email protected]>
chore: updating the CLI packages
chore: remove cli
- replace assertEquals with assertSame
Refactor: assertions
Fix Console::execute signature usage
Refs: CLO-4293
Fix PHP 8.5 curl_close() deprecation
…ommands Refactor DockerCLI for console 0.2 commands
🔵 Tier A · Mergeable after minor fixes
Imports Utopia Orchestration into Latest changes: Corrects execute examples and output documentation in the README, and passes a 10-second timeout to the screen readiness probe.
Fix with agent prompt### Issue 1
packages/orchestration/tests/E2E/Base.php:633-642
**Bound each readiness probe as well as the polling loop**
The probe calls `execute()` with its default unlimited timeout, so a stalled Docker exec can block inside the callback indefinitely; `waitUntil()` cannot enforce its 120-second deadline until that call returns. Please give the readiness probe finite request/command timeouts so a slow or unresponsive daemon produces a bounded test failure.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 9
⏳ Still open from earlier reviews · 1
✅ Fixed since the last review · 1
Reviewed the commits since |
| $installed = self::waitUntil(function () use ($containerId): bool { | ||
| $output = ''; | ||
| try { | ||
| static::getOrchestration()->execute($containerId, ['which', 'screen'], $output); | ||
| } catch (\Exception) { | ||
| return false; | ||
| } | ||
|
|
||
| return true; | ||
| }, 120); |
There was a problem hiding this comment.
Bound each readiness probe as well as the polling loop
The probe calls execute() with its default unlimited timeout, so a stalled Docker exec can block inside the callback indefinitely; waitUntil() cannot enforce its 120-second deadline until that call returns. Please give the readiness probe finite request/command timeouts so a slow or unresponsive daemon produces a bounded test failure.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/orchestration/tests/E2E/Base.php
Line: 633-642
Comment:
**Bound each readiness probe as well as the polling loop**
The probe calls `execute()` with its default unlimited timeout, so a stalled Docker exec can block inside the callback indefinitely; `waitUntil()` cannot enforce its 120-second deadline until that call returns. Please give the readiness probe finite request/command timeouts so a slow or unresponsive daemon produces a bounded test failure.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · testing · Reply if this doesn't apply.
There was a problem hiding this comment.
Fixed in the latest push: the which screen probe passes timeout: 10, so a stalled exec fails that probe after 10 seconds, and waitUntil() can reach its 120-second deadline.
There was a problem hiding this comment.
The probe now passes timeout: 10 in Base.php:638, but one request remains unbounded: DockerAPI.php:617 inspects the exec status without forwarding $timeout, so it still uses the default -1.
Please pass $timeout to that final call() too. Otherwise, a stall during inspection can still prevent waitUntil() from reaching its deadline.
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
…ss probe The README showed execute() taking separate stdout and stderr strings, but its fourth parameter is the environment array, so both examples threw a TypeError. They now pass the single output string, then the environment and timeout, and the parameter list says what each adapter writes into it. The screen readiness probe called execute() with no timeout, so a stalled exec could hold waitUntil() past its 120 second deadline indefinitely. Each probe is now capped at 10 seconds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Moves
utopia-php/orchestrationintopackages/orchestration. Wave 5 of #13828, following the playbook inrfc/monorepo.md.orchestrationis a standalone repository that was never inutopia-php/monorepo, so it gets the full playbook and needs no retire PR. The import is the mirror headf453ea7, the0.20.0release.Appwrite itself does not use
Utopia\Orchestration: no file underapp/,src/ortests/references it, andcomposer.lockdoes not contain it. Its consumers are open-runtimes/executor, and appwrite-labs/edge through the executor. They keep requiringutopia-php/orchestrationfrom Packagist, which the split now feeds from here. So there is norequireline to remove and no version gap to close; the root gains only the autoload, autoload-dev andreplaceentries every package has.Important
Merge with a merge commit, not a squash. A squash drops the
git-subtree-*annotation and orphans the package from its mirror.Commits
Add 'packages/orchestration/' from commit 'f453ea7…'mainwith full historychore(orchestration): mirror plumbingmirror.ymlreplacestest.yml,linter.yml,codeql-analysis.yml;pint.json,psalm.xml,Dockerfileandcomposer.lockremoved; hoisted QA stripped fromcomposer.json; README banner;CONTRIBUTING.mdnow points at appwrite/appwriterefactor: load orchestration from packages/test(orchestration): wait on the daemon instead of fixed sleepstestRunRemoveandtestUsageStatspoll for the state they assert instead of sleeping 1 and 2 seconds (below)docs(orchestration): strip trailing whitespace from the READMEgit diff --checkis clean over the branchWhat changed
composer.jsonreplaceentries added. Norequireline to remove: Appwrite never required itutopia-php/console 0.2.*, is already inpackages/console(still on the bareUtopia\prefix, seeBARE).ext-curlis used byDockerAPIbut not declared; the root already requires itcomposer.locksrc/src/Orchestration/*moved up tosrc/. Byte-identical to0.20.0otherwise: Pint makes no change and Rector skips its 10 rules that would rewritesrctests/OrchestrationTest(parseCommandString()), underUtopia\Orchestration\Tests\. It used to run once per adapter inside the Docker suites, though it never touches Dockertests/E2E/Base,DockerAPITest,DockerCLITestand theResources/fixtures, underUtopia\Orchestration\Tests\E2E\. 14@dependsannotations become#[Depends]attributes: PHPUnit 12 ignores the annotations, which upstream's PHPUnit 9 read, so a failedtestCreateContainerwould no longer skip the tests that use its containertestscompose container with the host's Docker socket mounted, and passedHOST_DIRso the containers it started could bind-mount the fixtures by their host path. The tier now runs on the host like every other package, so the fixture path is__DIR__ . '/Resources'andHOST_DIRand the hard-coded/usr/src/codeare gone.testUsageStatscounted every running container on the daemon and expected exactly one (the old test container); it now counts against what was running before it started, since a host daemon may run other containerstestRunRemoveslept 1 second before asserting an auto-removed container was gone, andtestUsageStatsslept 2 seconds before runningscreenin containers thatapk addit on start. Both raced a slow daemon: a still-exitingTestContainerRMfailedtestRunRemoveand then skewedtestUsageStats' container count. They now poll (30 and 120 seconds at most) for the state they assertdocker-compose.yml/var/run/docker.sock, whichDockerAPIhard-codes, and thedockerCLI forDockerCLI). TheDockerfileit built went with the plumbing commitcomposer.jsonscriptstestruns the unit suite;test:e2eruns the e2e suite withComposer\Config::disableProcessTimeout, because the suite (fixed sleeps, image pulls, CPU stress containers) runs past Composer's 300-second defaultphpunit.xmlunitande2esuitesphpstan.neonsrcandtests(excluding theResources/fixtures), withphpstan-baseline.neonholding 146 findings: 140 insrc, mostly offset access, arithmetic and arguments on the decodedmixedDocker Engine API responses inDockerAPI(121) andarray|stringvalues from parsed CLI output inDockerCLI(18); 6 in the e2e tests. Upstream analysed level 6 under PHPStan 1. Added to the RFC phase 8 listrector.phpsrc(constructor promotion, typed properties from constructor and from assigns, closure and arrow-fn types, closure to arrow fn, private method array return types,str_contains, catch variables), scoped tosrconlyValidation
bin/monorepo validatebin/monorepo check orchestrationbin/monorepo test orchestrationunitbin/monorepo test orchestratione2edf61233: 34 tests / 194 assertions OK in 2:35. At97558b6(polling), with the host at load 30–60: all 17DockerAPITesttests pass in both runs;DockerCLITesterrors only whereDockerCLI::run()'s fixed 30-seconddocker runtimeout (insrc, unchanged) expired. CI'sPackages / orchestrationat75fca16(PHP 8.5.11, the runner's own daemon):checkpasses, unit 1 test / 4 assertions OK, e2e 34 tests / 198 assertions OK in 1:36vendor/bin/phpunit --testsuite packagesinappwrite/appwrite:2.3.0orchestration(http's FPMResponseandRouteTest,nats'lcg_value())… --testsuite packages --filter 'Utopia\\Orchestration\\Tests'inappwrite/appwrite:2.3.0Utopia\Orchestration\Orchestrationresolves topackages/orchestration/src/Orchestration.php; novendor/utopia-php/orchestrationcomposer validate --no-check-publishcomposer lintbin/monorepo split orchestration --dry-run75fca16, fast-forward of the mirror headf453ea7(+4 commits), tree identical topackages/orchestrationgit diff --checkThe e2e tier ran in
composer:2(PHP 8.5.10) against an isolateddocker:dinddaemon (Docker 29.8.2, no other containers), with its socket mounted at/var/run/docker.sockand the worktree mounted at its host path. That reproduces a CI runner:DockerAPIhard-codes the socket path, and the fixtures are bind-mounted by host path.There is no Appwrite-side check beyond the above: no Appwrite file uses the package.
Mirror state
absorbcreated themainruleset (id24307503): deletion and non-fast-forward blocked, PRs required with 0 approvals, the split app (4016286) the only always-bypass actormainenforce_adminson. Rulesets cannot override it, soSplitwill be refused until it is removed, as was done forbalancerin #13886. Not removed here; it needs a maintainer to drop it before mergeAfter merge
Splitpush lands (see above)Splitrun fororchestrationis green and the mirror fast-forwards fromf453ea7orchestrationnever lived inutopia-php/monorepoOpen on utopia-php/orchestration: