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

🐛 Bug fix on java validator for failed test due to $DEFAULT at rule evaluation #27842

Merged
merged 18 commits into from
Apr 22, 2020

Conversation

GeorgeLuo
Copy link
Contributor

business logic change + test for fix + update tagchowder to newer version

@amp-owners-bot
Copy link

amp-owners-bot bot commented Apr 17, 2020

Hey @ampproject/wg-caching, these files were changed:

validator/java/WORKSPACE
validator/java/ampvalidator_checkstyle.xml
validator/java/build.sh
validator/java/pom.xml
validator/java/src/main/bin/copyValidatorJavaSource.sh
validator/java/src/main/java/dev/amp/validator/CdataMatcher.java
validator/java/src/main/java/dev/amp/validator/css/Canonicalizer.java
validator/java/src/main/java/dev/amp/validator/css/CssParsingConfig.java
validator/java/src/main/java/dev/amp/validator/parser/AMPHtmlParser.java
validator/java/src/main/java/dev/amp/validator/utils/CssSpecUtils.java
validator/java/src/main/java/dev/amp/validator/visitor/InvalidRuleVisitor.java
validator/java/src/main/proto/validator.proto
validator/java/src/test/java/dev/amp/validator/CdataMatcherTest.java
validator/java/src/test/java/dev/amp/validator/css/CanonicalizerTest.java
validator/java/src/test/java/dev/amp/validator/css/CssParsingConfigTest.java
validator/java/src/test/java/dev/amp/validator/utils/CssSpecUtilsTest.java

@rsimha
Copy link
Contributor

rsimha commented Apr 17, 2020

Tagging @ampproject/wg-caching, since it doesn't look like owners bot has the permission to @mention working groups

/cc @rcebulko @mrjoro

@twifkak twifkak requested a review from Gregable April 17, 2020 23:48
@twifkak
Copy link
Member

twifkak commented Apr 17, 2020

@Gregable This looks to be a port of cl/305733898 (#27784).

@honeybadgerdontcare
Copy link
Contributor

@Gregable This looks to be a port of cl/305733898 (#27784).

Yes. They need to get these engine changes in so the tests can pass for Java.

@rsimha
Copy link
Contributor

rsimha commented Apr 20, 2020

@GeorgeLuo @honeybadgerdontcare @Gregable A couple questions about these tests:

  1. From the latest travis logs, it appears the tests are still broken. Let me know if this isn't expected, and if you need help debugging.
  2. Several of the dependencies in validator/java/pom.xml are out of date, and some of them are showing up as security vulnerabilities in our repo (see 🏗📦 Switch renovate updates for amphtml from opt-in to opt-out #27692 (review)). I've enabled auto-upgrades for this file using our existing package auto-updater, but the java validator test failures are preventing us from merging all the upgrade PRs (15 and counting). Once the tests themselves are fixed, we'll need to a) re-test and re-run all these upgrade PRs or b) do a one-time manual upgrade of all packages in validator/java/pom.xml and then let automated maintenance take over. Can you help with this?

@GeorgeLuo
Copy link
Contributor Author

@rsimha yes, I can run a clean pull and see if tests fail, due to discrepancies with my local repos. I might ask to enable debugging for the build if it works from my local environment, just for a little visibility.

@rsimha
Copy link
Contributor

rsimha commented Apr 21, 2020

@rsimha yes, I can run a clean pull and see if tests fail, due to discrepancies with my local repos. I might ask to enable debugging for the build if it works from my local environment, just for a little visibility.

Thanks for the help. If you're developing on Linux or MacOS, you should be able to run these tests by checking out the amphtml repo and invoking gulp validator-java:

For local debugging, you'll see more logging by changing -verbose from 1 to 2 here:

args=['-testjar','libamphtml_validator_test_lib.jar','-verbose','1'],

@GeorgeLuo
Copy link
Contributor Author

Thank you! My maven build with a clean env was successful. When trying with gulp it actually looks it's hanging after the resource files are pulled down, with "Did you forget to signal async completion". It doesn't look like the tests are even ran.

This happens in the case when the files already exist as well. Either a resolution comes from the gulp job or our shell script to fetch resources needs modification. Have you seen this class of error before?

@rsimha
Copy link
Contributor

rsimha commented Apr 21, 2020

Have you seen this class of error before?

I'm unfamiliar with this. Can you temporarily increase the verbosity in your PR and see what the Travis logs reveal?

@GeorgeLuo
Copy link
Contributor Author

GeorgeLuo commented Apr 21, 2020

I can do that. here is what I'm observing

[01:23:34] Starting 'validator-java'...
install_bazel.sh Bazel binary detected at bazel-installer/bazel-3.0.0-installer-darwin-x86_64.sh; skipping installation
Both validator.proto and validator-all.protoascii exist
Copying Validator.java from /Users/gluo17/Documents/workspace/amphtml/validator/java/bazel-bin/amp/validator
done copying

I added the "done copying" to the end of amphtml/validator/java/src/main/bin/copyValidatorJavaSource.sh

It hangs after that. So it looks like it's not returning from that script gracefully, or whatever is calling that is not returning gracefully. What is the path from "gulp validator-java" to the shell script? I see it referenced in BUILD and nowhere else. But I'm not sure who is handling that BUILD file. It seems to be bazel.

@GeorgeLuo
Copy link
Contributor Author

GeorgeLuo commented Apr 21, 2020

When I run the build and test script, the ./build.sh step takes 30 seconds or so, successfully though. Could there be some kind of timeout when bringing travis into the equation?

Curiously, the output here proceeds through to the test output, displaying failure. Has any of the build logic been changed since?

change tagchowder
@GeorgeLuo
Copy link
Contributor Author

It worked courtesy of @nhant01. bazel was silently failing during the build phase because we only updated the tagchowder library in maven and didn't do the same in the bazel WORKSPACE. we'll probably need to figure out how to splay these types of errors. I'm going to clean up some of the echos and such.

Copy link
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

Glad you were able to figure this out. Now that tests are green, I'm going to merge this in order to unblock all the java validator upgrade PRs.

@rsimha rsimha merged commit 3900c8d into ampproject:master Apr 22, 2020
@rsimha
Copy link
Contributor

rsimha commented Apr 22, 2020

These tests are still failing during CI. See logs. Any idea what's going on?

/invite @GeorgeLuo @nhant01

@amp-invite-bot
Copy link

An invitation to join ampproject has been sent to @GeorgeLuo. I will update this thread when the invitation is accepted.

@GeorgeLuo
Copy link
Contributor Author

unclear but pulling the latest proto seems to have introduced compilation failure cases to do with css specs. I imagine we're in a state where the .proto under java validator compiled fine (outdated), but the protoascii has introduced new models and flows. I'll get the engine changes in and then see about the tests.

@rsimha
Copy link
Contributor

rsimha commented Apr 22, 2020

Thanks @GeorgeLuo. Meanwhile, we have a large backlog of package upgrade PRs for the Java validator that are all blocked by the test failures. Since validator/java/pom.xml currently has several outdated dependencies, would it make sense for you to do a one-time upgrade of all of them?

Under normal circumstances, once the file is up to date, there will be far fewer upgrade PRs each week, and they can be individually tested and merged as they appear.

Edit: I've filed #27939 to track this work.

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

Successfully merging this pull request may close these issues.

None yet

7 participants