Skip to content

Refactor: env#91

Open
TatevikGr wants to merge 6 commits into
mainfrom
env
Open

Refactor: env#91
TatevikGr wants to merge 6 commits into
mainfrom
env

Conversation

@TatevikGr

@TatevikGr TatevikGr commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Configuration
    • Improved application configuration updates by automatically generating dotenv configuration.
    • Updated API connection settings to use the application’s configured base URL.
    • Refined test environment setup for more consistent test execution.

Summary

Provide a general description of the code changes in your pull request …
were there any bugs you had fixed? If so, mention them. If these bugs have open
GitHub issues, be sure to tag them here as well, to keep the conversation
linked together.

Unit test

Are your changes covered with unit tests, and do they not break anything?

You can run the existing unit tests using this command:

vendor/bin/phpunit tests/

Code style

Have you checked that you code is well-documented and follows the PSR-2 coding
style?

You can check for this using this command:

vendor/bin/phpcs --standard=PSR2 src/ tests/

Other Information

If there's anything else that's important and relevant to your pull
request, mention that information here. This could include benchmarks,
or other information.

If you are updating any of the CHANGELOG files or are asked to update the
CHANGELOG files by reviewers, please add the CHANGELOG entry at the top of the file.

Thanks for contributing to phpList!

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@TatevikGr, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9245079c-1dd2-40d8-983d-cb1274ff6174

📥 Commits

Reviewing files that changed from the base of the PR and between 6e3d9c0 and fb17103.

📒 Files selected for processing (20)
  • assets/vue/api.js
  • config/packages/twig.yaml
  • config/services.yml
  • src/Controller/AnalyticsController.php
  • src/Controller/BouncesController.php
  • src/Controller/CampaignsController.php
  • src/Controller/DashboardController.php
  • src/Controller/ListsController.php
  • src/Controller/PublicPagesController.php
  • src/Controller/SettingsController.php
  • src/Controller/SubscribersController.php
  • src/Controller/TemplatesController.php
  • templates/base.html.twig
  • templates/spa.html.twig
  • tests/Integration/Controller/AnalyticsControllerTest.php
  • tests/Integration/Controller/BouncesControllerTest.php
  • tests/Integration/Controller/CampaignsControllerTest.php
  • tests/Integration/Controller/DashboardControllerTest.php
  • tests/Integration/Controller/ListsControllerTest.php
  • tests/bootstrap.php
📝 Walkthrough

Walkthrough

Composer now uses the phplist/core dev-env branch and invokes dotenv configuration generation during configuration updates. The service configuration sources api_base_url from the application parameter. PHPUnit now bootstraps through tests/bootstrap.php, removes API_BASE_URL, and forces APP_ENV to test.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague to convey the main change; it only hints at an environment refactor. Use a more specific title that mentions the config and test environment changes, such as updating env handling and bootstrap setup.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch env

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@composer.json`:
- Line 54: Update the phplist/core dependency version in composer.json to
reference an existing branch in phpList/core, replacing the invalid dev-env
constraint with the correct available branch name such as env.

In `@phpunit.xml.dist`:
- Around line 8-13: Add or restore the tracked tests/bootstrap.php file
referenced by the PHPUnit configuration, ensuring it initializes the test
autoloader and kernel hooks required before tests run. Keep the existing
phpunit.xml.dist bootstrap setting unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3da71c5a-f5e5-4ad8-8e54-1d3c682bbd75

📥 Commits

Reviewing files that changed from the base of the PR and between 244be0d and 6e3d9c0.

📒 Files selected for processing (3)
  • composer.json
  • config/services.yml
  • phpunit.xml.dist

Comment thread composer.json
"require": {
"php": "^8.1",
"phplist/core": "dev-main",
"phplist/core": "dev-env",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

composer validate --strict
composer show phplist/core --all | grep -F 'dev-env'
rg -n 'createDotenvConfiguration' composer.lock vendor 2>/dev/null || true

Repository: phpList/web-frontend

Length of output: 1350


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== composer.json =="
cat -n composer.json | sed -n '1,130p'

echo
echo "== composer.lock phplist entries =="
sed -n '1,220p' composer.lock | rg -n -C 3 '"phplist|source:|version":' || true
}

echo
echo "== createDotenvConfiguration definitions/usages =="
rg -n 'createDotenvConfiguration|ComposerHandler|ScriptHandler|update-configuration' composer.json vendor composer.lock 2>/dev/null || true

Repository: phpList/web-frontend

Length of output: 5519


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python3 - <<'PY'
import json
from pathlib import Path

lock = Path("composer.lock")
print("composer.lock exists:", lock.exists())
if lock.exists():
    data = json.loads(lock.read_text())
    packages = {p.get("name"): p for p in data.get("packages", []) + data.get("packages-dev", [])}
    for name in ["phplist/core", "phplist/api-client"]:
        if name in packages:
            p = packages[name]
            print(name, "version=", p.get("version"), "source=", {k:p["source"].get(k) for k in ("type","url","reference")})
        else:
            print(name, "NOT IN lock")
else:
    print("No composer.lock present")
PY

Repository: phpList/web-frontend

Length of output: 211


🌐 Web query:

phpList core dev-env createDotenvConfiguration PhpList\Core\Composer\ScriptHandler

💡 Result:

The reference to PhpList\Core\Composer\ScriptHandler::createDotenvConfiguration appears to be related to internal Composer script handling, likely used during the installation or setup process of a phpList application. Based on current technical documentation and development resources for phpList: 1. Installation and Setup: The primary method for setting up a phpList development environment is using Docker, which is the officially supported approach [1][2]. For a local setup, documentation typically directs users to configure environment files (such as.env or parameter files like config/parameters.yml) manually or via provided examples [3][4][1][5]. 2. Composer Script Handlers: While ScriptHandler classes are common in PHP applications (often based on Symfony) to automate tasks like generating environment configuration files (e.g., from a.env.dist file), there is no prominent public documentation explicitly detailing a method named createDotenvConfiguration within the PhpList\Core namespace. It is highly probable that this method is an internal, non-public helper function used during the composer install process to ensure necessary configuration files exist. 3. Development Workflow: If you are setting up a development environment, you should follow the official phpList Docker development guide [4][2] or the standard local setup instructions [1]. These guides emphasize using provided example configuration files to establish your local environment rather than relying on manual invocation of internal script handlers [4][1]. If you are encountering errors related to this script handler during a composer operation, ensure your composer.json is correctly configured and that you are working within a supported phpList base distribution [3][5].

Citations:


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

tmp="$(mktemp -d)"
cd "$tmp"

echo "== fetch phpList/core refs =="
git ls-remote --heads https://github.com/phplist/core.git | grep -E '(refs/heads/|^refs/tags/).*' | sed -n '1,80p'

echo
echo "== fetch phpList/core branch metadata =="
remote="$(git ls-remote --symref https://github.com/phplist/core.git refs/heads/dev-env | sed -n '1p')"
echo "$remote"

echo
echo "== inspect repo branch if present =="
if git ls-remote https://github.com/phplist/core.git refs/heads/dev-env | grep -q 'refs/heads/dev-env'; then
  git clone --quiet --depth 1 --branch dev-env --single-branch https://github.com/phplist/core.git "$tmp/core-dev-env"
  echo "== composer handlers in core/dev-env =="
  rg -n 'createDotenvConfiguration|class ScriptHandler|ScriptHandler' "$tmp/core-dev-env"
else
  echo "dev-env branch not present"
fi

Repository: phpList/web-frontend

Length of output: 469


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

tmp="$(mktemp -d)"
cd "$tmp"

for branch in env main; do
  echo "== inspect branch $branch =="
  git clone --quiet --depth 1 --branch "$branch" --single-branch https://github.com/phplist/core.git "$tmp/core-$branch"
  echo "== relevant handler entries in core/$branch =="
  rg -n --hidden -C 3 'createDotenvConfiguration|class ScriptHandler|function create|ScriptHandler' "$tmp/core-$branch/composer.phplist-core.php" "$tmp/core-$branch" 2>/dev/null | sed -n '1,220p'
done

Repository: phpList/web-frontend

Length of output: 23028


Use the existing phplist/core branch name.

phplist/core:dev-env points to a branch that doesn’t exist in phpList/core; Composer needs a valid branch, e.g. phplist/core:dev-env if that branch is created, or another existing branch such as env.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@composer.json` at line 54, Update the phplist/core dependency version in
composer.json to reference an existing branch in phpList/core, replacing the
invalid dev-env constraint with the correct available branch name such as env.

Comment thread phpunit.xml.dist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants