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

core: remove last debugString references #5856

Merged
merged 4 commits into from Aug 22, 2018
Merged

Conversation

patrickhulce
Copy link
Collaborator

Remaining cleanup from the debugString change, updates the gatherers to return explanation instead of debugString to align with our output in LHR.

@@ -37,21 +37,21 @@ const ALLOWED_ORIENTATION_VALUES = [
*/
function parseString(raw, trim) {
let value;
let debugString;
Copy link
Member

Choose a reason for hiding this comment

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

seems like we want the manifest-parser still returning something like debugString? explanation seems too generic for what is always indicating an error/warning. Gatherers that use it would still only use the standard thing

Copy link
Member

Choose a reason for hiding this comment

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

Originally in manifest-parser it was warning, which got switched to debugString, which was then spread throughout Lighthouse cause why not, all in #102 :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

explanation seems too generic for what is always indicating an error/warning.

sounds like you're upset with our decision to use explanation period :)

I'm not 100% sure what you're advocating for, is it for this PR to just remove the TODO and fix the tests then since we don't want to pursue it?

Copy link
Member

Choose a reason for hiding this comment

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

sounds like you're upset with our decision to use explanation period :)

haha, well, explanation on an audit is a little confusing in isolation (we really should add a jsdoc description to it in audit.d.ts :), but it comes in the context of a failing audit.

In this case the only indication that there was an issue is the existence of the string. I meant just for manifest-parser.js, it's not in the gatherer or audit pipelines, it's just a lib file, so it seems fine to have a more descriptive property name specific to that file.

Copy link
Member

Choose a reason for hiding this comment

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

looked and within manifest-parser, i'd say that, semantically, all these properties are really warnings. Except for the errorMessage at the end about invalid JSON

So i'd be in favor of changing the manifestparser explanation->warning for all items and errorMesssage on the toplevel. and also tweaking manifest-values.js to use these terms as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@brendankenny are you on board with warning as well? I think it reads rather well now (aside from the fact that it's warning = 'ERROR: 😆)

Copy link
Member

Choose a reason for hiding this comment

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

are you on board with warning as well?

yes, sounds good to me

(aside from the fact that it's warning = 'ERROR: 😆)

lol yes, that's terrible

@@ -425,7 +425,7 @@ function parse(string, manifestUrl, documentUrl) {
return {
raw: string,
value: undefined,
debugString: 'ERROR: file isn\'t valid JSON: ' + e,
warning: 'ERROR: file isn\'t valid JSON: ' + e,
Copy link
Member

Choose a reason for hiding this comment

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

I think @paulirish wanted this to be errorMessage, as this was the one true place it can fail (everywhere else it falls back to a default)

Copy link
Member

Choose a reason for hiding this comment

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

(it will be interesting to see if you change it just here (and errorMessage: undefined below) if tsc will correctly pick up all the places it needs to be adjusted automatically since the artifact is dynamically typed from the inferred return value of this function...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh meant to reply to this, this was an intentional feigned ignorance about that part of the comment ;)

I don't think manifest-parser should to try to name its properties based on how one audit will pass/fail because of its value. From the perspective of manifest-parser all of these strings are messages explaining that something was abnormal about the raw value (there are other cases that we ignore the string and provide a default where it's a warning).

Since we're taking the stance that these are all warnings and not total failures, seems like we should lean in to it :)

Copy link
Member

Choose a reason for hiding this comment

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

on the one hand.. this field represents why the manifest parser was unable to parse.
but on the other hand.. i dont really care. 😑 i'm fine with warning if you'd prefer it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

lol, I'd prefer it given the agreement we have around everything else in there labelled ERROR: being a warning :)

sg!

Copy link
Member

Choose a reason for hiding this comment

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

this field represents why the manifest parser was unable to parse.

I also agree with this. It's the only real failure for a manifest. Everything else is a warning that something was malformed but the browser will fall back to a default, so the manifest will still work.

But I also don't care that much :) it's just (minor) ergonomics of the result, not correctness.

@@ -19,7 +19,7 @@ const BOM_FIRSTCHAR = 65279;
class Manifest extends Gatherer {
/**
* Returns the parsed manifest or null if the page had no manifest. If the manifest
* was unparseable as JSON, manifest.value will be undefined and manifest.debugString
* was unparseable as JSON, manifest.value will be undefined and manifest.explanation
Copy link
Member

Choose a reason for hiding this comment

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

warning/errorMessage?

@ebidel
Copy link
Contributor

ebidel commented Aug 21, 2018

Long live debugString 👑

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM

@paulirish paulirish merged commit 673eedf into master Aug 22, 2018
@paulirish paulirish deleted the no_more_debug_string branch August 22, 2018 00:48
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.

None yet

4 participants