Skip to content

remove legacyDrush check - #387

Merged
AlexSkrypnyk merged 3 commits into
jhedstrom:masterfrom
ptmkenny:legacyDrush
Jul 28, 2026
Merged

remove legacyDrush check#387
AlexSkrypnyk merged 3 commits into
jhedstrom:masterfrom
ptmkenny:legacyDrush

Conversation

@ptmkenny

@ptmkenny ptmkenny commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

 I'm on Drupal 11 with the latest Drush. My behat tests run in GHA sometimes fail because I get a RuntimeException() in bootstrap() when the runner is setting up wireguard, which causes isLegacyDrush() to resolve TRUE as it fails closed.

However, DrupalDriver now only supports Drupal 10/11, so isLegacyDrush() seems to just be dead code that can accidentally be triggered by a Drupal 11 site, which definitely can't use legacy drush.

Prepared with assistance from Claude Opus.

Summary by CodeRabbit

  • Bug Fixes

    • Drush operations now consistently use the modern non-ANSI output mode.
    • Cache clearing now follows the standard cache rebuild behavior without legacy-specific handling.
  • Tests

    • Updated coverage to verify consistent Drush flags and cache-clearing behavior.
    • Removed obsolete tests for legacy Drush detection and compatibility paths.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

DrushDriver no longer detects or tracks legacy Drush versions. Cache clearing now uses the current flow, and command construction always applies --no-ansi. Tests and test doubles were updated to remove legacy-specific coverage and behavior.

Changes

Drush legacy handling

Layer / File(s) Summary
Remove legacy detection
src/Drupal/Driver/DrushDriver.php, tests/Drupal/Tests/Driver/Unit/DrushDriverTest.php, tests/Drupal/Tests/Driver/Unit/DrushDriverMethodsTest.php
Legacy state, bootstrap detection, isLegacyDrush(), related helpers, and detection tests were removed.
Use current Drush behavior
src/Drupal/Driver/DrushDriver.php, tests/Drupal/Tests/Driver/Unit/DrushDriverMethodsTest.php
Cache clearing uses the current flow, drushResult() always adds --no-ansi, and supporting tests and stubs were updated.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

Suggested reviewers: alexskrypnyk

🚥 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 accurately summarizes the main change: removing the legacy Drush detection check.
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

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
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
tests/Drupal/Tests/Driver/Unit/DrushDriverMethodsTest.php (2)

71-79: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the complete default cache-clear sequence.

Verify cache-clear drush occurs before cache:rebuild, not just that a rebuild exists.

🤖 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 `@tests/Drupal/Tests/Driver/Unit/DrushDriverMethodsTest.php` around lines 71 -
79, Update testCacheClearRebuilds to assert the complete default cache-clear
command sequence: verify cache-clear drush appears before cache:rebuild in the
recorded driver invocations, while retaining coverage that the invocations are
non-empty.

31-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that bootstrap does not invoke Drush.

Also assert $driver->invocations is empty after bootstrap(). This locks in removal of the version probe that could throw during bootstrap.

🤖 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 `@tests/Drupal/Tests/Driver/Unit/DrushDriverMethodsTest.php` around lines 31 -
36, Update testBootstrapMarksAsBootstrapped to assert that $driver->invocations
is empty immediately after bootstrap(), while preserving the existing
bootstrapped-state assertions. This verifies bootstrap no longer invokes Drush
or performs the removed version probe.
🤖 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.

Nitpick comments:
In `@tests/Drupal/Tests/Driver/Unit/DrushDriverMethodsTest.php`:
- Around line 71-79: Update testCacheClearRebuilds to assert the complete
default cache-clear command sequence: verify cache-clear drush appears before
cache:rebuild in the recorded driver invocations, while retaining coverage that
the invocations are non-empty.
- Around line 31-36: Update testBootstrapMarksAsBootstrapped to assert that
$driver->invocations is empty immediately after bootstrap(), while preserving
the existing bootstrapped-state assertions. This verifies bootstrap no longer
invokes Drush or performs the removed version probe.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d5fd86e5-f754-4e40-bcf1-b6c381e2cd87

📥 Commits

Reviewing files that changed from the base of the PR and between 8176be0 and 3cb7771.

📒 Files selected for processing (3)
  • src/Drupal/Driver/DrushDriver.php
  • tests/Drupal/Tests/Driver/Unit/DrushDriverMethodsTest.php
  • tests/Drupal/Tests/Driver/Unit/DrushDriverTest.php
💤 Files with no reviewable changes (1)
  • tests/Drupal/Tests/Driver/Unit/DrushDriverTest.php

@ptmkenny

Copy link
Copy Markdown
Contributor Author

Failing rector change appears to be due to a new version of rector; I can fix it in this MR, but it may be out of scope, so I won't fix it until requested.

@AlexSkrypnyk

Copy link
Copy Markdown
Collaborator

@ptmkenny
Thank you for your contribution. The rector issues are now fixed on master. Could you please rebase this PR and I will merge and release.

@AlexSkrypnyk

AlexSkrypnyk commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@ptmkenny
I can see that the smoke testing is failing. I'm looking into how to resolve this.n Thank you for your patience.

@AlexSkrypnyk

Copy link
Copy Markdown
Collaborator

@ptmkenny
Could you please rebase again from master. thank you

@ptmkenny

Copy link
Copy Markdown
Contributor Author

@AlexSkrypnyk All passed this time!

@AlexSkrypnyk
AlexSkrypnyk merged commit 0811772 into jhedstrom:master Jul 28, 2026
13 checks passed
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