Repository navigation
chore: absorb registry into packages/registry - #13889
Conversation
fully-qualified function calls
…n Psalm analysis.
Add contributing.md
Add `has` function to allow checking for existence without throwing
[Docs]removed authors
Feat 4388 add code analyzer
Test on GitHub action
|
| $copy2 = $this->registry->get('fresh'); | ||
| usleep(1); | ||
| $copy3 = $this->registry->get('fresh'); | ||
|
|
||
| $this->assertNotEquals($copy1, $copy2); | ||
| $this->assertNotEquals($copy2, $copy3); | ||
| $this->assertNotEquals($copy1, $copy3); |
There was a problem hiding this comment.
Timing-dependent registry tests
testSetFresh sleeps for one microsecond before comparing microtime() values, but that does not guarantee different timestamps. testContextSwitching also compares timestamps, without a delay. Correct registry behavior can therefore produce a test failure. Use a deterministic callback instead. AGENTS.md directs tests to avoid sleeps; this repository requirement needs to be satisfied before merging.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/registry/tests/RegistryTest.php
Line: 77-83
Comment:
**Timing-dependent registry tests** `testSetFresh` sleeps for one microsecond before comparing `microtime()` values, but that does not guarantee different timestamps. `testContextSwitching` also compares timestamps, without a delay. Correct registry behavior can therefore produce a test failure. Use a deterministic callback instead. AGENTS.md directs tests to avoid sleeps; this repository requirement needs to be satisfied before merging.
**Context Used:** AGENTS.md ([source](https://github.com/appwrite/appwrite/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| public function testGetFresh(): void | ||
| { | ||
| $this->registry->set('array', fn (): ArrayObject => new ArrayObject(['test'])); | ||
| $this->assertCount(1, $this->array(true)); | ||
| } |
There was a problem hiding this comment.
Fresh retrieval goes untested
testGetFresh requests a fresh value before anything has been cached. The test would still pass if get($name, true) stopped replacing cached values, leaving that behavior without direct coverage. Cache a value first, then check that a fresh request returns a different resource.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/registry/tests/RegistryTest.php
Line: 61-65
Comment:
**Fresh retrieval goes untested** `testGetFresh` requests a fresh value before anything has been cached. The test would still pass if `get($name, true)` stopped replacing cached values, leaving that behavior without direct coverage. Cache a value first, then check that a fresh request returns a different resource.
---
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!
| For the initial start, fork the project and use git clone command to download the repository to your computer. A standard procedure for working on an issue would be to: | ||
|
|
||
| 1. `git pull`, before creating a new branch, pull the changes from upstream. Your master needs to be up to date. | ||
|
|
There was a problem hiding this comment.
Contribution steps target mirror These instructions tell contributors to update
master and open a pull request against this repository, but the README identifies it as a read-only mirror and directs development to appwrite/appwrite. Following the instructions sends contributors to the wrong branch or repository. Update the contribution steps to match the mirror arrangement.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/registry/CONTRIBUTING.md
Line: 38
Comment:
**Contribution steps target mirror** These instructions tell contributors to update `master` and open a pull request against this repository, but the README identifies it as a read-only mirror and directs development to `appwrite/appwrite`. Following the instructions sends contributors to the wrong branch or repository. Update the contribution steps to match the mirror arrangement.
---
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!
✨ 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.lock
# Conflicts: # composer.lock
# Conflicts: # composer.json # composer.lock
# Conflicts: # composer.lock
# Conflicts: # composer.lock
# Conflicts: # composer.lock
Summary
This moves
utopia-php/registryintopackages/registry, so Appwrite loads it directly. It follows the playbook inrfc/monorepo.md(wave 1 of #13828) and comes in three commits:Add 'packages/registry/' from commit 'dbaa3cd5…': subtree import from the standaloneutopia-php/registryrepository'smainwith full history. The head is 21 commits past the0.6.0tag, but none of them change behaviour: typed docblocks, Pint formatting, aget(): mixedreturn type, and CI/QA files.chore(registry): mirror plumbing:absorbreplaces the repo's three workflows (tests,linter,codeql-analysis) withmirror.yml, adds the README banner, removespsalm.xml, theDockerfileand the committedcomposer.lock, and ignorescomposer.lock.refactor: load registry from packages/:replaceentries, drops the"utopia-php/registry": "0.5.*"require line, and removes the package from the lock.src/Registry/Registry.phpmoves up tosrc/.tests/Registry/RegistryTest.phpmoves up totests/, and its namespace goes from the bareUtopia\TeststoUtopia\Registry\Tests, with a matchingautoload-deventry.docker-compose.ymlis deleted. It only built the removedDockerfileto run PHPUnit, and the package has no e2e tier.phpunit.xmlmoves to the PHPUnit 12 schema. The old one used attributes PHPUnit 12 no longer accepts (backupStaticAttributes,convert*ToExceptions).vimeo/psalmleavesrequire-dev.minimum-stabilitygoes fromdevtostable, matching the other packages.phpstan.neon(level max,srcandtests) and the standardrector.php. No baseline. The package passes level max once two property docblocks describe what they already hold ($registryisarray<string, array<string, mixed>>, context then name;$callbacksisarray<string, callable>) and the test class stops typing its registry as nullable. Rector added arrow-function return types in the tests.There's nothing to hoist, since the package requires only PHP.
0.5.0 → 0.6.0 upgrade
Appwrite locked
0.5.0(March 2021), so this PR also moves it to the package head. What changed since 0.5.0:has(string $name): bool, which checks whether a callback is registered.get(string $name, bool $fresh = false): mixed:$freshis now typedbool, with amixedreturn type.array $callbacks,array $fresh,array $registry,string $context).None of this breaks Appwrite. No class extends
Registry(typed properties would break a subclass that redeclares them untyped), and everyget()call passes either one argument or a literaltrue(Tasks/Migrate.php). No call site needed changes. The 14 files that useUtopia\Registryareapp/cli.php,app/init/registers.php,app/mqtt.php,app/realtime.php,Health/Stats/Get.php,Tasks/{Doctor,Migrate}.php,Workers/{Mails,Notifications}.php, the three realtime message handlers, and theMailsandNotificationsworker unit tests.Cloud:
appwrite/cloudgetsUtopia\Registrythroughappwrite/server-ce's0.5.*requirement and will load the 0.6 head frompackages/registryonce it takes this version of server-ce. It doesn't subclassRegistry, and itsget()calls passtrue(app/{cli,http,realtime,worker}.php), so it sees no break either.Validation
bin/monorepo validate: all packages validbin/monorepo check registry: Rector, Pint, and PHPStan level max pass with no baselinebin/monorepo test registry: 7 tests / 13 assertionsvendor/bin/phpunit --testsuite packages --filter 'Utopia\\Registry': 7 tests / 13 assertions under the root autoloadervendor/bin/phpunit tests/unit/Platform/Workers/{MailsTest,NotificationsTest}.php: 5 tests / 15 assertions and 26 tests / 171 assertions (both construct aRegistry)Utopia\Registry: no errorsUtopia\Registry\Registryresolves topackages/registry/src/Registry.phpfrom the root autoloader, andvendor/utopia-php/registryis gonecomposer validate --no-check-publish: valid (only the existingutopia-php/platformexact-constraint warning)composer.lock: the only change is the removal ofutopia-php/registry0.5.0 (pluscontent-hash)bin/monorepo split registry --dry-run:be11128c, which fast-forwards from the mirror headdbaa3cd5composer lint(full repo) andgit diff --checkMerge and follow-up
Warning
Merge with a merge commit, not a squash. A squash drops the
git-subtree-*annotation, and the mirror then rejects the split.utopia-php/registryhad no rulesets.absorbcreated the canonicalmainruleset (id23943548, targeting the default branchmain), with the split app as an always-bypass actor.After merge:
Splitpushes toutopia-php/registry.mirror.yml. Close it with a pointer to this repository.masterbranch (same commit asmain) and four old feature branches (feat-allow-params,feat-allow-querying,feat-github-action,chore/dependabot-automation-20260826).Splitonly pushesmain, somasterwill fall behind. Consider deleting it so nobody installsdev-masterexpecting it to trackmain.🤖 Generated with Claude Code