Repository navigation
rfc: absorb the Utopia libraries, tooling and the first package - #13700
Conversation
- Implement Anthropic API integration with Utopia Fetch client - Update Adapter and Conversation classes to support Message-based responses - Add support for text and image message types in Anthropic adapter - Update composer dependencies to include utopia-php/fetch
…les, and listed available Deepseek models.
Feat deepseek adapter
… add bulkEmbed method to ConversationFakeAdapter
feat: add AppwriteEmbeddingAdapter and corresponding tests; update do…
added agent interface
|
| "require": { | ||
| "php": ">=8.5" | ||
| }, |
There was a problem hiding this comment.
Bus::dispatch() calls Utopia\Span\Span, but this standalone manifest does not require utopia-php/span. The root application currently masks the omission by supplying that package itself. A Packagist consumer installing Bus alone will get a class-not-found error when dispatching a listener.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/bus/composer.json
Line: 11-13
Comment:
**Span Dependency Is Missing**
`Bus::dispatch()` calls `Utopia\Span\Span`, but this standalone manifest does not require `utopia-php/span`. The root application currently masks the omission by supplying that package itself. A Packagist consumer installing Bus alone will get a class-not-found error when dispatching a listener.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| tests: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.php-${PHP_VERSION:-8.4} |
There was a problem hiding this comment.
Package Containers Cannot Build
This service references Dockerfile.php-${PHP_VERSION:-8.4}, which is absent after the import. The Agents Compose file likewise expects an absent default Dockerfile and ollama.dockerfile, and Agents has no standard test:e2e Composer script. As a result, the documented package tests and planned Compose-backed e2e workflow fail before any tests can start.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/abuse/docker-compose.yml
Line: 17-20
Comment:
**Package Containers Cannot Build**
This service references `Dockerfile.php-${PHP_VERSION:-8.4}`, which is absent after the import. The Agents Compose file likewise expects an absent default `Dockerfile` and `ollama.dockerfile`, and Agents has no standard `test:e2e` Composer script. As a result, the documented package tests and planned Compose-backed e2e workflow fail before any tests can start.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| { | ||
| "$schema": "vendor/phpbench/phpbench/phpbench.schema.json", | ||
| "runner.bootstrap": "vendor/autoload.php", | ||
| "runner.path": "tests/Abuse/Bench", |
There was a problem hiding this comment.
The benchmark configuration still points to the pre-flattening tests/Abuse/Bench tree, while the imported benchmarks now live under tests/bench. The retained composer bench command consequently discovers none of these benchmarks.
| "runner.path": "tests/Abuse/Bench", | |
| "runner.path": "tests/bench", |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/abuse/phpbench.json
Line: 4
Comment:
**Benchmarks Use Stale Path**
The benchmark configuration still points to the pre-flattening `tests/Abuse/Bench` tree, while the imported benchmarks now live under `tests/bench`. The retained `composer bench` command consequently discovers none of these benchmarks.
```suggestion
"runner.path": "tests/bench",
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| public function testModelsContract(): void | ||
| { | ||
| $adapter = $this->createAdapter(); | ||
| $models = $adapter->getModels(); | ||
|
|
||
| $this->assertSame($this->expectedModels(), $models); | ||
| $this->assertNotEmpty($models); |
There was a problem hiding this comment.
This exact-equality model-list test mirrors provider configuration instead of testing observable behavior, contrary to the repository directive that tests must not mirror source code, configuration, or version pins. OpenRouter is circular: its expected list is the same Models::MODELS constant returned by production. The TablesDB tests similarly assert exact column sizes, bounds, index names, types, and ordering. Replace these mirrored assertions with behavioral contracts such as model selection, request behavior, and successful rate limiting. This repository 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/agents/tests/Adapters/Adapter.php
Line: 45-51
Comment:
**Tests Mirror Configuration**
This exact-equality model-list test mirrors provider configuration instead of testing observable behavior, contrary to the repository directive that tests must not mirror source code, configuration, or version pins. OpenRouter is circular: its expected list is the same `Models::MODELS` constant returned by production. The TablesDB tests similarly assert exact column sizes, bounds, index names, types, and ordering. Replace these mirrored assertions with behavioral contracts such as model selection, request behavior, and successful rate limiting. This repository 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!
| <testsuite name="packages"> | ||
| <directory>./packages/*/tests</directory> | ||
| <exclude>./packages/*/tests/e2e</exclude> | ||
| <exclude>./packages/*/tests/bench</exclude> | ||
| </testsuite> |
There was a problem hiding this comment.
This adds a separate packages suite, but the current unit job still invokes the test runner with the explicit /usr/src/code/tests/unit path. That command bypasses this suite, so regressions in the newly absorbed packages can merge without their tests running until the deferred package matrix is added.
Prompt To Fix With AI
This is a comment left during a code review.
Path: phpunit.xml
Line: 19-23
Comment:
**Package Tests Bypass CI**
This adds a separate `packages` suite, but the current unit job still invokes the test runner with the explicit `/usr/src/code/tests/unit` path. That command bypasses this suite, so regressions in the newly absorbed packages can merge without their tests running until the deferred package matrix is added.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| public static function tearDownAfterClass(): void | ||
| { | ||
| } |
There was a problem hiding this comment.
Class setup creates a uniquely named abuse-cicd-* database, but teardown performs no corresponding deletion. Every suite run therefore leaves another database and its abuse rows in the configured Appwrite project, causing persistent test-resource accumulation and possible environment contamination.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/abuse/tests/e2e/TablesDBTest.php
Line: 176-178
Comment:
**Test Database Is Leaked**
Class setup creates a uniquely named `abuse-cicd-*` database, but teardown performs no corresponding deletion. Every suite run therefore leaves another database and its abuse rows in the configured Appwrite project, causing persistent test-resource accumulation and possible environment contamination.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| ## System Requirements | ||
|
|
||
| Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible. |
There was a problem hiding this comment.
This README advertises PHP 8.0 compatibility, while the Abuse manifest requires PHP 8.4.1 or later. The Agents README makes the same PHP 8.0 claim despite requiring PHP 8.3. Standalone consumers following this documentation will be rejected by Composer.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/abuse/README.md
Line: 127-129
Comment:
**PHP Requirements Are Wrong**
This README advertises PHP 8.0 compatibility, while the Abuse manifest requires PHP 8.4.1 or later. The Agents README makes the same PHP 8.0 claim despite requiring PHP 8.3. Standalone consumers following this documentation will be rejected by Composer.
---
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)
|
Appwrite becomes the home of every utopia-php library, loads each one directly from packages/<name> through the root autoload, and keeps mirroring them to Packagist for other consumers. The RFC records the target shape, the standard package layout, version gaps, the phase plan and open questions. Co-Authored-By: Claude Fable 5.1 <[email protected]>
First slice of rfc/monorepo.md, proving package for the tooling. agents sits under packages/agents in the standard shape (Utopia\Agents\ => src/, Utopia\Agents\Tests\ => tests/, tests/e2e/ for the suites that need a provider key or a service) and the root composer.json autoloads it; utopia-php/agents leaves require. It was imported from its main branch with history (the preceding subtree merge). Root wiring: a `packages` PHPUnit suite over the unit tiers, COPY ./packages in the Dockerfile (the optimised autoloader falls back to PSR-4 for classes outside its class map, so no re-dump is needed), dockerignore entries, and AGENTS.md pointing at packages/. Packages are analysed under their own phpstan.neon with the root binary, not by the root config: at Appwrite's level 4 their level-max ignore comments become errors. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Phase 1 tooling from rfc/monorepo.md, ported from utopia-php/monorepo. bin/monorepo keeps list, absorb, split, release, validate, check, test and dependents; graph and benchmark are dropped. Mirrors stay under utopia-php, every link back now points at packages/<name> here. validate enforces the standard package shape (one Utopia\<Ns>\ prefix over src/, its Tests\ prefix over tests/, no lock, no hoisted QA, a phpstan.neon, mirror.yml) and the root autoload wiring; the new autoload subcommand regenerates the root entries from the package manifests. check analyses each package under its own phpstan.neon with the root binaries, Rector first so --fix leaves formatted output. split.yml, split-dev.yml and mirror-redirect.yml move over with pinned actions. ci.yml validates packages in the checks job, runs the packages PHPUnit suite in the unit job (packages/ is mounted like tests/), and gains the changed-package matrix: diff against the base ref, expand through dependents, check and test each package, linked for dependents. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Add the mirror.yml that redirects pull requests and issues opened on utopia-php/agents back here, the read-only-mirror banner under the README H1, and drop what the mirror no longer needs: the issue templates, the docker-compose.yml that referenced a Dockerfile removed with the shape change (agents defines no e2e tier), and its .env.example. Co-Authored-By: Claude Fable 5.1 <[email protected]>
9ffb4b0 to
1d9de22
Compare
- ci.yml: run `bin/monorepo check` for every changed package, linked ones included; only tests were being run for a package that also depends on another changed package. - bin/monorepo: keep the Dockerfiles a package's docker-compose.yml builds an e2e service from; absorb and validate only treat the rest as hoisted tooling. - agents: the OpenRouter model sync script wrote to the pre-flattening src/Agents path; the README example had an unterminated string. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Post-merge check: the first Setup that was done outside the PR: What to watch: every push to |
Summary
Phase 1 of
rfc/monorepo.md, as five commits on top ofmain:chore: import utopia-php/agents into packages/agents:git subtree addfrom the library'smain, full history.docs: add the RFC: the plan for making this repository the home of everyutopia-php/*library. Each library lives atpackages/<name>in one standard shape, is autoloaded directly by the rootcomposer.json(no Composer dependency, nopathrepository), and keeps being split to itsutopia-php/<name>mirror so Packagist consumers are unaffected.refactor: load agents directly from packages/: the proving package. Standard shape (Utopia\Agents\ => src/, tests tiered into unit andtests/e2e/), root autoload entries,utopia-php/agentsgone fromrequire, apackagesPHPUnit suite,COPY ./packagesin the Dockerfile,AGENTS.mdpointing atpackages/.chore: add bin/monorepo and the mirror workflows: the monorepo tool ported fromutopia-php/monorepo(list,absorb,split,release,validate,check,test,dependents, plus a newautoloadthat generates the root map), thesplit,split-devandmirror-redirectworkflows, and a changed-package job inci.ymlthat runsvalidate, thencheckandtestper changed package and its dependents.chore(agents): mirror plumbing:mirror.yml, README banner, and the files the mirror no longer needs.What
validateenforcesPer package:
utopia-php/<name>name, license, no version; exactly one PSR-4 prefixUtopia\<Ns>\ => src/with<Ns>matching the slug;Utopia\<Ns>\Tests\ => tests/; no lock file; none of the QA files the root hoists; aphpstan.neon; amirror.yml; Packagist constraints for siblings. Root: the two autoload lines per package and norequireof an absorbed package, regenerated bybin/monorepo autoload.Decisions
phpstan.neonwith the root binary, never the root config: at Appwrite's level 4 their level-max ignore comments become errors.tests/e2e/even when they would skip without a key; agents' conversation suites errored on DNS rather than skipping.graphandbenchmarkwere not ported.Setup
Repository variabledone 2026-09-15 (appSPLIT_APP_IDand secretSPLIT_APP_PRIVATE_KEYon this repositoryutopia-php-monorepo, fresh key; the app's installation onutopia-phpis what the token targets).The mirror ruleset ondone 2026-09-15 viautopia-php/agentsbin/monorepo absorb agents(PR-only, no force-push, split app bypasses).A branch-ruleset allowance for merge commitsnot needed:mainhas no ruleset and the repository allows merge commits; the reviewer just has to pick "Create a merge commit".Merging
Merge with a merge commit, not a squash. Commit 1 carries the
git-subtreeannotation the split continues from;bin/monorepo split agents --dry-runsynthesises a head whose parent chain reaches the mirror's current head. A squash orphans the package from its mirror history.Verification
bin/monorepo validate: all packages validbin/monorepo check agents: Pint passed, PHPStan no errorsbin/monorepo test agentsandvendor/bin/phpunit --testsuite packages: 134 tests, 4 skipped, greenbin/monorepo split agents --dry-run: head synthesised, tree equalsHEAD:packages/agentscomposer validatevalid; the lock drops onlyutopia-php/agents🤖 Generated with Claude Code