Skip to content

chore: absorb storage into packages/storage - #13926

Merged
ChiragAgg5k merged 546 commits into
mainfrom
chore/absorb-storage
Sep 27, 2026
Merged

ChiragAgg5k merged 546 commits into
mainfrom
chore/absorb-storage

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

Moves utopia-php/storage into packages/storage so Appwrite loads it directly. Wave 2 of #13828, following the playbook in rfc/monorepo.md. The mirror head 7afbd2ed is the 4.3.0 release Appwrite already locks, so there is no version gap.

Commit What
Add 'packages/storage/' from commit '7afbd2ed…' Subtree import from the mirror with full history
chore(storage): mirror plumbing mirror.yml points here, README banner refreshed (no banned files to remove)
refactor: load storage from packages/ Step A shape, root autoload and replace, lock, RFC baseline bullet
style(storage): strip trailing whitespace from the adapter guide Two lines in docs/
merge of main composer.lock conflict re-resolved with composer update --lock

Step A

Change Detail
src/Storage/* → src/ src/ is the release apart from the move, Pint formatting (empty {} bodies and promoted-constructor braces) and the @see test references following the test namespace; git diff -w shows only brace placement
tests/Storage/{Device,Validator} → tests/ Namespace Utopia\Tests\Storage\ → Utopia\Storage\Tests\; fixture paths lose one ../
tests/E2E Already the MinIO tier (docker-compose.yml); no real-provider tests exist, nothing needs cloud credentials
phpunit.xml Unit suite is tests minus tests/E2E
phpstan.neon Standalone, level max over src and tests (was ../../phpstan.neon)
rector.php Standalone, the monorepo root's sets plus the package's extra ones; skips IfToNullCoalescingAssignRector, RemoveDeadReturnRector and AddVoidReturnTypeWhereNoReturnRector so tests stay as released
docs/adding-new-storage-adapter.md Paths and home repository updated
tests/Device/S3Test.php The only test edit: the ScriptedClient fake's withFollowRedirects() takes int $maxHops = Redirect::MAX_HOPS to match packages/client (#13910)

src has no PHPStan findings at level max. phpstan-baseline.neon holds 3, all in one test fixture: Pint's simplified_null_return turns the untyped detach() of LocalTest's failing stream from return null; into return;. Listed in the RFC phase 8 burn-down as a single bullet.

Root

Change Detail
require Drops utopia-php/storage: ^4.3
Hoisted Nothing new: psr/http-client ^1.0 and psr/http-message ^1.1 || ^2.0 are already in the root with the same constraints; ext-fileinfo / ext-simplexml follow the existing rule of not hoisting extensions
replace utopia-php/storage: * satisfies the still-vendored utopia-php/migration (storage 4.*)
composer.lock Diff against main drops only utopia-php/storage 4.3.0

Net: +8,042 / −52, nearly all the imported package. Root side is +5 / −52.

Validation

Check Result
bin/monorepo validate all packages valid
bin/monorepo check storage Rector, Pint, PHPStan level max (3-entry baseline) pass
bin/monorepo test storage unit 119 tests / 378 assertions
bin/monorepo test storage e2e (MinIO, unique compose project, torn down) 32 tests / 107 assertions
phpunit --testsuite packages --filter 'Utopia\\Storage' in appwrite/appwrite:2.3.0 119 tests / 378 assertions
tests/unit/Migration/MigrationsWorkerExportTest.php (uses Utopia\Storage) 6 tests / 59 assertions
Root PHPStan (host) on 11 files using Utopia\Storage (Doctor, Deletes, Messaging and Migrations workers, S3 module, CSV/JSON imports, Health stats, file push) no errors
Utopia\Storage\Device\S3 resolves to packages/storage/src/Device/S3.php
composer validate --no-check-publish valid (only the existing utopia-php/platform exact-pin warning)
bin/monorepo split storage --dry-run 8434e03e, fast-forwards from mirror head 7afbd2ed
git diff --check clean

Mirror state

Item State
Ruleset Canonical main ruleset (id 2848844) with the split app as always-bypass, so the absorb ran with --skip-ruleset
Classic branch protection on main Present: 1 required approving review, last-push approval; the split app (utopia-php-monorepo) is in bypass_pull_request_allowances, force pushes and deletions off. This may block Split after merge and needs an admin to remove it; left unchanged here

After merge

Step
Merge with a merge commit A squash drops the git-subtree-* annotation and orphans the package from its mirror
Confirm Split pushes to utopia-php/storage Watch for the classic protection above
Retire packages/storage from utopia-php/monorepo
Triage utopia-php/storage#37 Feature: Support for MINIO Object Storage (2024). The S3 adapter already works against MinIO, which is what the e2e tier runs on; propose closing
Re-open here if still wanted: utopia-php/monorepo#172 fix(storage): retry refused connections and unresolvable hosts (S3/RetryStrategy.php)
Re-open here if still wanted: utopia-php/monorepo#102 fix(storage): bound Local recursive directory walks (Device/Local.php)
Re-open here if still wanted: utopia-php/monorepo#352 fix(storage): delete S3 objects recursively and bound the prefix at a separator (Device/S3.php), external contributor

All three monorepo PRs target the old src/Storage/ and tests/Storage/ paths, so each needs the paths rebased onto packages/storage/src and packages/storage/tests.

🤖 Generated with Claude Code

mohitcharkha and others added 30 commits October 27, 2022 12:19
feat: add createDirectory method
fix: issues with delimiters in path
Removed mentions of authors (individual credits)
ChiragAgg5k and others added 13 commits August 27, 2026 11:43
chore: adopt validators ^1.0 in config and storage
chore: stop committing package lock files
chore(fastly,storage): require client 0.4
fix(storage): send explicit Content-Length on every S3 request
fix(storage): pull MinIO from quay.io now that Docker Hub no longer serves it
…ations

feat(storage): conditional reads and writes, file info, and upload listing
refactor(storage, domains, cdn, fastly): use client 0.5's names
…5bbd4fbf'

git-subtree-dir: packages/storage
git-subtree-mainline: ee19d6d
git-subtree-split: 7afbd2e
@ChiragAgg5k ChiragAgg5k added the absorb History-preserving package absorption; merge commit required label Sep 26, 2026
@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[High risk] Moves storage library from external dependency into monorepo.

The PR does not appear safe to merge while the production ext-fileinfo requirement remains missing.

Fix All in Claude CodeFindings

  1. P1 Production fileinfo requirement disappears ▶
  2. P2 Tests depend on private implementation ▶
  3. P2 Guide names wrong development repository ▶
Fix with agent prompt
### Issue 1
composer.json:undefined-215
If a production installation lacks `ext-fileinfo`, Composer can now install it because the root declares that extension only in `require-dev`. Replacing the storage package hides its production requirement, but `Local::getFileMimeType()` still calls `mime_content_type()`, so that storage operation will fail. Keep the extension requirement in the production dependency graph.

### Issue 2
packages/storage/tests/Device/LocalTest.php:816-820
This test uses reflection to call the private `joinChunks()` method. The S3 tests similarly assert sequences of operation labels defined by their own fake. These tests can fail after a harmless internal refactor without showing a change in storage behavior. The repository requires tests to assert observable behavior, not private methods or call order; this requirement needs to be satisfied before merging.

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!

### Issue 3
packages/storage/docs/adding-new-storage-adapter.md:undefined-11
This prerequisite tells contributors to fork `utopia-php/monorepo`, but the guide’s later steps require an `appwrite/appwrite` checkout and pull request. Storage’s mirror is read-only, so following the prerequisite sends contributors to the wrong place. Name `appwrite/appwrite` as the writable home here and update the related contributing and adapter-guide links in the README.

---

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

Summary

This PR moves the storage package into packages/storage, switches root autoloading and Composer replacement to the in-tree copy, and adds standalone package tooling. No new issue was established from changes since the previous review.

  • The prior production ext-fileinfo requirement, implementation-coupled test, and contributor-guide findings remain outstanding.

Reviews (4) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..."

Comment thread composer.json
"utopia-php/schedule": "*",
"utopia-php/smtp": "*",
"utopia-php/span": "*",
"utopia-php/storage": "*",

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.

P1 Production fileinfo requirement disappears

If a production installation lacks ext-fileinfo, Composer can now install it because the root declares that extension only in require-dev. Replacing the storage package hides its production requirement, but Local::getFileMimeType() still calls mime_content_type(), so that storage operation will fail. Keep the extension requirement in the production dependency graph.

Prompt To Fix With AI
This is a comment left during a code review.
Path: composer.json
Line: 215

Comment:
**Production fileinfo requirement disappears**

If a production installation lacks `ext-fileinfo`, Composer can now install it because the root declares that extension only in `require-dev`. Replacing the storage package hides its production requirement, but `Local::getFileMimeType()` still calls `mime_content_type()`, so that storage operation will fail. Keep the extension requirement in the production dependency graph.

---

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 +816 to +820
$reflection = new \ReflectionClass($storage);
$method = $reflection->getMethod('joinChunks');

try {
$method->invoke($storage, $dest, 2);

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 depend on private implementation

This test uses reflection to call the private joinChunks() method. The S3 tests similarly assert sequences of operation labels defined by their own fake. These tests can fail after a harmless internal refactor without showing a change in storage behavior. The repository requires tests to assert observable behavior, not private methods or call order; this requirement needs to 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/storage/tests/Device/LocalTest.php
Line: 816-820

Comment:
**Tests depend on private implementation**

This test uses reflection to call the private `joinChunks()` method. The S3 tests similarly assert sequences of operation labels defined by their own fake. These tests can fail after a harmless internal refactor without showing a change in storage behavior. The repository requires tests to assert observable behavior, not private methods or call order; this requirement needs to 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


## 1. Prerequisites

This library is developed in the [utopia-php monorepo](https://github.com/utopia-php/monorepo) — `utopia-php/storage` is a read-only mirror. Fork the monorepo, clone your fork, and create a `feat-XXX-YYY-storage-adapter` branch from `main`, where `XXX` is the issue ID and `YYY` the storage adapter name. The library lives in `packages/storage`.

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 Guide names wrong development repository

This prerequisite tells contributors to fork utopia-php/monorepo, but the guide’s later steps require an appwrite/appwrite checkout and pull request. Storage’s mirror is read-only, so following the prerequisite sends contributors to the wrong place. Name appwrite/appwrite as the writable home here and update the related contributing and adapter-guide links in the README.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/storage/docs/adding-new-storage-adapter.md
Line: 11

Comment:
**Guide names wrong development repository**

This prerequisite tells contributors to fork `utopia-php/monorepo`, but the guide’s later steps require an `appwrite/appwrite` checkout and pull request. Storage’s mirror is read-only, so following the prerequisite sends contributors to the wrong place. Name `appwrite/appwrite` as the writable home here and update the related contributing and adapter-guide links in the README.

---

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

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → chore/absorb-storage (after).

Metric Before After Change
🚀 Requests/sec 195.16 203.46 ⚪ +4.3%
⏱️ Latency P50 88.8 ms 86.12 ms ⚪ -3%
⏱️ Latency P95 210.18 ms 197.23 ms 🟢 -6.2%
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 86.12 197.23 12,540 203.46 -12.95
Account 162.6 301.54 660 11.26 -39.95
TablesDB 81.55 149.52 6,820 112.2 -15.28
Storage 84.05 180.74 3,300 56.39 +6.23
Functions 123.62 231.34 1,760 30.76 -23.51

Top API waits (after)

API request Max wait (ms)
account.prefs.update 421.84
account.name.update 397.63
tablesdb.rows.delete 366.38
account.get 344.18
functions.create 343.51

quay.io now answers 401 for the pinned MinIO image, so the package's e2e tier failed in CI before any test ran. Use the same Silo image Appwrite's S3 e2e group moved to in #13884.
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.