Add configuration for additional known files in project root

Created on 20 June 2025, about 1 month ago

Problem/Motivation

The Composer Patches plugin reads from patches.json as well as from composer.json. These files are unknown to Automatic Updates. By default, Package Manager excludes unknown files from the staging folder, so patches that would be applied in a Composer update are not applied in an automatic update. Currently the only workaround is to copy all unknown files to the staging folder.

Steps to reproduce

  1. Move patches to patches.json.
  2. Run composer install.
  3. Run composer update to set Drupal to an outdated version.
  4. Use Automatic Updates to update.
  5. Patches are not applied.

Proposed resolution

Add a configuration option for additional known files.

Remaining tasks

  1. Create branch to fix issue.
  2. Review code.
  3. Test.
  4. Merge branch.

User interface changes

None.

API changes

New configuration option to add known files to Automatic Updates.

Data model changes

Config schema has new additional_known_files_in_project_root option that defaults to an empty array.

πŸ› Bug report
Status

Active

Version

11.2 πŸ”₯

Component

package_manager.module

Created by

πŸ‡ΊπŸ‡ΈUnited States darren oh Lakeland, Florida

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @darren oh
  • πŸ‡ΊπŸ‡ΈUnited States darren oh Lakeland, Florida
  • Pipeline finished with Failed
    about 1 month ago
    Total: 746s
    #527701
  • πŸ‡ΊπŸ‡ΈUnited States darren oh Lakeland, Florida

    darren oh β†’ changed the visibility of the branch 11.x to hidden.

  • πŸ‡ΊπŸ‡ΈUnited States darren oh Lakeland, Florida
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    What's wrong with just flipping the already-existing include_unknown_files_in_project_root switch? Adding a whole new configuration option for this seems like overkill to me.

  • Pipeline finished with Failed
    1 day ago
    Total: 697s
    #556321
  • πŸ‡ΊπŸ‡ΈUnited States darren oh Lakeland, Florida

    I don’t want to include unknown files or fight with you over what files should be considered known.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Not intending to fight!

    The include_unknown_files_in_project_root switch would do what you want, but it sounds like you want to tailor the allow list, rather than do a flat allow-all/reject-all as is currently the case. Is that accurate?

    If so, I'm on board with making it more flexible, but I'm not sure that adding an entirely new setting is the best way to do it. Maybe we could convert include_unknown_files_in_project_root into an allow-list of paths, rather than having it be a boolean. Not sure. What does your use case call for?

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    For example: what if, rather than adding a new setting, we converted include_unknown_files_in_project_root into a nullable sequence of glob patterns?

    So, to exclude everything unknown: include_unknown_files_in_project_root: null. That would be the default, in keeping with the current default behavior.

    But then you could do this to include anything unknown in the project root: include_unknown_files_in_project_root: ['*'], since that matches any file path pattern.

    Or, you could be more specific: include_unknown_files_in_project_root: ['.special-config/*', 'an/extra/file']

    This would be a lot more flexible than a simple boolean, and would not require a whole new setting -- just a pretty simple update path to convert the existing boolean to the new form.

    What do you think?

  • πŸ‡ΊπŸ‡ΈUnited States darren oh Lakeland, Florida

    My use-case calls for including patches.json and patches.lock.json as known files. When I requested that you said my options were to wait for bugs to be fixed upstream, put the patches in composer.json, or include unknown files in the project root. I think a setting is the best way to deal with disagreements over what files should be considered known. That way we can hard code what we agree on and still know it works for everyone.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    I agree that it makes sense for this to be configurable as a list of files. So let's convert the existing setting as I described in #9. Having two settings is quite confusing; it's not clear how they interact. One setting seems quite attainable and reasonable to me.

  • πŸ‡ΊπŸ‡ΈUnited States darren oh Lakeland, Florida

    Works for me.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Pipeline finished with Failed
    1 day ago
    Total: 207s
    #556508
  • The Needs Review Queue Bot β†’ tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
Production build 0.71.5 2024