Skip to content

Conversation

@AlexSkrypnyk
Copy link
Member

@AlexSkrypnyk AlexSkrypnyk commented Feb 10, 2026

Summary

  • Added drush/php-ini/drush.ini with configurable PHP runtime settings (default: memory_limit=512M) that are auto-discovered via PHP_INI_SCAN_DIR.
  • Updated .docker/cli.dockerfile to set PHP_INI_SCAN_DIR so the CLI container automatically picks up the custom ini file.
  • Updated hooks/library/provision.sh to export PHP_INI_SCAN_DIR for Acquia deployments.
  • Added documentation section in .vortex/docs/content/tools/drush.mdx explaining how to modify Drush PHP runtime configuration.
  • Added Docker Compose workflow test in SubtestDockerComposeTrait that verifies ini values are applied and can be changed.

Closes #1913

Test plan

  • Verify drush/php-ini/drush.ini exists with memory_limit = 512M.
  • Build Docker stack and verify php -r "echo ini_get('memory_limit');" returns 512M inside the CLI container.
  • Change memory_limit in drush.ini, sync to container, and verify the new value is picked up.
  • Verify the workflow test subtestDockerComposeDrushPhpIni() passes in CI.

Summary by CodeRabbit

  • New Features

    • Drush now supports custom PHP runtime configuration, enabling adjustments like memory_limit to better handle heavy operations (imports, config sync).
  • Documentation

    • Added a guide describing how to provide and auto-discover editable PHP settings for Drush and recommended practices to avoid overriding hosting defaults.
  • Tests

    • Added functional tests to validate the custom PHP configuration behavior.

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

Walkthrough

This PR introduces customizable PHP runtime configuration for Drush CLI by adding a drush.ini file, setting PHP_INI_SCAN_DIR in Docker and provisioning scripts to discover it, updating documentation, and adding tests that exercise modifying and applying the drush.ini. A duplicate test method definition was also added in the trait.

Changes

Cohort / File(s) Summary
Docker CLI config
.docker/cli.dockerfile
Appends /app/drush/php-ini to PHP_INI_SCAN_DIR in the Docker CLI image environment.
Provisioning environment
hooks/library/provision.sh
Initializes and exports PHP_INI_SCAN_DIR to include $(pwd)/drush/php-ini so Drush picks up the custom ini during provisioning.
Drush PHP INI
drush/php-ini/drush.ini
Adds drush.ini with memory_limit = 512M and header comments describing purpose and discovery via PHP_INI_SCAN_DIR.
Documentation
.vortex/docs/content/tools/drush.mdx
Adds "PHP runtime configuration" section explaining drush/php-ini/drush.ini, PHP_INI_SCAN_DIR auto-discovery, example memory_limit change, and note about preserving default scan dirs.
Tests — orchestration
.vortex/tests/phpunit/Functional/DockerComposeWorkflowTest.php
Inserts a call to the new subtest subtestDockerComposeDrushPhpIni() into the full workflow test sequence.
Tests — implementation
.vortex/tests/phpunit/Traits/Subtests/SubtestDockerComposeTrait.php
Adds protected function subtestDockerComposeDrushPhpIni(): void which verifies default drush.ini values, modifies memory_limit, syncs to container, verifies changes, applies additional directives, and restores the original file. Note: the method was added twice (duplicate definitions), which will cause a redeclaration error and needs correction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested labels

Confirmed

Poem

🐇 I hopped to the ini, nibbling lines so fine,
I set memory higher, then trimmed it twice in time.
With PHP paths found and tests in a row,
Drush hums along where config seeds grow. 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the PR: allowing modification of Drush PHP runtime configuration through a new customizable PHP ini file.
Linked Issues check ✅ Passed The PR successfully implements both coding requirements from issue #1913: enables Drush PHP runtime configuration modification via drush/php-ini/drush.ini and updates Tools > Drush documentation as requested.
Out of Scope Changes check ✅ Passed All changes are within scope: new Drush PHP ini file, Docker configuration updates, provisioning script updates, documentation, and test coverage all directly support the core objective of allowing Drush PHP runtime configuration modification.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/1913-drush-php-ini

No actionable comments were generated in the recent review. 🎉


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

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1913-drush-php-ini branch from c516c61 to a19b80c Compare February 10, 2026 04:10
@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-10 04:16:20

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@github-actions

This comment has been minimized.

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

🤖 Fix all issues with AI agents
In @.vortex/tests/phpunit/Traits/Subtests/SubtestDockerComposeTrait.php:
- Around line 278-321: Wrap the parts of subtestDockerComposeDrushPhpIni that
modify drush/php-ini/drush.ini and run assertions in a try/finally so the
original file is always restored: call fileBackup($ini_file) before
modifications, then in a finally block call fileRestore($ini_file) and
syncToContainer($ini_file) to ensure restoration and container sync even if an
assertion (or any exception) fails; keep existing cmd/assert checks inside the
try and ensure the final logStepFinish() remains after restoration.

In `@hooks/library/provision.sh`:
- Around line 14-18: The PHP_INI_SCAN_DIR assignment can drop the default scan
dirs when the existing value lacks a leading colon; update the logic in
hooks/library/provision.sh around the PHP_INI_SCAN_DIR assignment so that you
normalize the existing PHP_INI_SCAN_DIR by ensuring it begins with a colon (if
non-empty and not already starting with ':') before appending
:$(pwd)/drush/php-ini, then export PHP_INI_SCAN_DIR; reference the
PHP_INI_SCAN_DIR variable in your change.

Comment on lines +278 to +321
protected function subtestDockerComposeDrushPhpIni(): void {
$this->logStepStart();

$ini_file = 'drush/php-ini/drush.ini';

$this->logSubstep('Assert default PHP ini values from drush.ini are applied.');
$this->assertFileExists($ini_file, 'Drush PHP ini file should exist');
$this->assertFileContainsString($ini_file, 'memory_limit = 512M', 'Drush PHP ini file should contain default memory_limit');
$this->cmd(
'docker compose exec -T cli php -r "echo ini_get(\'memory_limit\');"',
'512M',
'PHP memory_limit should be 512M from drush.ini'
);

$this->logSubstep('Assert PHP ini values are updated when drush.ini is changed.');
$this->fileBackup($ini_file);
File::dump($ini_file, "memory_limit = 256M\n");
$this->syncToContainer($ini_file);
$this->cmd(
'docker compose exec -T cli php -r "echo ini_get(\'memory_limit\');"',
'256M',
'PHP memory_limit should be 256M after changing drush.ini'
);

$this->logSubstep('Assert multiple PHP ini directives are applied.');
File::dump($ini_file, "memory_limit = 1024M\nerror_reporting = E_ALL\n");
$this->syncToContainer($ini_file);
$this->cmd(
'docker compose exec -T cli php -r "echo ini_get(\'memory_limit\');"',
'1024M',
'PHP memory_limit should be 1024M after second change'
);
$this->cmd(
'docker compose exec -T cli php -r "echo ini_get(\'error_reporting\');"',
'32767',
'PHP error_reporting should be 32767 (E_ALL) from drush.ini'
);

$this->logSubstep('Restore drush.ini to original state.');
$this->fileRestore($ini_file);
$this->syncToContainer($ini_file);

$this->logStepFinish();
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Ensure drush.ini is always restored (even on assertion failures).
A failing assertion before restore will leave the file modified and can cascade into later tests.

✅ Suggested fix (try/finally restore)
-    $this->logSubstep('Assert PHP ini values are updated when drush.ini is changed.');
-    $this->fileBackup($ini_file);
-    File::dump($ini_file, "memory_limit = 256M\n");
-    $this->syncToContainer($ini_file);
-    $this->cmd(
-      'docker compose exec -T cli php -r "echo ini_get(\'memory_limit\');"',
-      '256M',
-      'PHP memory_limit should be 256M after changing drush.ini'
-    );
-
-    $this->logSubstep('Assert multiple PHP ini directives are applied.');
-    File::dump($ini_file, "memory_limit = 1024M\nerror_reporting = E_ALL\n");
-    $this->syncToContainer($ini_file);
-    $this->cmd(
-      'docker compose exec -T cli php -r "echo ini_get(\'memory_limit\');"',
-      '1024M',
-      'PHP memory_limit should be 1024M after second change'
-    );
-    $this->cmd(
-      'docker compose exec -T cli php -r "echo ini_get(\'error_reporting\');"',
-      '32767',
-      'PHP error_reporting should be 32767 (E_ALL) from drush.ini'
-    );
-
-    $this->logSubstep('Restore drush.ini to original state.');
-    $this->fileRestore($ini_file);
-    $this->syncToContainer($ini_file);
-
-    $this->logStepFinish();
+    $this->fileBackup($ini_file);
+    try {
+      $this->logSubstep('Assert PHP ini values are updated when drush.ini is changed.');
+      File::dump($ini_file, "memory_limit = 256M\n");
+      $this->syncToContainer($ini_file);
+      $this->cmd(
+        'docker compose exec -T cli php -r "echo ini_get(\'memory_limit\');"',
+        '256M',
+        'PHP memory_limit should be 256M after changing drush.ini'
+      );
+
+      $this->logSubstep('Assert multiple PHP ini directives are applied.');
+      File::dump($ini_file, "memory_limit = 1024M\nerror_reporting = E_ALL\n");
+      $this->syncToContainer($ini_file);
+      $this->cmd(
+        'docker compose exec -T cli php -r "echo ini_get(\'memory_limit\');"',
+        '1024M',
+        'PHP memory_limit should be 1024M after second change'
+      );
+      $this->cmd(
+        'docker compose exec -T cli php -r "echo ini_get(\'error_reporting\');"',
+        '32767',
+        'PHP error_reporting should be 32767 (E_ALL) from drush.ini'
+      );
+    }
+    finally {
+      $this->logSubstep('Restore drush.ini to original state.');
+      $this->fileRestore($ini_file);
+      $this->syncToContainer($ini_file);
+      $this->logStepFinish();
+    }
🤖 Prompt for AI Agents
In @.vortex/tests/phpunit/Traits/Subtests/SubtestDockerComposeTrait.php around
lines 278 - 321, Wrap the parts of subtestDockerComposeDrushPhpIni that modify
drush/php-ini/drush.ini and run assertions in a try/finally so the original file
is always restored: call fileBackup($ini_file) before modifications, then in a
finally block call fileRestore($ini_file) and syncToContainer($ini_file) to
ensure restoration and container sync even if an assertion (or any exception)
fails; keep existing cmd/assert checks inside the try and ensure the final
logStepFinish() remains after restoration.

Comment on lines +14 to +18
# Allow custom PHP runtime configuration for Drush CLI commands.
# The leading colon appends to the default scan directories.
# @see https://github.com/drevops/vortex/issues/1913
PHP_INI_SCAN_DIR="${PHP_INI_SCAN_DIR:-}:$(pwd)/drush/php-ini"
export PHP_INI_SCAN_DIR
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat docs/deployment.md

Repository: drevops/vortex

Length of output: 1704


🏁 Script executed:

cat -n hooks/library/provision.sh

Repository: drevops/vortex

Length of output: 848


Ensure PHP_INI_SCAN_DIR preserves default scan directories when already set.

If PHP_INI_SCAN_DIR is already defined in the environment without a leading colon (possible from Acquia), the current assignment concatenates without a leading colon, causing PHP to skip its default configuration directories. Normalize the value to ensure a leading colon is always present before appending.

Suggested fix
-# Allow custom PHP runtime configuration for Drush CLI commands.
-# The leading colon appends to the default scan directories.
-# `@see` https://github.com/drevops/vortex/issues/1913
-PHP_INI_SCAN_DIR="${PHP_INI_SCAN_DIR:-}:$(pwd)/drush/php-ini"
-export PHP_INI_SCAN_DIR
+# Allow custom PHP runtime configuration for Drush CLI commands.
+# The leading colon appends to the default scan directories.
+# `@see` https://github.com/drevops/vortex/issues/1913
+ini_scan_dir="${PHP_INI_SCAN_DIR:-}"
+if [ -n "${ini_scan_dir}" ] && [[ "${ini_scan_dir}" != :* ]]; then
+  ini_scan_dir=":${ini_scan_dir}"
+fi
+PHP_INI_SCAN_DIR="${ini_scan_dir:-:}:$(pwd)/drush/php-ini"
+export PHP_INI_SCAN_DIR
📝 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
# Allow custom PHP runtime configuration for Drush CLI commands.
# The leading colon appends to the default scan directories.
# @see https://github.com/drevops/vortex/issues/1913
PHP_INI_SCAN_DIR="${PHP_INI_SCAN_DIR:-}:$(pwd)/drush/php-ini"
export PHP_INI_SCAN_DIR
# Allow custom PHP runtime configuration for Drush CLI commands.
# The leading colon appends to the default scan directories.
# `@see` https://github.com/drevops/vortex/issues/1913
ini_scan_dir="${PHP_INI_SCAN_DIR:-}"
if [ -n "${ini_scan_dir}" ] && [[ "${ini_scan_dir}" != :* ]]; then
ini_scan_dir=":${ini_scan_dir}"
fi
PHP_INI_SCAN_DIR="${ini_scan_dir:-:}:$(pwd)/drush/php-ini"
export PHP_INI_SCAN_DIR
🤖 Prompt for AI Agents
In `@hooks/library/provision.sh` around lines 14 - 18, The PHP_INI_SCAN_DIR
assignment can drop the default scan dirs when the existing value lacks a
leading colon; update the logic in hooks/library/provision.sh around the
PHP_INI_SCAN_DIR assignment so that you normalize the existing PHP_INI_SCAN_DIR
by ensuring it begins with a colon (if non-empty and not already starting with
':') before appending :$(pwd)/drush/php-ini, then export PHP_INI_SCAN_DIR;
reference the PHP_INI_SCAN_DIR variable in your change.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-10 04:19:46

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-10 04:19:53

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.46%. Comparing base (ff7b4c6) to head (275b793).
⚠️ Report is 2 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (ff7b4c6) and HEAD (275b793). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (ff7b4c6) HEAD (275b793)
14 12
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2268      +/-   ##
==========================================
- Coverage   84.19%   76.46%   -7.73%     
==========================================
  Files          75      107      +32     
  Lines        3751     5834    +2083     
  Branches       44        0      -44     
==========================================
+ Hits         3158     4461    +1303     
- Misses        593     1373     +780     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1913-drush-php-ini branch from a19b80c to 275b793 Compare February 10, 2026 04:29
@github-actions
Copy link

Code Coverage Report:
  2026-02-10 04:35:52

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-10 04:36:06

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-10 04:38:31

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-10 04:39:18

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk AlexSkrypnyk added this to the 1.36.0 milestone Feb 10, 2026
@AlexSkrypnyk AlexSkrypnyk moved this from BACKLOG to In progress in Vortex Feb 10, 2026
@AlexSkrypnyk AlexSkrypnyk merged commit 0b084ea into main Feb 10, 2026
27 of 28 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/1913-drush-php-ini branch February 10, 2026 06:00
@github-project-automation github-project-automation bot moved this from In progress to Release queue in Vortex Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Release queue

Development

Successfully merging this pull request may close these issues.

Allow to modify Drush PHP runtime configuration

1 participant