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:
- 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. - Eliminate the use of short names in packages data. If a short name is needed, there is the
FeaturesBundle::getShortName()method. - 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
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | features-namespace-2832170-3.patch | 2.44 KB | nedjo |
| #3 | features-namespace-2832170-3-tests-only.patch | 1.42 KB | nedjo |
Comments
Comment #2
nedjoAttached patch takes approach #1 from the summary. Needs tests.
Comment #3
nedjoAdding tests.
Comment #7
nedjoFailure is from #2833258: Test failure from core change.