Skip to content

chore: absorb platform into packages/platform - #13953

Merged
ChiragAgg5k merged 240 commits into
mainfrom
chore/absorb-platform
Sep 28, 2026
Merged

ChiragAgg5k merged 240 commits into
mainfrom
chore/absorb-platform

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

Moves utopia-php/platform into packages/platform so Appwrite loads it directly. Wave 4 of #13828, following the playbook in rfc/monorepo.md. Every HTTP action, worker and task in Appwrite extends Utopia\Platform\Action, so the full e2e matrix in CI is the real gate for this PR.

Merge with a merge commit: a squash drops the git-subtree-* annotation and orphans the package from its mirror.

Commit What
Add 'packages/platform/' from commit 'dc43dd34…' Subtree import of the mirror's main with full history
chore(platform): mirror plumbing mirror.yml calls this repository's mirror-redirect.yml; README banner points here. No banned files to strip
refactor: load platform from packages/ Root autoload + replace, utopia-php/platform dropped from require and the lock, step A shape, standalone phpstan.neon / rector.php, baseline
docs(rfc): list the platform baseline for phase 8 One bullet in the phase 8 list

Version gap

None. Appwrite pinned 1.0.0-rc25 (dc43dd34), which is the mirror head, and utopia-php/monorepo's packages/platform has the same manifest and history tip.

Step A

Change Detail
src/Platform/* → src/ Identical to 1.0.0-rc25 apart from the move and Pint formatting (empty {} bodies in Enum and Platform::initGraphQL(), fn () spacing in Platform)
Tests → tests/ tests/Platform fixtures, tests/unit and tests/e2e flattened into tests/; namespaces Utopia\Tests / Utopia\Unit → Utopia\Platform\Tests. HTTPServicesTest.php (declaring HttpServicesTest) → HttpServicesTest.php
No tests/E2E/ Upstream's tests/e2e needs no services and starts no Swoole server or process: CLITest runs a task through the Generic adapter, HttpServicesTest runs requests through the FPM adapter with a mock response, WorkerServicesTest only builds (never starts) the Swoole queue adapter over a lazy Redis connection. Upstream already ran them in its default suite, so they join the unit tier
HttpServicesTest tearDown() now restores $_SERVER, the default timezone (new Http(..., 'UTC') sets it) and Http::reset(), so it leaks no routes or globals into the root packages suite
phpunit.xml PHPUnit 12 shape: one unit suite (tests minus E2E/bench); composer test runs it
phpstan.neon Standalone, level max over src + tests (previously the monorepo root's level 5)
rector.php PHP sets + type declarations, skipping every rule that would rewrite the released source (same list as http). No changes
README Monorepo Tests badge dropped; contribution guide points at appwrite/appwrite
phpstan-baseline.neon 182 findings: 146 in src (115 in Platform, mixed from the untyped param/option/label definitions and worker params passed on to Hook, Http, CLI and the queue Server), 36 in tests

Nothing to hoist: require is php, ext-json, ext-redis (both already in the root require) and cli http queue servers, all in packages/.

Validation

Check Result
bin/monorepo validate all packages valid
bin/monorepo check platform Rector, Pint, PHPStan level max (with baseline) pass
bin/monorepo test platform (registry and --linked) 11 tests / 92 assertions, same as upstream's two suites combined
Root phpunit --testsuite packages in appwrite/appwrite:2.3.0 completes in 2m08s: 8717 tests / 24744 assertions, 37 skipped. The 2 warnings and 1 deprecation come from http tests. --filter 'Utopia\\Platform' 11 / 92 pass. 6 errors unrelated to platform: 5 agents DiffCheckTest (the worktree's .git file points outside the mount) and 1 client Swoole connection-reset test
tests/unit in appwrite/appwrite:2.3.0 1350 tests / 6382 assertions; one failure, CertificatesDomainValidationTest::testAJobWithoutTheFlagStillChecksDns, does a live DNS lookup and does not touch Utopia\Platform
Root PHPStan (host) on 25 files no errors: app/http.php, app/worker.php, app/cli.php, app/realtime.php, general.php, Platform/Appwrite.php, Platform/Action.php, Services/Tasks.php, Services/Workers.php, Teams/Users/TablesDB creates, Webhooks list, Tokens files, Compute/Base.php, Functions Module/Services/Builds, workers Deletes/Functions/Mails, tasks Maintenance/QueueRetry/Doctor
Autoload Utopia\Platform\Action resolves to packages/platform/src/Action.php; vendor/utopia-php/platform is no longer installed
composer update --lock lock diff drops only utopia-php/platform (plus content hash)
composer validate --no-check-publish valid, and the long-standing utopia-php/platform exact-version warning is gone
bin/monorepo split platform --dry-run 43e412ef, fast-forwards from mirror head dc43dd34 (2 commits), tree identical to packages/platform
git diff --check clean

Mirror

utopia-php/platform already has the canonical main ruleset (id 17500067: deletion, non-fast-forward, pull request) with the split app (4016286) as an always-bypass actor, so the absorb ran with --skip-ruleset. It also has classic branch protection on main (1 required approval, split app in the PR-review bypass list). Left as is.

After merge

Step
Confirm Split pushes to utopia-php/platform
Retire remove packages/platform from utopia-php/monorepo
Triage mirror PRs #67 Bump utopia-php/http to 2.0.0-RC5 (superseded), #32 PHPStan, #31 formatter/linter CI, #13 Travis → Actions, #7 analyzer (all superseded by the QA here). No open issues
Triage monorepo no open PRs touch packages/platform

🤖 Generated with Claude Code

loks0n and others added 16 commits July 14, 2026 15:38
docs: centralize CODE_OF_CONDUCT and CONTRIBUTING at the monorepo root
chore: move dependents onto client 0.3 and queue 0.24
chore(platform): allow utopia-php/queue 1.0
chore(platform): caret constraint for utopia-php/queue 1.x
…rm-f0c8

Add multi-queue jobs with independent coroutine caps
chore: stop committing package lock files
feat(platform): let a worker spec ask for a batch
feat(queue): unify consumption and recover stranded claims
Batch queue consumption independently of coroutines
chore(platform): allow queue 6 alongside 5
…7b68dbd3a'

git-subtree-dir: packages/platform
git-subtree-mainline: 1bc79bd
git-subtree-split: dc43dd3
@ChiragAgg5k ChiragAgg5k added the absorb History-preserving package absorption; merge commit required label Sep 28, 2026
@ghost

ghost commented Sep 28, 2026

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The package wiring and its Appwrite callers are consistent, and I found no concrete regression requiring a fix.

Moves Utopia Platform into packages/platform and loads it through Appwrite’s root autoloader instead of a Composer-installed dependency. Adds standalone package QA configuration, adapts its tests to the monorepo, and sets up mirror redirection.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 7
File Change
composer.json Loads Platform from the local package and replaces the external dependency.
packages/platform/src/ Imports Platform actions, services, modules, and HTTP scope.
packages/platform/tests/ Imports package tests and adds isolation for HTTP test globals.
packages/platform/composer.json, phpunit.xml, phpstan.neon, phpstan-baseline.neon, rector.php Defines standalone dependencies, tests, and QA configuration.
packages/platform/.github/workflows/mirror.yml Redirects mirror issues and pull requests to Appwrite.
packages/platform/README.md, LICENSE, .gitignore Adds package documentation, license, and ignore rules.
rfc/monorepo.md Records the Platform PHPStan baseline.

Reviewed 16a364b · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Tier S · Looks good to merge. Summary

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[High risk] Absorbs external package into monorepo as local package.

The package migration has no established blocking runtime defect, but the explicit requirement to test observable behavior must be satisfied before merging.

Fix All in Claude CodeFindings

  1. P2 README example cannot initialize ▶
  2. P2 Incorrect PHP minimum ▶
  3. P2 Tests mirror internal representation ▶
Fix with agent prompt
### Issue 1
packages/platform/README.md:65-70
A reader following this example hits an uninitialized `$core` property: `HelloWorldPlatform` overrides the constructor but never calls `parent::__construct()` with a `Module`, and `addService()` uses `$core`. The action also assigns `$httpMethod`, while route registration reads the methods set by `setHttpMethod()`. Update both parts so the example can register its GET route.

### Issue 2
packages/platform/README.md:82
The README says PHP 8.3 is supported, but the package manifest requires PHP 8.5 or later. Readers who choose PHP 8.3 based on this guidance cannot install the package.

```suggestion
Utopia Platform requires PHP 8.5 or later. We recommend using the latest PHP version whenever possible.
```

### Issue 3
packages/platform/tests/HttpServicesTest.php:159-166
This test asserts the route parameter key list and stored enum object instead of checking how requests behave. A change to internal storage could fail the test without affecting callers, while a routing or validation regression could pass unnoticed. The repository requires tests of observable behavior rather than assertions that mirror source or configuration; this requirement must be satisfied before merging. The worker tests likewise inspect registered jobs and hooks instead of worker outcomes.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR imports the pinned Utopia Platform package into packages/platform, switches root Composer autoloading and replacement to the local source, and adds package test and mirror configuration. The imported README has an unusable example and an incorrect PHP minimum; some package tests assert internal wiring rather than observable behavior.

Reviews (1) · Last reviewed commit: "docs(rfc): list the platform baseline fo..."

Comment on lines +65 to +70
class HelloWorldPlatform extends Platform
{
public function __construct()
{
$this->addService('helloService', new HelloWorldService());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 README example cannot initialize A reader following this example hits an uninitialized $core property: HelloWorldPlatform overrides the constructor but never calls parent::__construct() with a Module, and addService() uses $core. The action also assigns $httpMethod, while route registration reads the methods set by setHttpMethod(). Update both parts so the example can register its GET route.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/platform/README.md
Line: 65-70

Comment:
**README example cannot initialize** A reader following this example hits an uninitialized `$core` property: `HelloWorldPlatform` overrides the constructor but never calls `parent::__construct()` with a `Module`, and `addService()` uses `$core`. The action also assigns `$httpMethod`, while route registration reads the methods set by `setHttpMethod()`. Update both parts so the example can register its GET route.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex


## System requirements

Utopia Framework requires PHP 8.3 or later. We recommend using the latest PHP version whenever possible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Incorrect PHP minimum The README says PHP 8.3 is supported, but the package manifest requires PHP 8.5 or later. Readers who choose PHP 8.3 based on this guidance cannot install the package.

Suggested change
Utopia Framework requires PHP 8.3 or later. We recommend using the latest PHP version whenever possible.
Utopia Platform requires PHP 8.5 or later. We recommend using the latest PHP version whenever possible.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/platform/README.md
Line: 82

Comment:
**Incorrect PHP minimum** The README says PHP 8.3 is supported, but the package manifest requires PHP 8.5 or later. Readers who choose PHP 8.3 based on this guidance cannot install the package.

```suggestion
Utopia Platform requires PHP 8.5 or later. We recommend using the latest PHP version whenever possible.
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

Comment on lines +159 to +166
$params = $route->getParams();

// Verify all Action::param() fields are forwarded to the Route
$actionParamKeys = ['default', 'validator', 'description', 'optional', 'injections', 'skipValidation', 'deprecated', 'example', 'aliases'];

foreach ($params as $name => $param) {
foreach ($actionParamKeys as $key) {
$this->assertArrayHasKey($key, $param, "Param '{$name}' is missing '{$key}' on the Route. Platform must forward all Action param fields.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Tests mirror internal representation This test asserts the route parameter key list and stored enum object instead of checking how requests behave. A change to internal storage could fail the test without affecting callers, while a routing or validation regression could pass unnoticed. The repository requires tests of observable behavior rather than assertions that mirror source or configuration; this requirement must be satisfied before merging. The worker tests likewise inspect registered jobs and hooks instead of worker outcomes.

Context Used: Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/platform/tests/HttpServicesTest.php
Line: 159-166

Comment:
**Tests mirror internal representation** This test asserts the route parameter key list and stored enum object instead of checking how requests behave. A change to internal storage could fail the test without affecting callers, while a routing or validation regression could pass unnoticed. The repository requires tests of observable behavior rather than assertions that mirror source or configuration; this requirement must be satisfied before merging. The worker tests likewise inspect registered jobs and hooks instead of worker outcomes.

**Context Used:** Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

absorb History-preserving package absorption; merge commit required

Projects

None yet

Development

Successfully merging this pull request may close these issues.