Problem/Motivation
Currently as of the time of creating this issue, the latest version of Drupal is 9.4.5. My current site (for which I am using this module) is also running on 9.4.5, the current beta version of Drupal core is drupal 9.5.0-beta1. The updates tab gives an error
LogicException: Release information for Drupal 9.5.0 is not available. in Drupal\automatic_updates\Form\UpdaterForm->buildForm() (line 264 of modules/contrib/automatic_updates/src/Form/UpdaterForm.php).
Steps to reproduce
1. Make sure your Drupal installation's core version is upto date to the latest version of Drupal core (from Drupal.org)
2. Change the settings in settings.php to True with this code $config['automatic_updates.settings']['allow_core_minor_updates'] = TRUE; and try to test the updates from the updates tab
3. Goto "admin/reports/updates/automatic-update" and you will find the issue
I have attached the screenshot of the error as well.
Proposed resolution
Right now, UpdaterForm throws the exception if the release doesn't exist.
in the current example, showing the next minor 9.5.0-beta1, it is not a problem that 9.5.0 doesn't exist, it should not. if we showing the update to 9.5.1, or any 9.5.x that is greater than 9.5.0 it would be problem that 9.5.0 does not exist. That should never happen.
So we need to check if $next_minor_version > $first_release_version using \Composer\Semver\Semver::satisfies then \Drupal\automatic_updates\Form\UpdaterForm::createReleaseTable() will not need a link in the $caption argument.
if $next_minor_version < $first_release_version then we can still through the logic error because we should always have the release
| Comment | File | Size | Author |
|---|---|---|---|
| Screenshot 2022-09-20 at 16.11.48.png | 333.17 KB | shabbir |
Issue fork automatic_updates-3310666
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:
Comments
Comment #2
tedbowok this is because
$first_release_version = $next_minor_version->getMajorVersion() . '.' . $next_minor_version->getMinorVersion() . '.0';will get 9.5.0 but that is not released yet. so we can't make this link if the first stable release of the major is not out
Comment #3
phenaproximaAt the very least we should catch the exception.
Comment #4
shabbir commentedComment #5
phenaproximaLooking at this, I think this shouldn't be an exception. We should just flag a warning message if release notes are not available.
Comment #6
phenaproximaAdded a proposed resolution.
Comment #7
phenaproximaRe-titling for clarity.
Comment #9
rahul_ commentedComment #11
tedbowIn this case I don't think we need a warning.
basically originally in #3291730: When displaying updates in the next minor, show a link to the relevant major.minor.0 release notes the idea was if you are updating from 9.4.6 to 9.5.6(or anything above 9.5.0) you should also see a link to 9.5.0 because this is where the big changes between 9.4.x and 9.5.x will be documented.
but if you latest in 9.5.x is only a pre-release, 9.5.0-beta1 for example, then 9.5.0 will not exist so there is no need to show any other release notes beside 9.5.0-beta1. so in that case we don't need to have link in the table caption. so
\Drupal\automatic_updates\Form\UpdaterForm::createReleaseTable()will not need a link in the$captionargumentComment #12
phenaproximaDiscussing this with @tedbow on Zoom, this is what we agreed on as the right solution here.
First of all, this issue is only about what to do when generating the table caption that is shown above the table where you see the update to the next minor. No other part of the form should be affected.
Here's the logic we think we should do:
If the target version of core is greater than -- NOT greater or equal -- the .0 release of the next minor, the caption should link to the release notes for the MAJOR.MINOR.0 release. If we cannot get those release notes (i.e., the release is unavailable), that's an error condition and should raise a LogicException.
In any other situation, don't link to the release notes in the caption. They are already linked in the table itself.
In pseudocode (this is here merely as guidance, it won't work if used directly):
Comment #13
phenaproximaComment #14
siramsay commentedI can verify this issue. I got the white screen with "The website encountered an unexpected error. Please try again later" and the below message in the logs and ended up here.
I manually patched my version of Automatic Updates with the code from here https://git.drupalcode.org/issue/automatic_updates-3310666/-/compare/8.x...
This worked, I was able to update from 9.4.5 to 9.4.7 (with the option to update to 9.5.0-beta2)
Comment #15
phenaproxima@rahul_ asked me to take this on.
Comment #17
kunal.sachdev commentedComment #18
phenaproximaI think we've got our bases covered for tests. Just a few small requests and then I'm happy.
Comment #19
kunal.sachdev commentedComment #20
phenaproximaI'm happy with this; assigning to @tedbow for final review and commit.
One thing I wonder: do we maybe want test coverage to confirm that the exception is thrown if, for some reason, we can't get release info for the x.y.0 release? I don't think we had any such coverage before, so I don't know if that should block commit, but thought I'd raise the question.
Comment #21
tedbowComment #22
tedbowok the reason the tests are currently failing is because is in
\Drupal\package_manager\ProjectInfo::getInstallableReleasesif the update module considers the project "current" we don't return any releases. But the update module will consider the project "current" if there the only newer releases in the current major are pre-releases.we need to solve this problem first #3310696: if only newer releases are pre-releases Updating from one minor to latest version Drupal version, module does not show any other updates
Comment #23
tedbowcrediting @siramsay for testing the issue
Comment #24
tedbowI think this is good. Will merge if green
Comment #26
tedbowThanks everyone!
Comment #27
tedbowComment #29
tedbow