Skip to content

Sequence of module load order should be deterministic #8479

Closed
@scottsb

Description

@scottsb

Preconditions

Magento 2.1.3

Steps to reproduce

  1. Developer enables a new module using CLI command.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedfeature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions