Skip to content

Conversation

terabytesoftw
Copy link
Member

@terabytesoftw terabytesoftw commented Aug 30, 2025

Q A
Is bugfix
New feature ✔️
Breaks BC

Summary by CodeRabbit

  • New Features

    • Introduced RoadRunner support with a stateless application runtime and PSR-7 handling.
    • Added a simple “rr serve” development workflow.
  • Documentation

    • Updated README to guide setup and running via RoadRunner; removed multi-server/docker guidance.
  • Refactor

    • Switched bootstrap to RoadRunner; streamlined environment handling (no .env loader).
  • Tests

    • Simplified Codeception config; updated base URL; removed auto server start envs.
  • Chores

    • Removed Docker files and related CI workflow.
    • Updated dependencies and disabled code coverage in CI by default.

@terabytesoftw terabytesoftw added the enhancement New feature or request label Aug 30, 2025
Copy link

coderabbitai bot commented Aug 30, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Replaces Docker-based setup with RoadRunner. Adds RoadRunner config and DI bindings, updates bootstrap to run a stateless Yii app under RoadRunner, and adjusts modules. Simplifies CI Codeception run with a RoadRunner hook. Removes dotenv, c3/coverage settings, and multiple Docker files. Updates README and tests accordingly.

Changes

Cohort / File(s) Summary
CI workflow updates
.github/workflows/build.yml, .github/workflows/docker.yml
Simplified Codeception command, disabled coverage driver, enabled sockets, and added a hook to fetch/run rr. Removed Docker CI workflow with apache/caddy/frankenphp/nginx test jobs.
Environment and testing config
.env, codeception.yml, tests/Acceptance.suite.yml, tests/_envs/php-builtin.yml, tests/_envs/dockerized.yml
Removed system/Yii env vars from .env; dropped Codeception envs and coverage block; updated Acceptance base URL; removed builtin and dockerized env setups.
RoadRunner integration and app wiring
.rr.yaml, config/web/container.php, config/web/app.php, config/web/modules.php, web/index.php
Added RoadRunner YAML and DI definitions (PSR-7 worker/factories); injected container into app config; switched debug module to worker-debug; replaced web entry with RoadRunner+StatelessApplication bootstrap and getenv usage.
Documentation and dependencies
README.md, composer.json
Updated docs to use RoadRunner; removed Docker instructions/badges; added RR-related packages and http-message; replaced debug tool; removed dotenv and c3; set minimum-stability dev; adjusted plugins/keywords.
Docker removal
docker-compose*.yml, docker/** (apache, caddy, frankenphp, nginx, php.ini, supervisor, scripts)
Deleted all Docker Compose files, Dockerfiles, server configs, supervisor configs, and init/entrypoint scripts.
Controller adjustment
src/usecase/site/SiteController.php
Replaced ArrayHelper::merge with array_merge in actions() and removed ArrayHelper import.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant RR as RoadRunner HTTP
    participant PSR as PSR-7 Worker
    participant App as Yii StatelessApplication
    participant C as Controller

    User->>RR: HTTP request
    RR->>PSR: Dispatch PSR-7 ServerRequest
    PSR->>App: Handle request
    App->>C: Invoke action
    C-->>App: Response payload
    App-->>PSR: PSR-7 Response
    PSR-->>RR: Return response
    RR-->>User: HTTP response
    note right of RR: Configured via .rr.yaml (static/gzip, pool, ports)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

I swapped my docks for runner’s road,
With PSR winds to bear the load.
No whale to steer, no caddy’s tune—
Just rr humming, light as moon.
Hop-hop! My tests now swiftly flow,
Stateless fields where carrots grow. 🥕🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-mini-43

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

terabytesoftw and others added 19 commits August 30, 2025 19:14
…`C3` file in index.php if `YII_C3` is set.
@terabytesoftw
Copy link
Member Author

@coderabbitai review

Copy link

coderabbitai bot commented Aug 31, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (10)
tests/Acceptance.suite.yml (1)

10-10: Add trailing slash to base URL to avoid edge path joins.

Some Codeception helpers expect a trailing slash for clean relative path resolution. This also matches common examples.

-            url: http://127.0.0.1:8080
+            url: http://127.0.0.1:8080/
config/web/modules.php (1)

5-7: Alias Gii Module to avoid ambiguous bare Module import.

Using Module unqualified is easy to confuse and collide with local symbols. Alias for clarity.

-use yii\gii\Module;
+use yii\gii\Module as GiiModule;
...
-        'class' => Module::class,
+        'class' => GiiModule::class,

Also applies to: 15-15

.rr.yaml (4)

8-10: Avoid enabling coverage flag and debug unconditionally.

YII_C3=true implies c3 coverage, but CI disables coverage. Also hardcoding debug/dev can leak into prod if this file is reused.

-        YII_C3: true
-        YII_DEBUG: true
-        YII_ENV: dev
+# Uncomment locally as needed; keep CI/prod lean.
+#       YII_C3: true
+#       YII_DEBUG: true
+#       YII_ENV: dev

Confirm c3 bootstrap still exists; if removed, drop YII_C3 entirely.


18-21: Middleware order OK; consider adding only when needed.

Static first + gzip is fine. For prod, add/cache headers or CDN instead of global no-cache if you change that later.


31-35: Remove Jobs plugin if unused to speed startup and reduce noise.

-jobs:
-    pool:
-        num_workers: 2
-        max_worker_memory: 100
-    consume: {  }
+# jobs:  # enable when you add pipelines
+#   ...

41-42: Metrics port may conflict on shared runners.

If not scraping metrics in CI, disable or change to an ephemeral port.

-metrics:
-    address: '127.0.0.1:2112'
+# metrics:
+#     address: '127.0.0.1:2112'
.github/workflows/build.yml (1)

27-29: Coverage config is inconsistent (driver: none, yet pcov enabled).

Either re-enable coverage or drop pcov to speed up CI. If you intend no coverage, remove pcov.

-      codeception-command: vendor/bin/codecept run
-      coverage-driver: none
+      codeception-command: vendor/bin/codecept run
+      coverage-driver: none
       coverage-file: runtime/output/coverage.xml
-      extensions: gd, intl, pcov, sockets
+      extensions: gd, intl, sockets

If you want Codecov uploads, set coverage-driver to pcov and restore the Codeception coverage flags.

Also applies to: 30-30

composer.json (1)

41-41: Consider using stable worker-debug version when available.

The yii2-extensions/worker-debug package is set to ^0.1 which appears to be an early version. Monitor for stable releases.

README.md (2)

9-11: Fix markdown emphasis usage.

The static analysis correctly identified that emphasis is used instead of proper heading structure.

Based on the static analysis hint, consider whether this badge section should use proper heading markup if it represents a distinct section, or keep as emphasis if it's intentionally styled differently.


71-72: Update installation command for clarity.

The installation command references a specific development branch which may not be intuitive for users.

Consider updating the installation command to be more explicit about the RoadRunner version:

-composer create-project --prefer-dist --stability=dev yii2-extensions/app-basic:dev-road-runner app-basic
+composer create-project --prefer-dist --stability=dev yii2-extensions/app-basic app-basic

Or provide clearer documentation about when to use the specific branch.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4d58e8d and a75352f.

⛔ Files ignored due to path filters (3)
  • composer.lock is excluded by !**/*.lock
  • docker/ssl/localhost-key.pem is excluded by !**/*.pem
  • docker/ssl/localhost.pem is excluded by !**/*.pem
📒 Files selected for processing (39)
  • .env (0 hunks)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/docker.yml (0 hunks)
  • .rr.yaml (1 hunks)
  • README.md (3 hunks)
  • codeception.yml (0 hunks)
  • composer.json (3 hunks)
  • config/web/app.php (2 hunks)
  • config/web/container.php (1 hunks)
  • config/web/modules.php (1 hunks)
  • docker-compose.caddy.yml (0 hunks)
  • docker-compose.frankenphp.yml (0 hunks)
  • docker-compose.nginx.yml (0 hunks)
  • docker-compose.yml (0 hunks)
  • docker/apache/Dockerfile (0 hunks)
  • docker/apache/apache.conf (0 hunks)
  • docker/apache/vhost.conf (0 hunks)
  • docker/caddy/Caddyfile (0 hunks)
  • docker/caddy/Dockerfile (0 hunks)
  • docker/entrypoint.sh (0 hunks)
  • docker/frankenphp/Caddyfile (0 hunks)
  • docker/frankenphp/Dockerfile (0 hunks)
  • docker/init.sh (0 hunks)
  • docker/nginx/Dockerfile (0 hunks)
  • docker/nginx/default.conf (0 hunks)
  • docker/nginx/nginx.conf (0 hunks)
  • docker/php/php.ini (0 hunks)
  • docker/supervisor/conf.d/apache2.conf (0 hunks)
  • docker/supervisor/conf.d/caddy-php-fpm.conf (0 hunks)
  • docker/supervisor/conf.d/frankenphp.conf (0 hunks)
  • docker/supervisor/conf.d/nginx.conf (0 hunks)
  • docker/supervisor/conf.d/php-fpm.conf (0 hunks)
  • docker/supervisor/conf.d/queue.conf (0 hunks)
  • docker/supervisor/supervisord.conf (0 hunks)
  • src/usecase/site/SiteController.php (2 hunks)
  • tests/Acceptance.suite.yml (1 hunks)
  • tests/_envs/dockerized.yml (0 hunks)
  • tests/_envs/php-builtin.yml (0 hunks)
  • web/index.php (1 hunks)
💤 Files with no reviewable changes (29)
  • docker/frankenphp/Dockerfile
  • docker-compose.yml
  • docker/supervisor/conf.d/caddy-php-fpm.conf
  • docker/supervisor/conf.d/nginx.conf
  • docker/nginx/default.conf
  • docker/supervisor/conf.d/queue.conf
  • tests/_envs/php-builtin.yml
  • docker/init.sh
  • docker/supervisor/conf.d/php-fpm.conf
  • codeception.yml
  • docker/supervisor/conf.d/frankenphp.conf
  • docker/supervisor/supervisord.conf
  • docker-compose.frankenphp.yml
  • tests/_envs/dockerized.yml
  • .github/workflows/docker.yml
  • docker/apache/vhost.conf
  • docker-compose.nginx.yml
  • docker/php/php.ini
  • docker/entrypoint.sh
  • docker/supervisor/conf.d/apache2.conf
  • docker/frankenphp/Caddyfile
  • docker/apache/apache.conf
  • docker/apache/Dockerfile
  • docker/nginx/Dockerfile
  • docker/nginx/nginx.conf
  • .env
  • docker-compose.caddy.yml
  • docker/caddy/Dockerfile
  • docker/caddy/Caddyfile
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-30T20:31:14.913Z
Learnt from: terabytesoftw
PR: yii2-extensions/app-basic#129
File: tests/_envs/php-builtin.yml:4-4
Timestamp: 2025-08-30T20:31:14.913Z
Learning: Yii2 framework doesn't require separate router scripts for PHP's built-in server. Yii2 handles routing through URL rules in configuration files and controller/action mapping conventions, not separate route definition files. If tests pass with the built-in server setup, additional router scripts are unnecessary.

Applied to files:

  • web/index.php
🪛 markdownlint-cli2 (0.17.2)
README.md

75-75: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

🔇 Additional comments (12)
src/usecase/site/SiteController.php (1)

10-11: Drop the deep-merge suggestion—parent::actions() returns only a flat, one-level config, so array_merge is sufficient.

Likely an incorrect or invalid review comment.

config/web/modules.php (1)

10-10: LGTM: Debug module correctly wired for dev.

WorkerDebugModule registration under the dev-only gate is appropriate.

.rr.yaml (3)

12-12: Port matches tests; good alignment.


22-26: Good: PHP files forbidden from static serving.


28-30: Worker memory cap: verify units and headroom.

100 likely means ~100 MiB. Ensure this is sufficient for Yii + debug in CI to avoid premature restarts.

config/web/container.php (1)

1-37: LGTM! Well-structured DI container configuration for RoadRunner integration.

The container definitions are properly structured with correct PSR-7 factory bindings and RoadRunner worker configuration. The use of Instance::of() for dependency injection ensures proper lazy loading of dependencies.

composer.json (2)

13-13: Verify and confirm dev stability dependencies
The require section contains an @dev constraint (yii2-extensions/road-runner: ^0.1.0@dev), and your composer.lock lists dozens of packages at dev stability (e.g. cebe/markdown: dev-master, symfony/console: 7.4.x-dev, yiisoft/yii2: dev-master, etc.). Ensure this is intentional for production or adjust minimum-stability/prefer-stable and pin stable releases accordingly.


17-17: Confirm PSR-7 & RoadRunner compatibility

  • httpsoft/http-message ^1.0 resolves up to v1.1.6 and supports PHP ^7.4|^8.0 (includes PHP 8.1+) (packagist.org)
  • yii2-extensions/road-runner requires PHP >=8.1, ext-sockets, psr/http-factory ^1.1, psr/http-message ^2.0, spiral/roadrunner ^2025.1.2 and yii2-extensions/psr-bridge; ensure these deps are in composer.json and test under RoadRunner v3+ (packagist.org)

No further changes required.

README.md (1)

125-125: LGTM! Good practice using final class.

Declaring the controller as final prevents unintended inheritance and aligns with modern PHP best practices.

web/index.php (1)

17-19: LGTM! Clean RoadRunner integration.

The RoadRunner bootstrap is properly implemented with the stateless application pattern, which is appropriate for worker-based environments.

config/web/app.php (2)

7-14: LGTM! Improved type annotations and container integration.

The PHPStan type annotations are properly updated to reflect the actual mixed content of configuration arrays, and the container integration is cleanly implemented.


30-30: Verify container configuration compatibility with Yii2 DI container
Confirm that supplying your custom $container in config/web/app.php:30 aligns with yii\base\Application::$container expectations and doesn’t override or break Yii2’s built-in dependency definitions.

Comment on lines +31 to +33
hook: |
vendor/bin/rr get-binary
./rr serve > /dev/null 2>&1 &
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Wait for RoadRunner to be ready to avoid flaky tests.

Add a simple readiness check after starting the server.

       hook: |
         vendor/bin/rr get-binary
-        ./rr serve > /dev/null 2>&1 &
+        ./rr serve > /dev/null 2>&1 &
+        for i in {1..30}; do
+          curl -fsS http://127.0.0.1:8080/ >/dev/null && break
+          sleep 1
+        done
+        curl -fsS http://127.0.0.1:8080/ >/dev/null
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
hook: |
vendor/bin/rr get-binary
./rr serve > /dev/null 2>&1 &
hook: |
vendor/bin/rr get-binary
./rr serve > /dev/null 2>&1 &
for i in {1..30}; do
curl -fsS http://127.0.0.1:8080/ >/dev/null && break
sleep 1
done
curl -fsS http://127.0.0.1:8080/ >/dev/null
🤖 Prompt for AI Agents
In .github/workflows/build.yml around lines 31 to 33, the workflow starts
RoadRunner but does not wait for it to become ready which causes flaky tests;
after starting the server (./rr serve > /dev/null 2>&1 &) add a simple readiness
loop that polls the RoadRunner health or HTTP endpoint (e.g., curl -sSf
http://127.0.0.1:8080/health or the configured port) with a short sleep/retry
and a total timeout, exiting with failure if the server does not become ready in
time, so subsequent steps run only after RoadRunner is confirmed healthy.

Comment on lines +10 to +11
define('YII_DEBUG', getenv('YII_DEBUG') ?? false);
define('YII_ENV', getenv('YII_ENV') ?? 'prod');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve environment variable handling.

The current implementation uses loose type coercion that could lead to unexpected behavior. String values like "false" or "0" will be truthy in PHP.

-define('YII_DEBUG', getenv('YII_DEBUG') ?? false);
-define('YII_ENV', getenv('YII_ENV') ?? 'prod');
+define('YII_DEBUG', filter_var(getenv('YII_DEBUG'), FILTER_VALIDATE_BOOLEAN));
+define('YII_ENV', getenv('YII_ENV') ?: 'prod');

This ensures YII_DEBUG properly handles boolean string values and YII_ENV uses a more explicit fallback.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
define('YII_DEBUG', getenv('YII_DEBUG') ?? false);
define('YII_ENV', getenv('YII_ENV') ?? 'prod');
define('YII_DEBUG', filter_var(getenv('YII_DEBUG'), FILTER_VALIDATE_BOOLEAN));
define('YII_ENV', getenv('YII_ENV') ?: 'prod');
🤖 Prompt for AI Agents
In web/index.php around lines 10-11, replace the loose getenv() ?? fallback with
explicit handling: for YII_DEBUG, check if getenv('YII_DEBUG') returns a
non-false value and convert that string to a boolean using filter_var(...,
FILTER_VALIDATE_BOOLEAN) (so strings like "false"/"0" become false); for
YII_ENV, check getenv('YII_ENV') !== false and use that value, otherwise fall
back to 'prod'. Ensure you do not rely on PHP's truthiness of strings and handle
the getenv false return explicitly.

@terabytesoftw terabytesoftw merged commit baedd3a into road-runner Aug 31, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants