Repository navigation
chore: absorb client and span into packages/ - #13850
ChiragAgg5k wants to merge 113 commits into
Conversation
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
feat: add Pretty exporter
Set level=error when setError() is called, level=info otherwise.
Explicit level via set('level', ...) is never overridden.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
feat: auto-set level attribute on spans
fix(client): require utopia-php/psr7 ^0.2.1
…port feat(span): send Sentry exports through PSR-18
feat(span): batch Sentry exports
…hing revert(span): remove buffered Sentry export
chore: stop committing package lock files
fix(client): reconnect stale TLS sockets before sending
fix(client): enforce Swoole TLS peer identity verification
fix(client): keep streamed and buffered Swoole requests on separate connections
Point mirror.yml and the README banner at appwrite/appwrite so PRs and issues opened on the mirror are redirected here.
Point mirror.yml and the README banner at appwrite/appwrite so PRs and issues opened on the mirror are redirected here.
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
span and client require each other, so installing span on its own made Composer reject client's span constraint against the unversioned root. Linked runs already set COMPOSER_ROOT_VERSION for this; registry-mode installs in check and test now do the same.
Packages here are autoloaded by the root composer.json rather than installed, so a package's own autoload.files never ran. autoload now lists them in the root, which a class_alias shim for renamed classes needs.
…a\Client Utopia\Client and Utopia\Psr18\StreamingClientInterface sat outside the package's own namespace, so client had to declare the bare Utopia\ prefix. They are now Utopia\Client\Client and Utopia\Client\Psr18\StreamingClientInterface, src/Client is flattened, and the package declares a single Utopia\Client\ prefix. src/compat.php keeps the old names working through a lazy autoloader until the next major, since the vendored messaging, storage, domains, cdn, usage and sdk-for-php packages and the agents and span packages still use them. CompatTest pins both aliases.
Appwrite now autoloads Utopia\Client and Utopia\Span from packages/, loads client's alias shim through the root autoload files, and replaces both packages so the vendored copies are no longer installed. span's mirror head matches 4.2.0 (a batching change landed and was reverted); client moves from 0.4.4 to 0.4.5, which keeps streamed and buffered Swoole requests on separate connections. Neither needs a third-party requirement hoisted. Appwrite's three call sites use Utopia\Client\Client. span's src/Span is flattened and its QA configs already stand alone; client ships a baseline for three PHPStan 2.2.14 findings in its redirect-body replay, recorded for the phase 8 burn-down with the shim's removal.
39f7ddf to
63848c1
Compare
|
Closing in favour of releasing the client rename first. |
| $this->assertTrue(class_exists('Utopia\Client')); | ||
| $this->assertSame(Client::class, new \ReflectionClass('Utopia\Client')->getName()); |
There was a problem hiding this comment.
Aliases tested through reflection
These assertions use reflection to pin the aliases to their canonical implementation names. The same issue appears for the legacy interface at lines 21–22. This couples the tests to the class_alias implementation instead of proving that consumers can use the legacy class and interface through their public contracts. The repository requires tests to verify observable behavior rather than mirror implementation details, so this must be corrected before merging.
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/client/tests/CompatTest.php
Line: 15-16
Comment:
**Aliases tested through reflection**
These assertions use reflection to pin the aliases to their canonical implementation names. The same issue appears for the legacy interface at lines 21–22. This couples the tests to the `class_alias` implementation instead of proving that consumers can use the legacy class and interface through their public contracts. The repository requires tests to verify observable behavior rather than mirror implementation details, so this must be corrected before merging.
**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!
Summary
Move
utopia-php/clientandutopia-php/spanintopackages/so Appwrite loads them directly. This is step 4 of the messaging chain in #13828 (smtp→telemetry→pools→client+span→messaging). They require each other, so they move together, and client takes its RFC step B rename in the same PR instead of waiting for phase 6.Add 'packages/span/' from commit 'c935f78…'andAdd 'packages/client/' from commit 'd1e0d25…', each followed by achore(<name>): mirror plumbingcommit. span's head matches4.2.0in effect (Sentry batching landed after the tag and was reverted). client's head is the0.4.5tag; Appwrite ran 0.4.4. 0.4.5 keeps streamed and buffered Swoole requests on separate connections and keeps a caller'swrite_funcoff buffered requests.fix(monorepo): claim a release line when installing a package in a cycle: installing span on its own made Composer reject client'sutopia-php/spanconstraint against the unversioned root. Linked runs already setCOMPOSER_ROOT_VERSIONfor this, and registry-mode installs incheckandtestnow do the same.feat(monorepo): load a package's autoload files through the root: packages here are autoloaded by the root instead of being installed by Composer, so a package'sautoload.filesnever ran.bin/monorepo autoloadnow copies them into the rootautoload.files.refactor(client): move Client and the streaming interface under Utopia\Client:Utopia\ClientbecomesUtopia\Client\ClientandUtopia\Psr18\StreamingClientInterfacebecomesUtopia\Client\Psr18\StreamingClientInterface.src/Clientis flattened, so the package declares a singleUtopia\Client\prefix and no bare-prefix handling is needed.src/compat.phpregisters a lazy autoloader that aliases the old names. Nothing loads until an old name is used, and the aliases go away at client's next major.CompatTestpins both aliases and fails when the shim is empty.refactor: load client and span from packages/: adds the root autoload,filesandreplaceentries. Both packages leaverequireand the lock, and nothing else in the lock moves. Appwrite's three call sites useUtopia\Client\Client. span'ssrc/Spanis flattened, client's tests move toUtopia\Client\Tests, and bothphpstan.neonandrector.phpstand alone. client keeps level 10 onsrcandtests, as in the old monorepo.Old names still in use
The shim covers every consumer that still uses
Utopia\ClientorUtopia\Psr18\*. In Appwrite's lock those are the vendoredmessaging,storage,domains,cdn,usageandopen-runtimes/sdk-for-php.agentsandspanhere are covered too. They keep the old names for now because their mirrors resolve client from Packagist, where no release has the new names yet. After this merges, cuttingclient/0.5.0publishes the rename to the mirror. Thenagentsandspancan move to^0.5and the new names, and the shim is removed at the following major. The RFC now records both steps.Client PHPStan baseline
PHPStan 2.2.14, which Appwrite runs, reports three findings on one line of the Swoole adapter's redirect-body replay. It no longer sees that
$suppressedBodybecomes a resource only when$sinkis set. The old monorepo's 2.2.5 passes the same code, and the replay has test coverage. Per the RFC, the package ships aphpstan-baseline.neon, recorded in the phase 8 burn-down.Validation
bin/monorepo validate: all packages validbin/monorepo check client span: Rector, Pint and PHPStan passbin/monorepo test client span: client 187 tests (185 plus the two compat tests), span 108. client's tests start their own loopback server and need no external services.--testsuite packagesUtopia\ClientorUtopia\SpanUtopia\ClientandUtopia\Psr18\StreamingClientInterfacealias the moved classes, span's Sentry exporter still builds through the old name, andUtopia\Http\Httpstill loads from vendorcomposer dump-autoloadshows no PSR-4 warnings. The Docker composer stage tolerates thefilesentry beforepackages/is copied in.client→e364829,span→9e7675fMerge and follow-up
Merge with a merge commit, not squash, to keep both subtree annotations the split continues from. Both mirror rulesets let the split app bypass them, and neither mirror has open PRs.
After merge:
packages/clientandpackages/spanfromutopia-php/monorepoin one PR.client/0.5.0so the mirror publishes the rename.Part of #13828.