Repository navigation
fix(drupal-contrib): rebuild caches before enabling the module, fixes #153 - #226
Merged
Merged
Conversation
…153 ## Short Summary (TL;DR) Contrib setup now runs `drush cr` between `drush si` and `drush en`, which stops the intermittent "no commands defined in the pm namespace" failures. ## The Issue - Fixes #153 The daily contrib CI jobs often fail on the first attempt and pass on rerun. Example: https://github.com/ddev/coder-ddev/actions/runs/41777312122/job/126400559017 ``` ✓ Drupal installed (6s) Enabling pathauto (module)... There are no commands defined in the "pm" namespace. Failed to run drush en pathauto -y: exit status 1 ✗ pathauto not found in enabled modules — enable failed ``` The `ddev-web` healthcheck requests the site every 10s. If a request lands during `drush si`, Drupal caches a container from a half-installed site. The next `drush en` boots from it, and Drush fails to autowire `PmCommands`: ``` [debug] Could not instantiate Drush\Commands\pm\PmCommands: Cannot autowire service "Drupal\user\PermissionHandlerInterface" ``` Drush logs this only with `--debug`. The same stale cache can also fail with `Call to undefined function Drupal\update\Hook\update_storage_clear()`. ## How This PR Solves The Issue `drush cr` after `drush si` rebuilds the container from the installed site. `drupal-core` already does this. `test-issue-branches.sh` gets the same fix. ## Manual Testing Instructions In a pathauto checkout with `ddev-drupal-contrib`, request the site in a loop: ```bash while true; do curl -s -o /dev/null "$(ddev describe -j | jq -r .raw.httpurl)"; sleep 1; done & ddev drush si minimal -y && ddev drush en pathauto -y # Expect: fails most of the time ddev drush si minimal -y && ddev drush cr && ddev drush en pathauto -y # Expect: succeeds kill %1 ``` ## Automated Testing Overview Claude Code ran the loop above locally (Drush 13.8, Drupal 11.4): without `drush cr`, 15/15 runs failed; with it, 15/15 passed. CI contrib jobs confirm the template change. 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Short Summary (TL;DR)
Contrib setup now runs
drush crbetweendrush sianddrush en, which stops the intermittent "no commands defined in the pm namespace" failures.The Issue
The daily contrib CI jobs often fail on the first attempt and pass on rerun. Example: https://github.com/ddev/coder-ddev/actions/runs/41777312122/job/126400559017
The
ddev-webhealthcheck requests the site every 10s. If a request lands duringdrush si, Drupal caches a container from a half-installed site. The nextdrush enboots from it, and Drush fails to autowirePmCommands:Drush logs this only with
--debug. The same stale cache can also fail withCall to undefined function Drupal\update\Hook\update_storage_clear().Drupal 11 is affected most. Its installer installs
systemalone beforeuserand the other profile modules, which leaves a window. Drupal 12 installs them together (#3614153), so the same loop failed 1/22 times instead of 21/21.How This PR Solves The Issue
drush crafterdrush sirebuilds the container from the installed site.drupal-corealready does this.test-issue-branches.shgets the same fix.Manual Testing Instructions
In a pathauto checkout with
ddev-drupal-contrib, request the site in a loop:Automated Testing Overview
Claude Code ran the loop above locally (Drush 13.8, Drupal 11.4): without
drush cr, 15/15 runs failed; with it, 15/15 passed. CI contrib jobs confirm the template change.🤖 Developed with assistance from Claude Code