Skip to content

Conversation

@AlexSkrypnyk
Copy link
Member

@AlexSkrypnyk AlexSkrypnyk commented Feb 9, 2026

Closes #2202

Summary by CodeRabbit

  • Refactor

    • Configuration loading now supports environment-based site group values instead of relying on hardcoded paths.
    • Added deprecation notices guiding users away from legacy discovery sources.
  • Bug Fixes

    • Improved error reporting when expected configuration files are missing.
    • Maintained backward compatibility to avoid breaking existing setups.
  • Tests

    • Updated functional tests to reflect the new configuration handling.

@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Walkthrough

Replaces a hardcoded Acquia settings include with a path built from the AH_SITE_GROUP environment variable, adds deprecation notes to the HostingProjectName installer handler, and removes a test assertion expecting the old hardcoded path. The new include throws a RuntimeException if the computed file is missing.

Changes

Cohort / File(s) Summary
HostingProjectName handler
​.vortex/installer/src/Prompts/Handlers/HostingProjectName.php
Added deprecation notes in discover() and process() indicating discovery from settings.acquia.php and hardcoded project names are deprecated; retained backward-compatible replacement logic.
Dynamic Acquia settings include
web/sites/default/includes/providers/settings.acquia.php
Replaced hardcoded /var/www/site-php/...-settings.inc require with a path constructed from AH_SITE_GROUP; if AH_SITE_GROUP is set and the computed file is missing, throw RuntimeException.
Tests
​.vortex/installer/tests/Functional/Handlers/HostingProjectNameHandlerProcessTest.php
Removed assertion that expected the previously hardcoded Acquia settings path in the Acquia scenario output.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

I’m a rabbit who hops through code and log,
From hardcoded stones to an env-built bog,
AH_SITE_GROUP guides my nimble feet,
If the file’s missing, I’ll loudly bleat,
Hooray for paths that find the right spot! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: updating Acquia settings to use environment variables instead of hardcoded paths for including the cloud settings file.
Linked Issues check ✅ Passed All requirements from #2202 are met: hardcoded paths replaced with environment variables (AH_SITE_GROUP), dynamic path construction implemented, and RuntimeException thrown when file not found.
Out of Scope Changes check ✅ Passed All changes are directly related to the #2202 requirement: deprecation notes in handler class for clarity, environment variable-based path construction in settings file, and test assertion removal reflecting the new behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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/2202-acquia-settings

No actionable comments were generated in the recent review. 🎉


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

@AlexSkrypnyk AlexSkrypnyk moved this from BACKLOG to In progress in Vortex Feb 9, 2026
@AlexSkrypnyk AlexSkrypnyk added this to the 1.36.0 milestone Feb 9, 2026
@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/2202-acquia-settings branch from 1802c0e to db68431 Compare February 9, 2026 05:20
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: 1

🤖 Fix all issues with AI agents
In `@web/sites/default/includes/providers/settings.acquia.php`:
- Around line 22-33: The code currently reads $ah_site_group from
getenv('AH_SITE_GROUP') and silently skips requiring the Acquia settings file
when it's empty; update the logic so that if getenv('AH_SITE_ENVIRONMENT') is
non-empty but $ah_site_group is empty, you throw a RuntimeException indicating
missing AH_SITE_GROUP (before attempting to build $ah_settings_file or require
it). In practice, add a check referencing getenv('AH_SITE_ENVIRONMENT') and
$ah_site_group and throw a descriptive RuntimeException when AH_SITE_ENVIRONMENT
is present but AH_SITE_GROUP is not, keeping the existing
$ah_settings_file/file_exists/require flow unchanged otherwise.

Comment on lines 22 to 33
// The path is built dynamically from the AH_SITE_GROUP environment variable
// provided by Acquia Cloud.
// @codeCoverageIgnoreStart
$ah_site_group = getenv('AH_SITE_GROUP');
if (!empty($ah_site_group)) {
$ah_settings_file = sprintf('/var/www/site-php/%s/%s-settings.inc', $ah_site_group, $ah_site_group);
if (!file_exists($ah_settings_file)) {
throw new \RuntimeException(sprintf('Acquia settings file "%s" not found. Check Acquia Cloud environment configuration.', $ah_settings_file));
}
// @phpstan-ignore-next-line
require '/var/www/site-php/your_site/your_site-settings.inc';
// @codeCoverageIgnoreEnd
require $ah_settings_file;
}
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

Fail fast when AH_SITE_GROUP is missing.

When AH_SITE_ENVIRONMENT is set but AH_SITE_GROUP is empty, this silently skips the include and doesn’t signal misconfiguration. The objective calls for a hard failure on misconfigured Acquia env vars—please throw if AH_SITE_GROUP is not set.

✅ Suggested fix
   // `@codeCoverageIgnoreStart`
   $ah_site_group = getenv('AH_SITE_GROUP');
-  if (!empty($ah_site_group)) {
-    $ah_settings_file = sprintf('/var/www/site-php/%s/%s-settings.inc', $ah_site_group, $ah_site_group);
-    if (!file_exists($ah_settings_file)) {
-      throw new \RuntimeException(sprintf('Acquia settings file "%s" not found. Check Acquia Cloud environment configuration.', $ah_settings_file));
-    }
-    // `@phpstan-ignore-next-line`
-    require $ah_settings_file;
-  }
+  if (empty($ah_site_group)) {
+    throw new \RuntimeException('AH_SITE_GROUP is not set. Check Acquia Cloud environment configuration.');
+  }
+  $ah_settings_file = sprintf('/var/www/site-php/%s/%s-settings.inc', $ah_site_group, $ah_site_group);
+  if (!file_exists($ah_settings_file)) {
+    throw new \RuntimeException(sprintf('Acquia settings file "%s" not found. Check Acquia Cloud environment configuration.', $ah_settings_file));
+  }
+  // `@phpstan-ignore-next-line`
+  require $ah_settings_file;
📝 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
// The path is built dynamically from the AH_SITE_GROUP environment variable
// provided by Acquia Cloud.
// @codeCoverageIgnoreStart
$ah_site_group = getenv('AH_SITE_GROUP');
if (!empty($ah_site_group)) {
$ah_settings_file = sprintf('/var/www/site-php/%s/%s-settings.inc', $ah_site_group, $ah_site_group);
if (!file_exists($ah_settings_file)) {
throw new \RuntimeException(sprintf('Acquia settings file "%s" not found. Check Acquia Cloud environment configuration.', $ah_settings_file));
}
// @phpstan-ignore-next-line
require '/var/www/site-php/your_site/your_site-settings.inc';
// @codeCoverageIgnoreEnd
require $ah_settings_file;
}
// The path is built dynamically from the AH_SITE_GROUP environment variable
// provided by Acquia Cloud.
// `@codeCoverageIgnoreStart`
$ah_site_group = getenv('AH_SITE_GROUP');
if (empty($ah_site_group)) {
throw new \RuntimeException('AH_SITE_GROUP is not set. Check Acquia Cloud environment configuration.');
}
$ah_settings_file = sprintf('/var/www/site-php/%s/%s-settings.inc', $ah_site_group, $ah_site_group);
if (!file_exists($ah_settings_file)) {
throw new \RuntimeException(sprintf('Acquia settings file "%s" not found. Check Acquia Cloud environment configuration.', $ah_settings_file));
}
// `@phpstan-ignore-next-line`
require $ah_settings_file;
🤖 Prompt for AI Agents
In `@web/sites/default/includes/providers/settings.acquia.php` around lines 22 -
33, The code currently reads $ah_site_group from getenv('AH_SITE_GROUP') and
silently skips requiring the Acquia settings file when it's empty; update the
logic so that if getenv('AH_SITE_ENVIRONMENT') is non-empty but $ah_site_group
is empty, you throw a RuntimeException indicating missing AH_SITE_GROUP (before
attempting to build $ah_settings_file or require it). In practice, add a check
referencing getenv('AH_SITE_ENVIRONMENT') and $ah_site_group and throw a
descriptive RuntimeException when AH_SITE_ENVIRONMENT is present but
AH_SITE_GROUP is not, keeping the existing $ah_settings_file/file_exists/require
flow unchanged otherwise.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/2202-acquia-settings branch from db68431 to 3c0a000 Compare February 9, 2026 05:43
@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Code Coverage Report:
  2026-02-09 05:50:04

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   93.92% (170/181)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-09 05:52:31

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   93.92% (170/181)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-09 05:53:53

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   93.92% (170/181)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-09 05:54:08

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   93.92% (170/181)

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.44%. Comparing base (f88b404) to head (3c0a000).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2260      +/-   ##
==========================================
- Coverage   77.05%   76.44%   -0.61%     
==========================================
  Files         114      107       -7     
  Lines        5988     5829     -159     
  Branches       44        0      -44     
==========================================
- Hits         4614     4456     -158     
+ Misses       1374     1373       -1     

☔ 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 merged commit 72e6150 into main Feb 9, 2026
34 of 35 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Release queue in Vortex Feb 9, 2026
@AlexSkrypnyk AlexSkrypnyk deleted the feature/2202-acquia-settings branch February 9, 2026 10:18
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.

Update Acquia settings to not use hardcoded project settings file.

1 participant