Description
Preconditions
Magento 2.1.3
Steps to reproduce
- Developer enables a new module using CLI command.
- Magento adds an entry for the module to
config.php
.
Expected result
The only change to config.php
is the addition of the module that changed.
Actual result
In addition to the new line for the new module, many other lines change sequence.
Discussion
It seems that the current semi-official recommendation is not to version the config.php
file with the code base and to treat it as an asset along with images, as evidenced by the fact that it is git-ignored in the Magento repository by default and by the fact this advice is upvoted and without alternative:
http://magento.stackexchange.com/a/130109/567
If I understand the intent behind this recommendation, it's that one should be able to pull the latest copy of the code without immediately breaking the site due to an incompatible database schema. My counterpoint is that since themes and existing modules may be modified to depend on certain new modules being enabled, pulling code without including config.php
is just as likely to break a site.
Ultimately whether config.php
is versioned or not is probably a decision best made by each individual implementor. However, for us, it definitely makes sense to version it. It allows us to have one atomic unit of enabled code to test and deploy from dev through to production. I know others will agree, given the comments on #800 and the original Stack Exchange question referenced above.
Given that, in order to minimize merge conflicts, it would be best for the sequence of modules in config.php
to be deterministically generated. It appears that currently it is based on the module load order, but that is not fully deterministic. Since the sequence of modules in config.php
is not itself used to determine any programatic behavior, my suggestion is that the array be sorted alphabetically by key, but I would consider any deterministic ordering to meet the goal.