Skip to content

chore: absorb psr7 into packages/psr7 - #13723

Merged
loks0n merged 10 commits into
mainfrom
feat/absorb-psr7
Sep 16, 2026
Merged

loks0n merged 10 commits into
mainfrom
feat/absorb-psr7

Conversation

@loks0n

@loks0n loks0n commented Sep 16, 2026

Copy link
Copy Markdown
Member

Summary

Fourth package on the plan in rfc/monorepo.md, one package per PR from here. Four commits:

  1. chore(monorepo): validate that package requirements are hoisted into the root. Because the root replaces absorbed packages, Composer no longer reads their require, so a package's third-party dependencies must be declared by the root or they silently leave the lock. validate now fails when one is missing. The three packages already merged were only safe because they depended on nothing the root did not already require.
  2. Add 'packages/psr7/' from commit cf70bec9…: subtree import from the mirror, full history; the mirror ruleset updated by the same absorb run.
  3. chore(psr7): mirror plumbing: mirror.yml pointed here, README banner refreshed.
  4. refactor: load psr7 from packages/: src/Psr7 and tests/Psr7 flattened, tests under Utopia\\Psr7\\Tests\\, standalone PHPStan config at the package's own level 10, standalone Rector config (it required the old monorepo's root file, which exists nowhere any more; phpunitCodeQuality dropped because it needs a package-local installed.json). psr7 was never in the root require, only a transitive dependency of client, domains, http, span and storage; the root now replaces it and hoists psr/http-factory and psr/http-message. The lock drops only utopia-php/psr7.

Also in commit 4: bin/monorepo lists packages by their composer.json rather than by directory. A leftover vendor/ from another branch's test run made it generate replace entries for packages that were not on the branch, which pulled four packages and their dependencies out of the lock.

Merging

Merge with a merge commit, not a squash, so the subtree annotation survives for the split.

Verification

  • bin/monorepo validate: all packages valid (the hoisting rule fires when a hoisted line is removed)
  • bin/monorepo check psr7 clean; bin/monorepo test psr7: 47 tests green on a fresh package vendor
  • vendor/bin/phpunit --testsuite packages: 199 tests, 4 skipped
  • No Appwrite source consumes Utopia\\Psr7 directly; composer validate valid; dump-autoload without PSR-4 warnings

🤖 Generated with Claude Code

loks0n and others added 9 commits July 6, 2026 12:47
Split PSR-7 into separate package
Add PSR-7 server request implementation
docs: enforce documentation style with Vale
fix(psr7): always attach multipart body boundary to Content-Type
chore: stop committing package lock files
…the root

The root replaces every absorbed package, which hides the package's own require block from the solver: a third-party dependency a package declares only resolves when the root declares it too. validate now fails for any non-php, non-ext, non-utopia-php requirement missing from the root require, and the RFC says so.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…f899d'

git-subtree-dir: packages/psr7
git-subtree-mainline: f4da953
git-subtree-split: cf70bec
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Fourth package on the plan in rfc/monorepo.md. Imported from the mirror
with history (the preceding subtree merge), src/Psr7 flattened to src/,
tests/Psr7 flattened to tests/ under Utopia\Psr7\Tests\, the package
PHPStan config made standalone at its own level 10, and rector.php made
standalone (it required the old monorepo's root config, which exists
nowhere any more) with phpunitCodeQuality dropped because that set needs a
package-local installed.json.

psr7 was never in the root require, only a transitive dependency of five
vendored packages; the root now replaces it and hoists its two PSR
requirements (psr/http-factory, psr/http-message). The lock drops only
utopia-php/psr7.

bin/monorepo lists packages by their composer.json rather than by
directory: a leftover vendor/ from another branch's test run made the tool
generate replace entries for packages that were not there.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@loks0n loks0n self-assigned this Sep 16, 2026
@greptile-apps

greptile-apps Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The post-review changes appear safe to merge, with only the previously reported non-blocking hoisted-constraint validation gap still outstanding.

Fix All in Claude CodeFindings

  1. P2 Hoisting Validation Has Gaps ▶
Fix with agent prompt
### Issue 1
bin/monorepo:700-703
This check skips every `utopia-php/*` requirement and only checks whether other dependencies are present, without using `$constraint`. A future absorbed package could therefore add an unhoisted Utopia dependency or tighten an existing constraint while validation remains green. Because the root `replace` entry hides the package's own requirements, Composer could then omit that dependency or install a version outside the package's declared range.

---

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

Summary

This PR absorbs utopia-php/psr7 into the monorepo and updates Composer, package tooling, mirroring configuration, and tests accordingly. Since the previous review, the hoisting validator was refined to exempt only Utopia dependencies represented by actual sibling package manifests.

  • Adds packages/psr7 as a standalone, mirrored Composer package.
  • Autoloads and replaces the absorbed package from the root project.
  • Hoists the package’s third-party PSR dependencies.
  • Makes package discovery manifest-based and validates missing root dependency declarations.

Reviews (2) · Last reviewed commit: "chore(monorepo): validate hoists sibling..."

Comment thread packages/psr7/tests/ConstantsTest.php Resolved
Comment thread bin/monorepo
Comment on lines +700 to +703
foreach ($manifest['require'] ?? [] as $dependency => $constraint) {
if ($dependency !== 'php' && !str_starts_with($dependency, 'ext-') && !str_starts_with($dependency, ORG . '/') && !isset($root['require'][$dependency])) {
$problems[] = "{$dependency} is required by packages/{$package} but not by the root; hoist it, replace hides the package's requirements from Composer";
}

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 Hoisting Validation Has Gaps

This check skips every utopia-php/* requirement and only checks whether other dependencies are present, without using $constraint. A future absorbed package could therefore add an unhoisted Utopia dependency or tighten an existing constraint while validation remains green. Because the root replace entry hides the package's own requirements, Composer could then omit that dependency or install a version outside the package's declared range.

Knowledge Base Used: Reusable platform packages

Prompt To Fix With AI
This is a comment left during a code review.
Path: bin/monorepo
Line: 700-703

Comment:
**Hoisting Validation Has Gaps**

This check skips every `utopia-php/*` requirement and only checks whether other dependencies are present, without using `$constraint`. A future absorbed package could therefore add an unhoisted Utopia dependency or tighten an existing constraint while validation remains green. Because the root `replace` entry hides the package's own requirements, Composer could then omit that dependency or install a version outside the package's declared range.

**Knowledge Base Used:** [Reusable platform packages](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/appwrite/-/docs/reusable-platform-packages.md)

---

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 16, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

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

Metric Before After Change
🚀 Requests/sec 195.48 200.15 ⚪ +2.4%
⏱️ Latency P50 88.73 ms 88.3 ms ⚪ -0.5%
⏱️ Latency P95 208.36 ms 202.12 ms ⚪ -3%
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 88.3 202.12 12,540 200.15 -6.24
Account 160.84 305.17 660 11.2 -19.57
TablesDB 84.99 163.84 6,820 111.68 -2.01
Storage 81.64 179.17 3,300 55.44 -4.55
Functions 123.45 240.24 1,760 30.21 -15.61

Top API waits (after)

API request Max wait (ms)
account.name.update 477.46
tablesdb.rows.increment 457.46
tablesdb.rows.update 431.09
functions.variables.update 408.46
tablesdb.rows.delete 405.67

The hoisting rule skipped every utopia-php/* requirement. A sibling is satisfied when its own packages/ directory exists or the root still requires it from Packagist; anything else is a dependency Composer would silently drop, so it is now reported like any third-party one. Constraint ranges are still not compared: siblings in packages/ are always head.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@loks0n
loks0n merged commit ca3c55a into main Sep 16, 2026
55 checks passed
@loks0n

loks0n commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Post-merge check: Split run 35125384938 succeeded. utopia-php/psr7 main moved from cf70bec9ae (its last split from utopia-php/monorepo) to 52bc3ca1e0, matching bin/monorepo split psr7 --dry-run. Removal from the old monorepo: utopia-php/monorepo PR opened from branch chore/drop-psr7.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants