Problem/Motivation
Noticed by @webchick when on 9.0.x

This is because there is no new release newer than the dev release the user is currently on. At the time this was found there was no 9.x releases at all except dev snapshots. In this case the dev snapshot should not have been recommended because it is not in a supported branch.
Proposed resolution
Never recommend a release, dev snapshot or others, that is not in a recommend branch.
This will stop 9.1.x-dev snapshot from being recommended. It does not mean that a dev snapshot will never be recommended if it is in a supported branch and there are no other releases to recommend. This much more likely to happen contrib than it is in core.
This solution is the not the full solution to #3100115: The update module should recommend updates based on supported_branches rather than major versions majors because the user would still be shown and recommend the most recent full release in major and not a support branch.
Remaining tasks
None
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
None
| Comment | File | Size | Author |
|---|---|---|---|
| #59 | 3qqlbx.jpg | 36.07 KB | gábor hojtsy |
| #52 | 3111929-52-reroll.patch | 32.33 KB | tedbow |
| #50 | 3111929-49.patch | 32.29 KB | tedbow |
| #50 | interdiff-47-49.txt | 1.5 KB | tedbow |
| #47 | 3111929-47.patch | 32.02 KB | tedbow |
Comments
Comment #2
tedbowLet's see if we have explicit test coverage that expects the current behavior
Comment #3
dwwI'm pretty sure webchick was on a git checkout. That's why it says "Unknown release date". Update module has (by design) never been able to work from raw checkouts (neither CVS nor Git). It was deemed too much complication to add support for those directly into core, considered a developer-only-workflow to deploy from checkouts, and punted to contrib (cvs_deploy and git_deploy respectively). If you use a tarball, the packaging system injects the info it needs to work properly.
Tempted to call this "works as designed", not a bug.
If we've changed our minds about any of the above, then we need to re-scope this issue into a "Move git_deploy into core" style issue/plan.
Furthermore, I don't think this is a bug. If you're on a dev snapshot tarball, and the only newer release than what you have is another -dev release, Update module should tell you when newer -dev snapshots are available. That's its job. ;)
So, what's it gonna be? I see 3 ways forward:
A) Close this as a works-as-designed support request.
B) Move git_deploy into core.
C) Continue to debate the pros/cons of putting a band-aid on this by adding logic to Update to prevent it from giving you accurate information if you're on the bleeding edge of core development and the only newer update it has to offer is another -dev snapshot.
Cheers,
-Derek
Comment #4
tedbowI agree this might be the best answer. If so I think we should then repurpose this issue to just add test coverage for the expected behavior. I think #2 passing shows we don't have test coverage for this "design".
Comment #5
webchicka) Yes, I was on a git clone.
b) Regardless, however, 9.1.x-dev is not a viable target. It's purely a placeholder for us to point issues to. (Though it will be a viable target in a few months.)
Expected behaviour though IMO would be to recommend 9.0.x-dev in this case. Regardless if it's an unknown core version or not, it doesn't seem like we should be recommending leaping ahead a minor version only to get the same level of stability.
Comment #6
webchickConfirmed this release is marked unsupported on D.o:
Therefore, there's no reason 9.1.x should ever be shown in Update Status, let alone as "recommended." I think this is an actual problem, albeit one likely to affect very few people in practice (hopefully).
@Mixologic pointed out that the feed at https://updates.drupal.org/release-history/drupal/current includes this element:
The bug IMO is that Update Status needs to cross-check that what it's recommending appears in that list.
Comment #7
webchickMaybe a better title?
Comment #8
tedbowHere I think is the correct fix
we shouldn't recommend it if it is not in a supported branch
Comment #9
tedbowThere is only 2 places we set
$project_data['recommended']lets add this check there too.Comment #11
tedbowThe test failed because the xml
core/modules/update/tests/modules/update_test/aaa_update_test.8.x-1.2.xmldid not havesupported_branches.Originally the test passed because of
So since
supported_brancheswasn't set we hit this fallback.Other XML test fixtures are malformed some for a long time a few from recent changes. I opened #3110917: [meta] Fix update XML fixtures bad data recently
Comment #12
tedbowRunning #11 on 8.9.x too. It should pass and be committed to each branch
Comment #13
tedbowThe issue needs to update. The real problem is recommended a non-supported branch. Besides the dev problem this won't be problem for core. It won't be problem for contrib until Semantic releases
Comment #14
tedbowremoving this from the summary but if someone this is important than we should open another issue.
Comment #15
tedbow$is_in_supported_branch()whenupdate_calculate_project_update_status()is setting thelatest_versionand settingdev_version. We should not be showing any download links to versions that are unsupported branches.For instance in core currently https://updates.drupal.org/release-history/drupal/current
<supported_branches>8.7.,8.8.,8.9.,9.0.</supported_branches>So our future development branches are considered supported.
\Drupal\Tests\update\Functional\UpdateCoreTest::testNormalUpdateAvailable()uses for the cases where the expected recommend release is in the8.0.xminor branch. I added an extra release in the8.1.xbranch.For some reason(probably my copy/paste error in #3074993: Use "current" in update URLs instead of CORE_COMPATIBILITY to retrieve all future updates) in the XML it previously had
<supported_branches>8.0.,8.1.</supported_branches>even there are no8.1.xreleases in the XML. I remove move8.1.Therefore the add 8.1.0 release should be ignored by the test because it is not in a support branch.
\Drupal\Tests\update\Functional\UpdateContribTest::testNormalUpdateAvailablethat expect a8.x-1.xrelease and added8.x-2.xrelease. It should also be ignored.Comment #16
tedbowHere is simpler change. It just tests each release to see if it is in a supported branch if it is not then it goes to the next release.
Comment #18
tedbowComment #19
tedbowchanging to critical because the problem involves the user seeing downloads that aren't in supported branches.
This solution is the not the full solution to #3100115: The update module should recommend updates based on supported_branches rather than major versions majors because the user would still be shown and recommend the most recent full release in major and not a support branch. But I believe this issue is the critical part of #3100115
Comment #20
tim.plunkettNice to see #3110917: [meta] Fix update XML fixtures bad data opened. It's always scary to be operating with bad fixtures 😬
Just one minor question, the new approach in #16 is very straightforward. Still needs tests though. NW for that.
Is there a difference between
$versionand$release['version']?Or is this similar to iterating over an array of entities, and choosing between the array key or $entity->id()?
Comment #21
tedbow@tim.plunkett thanks for the review
So by adding this new release which is not in supported branch it adds test coverage that this release is ignored in
\Drupal\Tests\update\Functional\UpdateCoreTest::testNormalUpdateAvailable()This is what I was trying to explain in #15.2 but obviously this is not super clear. I thought about just adding a comment about this but I think it is clearer to assert the release is name is nowhere on the page.
I switched this 8.2.0 which is also not in a supported branch and would be recommended if it were in a supported branch since it is most recent release for the major.
Also because 8.2.0 is newer than all expected release in
testNormalUpdateAvailableit can be added to all the fixtures used by this test method.In addition I am adding an explicit assert and comment to explained why this is not being shown on the available updates.
I did the same for the contrib version.
So by adding this new release which is not in supported branch it adds test coverage that this release is ignored in
\Drupal\Tests\update\Functional\UpdateCoreTest::testNormalUpdateAvailable()This is what I was trying to explain in #15.2 but obviously this is not super clear. I thought about just adding a comment about this but I think it is clearer to assert the release is name is nowhere on the page.
I switched this 8.2.0 which is also not in a supported branch and would be recommended if it were in a supported branch since it is most recent release for the major.
Also because 8.2.0 is newer than all expected release in
testNormalUpdateAvailableit can be added to all the fixtures used by this test method.In addition I am adding an explicit assert and comment to explained why this is not being shown on the available updates.
I did the same for the contrib version.
In addition I added the same assert and comment to
\Drupal\Tests\update\Functional\UpdateCoreTest::testNoUpdatesAvailable()which uses these same XML fixtures. Because this is asserting that there no available updates and 8.2.0 is newer than all test installed versions I think this is even more clear that 8.2.0 is being skipped because it is in an unsupported branch.I will upload new test-only patch and with the new assert it should be clearer because the core tests will fail on the 2 new assert statements.
The contrib version will not fail in test-only version because supported branches don't specify a minor.
Since we are now using the 8.2.0 release we no longer have to change these lines.
I commented in #3110917-3: [meta] Fix update XML fixtures bad data that we really don't need
8.1.here.No difference the releases array is keyed by version number and they contain the same in the
versionkey.But I will change this to use
$release['version']because this comes more directly from the XML.Comment #24
tedbowok #21 was an unexpected fail but not because of problem with this patch with the commit in #3096078: Display core compatibility ranges for available module updates
The test that failed here
Drupal\Tests\update\Functional\UpdateContribTest::testCoreCompatibilityMessage()also uses the some of the core XML test fixtures that have been update.Basically it tests that a contrib module will display the core compatibility range
But because 8.2.0 was added it now shows
But actually because we are looking at the available updates 8.2.0 should have been ignored here also. So it was problem in #3096078 it didn't ignore it. I will comment on that issue.
Comment #25
tedbowI created a new issue #3112962: Core compatibility messages on contrib available updates should consider supported branches for #24
Comment #26
webchickThis seems at least related, if not a dupe: #3100115: The update module should recommend updates based on supported_branches rather than major versions majors
Comment #27
tedbowI made duplicates of the
drupal.1.1.*.xmlfiles that are also used in\Drupal\Tests\update\Functional\UpdateContribTest::testCoreCompatibilityMessage()in the copies I didn't add the 8.2.0 release that was adding in this issue. I added a @todo to remove this files in #3112962: Core compatibility messages on contrib available updates should consider supported branches
Basically the problem for core in that issue is:
I think #310011 could be tricker than this issue it might need wording changes and discussion as to whether the above behavior is also correct for contrib once it is using semantic versioning.
So hopefully we can get this issue sooner and make that issue smaller.
Comment #28
catchAfter discussion with webchick and xjm, bumping this to critical and beta blocking.
I think this issue resolves the beta-blocking part of #3100115: The update module should recommend updates based on supported_branches rather than major versions majors (it would still be critical just not block the beta), but please confirm either way.
Comment #29
tedbowThis comment is now wrong because now all the XML fixtures have the have new 8.2.0 release
Removing this comment because now there is comment before the new assert that explains this.
@@ -564,18 +568,21 @@ public function testCoreCompatibilityMessage() {
+ // delight the '*-core_compatibility.xml' files in suffix in
'delete' not 'delight' 😂
Comment #30
tim.plunkettThe explanation in #21 was very helpful, thanks @tedbow
Changes in #29 are straightforward.
Sufficient test coverage now, and it's much clearer. Also there are @todos pointing to the right places for the future.
I'm calling this RTBC!
Comment #31
dwwSorry I was away for a while from this issue. Sorry I brushed it off as "by design".
However, this isn't RTBC. Reviewing the patch in order, I first have a few questions about the test fixture changes, but then the final point is possibly a deal-breaker for this whole approach.
Maybe it doesn't matter, but tags haven't looked like this since the CVS days. Seems like if we want accurate test fixtures, we should use accurate tag values.
https://updates.drupal.org/release-history/token/current
Also probably doesn't matter, but the real feeds have a whole
<files>section, too. Guess we don't care?Shouldn't this have happened in another issue? ;) Did we miss some of this when converting to use /current/* feeds?
More CVS tags, this time for core...
This function isn't just about "showing the user releases". A few lines below this hunk, we have all this:
Probably we don't have test coverage for any of this, which is why the patch is green. :( But I think this patch, as written, would stop update.module from reporting that people are running a version that's been revoked for security reasons. Presumably such a branch would be marked unsupported, then this patch would hide it and the site admin would never know.
Perhaps we can salvage this approach by moving the check for is_supported after all the stuff where we see if the current release has been revoked or something.
Thanks/sorry,
-Derek
Comment #32
dwwRe: #31.5:
Looking closer, I think this would be peachy keen if we inserted the
!$is_in_supported_branch()check into this:Of course, #NeedsFollowup and #NeedsTests for the fact that I had to spot this manually, and the bot didn't tell us. :/
Comment #33
dwwComment #34
dwwLike so.
Interdiff seems confused, and is flagging stuff I didn't actually change. Also attaching a raw diff of the two patch files. Attaching the actual relevant changes I made as 3111929-34.relevant-changes.patch.txt in case that helps. /shrug
Comment #35
dwwFollow-up about the missing test coverage: #3113292: Update module has no tests for changes to status of the installed release (revoked, etc)
Comment #36
xjmNo, let's not do this in test fixtures.
Comment #37
xjmIf there is an actual bug here, it needs test coverage in this issue. Otherwise, the "before" seems better.
Comment #38
tedbow@dww thanks for the reviews and patches.
re #31
1-4 yes we should fix the problem with xml fixtures. Just copied from another release which were. i opened #3110917: [meta] Fix update XML fixtures bad data but no need to make more problems here
5. Yes I think you fix is correct and it points to the fact that we have missing test coverage. But I think the test coverage for the current problem is good just need to the missing in #3113292: Update module has no tests for changes to status of the installed release (revoked, etc)
Comment #39
xjm@tedbow and I crossposted. I think the test coverage needs to be added here, since the patch introduced a regression that was then fixed. When that happens, we add a test scenario.
Comment #40
dwwThen maybe we should postpone this on #3113292: Update module has no tests for changes to status of the installed release (revoked, etc) and promote that to critical? We should have those tests, regardless of this issue, and they're basically completely independent of what this issue is talking about. It just so happens that the lack of those tests meant the fix in here would have broken that other functionality if I hadn't noticed it myself.
If we commit tests in a separate issue, we can come back and re-queue tests on #29 vs. #34 and see the results...
Comment #41
xjmI'm alright with that approach. Bumping its status and postponing this for now.
Comment #42
xjmComment #43
dww@alexpott committed the tests from #3113292: Update module has no tests for changes to status of the installed release (revoked, etc) to 8.9.x and 9.0.x (yay, thanks!). Requeued #29 and #34.
#34 fixes #31.5.
#31.1 and 4 are better solved at #3113798: Remove unused (and generally wrong) <tag> markup from Update module test XML fixtures
#31.2 is better in scope at #3110917: [meta] Fix update XML fixtures bad data
#31.3 is probably still needed here.
Maybe NW, but NR for now.
Thanks,
-Derek
Comment #45
tedbowre #43
@dww thanks for getting this started again.
Yep,
\Drupal\Tests\update\Functional\UpdateContribTest::testCoreCompatibilityMessage()will fail without this change because it will not longer be a recommended release since it is not in a recommended branch. Yes we missed it before but because of the bug this issue addresses the test passed because it was still the recommended release.Comment #46
dww#31.1 and 4 are better solved at #3113798: Remove unused (and generally wrong) <tag> markup from Update module test XML fixtures so I don't care if we add more bogus values here.
#31.2 is better in scope at #3110917: [meta] Fix update XML fixtures bad data and definitely out of scope here.
#45 confirms that #31.3 is still needed here.
So I think the only remaining @todo is to remove the @todo per #36. ;) I think. Maybe @xjm can clarify what they'd prefer to resolve that?
Comment #47
tedbowI removed the xml @todo's as per #36.
We have
This @todo also tell us delete the files so I think this is ok.
Comment #48
tim.plunkettWas great to see the patch in #29 fail as expected after the other issue, yay.
Those todos removed in #47 pointed to #3112962: Core compatibility messages on contrib available updates should consider supported branches, but one is left over:
Also, this isn't that issue. (idk if that matters)
Comment #49
tedbowRE #48 Yes we still need at least 1 todo for #3112962: Core compatibility messages on contrib available updates should consider supported branches
I updated the comment to hopefully make it more clear what we need to do in that issue.
Comment #50
tedbowwhoops here is the todo comment change I mentioned in #49
Comment #51
tim.plunkettThis was RTBC in #30, until #31 spun out that other issue, which is now resolved.
#43/46 nicely summed up the outstanding points of feedback, which were addressed in #47.
And #50 addressed my question.
Marking this back to RTBC!
Comment #52
tedbow@tim.plunkett thanks for reviewing
just a reroll
Comment #55
gábor hojtsyYay, so many test coverage for such a few lines of fix :) I like how the solution for a random bug found by @webchick is also a fit for new efforts for supporting semantic versioning :)
Committed! Does this need to go into 8.8? I assume so. Sent testing for that too.
Comment #56
tedbow@Gábor Hojtsy thanks for committing this! Thanks @webchick for finding the 🐜, thanks everyone for helping getting it done!
Yes I think we want all the related test coverage backported. I also sent it back for testing but canceled mine. The patch still applies
Comment #57
tedbowre me in #56
So many issues getting committed I was confused. This is not a test-only patch.
Yes, I think this is critical to backport so that under no circumstances do we recommend and unsupported release.
Marking RTBC because previous patch applies and passes on 8.8.x se #52
Comment #59
gábor hojtsySuperb, thanks!