[go: nahoru, domu]

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

misc(build): create error-y LHR for the deploy #9283

Merged
merged 11 commits into from
Jun 29, 2019
Merged

Conversation

paulirish
Copy link
Member

will aid in looking at some of @connorjclark's recent PRs.

@paulirish paulirish changed the base branch from deployvariants to master June 25, 2019 22:23
@paulirish
Copy link
Member Author

@connorjclark this one doesn't add any runWarnings.... it probably should. got a suggestion for what to add in there?

@connorjclark
Copy link
Collaborator

"Something went wrong with recording the trace over your page load. Please run Lighthouse again. (NO_FCP)"

@connorjclark
Copy link
Collaborator

a classic

@patrickhulce
Copy link
Collaborator

got a suggestion for what to add in there?

We can just throw any string into the LighthouseRunWarnings artifact, right?

Copy link
Collaborator
@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM!

lighthouse-core/scripts/build-report-for-autodeployment.js Outdated Show resolved Hide resolved
Co-Authored-By: Patrick Hulce <patrick.hulce@gmail.com>
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@paulirish
Copy link
Member Author

We can just throw any string into the LighthouseRunWarnings artifact, right?

yup. just wanted something realistic. ;)

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.

This seems like it could be pretty fragile. What do you think about checking in error artifacts? If the pageLoadError-defaultPass trace and devtoolsLog are deleted, they should be quite small.

@@ -220,6 +220,8 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
element.appendChild(groupEl);
}

// TODO: Handle passed w/ warnings in a unique clump like non-perf categories do
Copy link
Member

Choose a reason for hiding this comment

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

This is chicken nuggets an issue

Copy link
Member Author

Choose a reason for hiding this comment

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

ayup #9288

Copy link
Member

Choose a reason for hiding this comment

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

delete then? it doesn't really have anything to do with this PR and is redundant with that PR

lighthouse-core/scripts/build-report-for-autodeployment.js Outdated Show resolved Hide resolved

/**
* Generate an LHR with errors for the renderer to display
* We'll write an "empty" artifacts file to disk, only to use it in auditMode
Copy link
Member

Choose a reason for hiding this comment

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

Needs periods

},
};
// @ts-ignore driver isn't mocked out completely
const artifacts = await GatherRunner.initializeBaseArtifacts(options);
Copy link
Member

Choose a reason for hiding this comment

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

One downside here is that ts-ignore is going to make this invisible to any breaking changes made to initializeBaseArtifacts, and since it's an internal method that could pretty easily happen

Copy link
Collaborator

Choose a reason for hiding this comment

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

how about throwing a ts-ignore/cast on the driver object instead?

mkdirp(TMP);
fs.writeFileSync(`${TMP}/artifacts.json`, JSON.stringify(artifacts), 'utf-8');
const errorRunnerResult = await lighthouse(url, {auditMode: TMP});
const errorLhr = /** @type {LH.RunnerResult} */ (errorRunnerResult).lhr;
Copy link
Member

Choose a reason for hiding this comment

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

Why does this need a cast?

Copy link
Member Author

Choose a reason for hiding this comment

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

because lighthouse can return RunnerResult | undefined (i think because of -G?)

Copy link
Member

Choose a reason for hiding this comment

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

because lighthouse can return RunnerResult | undefined (i think because of -G?)

ah, oh right. I prefer the real undefined check over the cast personally, but not a big deal in this case

@paulirish
Copy link
Member Author

What do you think about checking in error artifacts?

I was thinking that (and i've done something like that locally for months) but calling GatherRunner.initializeBaseArtifacts gives me the same thing, without as much maintenance cost.

Not sure if you were suggesting it, but also adding that reverse engineering how to structure artifacts to get these warnings also is not fun.

@@ -220,6 +220,8 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
element.appendChild(groupEl);
}

// TODO: Handle passed w/ warnings in a unique clump like non-perf categories do
Copy link
Member

Choose a reason for hiding this comment

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

delete then? it doesn't really have anything to do with this PR and is redundant with that PR

mkdirp(TMP);
fs.writeFileSync(`${TMP}/artifacts.json`, JSON.stringify(artifacts), 'utf-8');
const errorRunnerResult = await lighthouse(url, {auditMode: TMP});
const errorLhr = /** @type {LH.RunnerResult} */ (errorRunnerResult).lhr;
Copy link
Member

Choose a reason for hiding this comment

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

because lighthouse can return RunnerResult | undefined (i think because of -G?)

ah, oh right. I prefer the real undefined check over the cast personally, but not a big deal in this case

const artifacts = await GatherRunner.initializeBaseArtifacts(options);
// Add in a global runWarning
artifacts.LighthouseRunWarnings.push(`Something went wrong with recording the trace over your
page load. Please run Lighthouse again. (NO_FCP)`);
Copy link
Member
@brendankenny brendankenny Jun 27, 2019

Choose a reason for hiding this comment

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

What do you think about checking in error artifacts? If the pageLoadError-defaultPass trace and devtoolsLog are deleted, they should be quite small.

could just replace all of the above with

/** @type {LH.BaseArtifacts} */
const artifacts = {
  fetchTime: '2019-06-26T23:56:58.381Z',
  LighthouseRunWarnings: [
    `Something went wrong with recording the trace over your page load. Please run Lighthouse again. (NO_FCP)`, // eslint-disable-line max-len
  ],
  TestedAsMobileDevice: true,
  HostUserAgent: 'Mozilla/5.0 ErrorUserAgent Chrome/66',
  NetworkUserAgent: 'Mozilla/5.0 ErrorUserAgent Chrome/66',
  BenchmarkIndex: 1000,
  WebAppManifest: null,
  Stacks: [],
  settings: defaultSettings,
  URL: {
    requestedUrl: 'http://fakeurl.com',
    finalUrl: 'http://fakeurl.com',
  },
  Timing: [],
  PageLoadError: null,
  devtoolsLogs: {},
  traces: {},
};

and then continue as below. Only a little bit longer and the type assertion keeps everything in sync.

@googlebot

This comment has been minimized.

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.

Nice! LGTM

@paulirish paulirish merged commit 0da300a into master Jun 29, 2019
@paulirish paulirish deleted the deployvariant-error branch June 29, 2019 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants