Add support for patches.json

Created on 7 January 2025, 4 months ago

Problem/Motivation

The Composer Patches plugin reads from patches.json as well as from composer.json. Automatic Updates only copies composer.json.

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

Copy patches.json as well as composer.json.

Remaining tasks

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

User interface changes

None.

API changes

Patches in patches.json are applied in automatic updates.

Data model changes

None.

Feature request
Status

Active

Version

3.1

Component

Code

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
  • 🇵🇱Poland dmitry.korhov Poland, Warsaw

    Hey, let’s not do this.

    Patches are meant to be a temporary fix for a single issue: the delay in maintainers responding and merging changes.
    Relying on patches as a long-term solution would make the system unstable and unpredictable.

    Now, imagine having 30 core patches listed in your composer.json, and then trying to install another module on shared hosting—it would be a headache for everyone! Let’s not open that Pandora’s box for Drupal CMS :)

    Instead, let’s focus on finding a better way to speed up fix merges so we can avoid relying on patches in the first place.

  • 🇺🇸United States darren oh Lakeland, Florida

    I agree that it would be better if no one needed patches, but that is outside the scope of this issue. This issue is not even about Drupal CMS. It is about a bug in how Automatic Updates handles the Composer Patches extension. Trying to use this bug to force people to come up with an alternative to patching will turn more people off of Drupal rather than getting them to improve it.

  • 🇵🇱Poland dmitry.korhov Poland, Warsaw

    I disagree. Most use cases for this module involve Drupal CMS. For anything else, we have Composer, which supports patches.
    Drupal CMS must be user-friendly - even if that means imposing some limitations, so that workarounds like patches aren’t necessary to make it work.
    However, if Drupal CMS is not mature enough to work as intended OOTB, then the Drupal community and core maintainers have a real problem.

  • 🇺🇸United States darren oh Lakeland, Florida

    The previous response illustrates why we need support for patches. Lots of bug fixes are blocked from coming to the attention of project maintainers by reviewers who argue against allowing them to be fixed. I hope the Automatic Updates maintainers agree that this project should not be limited to supporting Drupal CMS.

  • 🇺🇸United States darren oh Lakeland, Florida
  • Pipeline finished with Failed
    3 months ago
    Total: 3474s
    #421556
  • 🇺🇸United States darren oh Lakeland, Florida

    This works in my tests.

  • 🇵🇱Poland dmitry.korhov Poland, Warsaw

    > Lots of bug fixes are blocked from coming to the attention of project maintainers by reviewers who argue against allowing them to be fixed.

    Many bug fixes go unnoticed by project maintainers due to a lack of motivation for contributors to review them. This is the real problem that needs to be addressed, rather than relying on workarounds like patches.

    If you maintain your codebase manually using Composer, patches, etc., then we can agree that, in some cases, applying patches (hacks) is the only urgent solution.
    However, Drupal CMS is designed as a one-click installation that works out of the box (OOTB). It should not require any patching—otherwise, it cannot be considered a production-ready application.

    By supporting patches in Drupal CMS, we shift the system’s focus away from content creators and towards developers, who will then have to manage all these patches instead.

  • 🇺🇸United States darren oh Lakeland, Florida
  • 🇵🇱Poland dmitry.korhov Poland, Warsaw
  • 🇺🇸United States darren oh Lakeland, Florida

    Please allow someone else to review.

Production build 0.71.5 2024