Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add Site Health test to verify that static assets are served with far-future expires #1727
base: trunk
Are you sure you want to change the base?
Add Site Health test to verify that static assets are served with far-future expires #1727
Changes from 26 commits
dc9e364
4cb07aa
ec9a552
dd8e70d
0078cfc
3e5d958
35e7977
3db5886
655d4e5
20099bf
54f3621
0a776c5
3c98337
7afd746
3fcd641
54c73ec
6a2da47
48166ac
17d380e
200b518
1b4cef4
ed28196
ee3a57d
f6ba392
0620840
7ebdc87
49ca83f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 10 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L9-L10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two different checks which are getting performed one with
Cache-Control
,Expires
and other withEtag
,Last-Modified
should there be different messages shown based on the checks?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the new 3db5886 commit a table is used to display reason for different failure cases.
Check warning on line 109 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L104-L109
Check warning on line 120 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L115-L120
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two
if
statements lack tests, but I don't think they are critical.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditions here seem a bit confusing to me, related to how
perflab_ffh_check_headers()
returns either anarray
orfalse
. I think it would be preferable ifperflab_ffh_check_headers
always returned an array. Maybe it could always return an array key formissing_max_age
which is a boolean. And then this could be changed to:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently even if one asset fails the header check then this test will be show in the site health. Would it be better to show a table with mime type which will specifically tell for which mime type needs to add the
Cache-Control
headers?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A table makes sense to me.
Check warning on line 178 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L178
Check warning on line 181 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L180-L181
Check warning on line 185 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L184-L185
Check warning on line 190 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L187-L190
Check warning on line 200 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L196-L200
Check warning on line 207 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L204-L207
Check warning on line 212 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L209-L212
Check warning on line 219 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L216-L219
Check warning on line 225 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L221-L225
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a test is missing for the
max-age
being present but it not being high enough.Check warning on line 229 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L227-L229
Check warning on line 235 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L231-L235
Check warning on line 240 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L239-L240
Check warning on line 245 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L243-L245
Check warning on line 251 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L247-L251
Check warning on line 267 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L266-L267
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor improvement.
Check warning on line 271 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L269-L271
Check warning on line 274 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L273-L274
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like test coverage for this line is warranted.
Check warning on line 283 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L277-L283
Check warning on line 286 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L285-L286
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could add a test for this case, although not critical.
Check warning on line 290 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L289-L290
Check warning on line 307 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L303-L307
Check warning on line 314 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L309-L314
Check warning on line 317 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L317
Check warning on line 319 in plugins/performance-lab/includes/site-health/far-future-headers/helper.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/helper.php#L319
Check warning on line 10 in plugins/performance-lab/includes/site-health/far-future-headers/hooks.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/hooks.php#L9-L10
Check warning on line 27 in plugins/performance-lab/includes/site-health/far-future-headers/hooks.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/hooks.php#L23-L27
Check warning on line 29 in plugins/performance-lab/includes/site-health/far-future-headers/hooks.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/far-future-headers/hooks.php#L29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A trivial function to add a test for, but it would ensure test coverage.
Check warning on line 35 in plugins/performance-lab/includes/site-health/load.php
Codecov / codecov/patch
plugins/performance-lab/includes/site-health/load.php#L34-L35