Problem/Motivation

The namespace assignment plugin assigns configuration items to features based on matching the "short name" of the feature (for example, article for the feature example_article, where example is the bundle name).

When an existing feature has a bundle-prefixed machine name such as example_article, however, namespace matching currently fails.

The bug arises from #2745023: Features Drush commands are using shortname instead of the expected module name (fullname). Prior to that patch, the short name was used as the machine name for all packages, and also as the array key in the FeaturesManager::packages property. After that patch, machine names and FeaturesManager::packages keys are a mixture of short and full names. In the namespace assignment plugin (and in other places in the code base), array keys are extracted from packages returned by FeaturesManager::getPackages(). These keys are then used as the patterns to match against. Those patterns formed from short names work as expected, but those with full names do not. For example, while the pattern article will match a configuration item named article_type, the pattern example_article will not.

More broadly, an issue here is inconsistency in our data model, which mixes short and long names.

We have a test for the assignment plugin, but this bug is not showing up because we don't test the case of assigning to an existing feature.

Proposed resolution

Three possible fixes are:

  1. Rework relevant code in the namespace assignment plugin to work with both short and long names. Also (in another issue) review all other usage of package machine names and keys as returned by FeaturesManager::getPackages() to determine if undetected bugs are present.
  2. Eliminate the use of short names in packages data. If a short name is needed, there is the FeaturesBundle::getShortName() method.
  3. Roll back #2745023: Features Drush commands are using shortname instead of the expected module name (fullname) and any related fixes subsequently made to address the mix of full and short machine names in packages data.

In any case, we should extend test coverage to include assigning configuration to existing features.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

nedjo created an issue. See original summary.

nedjo’s picture

StatusFileSize
new1.02 KB

Attached patch takes approach #1 from the summary. Needs tests.

nedjo’s picture

Status: Active » Needs review
StatusFileSize
new1.42 KB
new2.44 KB

Adding tests.

The last submitted patch, 3: features-namespace-2832170-3-tests-only.patch, failed testing.

The last submitted patch, 3: features-namespace-2832170-3.patch, failed testing.

  • nedjo committed 9d4cc90 on 8.x-3.x
    Issue #2832170 by nedjo: Namespace assignment method broken for existing...
nedjo’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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