Problem/Motivation

Basically all of the Update module test XML fixtures include a <tag> value. In the vast majority of cases, these values are bogus, and represent tags we used to use in the CVS days:

<tag>DRUPAL-8-0-2</tag>

There's no code in all of Update module, nor its tests, that look at this value:

% grep -i -r 'tag' --exclude '*.xml' core/modules/update
core/modules/update/migrations/update_settings.yml:migration_tags:
core/modules/update/update.module: *   'Insecure' release type tag in update XML provided by Drupal.org to
core/modules/update/update.module:  trigger_error("_update_equivalent_security_releases() was a temporary fix and will be removed before 9.0.0. Use the 'Insecure' release type tag in update XML provided by Drupal.org to determine if releases are insecure.", E_USER_DEPRECATED);
core/modules/update/update.services.yml:    tags:
core/modules/update/update.services.yml:    tags:

I think it's something I added to the feed 10+ years ago, thinking we'd care in core, but in practice, we don't. Other possible consumers of these feeds might care, so we don't want to remove it from d.o, but it's pointless to have bogus tag values in our test fixtures.

We keep copying fixtures to add more test cases, propagating the bogus tags. I keep flagging it for review.

Proposed resolution

Let's completely purge all the test fixtures of <tag> so we don't keep confusing ourselves and generating more noise during patch/test reviews.

Remaining tasks

  1. Purge <tag> from all fixtures.
  2. Verify all the tests still pass.
  3. Review.
  4. RTBC.
  5. Commit.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

CommentFileSizeAuthor
#10 3113798-10.8_8.patch122.59 KBdww
#10 3113798-10.patch122.32 KBdww
#6 3113798-6.8_8_x.patch119.14 KBdww
#6 3113798-6.patch118.87 KBdww
#2 3113798-2.patch89.61 KBdww

Comments

dww created an issue. See original summary.

dww’s picture

Assigned: dww » Unassigned
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new89.61 KB

perl -n -i.bak -e 'print unless m/<tag>/' *.xml
;)

dww’s picture

All tests passed, so crossing that off from remaining tasks.

Also, calling this a sub-task of #3110917: [meta] Fix update XML fixtures bad data

Thanks,
-Derek

tedbow’s picture

Looking at the XML that drupal.org produces:
legacy
https://updates.drupal.org/release-history/drupal/8.x
and current
https://updates.drupal.org/release-history/drupal/current

They do have the "tag" element although with different values

the documentation https://www.drupal.org/drupalorg/docs/apis/update-status-xml
says

<tag> The Git tag or branch name, like 8.x-1.5 or 8.x-1.x

In my opinion our test fixtures should be as close as possible to what drupal.org's XML as possible. If there is no use for this element it should be removed from the drupal.org XML first.

It is very unlikely but having it in our test fixtures would stop us from doing something like

if (isset($release['tag']) {
  // buggy code
}

Of course you could make that argument for any possible key of $release but in this we know it will be set on the drupal.org XML.

dww’s picture

Issue summary: View changes

Re: #4:

A) Yes, both feeds have the value. They have the same values (the git tags). Not sure what you mean by "although with different values". I can't spot any examples of that.

B)

In my opinion our test fixtures should be as close as possible to what drupal.org's XML as possible.

Then there are a bunch of other values that our test fixtures are missing, like the entire <files> section for each release, etc. IMHO, our test fixtures should be realistic, but only include enough info for the tests to do their job. There's 0 code in update module that uses this, neither the code nor the tests, so this is entirely noise:

% grep -i -r 'tag' --exclude '*.xml' core/modules/update
core/modules/update/migrations/update_settings.yml:migration_tags:
core/modules/update/update.module: *   'Insecure' release type tag in update XML provided by Drupal.org to
core/modules/update/update.module:  trigger_error("_update_equivalent_security_releases() was a temporary fix and will be removed before 9.0.0. Use the 'Insecure' release type tag in update XML provided by Drupal.org to determine if releases are insecure.", E_USER_DEPRECATED);
core/modules/update/update.services.yml:    tags:
core/modules/update/update.services.yml:    tags:

In other core test fixtures (e.g. default views for tests) we tend to keep the default view config as small as possible for each test, instead of having full views exports for every single test view. This generally makes it easier to understand, since you don't have to read through 2000 lines of views config for every test view.

C)

If there is no use for this element it should be removed from the drupal.org XML first.

Update module isn't the only possible consumer of this API. Just because update.module nor our tests reference these values doesn't mean d.o should remove them from the feed. Added note about this to the summary.

D)

It is very unlikely but having it in our test fixtures would stop us from doing something like ...

That's quite a stretch. ;)

If you want to keep <tag> in the fixtures, then we have a very large task to actually go through and give them accurate values. That's going to take hours, and we have much more important fish to fry. Instead, we could agree that this is completely meaningless garbage in our fixtures that's accumulated over the years from copy/paste that should be purged by script. ;)

Thanks,
-Derek

dww’s picture

StatusFileSize
new118.87 KB
new119.14 KB

Refreshing this, and adding a 8.8.x version. Interdiff is pointless.

tedbow’s picture

I still think our test fixtures should mimic updates.drupal.org as much as possible.

Related I created

dww’s picture

@tedbow Re: #7: It's not clear if you've read #5. I don't want to repeat all those reasons here. Would you be willing to respond to the specific points in #5?

Thanks,
-Derek

xjm’s picture

Version: 9.0.x-dev » 8.8.x-dev
dww’s picture

StatusFileSize
new122.32 KB
new122.59 KB

Re-generated patches now that #3121020: Move Update Manager XML test fixtures into a fixtures/release-history directory landed. The main patch applies cleanly to 9.1.x through 8.9.x. Separate patch needed for 8.8.x.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Version: 8.9.x-dev » 9.2.x-dev

Dipping my toes into the update system here ....

First, I read the issue, then went to see if the latest patch applied to 9.2.x. It does. The I went back to see what the perl command in #2 does (I don't know perl). Figured that out and made a new patch. Made a diff of the with the 9.1.x patch in #10. It is only index changes. So no new changes to the patch. I will start a test for 9.2.x.

Then went back to consider whether <tag> should be removed or not. There are valid point raised in #5 and #7. I mulled it over for a while and then talked to dww on Slack. I learned that I was confused about the output of updates.durpal.org. I had misunderstood and thought that data ffor <tag> from there was incorrect not just the data in the test files. So, now that that is cleared up I fully support fixture files that have only the data necessary for the test. I think we can trust the dev and the review process to ensure the test is robust. So, yes, lets remove <tag>.

Separate from this issue is that I also spent a bit of time looking at documentation.

  • I was hoping to find what elements were used by the update system and I could not find it. I think this needs to be documented. Right now the only way I can find that information is to read the code (correct me if I am wrong). Should that go in update.api.php?
  • Update status XML has a list of, what I hope, is all the elements of the XML. It is good page providing explanations of the elements. I do wish it has a definition of 'Legacy-only' but that is minor. Do we know if that page does, in fact, list all possible elements?
quietone’s picture

Status: Needs review » Reviewed & tested by the community

Tests are passing on 9.2.x so RTBC.

dww’s picture

Yay, thanks @quietone!

I now realize that #3110917: [meta] Fix update XML fixtures bad data is basically duplicate with #1478294: Update manager XML test fixtures contain D7 links to D8 releases, although #3110917 has a better scope at the moment.

I totally agree we (probably I) should document what parts of these feeds the update manager actually uses. I'm not sure if update.api.php is the best spot, since that's usually where we document the external API a given module provides (e.g. the hooks it invokes that other modules can use), right? Do we put internal API docs in there, too? Anyway, split that out to #3203359: Document what elements in the release history XML feeds the Update manager uses. Comments welcome there for where to put the docs.

Also good question on https://www.drupal.org/drupalorg/docs/apis/update-status-xml -- I'm 95% sure that's complete (all thanks to @drumm and @tedbow), but it's worth a review to be sure.

Thanks again!
-Derek

  • catch committed 2b0ba20 on 9.2.x
    Issue #3113798 by dww, tedbow, quietone: Remove unused (and generally...
catch’s picture

Status: Reviewed & tested by the community » Fixed

OK I am nearly on the fence with this one. It is tempting to say the fixtures should be identical to the feed, but if so I think we'd want to literally copy a snapshot of the feed every so often. i.e. if d.o had suddenly added '' we have no process in core to add it to the test fixtures unless we relied on it. Since we don't have that, having the XML be concise (and hence closer to human-readable) seems like an OK trade-off, especially given some of the values are incorrect in the test fixtures.

Committed/pushed to 9.2.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.