Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint: add version consistency check #3368

Merged
merged 59 commits into from Oct 24, 2019

Conversation

queengooborg
Copy link
Collaborator

@queengooborg queengooborg commented Feb 2, 2019

Unfortunately as time has progressed and more changes have been merged into this repository, a number of inconsistencies have been found. A huge one that occurred is a subfeature being implemented in a browser before its parent feature, if the parent feature was even implemented in the first place.

This PR is a combination from the efforts of #2463, #2875, and #3051, and also closes #1618. Kudos to @caugner for writing the first half of this PR! It offers the following consistency checks:

  • A subfeature cannot be supported if its parent feature isn't.
  • A subfeature cannot be supported in an earlier version than its parent.
  • A parent feature cannot have version_added == null if its subfeatures are supported

@Elchi3
Copy link
Member

Elchi3 commented Feb 4, 2019

Hey, thanks for coming back to this! This is quite big and will need some serious reviewing. I will see how we can get to this. Thank you for some patience in advance :)

@Elchi3 Elchi3 added the linter 🏡 Issues or pull requests regarding the tests / linter of the JSON files. label Feb 4, 2019
ddbeck
ddbeck previously requested changes Feb 4, 2019
Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your effort on this, @vinyldarkscratch! This is a major undertaking and I am impressed that you've made such substantial progress on it.

I've taken a look at the first dozen files in the diff to get a sense for the size and type of changes here. Which is to say, I haven't looked at anywhere near everything yet. My biggest concern so far is that there appears to be a lot of top-level changes which don't have obvious antecedents to be inconsistent with. So that seems like something in the scripts that needs looking into, or something about the relationships that needs explaining.

That said, if questions on the diff are as pervasive in the remaining files as they are in the first dozen files, then I'm inclined to go with your suggestion of breaking up the PR into smaller pieces. Hundreds of comments on a single PR is going to become unmanageable, so breaking it up would speed up review times and making sure we resolve every issue more likely.

Thank you again!

api/AnimationEvent.json Outdated Show resolved Hide resolved
api/BaseAudioContext.json Outdated Show resolved Hide resolved
api/CSS.json Outdated Show resolved Hide resolved
api/Cache.json Outdated Show resolved Hide resolved
api/ConstantSourceNode.json Outdated Show resolved Hide resolved
api/CustomElementRegistry.json Outdated Show resolved Hide resolved
@queengooborg
Copy link
Collaborator Author

Yeah, the more I think about it, the more it would be MUCH easier to separate this PR into multiple pieces, haha -- once I go through @ddbeck's comments, I'll be splitting this off into pieces by root folder. 😉

@jpmedley
Copy link
Collaborator

jpmedley commented Feb 4, 2019

This might be useful as a guide to what's inconsistent. But I can't support merging these. The API one alone introduces numerous Chrome errors. I don't know if the linter's incorrect or what.

@queengooborg
Copy link
Collaborator Author

queengooborg commented Feb 5, 2019

I’ve run numerous tests on the linter’s behavior to make sure that it’s functioning as expected. As much as I’d love to say this is an easy fix, this is going to take some time to get through. There's just so much data to review in this repository.

The PRs that alter the data are based on a simple concept: adjust the subfeatures to match the support status of their parents, and make sure they have been added no earlier (or removed no later) than the parent. Any invalidity it has created in the process originated from iterations of the data over time (aside from one case mentioned in #3375 (comment)).

@Elchi3
Copy link
Member

Elchi3 commented Feb 5, 2019

By providing smaller PRs, we might actually get a better picture here, so I think could start with reviewing everything that is not in the API folder for now and then see how we could tackle that one in smaller chunks later. Note that myself and other maintainers or staffs only have that much time and so I'm not promising to get to all of this immediately. Thanks for getting into this, though. It is a nice data quality exploration.

@jpmedley
Copy link
Collaborator

jpmedley commented Feb 5, 2019

Even still, these are going to take considerably time to get through. The number of edge cases is unknown. And in some cases a decision will need to be made as to whether the data or the test should altered.

@Elchi3 What order do you want to review them in?

@queengooborg
Copy link
Collaborator Author

Totally understandable -- this is a big change to the repo. Take all the time you need, neither myself nor the PRs are going anywhere. 😉

@foolip
Copy link
Collaborator

foolip commented Feb 7, 2019

In the sub-PRs like #3375, is there a data source or is it just fixing inconsistencies by changing one piece of the data? Taking the first file, Animation.idl, it is changing from 40 to 46 for one API member. Is it just picking the earliest release and using that?

@queengooborg
Copy link
Collaborator Author

The data source is within the files themselves. What each of the sub-PRs is doing is:

  • Setting a sub-feature's version_added to false if the parent feature does not provide support;
  • Adding a version_removed to the sub-feature if the parent feature has a version_removed; and
  • Bumping the version_added to match or exceed the version_added of its parent feature.

In doing so, it seems that we're coming across some inconsistencies in the data where the simple solution isn't the answer.

@foolip
Copy link
Collaborator

foolip commented Feb 7, 2019

it seems that we're coming across some inconsistencies in the data where the simple solution isn't the answer

Indeed. The inconsistency means that some data must be wrong, but it seems to me the only way to make it consistent is by finding out which is correct, which can't be derived from the data itself. Perhaps it's better to have consistent data which could be wrong, I'll leave it to other to make that call, I'm not a reviewer.

@queengooborg
Copy link
Collaborator Author

Perhaps it's better to have consistent data which could be wrong

Personally, I feel the same way about this. However, we shouldn’t ever have wrong data, which is particularly why the review is taking so long to get this PR, and its sub-PRs, merged. So far, there’s only been one special case, though quite frankly, it’s one out of thousands.

@jpmedley’s got the right idea in going through and checking the PRs carefully. Sometimes it’s not the sub-features that have the inaccurate data, it’s the parent feature. It’s good that we’re checking it all now, though, rather than simply leaving it to remain inaccurate forever.

@jpmedley
Copy link
Collaborator

jpmedley commented Feb 7, 2019 via email

@queengooborg
Copy link
Collaborator Author

The linter actually doesn’t do the fixes, that’s in a separate script — and much dumber changes at that. Aside from the changes of setting any null values to false, all the PR’s modifications have been manual, particularly me going through and just doing the adjustments described up above.

As for the plan you’re proposing...well, to be honest, that’s what I assumed we were already doing. The sub-PRs are dumb and have no source data other than itself, and as mentioned, the original data needs review already. (I just don’t have the time available to review every change, which is why I’m glad you are.) Once all the existing data is reviewed and it’s all ready to merge, that’s when this one will be ready to merge — the final piece that ensures new PRs will follow said consistency.

@jpmedley
Copy link
Collaborator

jpmedley commented Feb 7, 2019 via email

@queengooborg
Copy link
Collaborator Author

ARGH! Looks like a few recent PRs created some more inconsistencies...

@caugner
Copy link
Contributor

caugner commented Sep 25, 2019

Wouldn't it be possible to freeze the repository temporarily (i.e. not merge other PRs) once everything is consistent again? After that, all other PRs would need to be rebased anyways.

Or, alternatively, couldn't this PR be merged, even if there are few remaining inconsistencies (since merging other unrebased PRs after merging a consistent state might introduce new consistencies - and break the master build - anyway)?

Update: There haven't been any commits on 13-14/16/18 September, so a freeze should be feasible.

@queengooborg
Copy link
Collaborator Author

Whoo, the linter passed in a local run and we've fixed all the consistency! This is ready to merge once again!

@queengooborg queengooborg removed the not ready ⛔ This is not yet ready to be merged. It's pending a decision, other PR, or a prerequisite action. label Oct 8, 2019
@queengooborg
Copy link
Collaborator Author

All inconsistencies are now fixed, so this is ready for merge again!

Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really sorry it took me forever to take a look into this :(
The good thing is that we've been testing this for quite a few scenarios already, thanks to your PRs and keeping this branch always green.
The 3 consistency checks make sense to me and your ongoing PRs have kind of proven that they make sense also.
I think we need to try to present consistency errors a bit less cryptic to PR authors, so I have a thought about that below and then there are a few variables never used I believe (probably from an earlier version of this). Overall I believe we're close to land this as, thanks to your PRs, we've been applying the rules of this anyways, we now just need to see how to have it best in front of others :)

The code is yet again another completely different lint script, but we've been somewhat bad at re-using code and organizing our linting code to share functionality. I think it is fair to say that consolidating is a task for another day and shouldn't block this.

Thanks for your great work on this! 👍

test/linter/test-consistency.js Outdated Show resolved Hide resolved
test/linter/test-consistency.js Outdated Show resolved Hide resolved
test/linter/test-consistency.js Outdated Show resolved Hide resolved
Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ready 🎉
Just slightly nervous any current open PRs could contain consistency errors.
I guess the giant Samsung one will be re-submitted in smaller chunks anyways and maybe the others aren't much of a big deal. What do you think?

@queengooborg
Copy link
Collaborator Author

Thank you very much! I'm leaning towards going for the merge -- if any of the existing PRs are failing consistency tests, then I'd say that's a sign that we'd need to give it some additional review for accuracy.

@Elchi3
Copy link
Member

Elchi3 commented Oct 24, 2019

Yes, or back things out or correct things otherwise. I think we would manage. Let's do this! :)

@Elchi3 Elchi3 merged commit 112930d into mdn:master Oct 24, 2019
@queengooborg queengooborg deleted the linter/lint-version-consistency branch October 24, 2019 10:55
@queengooborg
Copy link
Collaborator Author

Woo, celebration time!

I have to give @caugner a HUGE thanks for this -- without them, this probably wouldn't have come to life. Thank you so much, @caugner!

@caugner
Copy link
Contributor

caugner commented Oct 25, 2019

Congratulations to you, @vinyldarkscratch! 🎉
Thank you for working on this so hard for the last 8,5 months! 🎂

@jpmedley
Copy link
Collaborator

Yes indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linter 🏡 Issues or pull requests regarding the tests / linter of the JSON files.
Projects
No open projects
Non-data issue overview
Linter improvements
Development

Successfully merging this pull request may close these issues.

Linter: Make sure each child version is valid relative to its parent version
6 participants