Skip to content

Add purgeHTML extractor to fix flakiness

Paul Slaughter requested to merge ps-add-purge-html-extractor into master

What does this MR do?

This MR should help harden the purge-css-check jobs and prevent flaky failures. It does this by adding the official HTML extractor, instead of using a default extractor that only looks for words in a file regardless of context.

How does this help?

In this failed pipeline one of the fixtures was generated with a csp-nonce with content="p/...". This caused our default extractor to find the word "p" and fail because it was missing 😞

Screen_Shot_2021-06-03_at_5.18.35_PM

https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/1316947507

By using the official HTML extractor, we will be significantly less vulnerable to false positives (that cause pipeline failures) 😬

HTML Fixtures

These are the HTML fixtures of the failed job. You can use them to analyze what words PurgeCSS might have been finding which will rightfully ignore now.

https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/1316947471/artifacts/browse/tmp/tests/frontend/fixtures/startup_css/

Screenshots (strongly suggested)

How to test?

Since the startup_css is only visible for a second, you can use this patch to force it to stay with ?startup_css_only=true

0001-Add-startup_css_only-condition.patch

Description Screenshot
Project with ?startup_css_only=true Screen_Shot_2021-06-03_at_5.59.08_PM
Dark mode with ?startup_css_only=true Screen_Shot_2021-06-03_at_6.00.17_PM

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Paul Slaughter

Merge request reports

Loading