Port library to utopia-php conventions#1
Conversation
Bring the full base circuit-breaker library in under the Utopia namespace and house it to match the shape of other utopia-php packages (cache, pools, telemetry). Namespaces - ChiragAgg5k\CircuitBreaker -> Utopia\CircuitBreaker - ChiragAgg5k\Tests -> Utopia\Tests - Sources moved under src/CircuitBreaker/ (matches "src/<Foo>/<Foo>.php" PSR-4 layout used by the rest of utopia-php) composer.json - Name, description, authors, keywords, PSR-4 roots, suggest keys - Utopia script names (lint / format / check / test, test:unit, test:e2e, test:e2e:docker, telemetry:up/scenario/down) Docs & branding - README rewritten with utopia banner, badges, marketing paragraph, section ordering, and API reference - LICENSE copyright changed to "Utopia" Tooling - phpunit.xml.dist -> phpunit.xml, phpstan.neon.dist -> phpstan.neon - docker-composer.yml / docker-composer.telemetry.yml renamed to the standard docker-compose.* spelling - CI split into .github/workflows/linter.yml (pint + phpstan) and .github/workflows/tests.yml (unit tests on PHP 8.2/8.3/8.4 plus a Docker-based e2e job) The public API, adapter surface, telemetry wiring, cache semantics, and test coverage all behave exactly as before; this change is purely structural + cosmetic. Unit tests, phpstan level 5, and pint all pass locally.
Greptile SummaryThis is a structural port of the Confidence Score: 5/5Safe to merge — pure structural/namespace migration with no behavioural changes and full test coverage retained All remaining findings are P2 style suggestions (unnecessary C extensions in linter workflow). No logic, correctness, or security issues were found. No files require special attention beyond the minor extension cleanup in linter.yml Important Files Changed
Reviews (2): Last reviewed commit: "Address Greptile P2 findings" | Re-trigger Greptile |
- tests.yml: drop opentelemetry/protobuf host extensions from the E2E job. The E2E step only shells out to `composer test:e2e:docker`; all PHP execution happens inside the Dockerfile container where those extensions are installed already. - phpstan.neon: add `tests` to analysed paths so test helpers, anonymous-class cache adapters, and the custom telemetry subclass are covered. Paired with a narrow ignoreErrors block for two patterns the upstream type system can't express: the $values property on anonymous Counter/Gauge subclasses emitted by Utopia\Telemetry\Adapter\Test, and the defensive method_exists(Redis, 'getLastError') guard.
Summary
Rehome the base circuit-breaker library (originally developed at
ChiragAgg5k/circuit-breaker) under the Utopia organisation so it can ship asutopia-php/circuit-breaker. Public behaviour, adapter surface, telemetry wiring, cache semantics, and test coverage are unchanged — this is a structural + cosmetic port only.What changed
Namespaces & layout
ChiragAgg5k\CircuitBreaker→Utopia\CircuitBreakerChiragAgg5k\Tests→Utopia\Testssrc/CircuitBreaker/to match thesrc/<Foo>/<Foo>.phplayout used by utopia-php/cache, utopia-php/pools, and utopia-php/telemetry.src/CircuitBreaker.php(ChiragAgg5k)src/CircuitBreaker/CircuitBreaker.php(Utopia\CircuitBreaker)src/CircuitState.php(ChiragAgg5k)src/CircuitBreaker/CircuitState.php(Utopia\CircuitBreaker)src/CircuitBreaker/Adapter.phpUtopia\CircuitBreakersrc/CircuitBreaker/Adapter/*.phpUtopia\CircuitBreaker\Adaptercomposer.json
utopia-php/circuit-breakerTeam Appwrite <team@appwrite.io>["php","framework","upf","utopia","circuit-breaker","fault-tolerance","resilience"]"Utopia\\CircuitBreaker\\": "src/CircuitBreaker"; dev"Utopia\\Tests\\": "tests"lint,format,check,test) while keeping the existingtest:unit,test:e2e,test:e2e:docker,telemetry:up|scenario|downhelperssuggestkeys updated to the newUtopia\CircuitBreaker\Adapter\…class namesDocs & branding
README.mdrewritten with the utopia banner, badges (build / packagist / discord), marketing paragraph, and standard section ordering (Getting Started → Examples → Shared Cache → Telemetry → System Requirements → Tests → Copyright)LICENSEcopyright changed toUtopiaTooling & CI
phpunit.xml.dist→phpunit.xml,phpstan.neon.dist→phpstan.neon(utopia uses the non-.distnames)docker-composer.yml/docker-composer.telemetry.ymlrenamed to the standarddocker-compose.*spelling (drops the typo, matches what every tutorial says).github/workflows/ci.ymlsplit into:linter.yml— pint lint + phpstantests.yml— unit tests on a PHP 8.2 / 8.3 / 8.4 matrix plus a Docker-based e2e jobNot changed
CircuitBreaker,CircuitState, and all adaptersbreaker.*, optional prefix still works)get/set/increment/delete)max; a follow-up PR can bump this)Test plan
composer install(locally)composer test— 10 tests, 50 assertions, all passcomposer check— PHPStan level 5, no errorscomposer lint— Pint reports{"result":"pass"}