Skip to content

chore: Chore add VNU GitHub Action#1206

Closed
nschonni wants to merge 1 commit into
mdn:mainfrom
nschonni:vnu-jar
Closed

chore: Chore add VNU GitHub Action#1206
nschonni wants to merge 1 commit into
mdn:mainfrom
nschonni:vnu-jar

Conversation

@nschonni

@nschonni nschonni commented Jan 12, 2021

Copy link
Copy Markdown
Contributor

As and alternate to mdn/yari#418
Downside to this approach is that there is no local runnable version of the testing without running the replacement that touches ~400 files

@nschonni nschonni requested a review from peterbe as a code owner January 12, 2021 09:01
@nschonni nschonni requested a review from a team January 12, 2021 09:01
@nschonni

Copy link
Copy Markdown
Contributor Author

@Elchi3 FYI, the issue it's failing on was introduced in mdn/yari#1106

@Elchi3

Elchi3 commented Jan 12, 2021

Copy link
Copy Markdown
Member

@nschonni not sure I follow. What did I break? :) Can you elaborate?

@Elchi3

Elchi3 commented Jan 12, 2021

Copy link
Copy Markdown
Member

ahh I see it now.

Error: "file:/home/runner/work/content/content/files/en-us/web/html/global_attributes/enterkeyhint/index.html":23.112-23.115: error: No “p” element in scope but a “p” end tag seen.

Yeah, it would be great if CI or any tests would have caught this for me. I'll try to see if I can add an HTML validator to my editor at least.

@Elchi3

Elchi3 commented Jan 12, 2021

Copy link
Copy Markdown
Member

Opened #1210 which should fix it.

@peterbe

peterbe commented Jan 12, 2021

Copy link
Copy Markdown
Contributor

I'm not sure. This feels like a hack. And adding vnu-jar feels very heavy. Also, this kind of stuff feels more appropriate to do with Yari if anything. https://github.com/mdn/content/runs/1686915136 was cool though.
There's just something that doesn't feel great about running the content through a HTML validator. It's not really HTML. It's Kumascript-HTML if anything. Perhaps it would make more sense to do a string replace on the rawHTML and replace it with something like <ignore data-macro="..."/> and then run it.
Besides, the whole sed stuff feels weird and if we're going to do this properly, I think we should do it properly and with more care and time. Sorry for sounding a bit of a downer. I'm also hesitant to invest more into the HTML validation when we could use the limited time and energy investing into something Markdownish.

@sideshowbarker

Copy link
Copy Markdown
Member

I'm also hesitant to invest more into the HTML validation when we could use the limited time and energy investing into something Markdownish.

Strongly agree. (And that coming from a developer of an HTML validator…) Feels like this might be a bit of an XY problem https://en.wikipedia.org/wiki/XY_problem.

It’d be great if a plan and proposed schedule for moving to something Markdown-ish were put together.

That said, if/when we do move to something Markdown-ish, does that means we necessarily mass-convert all the existing sources? Or instead would it be that — at least in the near term — we’d continue HTML file in the tree, mixed with some Markdown files?

@peterbe

peterbe commented Jan 12, 2021

Copy link
Copy Markdown
Contributor

I'm also hesitant to invest more into the HTML validation when we could use the limited time and energy investing into something Markdownish.

Strongly agree. (And that coming from a developer of an HTML validator…) Feels like this might be a bit of an XY problem https://en.wikipedia.org/wiki/XY_problem.

Never heard that one before. Thanks!

It’d be great if a plan and proposed schedule for moving to something Markdown-ish were put together.

I hear ya, but that's going to be hard. Sorry. The reason is that we predict it'll be a slow progress since we first need to do a bunch of exploration, research, and prototyping. Within that work, we'd get a better handle on compromises and trade-offs that we need to counter for the fact that we have so much legacy and weird content.

That said, if/when we do move to something Markdown-ish, does that means we necessarily mass-convert all the existing sources? Or instead would it be that — at least in the near term — we’d continue HTML file in the tree, mixed with some Markdown files?

I suspect we won't. It'd probably be gentle and almost a page-by-page. Or sub-tree by sub-tree.

@nschonni nschonni force-pushed the vnu-jar branch 3 times, most recently from b2ad410 to 115c117 Compare January 14, 2021 19:27
@nschonni nschonni mentioned this pull request Jan 14, 2021
@nschonni nschonni force-pushed the vnu-jar branch 5 times, most recently from 4c9d18e to 6add6b9 Compare January 19, 2021 17:23
@Ryuno-Ki

Copy link
Copy Markdown
Collaborator

That said, if/when we do move to something Markdown-ish, does that means we necessarily mass-convert all the existing sources?

I feel like this should be moved into another issue, which could be linked to to collect all the comments that contain bits of what would be needed.

@nschonni nschonni force-pushed the vnu-jar branch 3 times, most recently from 87ef826 to 4ee6a51 Compare January 24, 2021 20:59
@nschonni

Copy link
Copy Markdown
Contributor Author

@peterbe this continues to find issues as I rebase this occasionally. To make this more of a CI only thing, I could drop the package install and just "NPX" run it on the CI only

@nschonni nschonni force-pushed the vnu-jar branch 4 times, most recently from 8fda94d to 4befd17 Compare February 2, 2021 05:19
@nschonni

Copy link
Copy Markdown
Contributor Author

How about making it part of the regular Yari runner?

I don't think the complication of trying to add it to Yari is worth it. This job will go away at the end of your markdown conversion. This just keeps the files in better shape for editors (and the markdown conversion tool) till you eventually cut over.

It could even be part of the flaw system even though it's run on the source HTML file, not the built HTML.

Think @sideshowbarker mentioned before that this works best in "batch mode" like we're calling it here, vs individual invokations that each take a Java start-up hit.

I'd rather the CI doesn't become red ❌ unless there's important things that really ought to be fix now.

HTML validation issues are important, as either they creating rendering issues, or the browser is swallowing the issue, but may stop doing after an unrelated change on the page

So you got it working?? You had said: "and it's not going to work as it can't properly report the annotations back to the PR."

It's always been working as this current separate PR job. It didn't work when I tried to move it to a workflow trigger as part of the PR Companion. It's possible that way is workable with annotations, but you're fighting the built-in integration that Actions already has with the problem matchers. The implications for the other PR companion stuff is tracked in mdn/fred#955, and probably better to discuss there

@nschonni

Copy link
Copy Markdown
Contributor Author

Sorry, this has been going for awhile (started in another PR), so I forgot the "gotcha" for someone running locally, is that they'd get some "false positives" from the elements in the frontmatter on some pages.
CI modifies the local tree in place to escape that, but I didn't think it was "safe" to add that to the locally NPM script, so people don't accidentally change a large chunk of files.

@nschonni

nschonni commented May 3, 2021

Copy link
Copy Markdown
Contributor Author

@peterbe ping

@peterbe

peterbe commented May 3, 2021

Copy link
Copy Markdown
Contributor

@peterbe ping

So how do we test this? My fear is that false positives (where VNU incorrectly complains about a file the user didn't even touch) leads to a PR being failingly red when the user didn't introduce the problem. Perhaps they just touched a file that's always had an HTML validation problem.

Will yarn vnu-jar exit non-zero if there's a index.html that has a validation problem? Or will it just post a comment within the PR?

Perhaps butter me up and/or we put in some things to work around possible false positives and then we merge this and see how it goes.

Comment thread package.json
"node": ">=12.0.0"
},
"scripts": {
"vnu-jar": "java -jar node_modules/vnu-jar/build/dist/vnu.jar --errors-only --filterfile .vnurc --no-langdetect --skip-non-html files/",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How does it know which files to test? Will it test all 11k each time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tests them all in a batch each time, but it's around 3 minutes in the CI. User doesn't have to run it locally unless they want to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems here https://github.com/mdn/content/pull/1206/checks?check_run_id=2493264692 it only took 1m 32s.
23 seconds was the time it took to run the actual yarn vnu-jar.

Will this delay when the PR Review Companion starts to run? I know that one waits for the PR Test workflow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, this runs in parallel with the other jobs AFAIK. PR companion is waiting for the "PR Test" to finish, not all other parallel jobs

@nschonni

nschonni commented May 3, 2021

Copy link
Copy Markdown
Contributor Author

My fear is that false positives (where VNU incorrectly complains about a file the user didn't even touch) leads to a PR being failingly red when the user didn't introduce the problem.

If the error is with the file that is touched by the PR, it will show up on the regular files as inline annotations. If it's an issue with something they didn't touch, then GitHub pushes them to the bottom of the Files tab.
Either way, as we tested with the "System file changes" job, a contributor can always land even with the job failing if they don't want to bother a new contributor 😄

@peterbe

peterbe commented May 3, 2021

Copy link
Copy Markdown
Contributor

If the time it takes to run this is too slow, I don't want the reviewer (with merge access) to have to sit around impatiently waiting for the "HTML Linting" to go green whilst it's checking unrelated files. If that's the case we can optimize this workflow to just test the files/**/index.html files that were actually touched.

@Ryuno-Ki

Ryuno-Ki commented May 3, 2021

Copy link
Copy Markdown
Collaborator

If I understand that correctly, the failing test requires admin permissions to resolve?

@peterbe

peterbe commented May 3, 2021

Copy link
Copy Markdown
Contributor

If I understand that correctly, the failing test requires admin permissions to resolve?

No, just write access.

@peterbe

peterbe commented May 3, 2021

Copy link
Copy Markdown
Contributor

Let's try it! We'll keep an eye on it to see what things it's finding and what might not be great and we can iterate from there.

@nschonni

nschonni commented May 3, 2021

Copy link
Copy Markdown
Contributor Author

If I understand that correctly, the failing test requires admin permissions to resolve?

PS: @Ryuno-Ki we did some testing around that in #3728

@peterbe

peterbe commented May 3, 2021

Copy link
Copy Markdown
Contributor

@nschonni To be honest, I don't know how to test this.
I check out your branch and run

yarn vnu-jar

I get pages and pages of warnings and then it exits non-zero.

Screen Shot 2021-05-03 at 4 59 18 PM

How come it's not failing here in this PR?

@nschonni

nschonni commented May 3, 2021

Copy link
Copy Markdown
Contributor Author

How come it's not failing here in this PR?

Right, the CI is doing this to escape the front matter https://github.com/mdn/content/pull/1206/files#diff-c6f76479cefbaa8eea1ca9824164c77d44d8b981fbd44ae665e36cb09e6951f2R45

@peterbe

peterbe commented May 3, 2021

Copy link
Copy Markdown
Contributor

How come it's not failing here in this PR?

Right, the CI is doing this to escape the front matter https://github.com/mdn/content/pull/1206/files#diff-c6f76479cefbaa8eea1ca9824164c77d44d8b981fbd44ae665e36cb09e6951f2R45

Oh so it rewrites the index.html files first. Then you'd get different results.

@nschonni

nschonni commented May 3, 2021

Copy link
Copy Markdown
Contributor Author

It only re-writes the frontmatter lines in the CI, so the lines/colums it reports here are still correct

@nschonni

Copy link
Copy Markdown
Contributor Author

@peterbe #4901 fixes the latest round of issues this flagged so this can be landed before/after that one

@peterbe

peterbe commented May 11, 2021

Copy link
Copy Markdown
Contributor

@nschonni Dang! Now that I wake up from my snooze, your CI tests are failing. Sorry.

@nschonni

Copy link
Copy Markdown
Contributor Author

@peterbe that PR was landed, rebased and needed to submit #4916 for the new ones since last night
I suggest just landing this and cleaning up things as they come in

@nschonni

Copy link
Copy Markdown
Contributor Author

@peterbe and there were more between landing the latest and rebasing 😄
I'll submit a cleanup PR after if you land this

@peterbe

peterbe commented May 11, 2021

Copy link
Copy Markdown
Contributor

@peterbe and there were more between landing the latest and rebasing 😄
I'll submit a cleanup PR after if you land this

I did see the PR you submitted recently. Great catches! That kind of stuff would have been prevented with this as part of CI. Right?

@nschonni

Copy link
Copy Markdown
Contributor Author

Yup, that's what this catches, but doesn't block a PR from landing if a maintainer is OK with cleaning it up after

@nschonni

Copy link
Copy Markdown
Contributor Author

@peterbe any remaining concerns?

@peterbe

peterbe commented May 13, 2021

Copy link
Copy Markdown
Contributor

@peterbe any remaining concerns?

Can you merge in main one more time to assert that all errors will go away.

Also, I don't understand your point about being able to merge even if the line CI fails. Won't that just ruin CI for the next person making a PR if you merge it.

@nschonni

Copy link
Copy Markdown
Contributor Author

@peterbe rebased again
Yes the next persons CI might go red, but I've said I'd submit another PR to clean it up (like the 31 others I submitted while this has been open https://github.com/mdn/content/pulls?q=is%3Apr+html+validation+is%3Aclosed+author%3Anschonni)

@peterbe

peterbe commented May 13, 2021

Copy link
Copy Markdown
Contributor

I don't like...

  • This runs for every file and not just the ones touched.
  • The complicated sed command doesn't work on any OS.
  • That this whole thing relies on changing the file which makes it problematic to run locally

nschonni#1 solves 1 and 2 of that list.

What's so weird is that if someone, a reviewer, says "Fine. I'll let this pass" it'll poison every other PR going forward.
It also just feels strange to run something like vnu-jar on all ~12k files. It could maybe make sense in a push workflow or as a cronjob.

@peterbe

peterbe commented May 13, 2021

Copy link
Copy Markdown
Contributor

nschonni#1 solves 1 and 2 of that list.

Perhaps I rushed that. The front-matter doesn't actually need to escaped. It just needs to be deleted, right?
Using that bodyBegin attribute from fm() we could turn...

---
foo: "bar"
---
<p>Here it starts</p>

...into...

<p>Here it starts</p>

the line number still make sense in the problem matcher and front-matter could never matter.

@nschonni

Copy link
Copy Markdown
Contributor Author

OK, I give up. @sideshowbarker I'll leave this to you to work out internally

@peterbe

peterbe commented May 13, 2021

Copy link
Copy Markdown
Contributor

OK, I give up. @sideshowbarker I'll leave this to you to work out internally

Please don't. If you agree and can incorporate my PR I think this is good to go.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants