Repository navigation
chore: absorb di into packages/di - #13885
Conversation
Removed old test
…and-readme Improve set() defaults and refresh README examples
chore: add missing logo in readme
When calling set() to override an already-resolved dependency, the stale cached value in $concrete was still returned by get(). Now set() clears the cache entry so the new factory is used on the next get() call.
Fix set() not clearing cached instance on override
Strip hoisted QA tooling, add the mirror PR redirect, apply the canonical style, and migrate the phpunit.xml schema.
Every uses: ref is upgraded to its latest major (checkout v6, create-github-app-token v3) and pinned to the tag's commit SHA in ratchet's format. The validate job now runs ratchet lint over root and package workflows, so unpinned refs fail CI. Four leftover QA-only codeql workflows (cli, pools, telemetry, validators) are deleted — they invoke the composer check script that QA hoisting removed. Co-Authored-By: Claude Fable 5 <[email protected]>
- 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) <[email protected]>
build: hoist baseline rector + phpstan configs to the root
Reuse mirror redirect workflow
docs: enforce documentation style with Vale
docs: centralize CODE_OF_CONDUCT and CONTRIBUTING at the monorepo root
chore: stop committing package lock files
|
| // Parent factory is resolved through parent->get(), which looks in parent's scope | ||
| // The child provides 'name' but parent resolves its own dependencies from its own container | ||
| // This should throw because 'name' is not in parent | ||
| $this->expectException(NotFoundExceptionInterface::class); | ||
| $child->get('greeter'); |
There was a problem hiding this comment.
This test expects a child lookup to fail because the parent factory resolves dependencies through the parent container. That assertion mirrors the current implementation rather than an independently stated container contract. The repository requires tests to check intended observable behavior, not implementation details. Please test the intended child-scope behavior 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/di/tests/ContainerTest.php
Line: 267-271
Comment:
**Test locks in resolution path**
This test expects a child lookup to fail because the parent factory resolves dependencies through the parent container. That assertion mirrors the current implementation rather than an independently stated container contract. The repository requires tests to check intended observable behavior, not implementation details. Please test the intended child-scope behavior 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!
|
|
||
| Fork the [utopia-php monorepo](https://github.com/utopia-php/monorepo), create a feature branch, and send us a pull request. | ||
|
|
||
| You can refer to the [Contributing Guide](https://github.com/utopia-php/monorepo/blob/main/CONTRIBUTING.md) for more info. |
There was a problem hiding this comment.
Conflicting contribution directions
The new banner says development and pull requests belong in appwrite/appwrite, but this section still tells contributors to fork utopia-php/monorepo and submit a PR there. Contributors following this section may send DI changes to the former development repository. Please align the instructions with the banner.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/di/README.md
Line: 112
Comment:
**Conflicting contribution directions**
The new banner says development and pull requests belong in `appwrite/appwrite`, but this section still tells contributors to fork `utopia-php/monorepo` and submit a PR there. Contributors following this section may send DI changes to the former development repository. Please align the instructions with the banner.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
# Conflicts: # composer.lock
# Conflicts: # composer.json # composer.lock
# Conflicts: # composer.lock
Summary
This moves
utopia-php/diintopackages/di, so Appwrite loads it directly. It's wave 1 of #13828, follows the playbook inrfc/monorepo.md, and comes in three commits:Add 'packages/di/' from commit 'a72d8ee1…': subtree import from the mirror with full history. The mirror head is the0.3.6commit Appwrite already locks, so the dependency graph doesn't change.chore(di): mirror plumbing:mirror.ymlnow points here and the README banner is refreshed. There were no banned files to remove.refactor: load di from packages/:replaceentries and removes the package from the lock. Appwrite never required it directly. It came in throughutopia-php/http,utopia-php/queueandutopia-php/servers, andreplacenow satisfies all three.psr/container: ^2.0into the rootrequire, the same constraint the package declares. The lock stays at2.0.2.Utopia\prefix plus a strayTests\E2E\ => tests/e2e(a directory that doesn't exist). It now declares onlyUtopia\DI\→src/. This is safe because all three classes (Container,Exceptions\ContainerException,Exceptions\NotFoundException) already live underUtopia\DI\.diis now off the bare-Utopia\list the RFC tracks.src/DI/*moves up tosrc/.autoload-deventry forUtopia\DI\Tests\→tests/, the namespaceContainerTestalready declared. The suite has no services tier, so there is notests/E2E.phpunit.xmluses the standardunitsuite withtests/E2Eexcluded.phpstan.neonandrector.phpused to include the monorepo root configs (../../), whichvalidaterejects. Both are now standalone. PHPStan runs at level max oversrcand passes with no baseline.rector.phpkeeps its one skip (ThrowWithPreviousExceptionRector).require-dev(phpbench/phpbenchhad no benchmarks, andswoole/ide-helperwas only scanned by the old PHPStan config).fn (spacing).Appwrite uses
Utopia\DI\Containerin 13 files (app/http.php,app/realtime.php,app/mqtt.php,app/init/resources.php, the worker, realtime and MQTT connection init,Tasks/Specs.php,Promises/Swoole.php,Realtime/Message/Dispatcher.php,SDK/Specification/Format.php,Mqtt/Handler.php). They now load it frompackages/di/src.Validation
bin/monorepo validate: all packages validbin/monorepo check di: Rector, Pint and PHPStan level max pass (no baseline)bin/monorepo test di: unit 31 tests / 39 assertions. There is no e2e tier.vendor/bin/phpunit --testsuite packages --filter 'Utopia\\DI': 31 tests / 39 assertions pass under the root autoloaderUtopia\DI\Containerresolves topackages/di/src/Container.phpfrom the root autoloader, andvendor/utopia-php/diis no longer installedTasks/Specs.php,Promises/Swoole.php,Realtime/Message/Dispatcher.php,SDK/Specification/Format.php,Mqtt/Handler.php,app/init/resources.php,app/init/worker/message.php: no errorscomposer validate --no-check-publish: valid. The one warning is the existingutopia-php/platformexact pin.composer update --lock: the lock diff removes onlyutopia-php/di(plus the content hash)bin/monorepo split di --dry-run:837bd827, which fast-forwards from the mirror heada72d8ee1git diff --check,composer linton the package sourcesMerge and follow-up
Merge with a merge commit.
The
utopia-php/dimirror already has the canonicalmainruleset (id17508424), with the split app as an always-bypass actor, so the absorb ran with--skip-ruleset.After merge: confirm
Splitpushes toutopia-php/di. Then removepackages/difromutopia-php/monorepo.http,queueandserversthere still requireutopia-php/difrom Packagist, and the mirror keeps serving that. The mirror has no open PRs, and neither does the monorepo fordi.🤖 Generated with Claude Code