[PP-1] Improve messaging if the staged update has already been applied

Created on 12 June 2023, over 1 year ago
Updated 5 July 2023, over 1 year ago

Problem/Motivation

In ๐Ÿ› [DrupalCon] Automatic Updates alpha test result Active @UpTil4Music ran into a problem after the update was applied and end up back at the UpdateReady form

The received this messages

Your site does not pass some readiness checks for automatic updates. It cannot be automatically updated until further action is performed.
Some modules have database schema updates to install. You should run the database update script immediately.
Problem detected in lock file during stage operations.
Unexpected changes were detected in composer.lock, which indicates that other Composer operations were performed since this Package Manager operation started. This can put the code base into an unreliable state and therefore is not allowed.

Basically something went wrong and the stage was not deleted.

but in any case the composer.lock is not very helpful.

This comes from \Drupal\package_manager\Validator\LockFileValidator::validate

// If we have both hashes, ensure they match.
    if ($active_hash && $stored_hash && !hash_equals($stored_hash, $active_hash)) {
      $messages[] = $this->t('Unexpected changes were detected in composer.lock, which indicates that other Composer operations were performed since this Package Manager operation started. This can put the code base into an unreliable state and therefore is not allowed.');
    }

We originally wrote this validator to ensure no other operations where happening on the active site between when you started the process and when you applied the changes.

Steps to reproduce

Proposed resolution

In \Drupal\package_manager\Validator\LockFileValidator::validate inside

if ($active_hash && $stored_hash && !hash_equals($stored_hash, $active_hash)) {
.....
    }

Before giving the current messages check if the active hash is actually equal to the staged hash. This would indicate that staged operation has already been applied.

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Postponed

Version

3.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States tedbow Ithaca, NY, USA

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024