Fix double-wrapped no-network issue in createKnowledgeFromData#143
Open
marcusosterberg wants to merge 1 commit into
Open
Fix double-wrapped no-network issue in createKnowledgeFromData#143marcusosterberg wants to merge 1 commit into
marcusosterberg wants to merge 1 commit into
Conversation
When the target page cannot be loaded (e.g. browsertime UrlLoadError),
createKnowledgeFromData wrapped the no-network issue in an extra
'no-network' key, producing knowledgeData.issues of the shape:
{ 'no-network': { 'no-network': { rule, severity, subIssues, ... } } }
instead of the expected:
{ 'no-network': { rule, severity, subIssues, ... } }
This caused downstream consumers (plugin-webperf-core's pug template
and webperf_core's calculate_rating) to fail because severity and
subIssues were one level too deep.
Aligns the shape with plugin-accessibility-statement and the rest of
the no-network handling in this file.
Fixes #142
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Removes an extra
'no-network'wrapper object from the issue emittedby
createKnowledgeFromDatawhen the target page could not be loaded.The issue now has the same shape as in
plugin-accessibility-statementand the rest of
lib/harAnalyzer.js.Fixes #.
Before
After
Verification
Tested by running
python default.py -t 2 -u <site> -r -o t2.jsonagainst a site that triggers browsertime's
UrlLoadError. Beforethe fix, this crashes downstream (
Cannot read properties of undefined (reading 'length')in plugin-webperf-core's pug template,then
KeyError: 'severity'in webperf_core). After the fix the testcompletes and reports
no-networkas a warning issue.