Problem/Motivation
Right now we do not check if active composer.lock file has change when we apply an update from the time the stage was created.
The worst case scenario would be
- latest version drupal is 10.1.0
- site is on Drupal 10.0.9
- Person A starts an update to through the UI to 10.0.10
- Person B else(or Person A on bad day) runs
composer require drupal/core:10.1.0on the terminal - Person A applies the update that is stage to 10.0.10
Because `\PhpTuf\ComposerStager\Domain\Stager::stage()` is file syncing command not a direct composer operation on the active site it makes the assumption that the other conflicting commands have not been run the project since it was staged.
The other problem is that step 3 instead of an update to Drupal could be requiring a contrib module that is compatible with 10.0.9 but not compatible with 10.0.10. This seems less likely but still possible.
Steps to reproduce
Proposed resolution
Write a validator that subscribes to \Drupal\package_manager\Event\PreApplyEvent and prevents an update from being applied if the lock file is not the same as when PreCreateEvent was fired.
We may want to also subscribe to PreRequireEvent because if we know the composer.lock has changed then we know we won't be able to apply the stage.
Issue fork automatic_updates-3246420
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3246420-use-vfs
changes, plain diff MR !104
- 3246420-create-a-validator
changes, plain diff MR !98
Comments
Comment #2
tedbowComment #5
phenaproximaComment #6
tedbowComment #7
phenaproximaComment #10
tedbowLooks good!
Comment #12
phenaproxima