chore: absorb pools into packages/pools by ChiragAgg5k · Pull Request #13845 · appwrite/appwrite · GitHub
Skip to content

chore: absorb pools into packages/pools - #13845

Merged
ChiragAgg5k merged 161 commits into
mainfrom
feat/absorb-pools
Sep 23, 2026
Merged

ChiragAgg5k merged 161 commits into
mainfrom
feat/absorb-pools

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Move utopia-php/pools into packages/pools so Appwrite loads it directly, step 3 of the messaging chain in #13828 (smtp → telemetry → pools → client + span → messaging). Three commits, per the playbook in rfc/monorepo.md:

  1. Add 'packages/pools/' from commit 'a45d867e…': subtree import from the mirror with full history. The mirror head is the 2.1.2 tag Appwrite already locks, so nothing else in the dependency graph moves.
  2. chore(pools): mirror plumbing: mirror.yml pointed here, README banner refreshed, the Gitpod config dropped; the mirror ruleset was updated by the same absorb run (split app bypass).
  3. refactor: load pools from packages/: root autoload and replace entries, utopia-php/pools dropped from require and from the lock (the six vendored packages that require it, abuse, cache, client, database, messaging, queue, now resolve against the root). Step A of the standard shape: src/Pools and tests/Pools flattened, tests under Utopia\Pools\Tests, phpstan.neon and rector.php made standalone. PHPStan keeps scanDirectories: vendor/swoole/ide-helper (inside the package, so allowed) because the Swoole\Coroutine\Channel generic in Adapter\Swoole only exists in the stubs. Rector is clean on arrival, so production changes are Pint formatting only.

Nothing to hoist: the package's only requirement, utopia-php/telemetry, is already a sibling in packages/. Appwrite imports the namespace in 19 files; root PHPStan is clean on all of them.

Validation

  • bin/monorepo validate: all packages valid
  • bin/monorepo check pools: Rector, Pint and PHPStan level max, no baseline
  • bin/monorepo test pools: 97 tests; the Stack adapter tests (43) pass, the Swoole adapter and waiter tests segfault on this macOS host (Swoole 6 + PHP 8.5) exactly as the untouched mirror code does from utopia-php/monorepo, so the Linux runner decides, as it did for lock and telemetry
  • vendor/bin/phpunit --testsuite packages --filter 'Utopia\\Pools\\Tests\\Adapter\\StackTest': 43 tests green under the root autoloader; telemetry's 24 still green
  • composer validate --no-check-publish: existing exact-version warnings only; composer dump-autoload without PSR-4 warnings
  • bin/monorepo split pools --dry-run: 99a729f7413210ed3e6a45a225ca46a9bc9338f0
  • git diff --check

Merge and follow-up

Merge with a merge commit, not squash, to preserve the subtree annotation the split continues from.

After merge: confirm Appwrite's Split pushes to utopia-php/pools, then remove packages/pools from utopia-php/monorepo and regenerate its graph in a follow-up PR. One PR is still open on the mirror, utopia-php/pools#30 (stale connection recovery, opened 2026-03-11); the redirect only covers new PRs, so it needs a decision from its owner: re-open here against packages/pools or close.

Part of #13828.

loks0n and others added 16 commits June 20, 2026 10:45
- Drop the 17 per-package mirror CI workflows: they were inert in the monorepo
  and only re-tested, on the mirror, code the monorepo's own matrix already
  gated pre-merge. absorb now strips all incoming workflows and writes only
  mirror.yml; the ratchet lint over packages/* (no uses: left to pin) goes too.
- Make absorb's mirror ruleset idempotent: update whatever branch ruleset
  already exists in place instead of skipping on a name clash (the gap that left
  auth's mirror without the split-app bypass).
- Remove the standalone `import` command — unused, and it left a package without
  mirror.yml/banner/ruleset. import_package() stays as absorb's helper.
- Trim absorbing.md/creating.md/README to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
build: hoist baseline rector + phpstan configs to the root
docs: enforce documentation style with Vale
docs: centralize CODE_OF_CONDUCT and CONTRIBUTING at the monorepo root
…ctions

fix(pools): recover failed pool connections
fix(pools): release the reserved slot when connection creation fails
feat(pools)!: constructor-only configuration, one acquisition budget
fix(pools): hold the owning pool weakly so dropped pools free their resources
refactor(pools,circuit-breaker,storage): drop the deprecated Instrument::lazy() helpers
…ection

fix(nats,pools,queue): stop losing work, dedupe enqueues, end duplicate delivery (CLO-4771/4772/4773)
chore: stop committing package lock files
…ters

fix(pools): wake waiters when failed borrowers free capacity
…059f4a'

git-subtree-dir: packages/pools
git-subtree-mainline: 7eab5f1
git-subtree-split: a45d867
Point mirror.yml and the README banner at appwrite/appwrite so PRs and issues opened on the mirror are redirected here, and drop the Gitpod config the root tooling replaces.
Appwrite now autoloads Utopia\Pools from packages/pools and replaces
utopia-php/pools so the vendored copy is no longer installed; the six
vendored packages that require it resolve against the root. The mirror
head is the 2.1.2 tag the lock already resolved, and its only
requirement, utopia-php/telemetry, is already a sibling in packages/.

Shape follows rfc/monorepo.md step A: src/Pools and tests/Pools are
flattened, tests live under Utopia\Pools\Tests, and phpstan.neon and
rector.php no longer reach for the old monorepo root configs. PHPStan
keeps scanning the package's Swoole stubs for the generic Channel type.
Source changes are Pint formatting only.
@ChiragAgg5k ChiragAgg5k added the absorb History-preserving package absorption; merge commit required label Sep 22, 2026
@greptile-apps

greptile-apps Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Comment thread packages/pools/tests/Scopes/PoolTestScope.php
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → feat/absorb-pools (after).

Metric Before After Change
🚀 Requests/sec 196.73 196.86 ⚪ +0.1%
⏱️ Latency P50 88.81 ms 87.87 ms ⚪ -1.1%
⏱️ Latency P95 204.07 ms 206.31 ms ⚪ +1.1%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 87.87 206.31 12,483 196.86 +2.24
Account 175.67 329.64 657 11.01 +19.1
TablesDB 85.12 160 6,789 110.16 -1.33
Storage 79.79 173.16 3,285 54.58 -8.08
Functions 126.89 248.98 1,752 29.67 +6.22

Top API waits (after)

API request Max wait (ms)
account.name.update 472.48
functions.create 430.35
functions.variables.update 428.72
functions.delete 400.18
account.prefs.update 396.8

CI runs check before test on a fresh checkout, so a phpstan.neon that
scans the package's own stubs (pools reads swoole/ide-helper for the
generic Channel type) failed with a missing vendor directory. The old
monorepo's check installed the package first; do the same.
Comment on lines +104 to +105

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 Implementation-Coupled Creation Counts

This concurrency test requires the initializer to run exactly once per configured pool slot, so it mirrors the pool's current lazy-creation strategy rather than testing only observable capacity, exclusivity, and reuse. The same brittle assertion appears in the high-concurrency and stress tests. This violates the repository directive that tests assert observable behavior instead of implementation details, and that requirement must be satisfied 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/pools/tests/Adapter/SwooleTest.php
Line: 104-105

Comment:
**Implementation-Coupled Creation Counts**

This concurrency test requires the initializer to run exactly once per configured pool slot, so it mirrors the pool's current lazy-creation strategy rather than testing only observable capacity, exclusivity, and reuse. The same brittle assertion appears in the high-concurrency and stress tests. This violates the repository directive that tests assert observable behavior instead of implementation details, and that requirement must be satisfied 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!

Fix in Claude Code Fix in Codex

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Pre-existing in the imported library at mirror commit a45d867 (the 2.1.2 release Appwrite already runs). An absorb PR relocates the package with its history and does not change library behaviour or tests; production changes here are Pint formatting only, matching #13723, #13798, #13804, #13829 and #13731. Tracked for the phase 8 harvest rather than changed in this PR.

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.

Understood. Since this is unchanged behavior from the imported 2.1.2 library and the absorb PR only relocates it—with production changes limited to formatting—I agree it is out of scope for this PR. Tracking the assertion cleanup for the phase 8 harvest is appropriate; I’m withdrawing this as a merge-blocking finding.

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.