Problem/Motivation

In #2401073: Assign inter-feature dependencies we introduced handling to ensure that features depended on other features that provide configuration that is a dependency. However, this is not occurring for features in the same bundle--let alone for modules outside the feature bundle..

Steps to reproduce:

  • Install with the Standard install profile.
  • Install Features UI and dependencies.
  • Create a custom bundle, 'one'; do not include an install profile.
  • Export all detected features of that bundle. Result: features including one_article are missing the dependency on one_core (which provides configuration required by configuration in one_article).
  • Create a new bundle, 'two', configuring it to include the install profile.
  • Export the install profile. Result: the install profile includes several block configuration items but does not have dependencies on the features from the 'one' bundle that provide configuration required by those blocks.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nedjo created an issue. See original summary.

nedjo’s picture

Priority: Normal » Major
Issue summary: View changes

Elevating to major as this leads to install errors when features are installed before their dependencies.

nedjo’s picture

Assigned: Unassigned » nedjo

Working on this.

nedjo’s picture

Status: Active » Needs review
FileSize
8.25 KB

The main issue was that we were looking for packages using the package name without a bundle prefix, while, because FeaturesManager::assignInterPackageDependencies() is invoked after ::setPackageBundleNames() has been called, package names were prefixed (if part of a custom bundle). Our test FeaturesManagerTest::testAssignInterPackageDependenciesWithBundle() wasn't detecting this problem because it didn't call ::setPackageBundleNames() before invoking FeaturesManager::assignInterPackageDependencies().

To facilitate testing, I've converted ::setPackageBundleNames() into a public method on Features ManagerInterface.

dawehner’s picture

dawehner’s picture

We talked about the $bundle = NULL bit for a while. Nedjo and myself agreed that having a fallback in there is not optional and we should try to remove it.
If this would not be possible (note there are still callers with = NULL around), we should at least throw an exception to better be able to understand what is going on.

On top of that we talked about possible invariants in which the call to setPackageBundleNames would always be true. Ensuring this
could reduce fragility quite a bit.

nedjo’s picture

FileSize
0 bytes
8.49 KB

Initial round of changes dropping the $bundle = NULL default and hence the fallback.

Status: Needs review » Needs work

The last submitted patch, 7: 2649302-7.patch, failed testing.

nedjo’s picture

Status: Needs work » Needs review
FileSize
15.95 KB
12.73 KB

Ignore #7 (patch file was empty).

Initial round of changes dropping the $bundle = NULL default and hence the fallback.

Most of this is just changing the order of arguments, putting $bundle before $package_names because the latter has a default value.

nedjo’s picture

Adding the second change from #6, addressing fragility.

nedjo’s picture

FileSize
17.61 KB
1.71 KB

Add a test for the exception added in #10, and fix a misnamed property.

  • nedjo committed 52521a9 on 8.x-3.x
    Issue #2649302 by nedjo, dawehner: Inter-feature dependencies not being...
nedjo’s picture

Status: Needs review » Fixed

Committed. Moving follow-up test coverage gap to #2607782: Feature should not declare dependency on itself.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.