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

Gecko exported tests sometimes contain lint errors #8271

Closed
Hexcles opened this issue Nov 16, 2017 · 17 comments
Closed

Gecko exported tests sometimes contain lint errors #8271

Hexcles opened this issue Nov 16, 2017 · 17 comments

Comments

@Hexcles
Copy link
Member

Hexcles commented Nov 16, 2017

Gecko export #8261 introduced a few tests that have lint errors, especially the multiple uses of setTimeout.

This is currently blocking chromium import.

By the way, @jgraham wpt lint should have been run against the change somewhere in the process, either before committing to mozilla-central, or before merging (Chromium actually does both). And for this change, it seems neither happened. Is this a bug?

Hexcles added a commit that referenced this issue Nov 16, 2017
* A new exception for SET TIMEOUT is added to lint.whitelist.
* Rename a variable called `testRunner` to avoid confusing the linter.

This fixes the immediate problem of issue #8271.
@Hexcles
Copy link
Member Author

Hexcles commented Nov 16, 2017

cc @rakuco , who's on ecosystem-infra rotation.

@jdm
Copy link
Contributor

jdm commented Nov 16, 2017

The lint does run in Gecko as far as I know; the problem is that the upstream process happens in batches, so newer lints that have not reached mozilla-central can miss tests that were written in the interval.

jdm pushed a commit that referenced this issue Nov 16, 2017
* A new exception for SET TIMEOUT is added to lint.whitelist.
* Rename a variable called `testRunner` to avoid confusing the linter.

This fixes the immediate problem of issue #8271.
@rakuco
Copy link
Member

rakuco commented Nov 16, 2017

Thanks for the fix, I can confirm lint has stopped blocking our imports.

@Hexcles
Copy link
Member Author

Hexcles commented Nov 16, 2017

Thank you, @jdm.

So supposedly the timeline is:

  1. The change was submitted to Gecko and passed the lint Gecko had at that time (which didn't have rules for setTimeout, testRunner, etc.).
  2. New rules were introduced to lint.
  3. The changes were exported to GitHub, and failed the new lint rules.

If we don't want to change the current Gecko export workflow too much, one thing we can do for sure is to wait for Travis CI before merging the export PRs. WDYT, @jgraham ?

@Hexcles Hexcles changed the title Gecko exported tests in html/browsers/history/the-session-history-of-browsing-contexts/ are failing lint Gecko exported tests sometimes contain lint errors Nov 16, 2017
@Hexcles
Copy link
Member Author

Hexcles commented Nov 16, 2017

The immediate problem has been fixed by #8272.

As @jgraham points out on IRC, Travis checks are currently skipped during Gecko exports because they are too slow for the current Gecko export workflow. (A bunch of commits are exported one time, and each has a PR, which would create a long queue on Travis.) Besides, we can always miss things because of racing conditions regardless: new lints can be introduced between a PR passes Travis and lands in master.

@foolip
Copy link
Member

foolip commented Nov 17, 2017

I'm fixing more cases in #8294, those were in Python code. @andreastt FYI.

@foolip
Copy link
Member

foolip commented Nov 17, 2017

@jgraham, what would it take to make this much less likely to happen? Is it blocked on the new Gecko 2-way sync?

@andreastt
Copy link
Member

Is it the slowness of wpt lint that prevents us from hooking it up to mozlint? AIUI m-c’s default linter runs on touched files, so if it supported that maybe not every file had to be linted every time.

flake8, using the configuration already available in WPT, seems easier to hook up becuase there is already plumbing in mozlint for that.

@jgraham
Copy link
Contributor

jgraham commented Nov 19, 2017

wpt lint is hooked up. Since the rules can change it doesn't always catch everything. The python lint isn't hooked up, but I think we are already running flake8 for some other things, so that's probably possible to set up; I don't know if we can ensure we are using the right rules.

@Hexcles
Copy link
Member Author

Hexcles commented Nov 20, 2017

Yeah, the underlying root cause is a race condition that's hard to be fixed: changes can be made on the vendor side while new lint rules are being added to this GitHub repo. (There's a more extreme scenario in my comment above, but that's quite rare and is not the direct cause of the issue we are discussing.)

However, one easy way to mitigate the problem is to sync more often, which alleviate this race condition in two folds:

  1. Frequent GitHub -> m-c sync ensures m-c has up-to-date lint rules most of the time.
  2. If m-c -> GitHub sync happens more often (say right after each commit lands), then we'll be able to wait for the Travis checks to complete before merging the PR, which is not quite feasible in the current batch/burst mode.

Presumably Mozilla's new two-way sync will improve on this very aspect?

@foolip
Copy link
Member

foolip commented Nov 20, 2017

Was there really a race in this case? Sounds like there's just some missing lint that's been missing for some time?

@Hexcles
Copy link
Member Author

Hexcles commented Nov 20, 2017

@foolip Well, from what we've heard from moz folks, m-c is running wpt lint (there might be some discrepancies in Python files, but lints for tests should be the same). When the changes in question were committed, they passed all the lints in m-c at the time. Either the lints in m-c at the time were already out-of-date, or new lints were added between the changes landed in m-c and exported to GitHub. Both would lead to this fail mode. And they are both essentially race conditions.

@foolip
Copy link
Member

foolip commented Nov 21, 2017

Right, some race conditions are inevitable, but if most of the cases could be avoided by just being more in sync, then I wouldn't be very concerned about the fact that a race remains.

@foolip
Copy link
Member

foolip commented Nov 21, 2017

To clarify: it's inevitable with 2-way sync because we don't have cross-repo atomic commits, so however hard we try we can get into situations that require a human to resolve. Until superhuman AI.

@gsnedders
Copy link
Member

My hypothesis is that wpt lint has been asserting in mozilla-central for a long time and hence not running to completion, and nobody noticed it was failing with an uncaught exception.

@foolip
Copy link
Member

foolip commented Feb 21, 2018

https://bugzilla.mozilla.org/show_bug.cgi?id=1428582 is now resolved.

@gsnedders, do you think that this issue itself is now then also solved?

@gsnedders
Copy link
Member

I would assume so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants