Skip to content

Conversation

@AlexSkrypnyk
Copy link
Member

@AlexSkrypnyk AlexSkrypnyk commented Aug 25, 2025

Closes #1886

Summary by CodeRabbit

  • New Features

    • Automatically includes the Lagoon logging package during setup when Lagoon is selected as the hosting provider, enabling out-of-the-box log integration in Lagoon environments.
    • Composer configuration is updated accordingly during project initialization.
  • Other Providers

    • No changes for Acquia or Other hosting options.

@coderabbitai
Copy link

coderabbitai bot commented Aug 25, 2025

Walkthrough

Adds logic in HostingProvider::process() for Lagoon: after removing target htaccess, it loads composer.json from the temp directory, uses JsonManipulator to add a require entry for drupal/lagoon_logs:^3, and writes the updated composer.json back. Other providers unchanged.

Changes

Cohort / File(s) Summary
Installer: Lagoon composer augmentation
.vortex/installer/src/Prompts/Handlers/HostingProvider.php
Import JsonManipulator; in Lagoon branch, load temp composer.json, add require drupal/lagoon_logs with version ^3 (using addLink with TRUE), and write back to temp composer.json. No changes for Acquia/Other branches.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant U as User
    participant I as Installer CLI
    participant HP as HostingProvider::process()
    participant FS as File System
    participant JM as JsonManipulator

    U->>I: Select hosting provider (Lagoon)
    I->>HP: process(selection="LAGOON", tmpDir)
    HP->>FS: Remove target .htaccess
    note over HP,FS: Existing step retained
    HP->>FS: Read tmpDir/composer.json
    FS-->>HP: composer.json contents
    HP->>JM: addLink(require, "drupal/lagoon_logs", "^3", true)
    JM-->>HP: Updated JSON
    HP->>FS: Write tmpDir/composer.json
    FS-->>HP: OK
    HP-->>I: Done
    I-->>U: Installer continues
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Add drupal/lagoon_logs when hosting provider is Lagoon (#1886)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
None detected All changes align with adding drupal/lagoon_logs for Lagoon selection.

Poem

A whisk of whiskers, code in tow,
I hop through installers, watch it grow—
Lagoon selected? Logs now bloom,
Composer hums a tidy tune.
Thump-thump! The pipeline sings,
With lagoo_n logs on sprightly springs.
Carrots deployed; success rings! 🥕✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 phpcs (3.7.2)
.vortex/installer/src/Prompts/Handlers/HostingProvider.php

ERROR: Referenced sniff "Drupal" does not exist

Run "phpcs --help" for usage information

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/1886-add-lagoon-logs

🪧 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 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.

@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (rebase) August 25, 2025 09:02
@github-actions github-actions bot temporarily deployed to commit August 25, 2025 09:04 Inactive
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

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 88043f3 and 5618410.

⛔ Files ignored due to path filters (2)
  • .vortex/installer/tests/Fixtures/install/hosting_lagoon/composer.json is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/provision_database_lagoon/composer.json is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (1)
  • .vortex/installer/src/Prompts/Handlers/HostingProvider.php (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: build (1)
  • GitHub Check: build (0)
  • GitHub Check: vortex-test-deployment (0)
  • GitHub Check: vortex-test-deployment (1)
  • GitHub Check: vortex-test-workflow (1)
  • GitHub Check: vortex-test-workflow (3)
  • GitHub Check: vortex-test-workflow (0)
  • GitHub Check: vortex-test-workflow (2)
  • GitHub Check: vortex-test-common
  • GitHub Check: vortex-test-installer (8.3)
  • GitHub Check: vortex-test-installer (8.2)
  • GitHub Check: vortex-test-installer (8.4)
  • GitHub Check: vortex-test-docs
🔇 Additional comments (1)
.vortex/installer/src/Prompts/Handlers/HostingProvider.php (1)

9-9: Import looks correct and scoped appropriately.

Brings JsonManipulator into scope for the new Lagoon branch logic. No concerns.

Comment on lines +94 to +96
$cj = JsonManipulator::fromFile($this->tmpDir . '/composer.json');
$cj->addLink('require', 'drupal/lagoon_logs', '^3', TRUE);
file_put_contents($this->tmpDir . '/composer.json', $cj->getContents());
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Harden composer.json manipulation: guard rails + consistency.

Current code assumes composer.json exists and is readable, and writes without a lock. Also mixes $this->tmpDir with the local $t var. Recommend guarding existence/readability, using the local $t for consistency, checking addLink’s return value, and writing with LOCK_EX.

Apply this diff:

-      $cj = JsonManipulator::fromFile($this->tmpDir . '/composer.json');
-      $cj->addLink('require', 'drupal/lagoon_logs', '^3', TRUE);
-      file_put_contents($this->tmpDir . '/composer.json', $cj->getContents());
+      $composerPath = sprintf('%s/composer.json', $t);
+      if (is_file($composerPath) && is_readable($composerPath)) {
+        $cj = JsonManipulator::fromFile($composerPath);
+        if ($cj->addLink('require', 'drupal/lagoon_logs', '^3', TRUE)) {
+          file_put_contents($composerPath, $cj->getContents(), LOCK_EX);
+        }
+      }

If JsonManipulator::addLink() throws on invalid JSON or returns a non-boolean, consider wrapping in a try/catch and surfacing a friendly message to avoid installer crashes.

📝 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
$cj = JsonManipulator::fromFile($this->tmpDir . '/composer.json');
$cj->addLink('require', 'drupal/lagoon_logs', '^3', TRUE);
file_put_contents($this->tmpDir . '/composer.json', $cj->getContents());
$composerPath = sprintf('%s/composer.json', $t);
if (is_file($composerPath) && is_readable($composerPath)) {
$cj = JsonManipulator::fromFile($composerPath);
if ($cj->addLink('require', 'drupal/lagoon_logs', '^3', TRUE)) {
file_put_contents($composerPath, $cj->getContents(), LOCK_EX);
}
}
🤖 Prompt for AI Agents
.vortex/installer/src/Prompts/Handlers/HostingProvider.php lines 94-96: the code
assumes composer.json exists and is readable, uses $this->tmpDir instead of the
local $t var, doesn't check the result of addLink and writes without LOCK_EX;
update to first check that $t . '/composer.json' exists and is readable and
throw or return a clear installer-friendly error if not, use the local $t
variable everywhere for path consistency, call JsonManipulator::fromFile() and
wrap the addLink call in a try/catch to handle thrown exceptions or non-boolean
returns (and surface a friendly message), check the return value of addLink
before proceeding, and write the final contents with file_put_contents(...,
LOCK_EX) to avoid race conditions.

$this->removeAcquia();
@unlink(sprintf('%s/%s/.htaccess', $t, $w));
$cj = JsonManipulator::fromFile($this->tmpDir . '/composer.json');
$cj->addLink('require', 'drupal/lagoon_logs', '^3', TRUE);
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Double-check the version constraint '^3' against the template’s Drupal core.

If the project template targets a newer core that requires a later major of drupal/lagoon_logs, you may want to use a widened constraint (e.g., ^3 || ^4) or align to the matrix supported by your baseline. Please verify against the latest module releases.


🌐 Web query:

What is the latest stable major of the Composer package "drupal/lagoon_logs" and which Drupal core versions does it support?

💡 Result:

Searching for current package info... I’ll fetch and verify the latest stable major for drupal/lagoon_logs and its supported Drupal core versions, then cite sources.


🌐 Web query:

What is the latest stable major of the Composer package "drupal/lagoon_logs" and which Drupal core versions does it support?

💡 Result:

Search results indicate the Composer package "drupal/lagoon_logs" latest stable major is 2.x, which supports Drupal core 9 and 10. Source: project page on Drupal.org and the package release notes [1][2].

Sources:
[1] https://www.drupal.org/project/lagoon_logs
[2] https://www.drupal.org/project/lagoon_logs/releases


Update lagoon_logs version constraint to match latest stable major

The current constraint ^3 will fail because the latest stable major of drupal/lagoon_logs is 2.x (supporting Drupal core 9 and 10). Please adjust the constraint accordingly:

  • File: .vortex/installer/src/Prompts/Handlers/HostingProvider.php
    Line 95: change
    $cj->addLink('require', 'drupal/lagoon_logs', '^3', TRUE);
    to either
    $cj->addLink('require', 'drupal/lagoon_logs', '^2', TRUE);
    or, if you plan to adopt future 3.x releases once available, a widened range:
    $cj->addLink('require', 'drupal/lagoon_logs', '^2 || ^3', TRUE);
🤖 Prompt for AI Agents
.vortex/installer/src/Prompts/Handlers/HostingProvider.php around line 95: the
composer requirement currently pins drupal/lagoon_logs to ^3 which is
incompatible with the latest stable major (2.x); update the addLink call to
require a compatible constraint (e.g. ^2) or a widened range supporting both
current and future majors (e.g. ^2 || ^3) so the installer will not fail
resolving dependencies.

@codecov
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.24%. Comparing base (88043f3) to head (5618410).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1940      +/-   ##
===========================================
+ Coverage    76.23%   76.24%   +0.01%     
===========================================
  Files           87       87              
  Lines         5382     5385       +3     
  Branches        35       35              
===========================================
+ Hits          4103     4106       +3     
  Misses        1279     1279              

☔ 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 1291e8e into develop Aug 25, 2025
30 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/1886-add-lagoon-logs branch August 25, 2025 09:22
@github-project-automation github-project-automation bot moved this from BACKLOG to Release queue in Vortex Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[INSTALLER] Add drupal/lagoon_logs if the selected hosting provider is Lagoon

2 participants