Always show summary of validation result if exists

Created on 6 February 2023, almost 2 years ago
Updated 10 February 2023, almost 2 years ago

Problem/Motivation

Follow-up to πŸ› Automatic Updates hosting test result on Dreamhost Fixed


This image here I think is trying to show a message from \Drupal\package_manager\Validator\StagedDBUpdateValidator::checkForStagedDatabaseUpdates

but it does not show the message "Possible database updates have been detected in the following extensions." only the module that has the update. I think this is because \Drupal\automatic_updates\Form\UpdateFormBase::displayResults assumes if there is only 1 messages(the module name) then you don't need to show the summary(in this case the "Possible database updates have.." message). This is not correct.

Steps to reproduce

Proposed resolution

  1. \Drupal\automatic_updates\Form\UpdateFormBase::displayResults we should on always use the theme unless unless there is only 1 message and there is not summary.

    In \Drupal\package_manager\ValidationResult::__construct we throw an error if there are more than 1 message and there is not a summary but you can create a result with only 1 message and still have a summary.

  2. Look at the other places will display results and determine if this is problem.

    at least \Drupal\automatic_updates\Validation\StatusCheckRequirements::getRequirements and \Drupal\automatic_updates\Validation\ValidationResultDisplayTrait::displayResults

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

Live updates comments and jobs are added and updated live.
  • Usability

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

Sign in to follow issues

Comments & Activities

  • Issue created by @tedbow
  • First commit to issue fork.
  • @phenaproxima opened merge request.
  • Status changed to Needs review almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

    @phenaproxima did you check the other place mentioned in Proposed resolution 2)?

  • Status changed to Needs work almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

    Looks good but I don't the original problem documented in the screenshot has test coverage.

    This is when the User is on the UpdateReady form and there is a status check warning with 1 message and summary.

    the closest test coverage we have is \Drupal\Tests\automatic_updates\Functional\UpdateWarningTest but it only deals with an warning with more than 1 message, that is why it was passing.

    That should be update to handle both cases. I think just setting a different `TestSubscriber::setTestResult([$warning], StatusCheckEvent::class);` and reloading the page should be ok

  • Status changed to Needs review almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    Crediting you for review.

  • Status changed to Needs work almost 2 years ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    🀯 This is such a no-brainer improvement. This explains why I've gotten confused in the past by the assertions in the build tests πŸ˜„

    But … there's still something that I don't quite get: why we sometimes want only the summary, and not also the non-summarized messages?

  • Status changed to Needs review almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

    why we sometimes want only the summary, and not also the non-summarized messages?

    As I understand it:

    On the status report, and on the updater form, we want everything. Summaries and details. These areas are where the user is most concerned with the details, and could use as much information as possible to fix the problems.

    On any other admin page, we want only the summaries (or first message, if there is no summary). In such a context, we just want people to know that problems exist, and give people a basic idea of what those problems are. But providing the full details would be clutter.

    Not seeing any other actionable feedback here, so this is back to needing review...

  • Assigned to phenaproxima
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    On any other admin page (like /admin/structure and friends), we want only the summaries (or first message, if there is no summary). In such a context, we just want people to know that problems exist, and give people a basic idea of what those problems are. But providing the full details would be clutter.

    But how do we expect people to act on problems surfaced in the status report if they literally cannot see the details? πŸ˜…

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

    They can see the details on the status report...? (By "status report", by the way, I'm referring specifically to /admin/reports/status.)

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    That's not what I'm seeing in StatusCheckTest β€” see https://git.drupalcode.org/project/automatic_updates/-/merge_requests/68....

    I verified locally by doing

    var_dump($expected_results['1 error']);
    var_dump($this->getSession()->getPage()->getContent());
    return;

    immediately after that.

    What am I missing? πŸ™ˆ

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

    The fact that the result you're looking at only has one message. In which case, that's the only thing that gets displayed.

    If I add the following code to the end of ComposerExecutableValidator:

        $event->addError([
          'One message with some details.',
          'Another message with some details.',
        ], t('A test summary'));

    I get this on the status report:

    Which is exactly what I would expect to see.

  • Issue was unassigned.
  • Status changed to RTBC almost 2 years ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    OMG β€” I must've missed that then in my detailed test πŸ™ˆ Sorry for the distraction!

  • Status changed to Fixed almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024