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: replace remaining rawValue with numericValue #8421

Merged
merged 2 commits into from
Apr 25, 2019
Merged

Conversation

brendankenny
Copy link
Member

part 3 of 3 after #8343 and #8385

Replaces rawValue with numericValue in the internal audit output (LH.Audit.Product). Went suspiciously easily :)

fixes #6199

@@ -26,7 +26,7 @@ describe('Performance: first-contentful-paint-3g audit', () => {

const result = await FCP3G.audit(artifacts, {settings: {}, options, computedCache: new Map()});
// Use InlineSnapshot here so changes to Lantern coefficients can be easily updated en masse
Copy link
Member Author

Choose a reason for hiding this comment

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

:roll_eyes: :P

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh puh-lease 😛 there's like 40 freaking values to manually and copy and paste when lantern changes and I've had to do it like 8 times. do you want to volunteer to manually fix every expectation every time this happens from here on out?

@@ -75,8 +75,7 @@ describe('PWA: load-fast-enough-for-pwa audit', () => {

const settings = {throttlingMethod: 'provided', throttling: {rttMs: 40, throughput: 100000}};
const result = await FastPWAAudit.audit(artifacts, {settings, computedCache: new Map()});
expect(result.rawValue).toBeGreaterThan(2000); // If not overridden this would be 1582
expect(Math.round(result.rawValue)).toMatchSnapshot();
Copy link
Member Author

Choose a reason for hiding this comment

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

wasn't sure why this was this way, but just a single number, so removed

Copy link
Collaborator

Choose a reason for hiding this comment

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

@brendankenny it's a lantern computed value it does it this way so that lantern changes can be updated with -u in jest

Copy link
Collaborator

Choose a reason for hiding this comment

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

could you revert with a comment?

@@ -75,8 +75,7 @@ describe('PWA: load-fast-enough-for-pwa audit', () => {

const settings = {throttlingMethod: 'provided', throttling: {rttMs: 40, throughput: 100000}};
const result = await FastPWAAudit.audit(artifacts, {settings, computedCache: new Map()});
expect(result.rawValue).toBeGreaterThan(2000); // If not overridden this would be 1582
expect(Math.round(result.rawValue)).toMatchSnapshot();
Copy link
Collaborator

Choose a reason for hiding this comment

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

@brendankenny it's a lantern computed value it does it this way so that lantern changes can be updated with -u in jest

@@ -75,8 +75,7 @@ describe('PWA: load-fast-enough-for-pwa audit', () => {

const settings = {throttlingMethod: 'provided', throttling: {rttMs: 40, throughput: 100000}};
const result = await FastPWAAudit.audit(artifacts, {settings, computedCache: new Map()});
expect(result.rawValue).toBeGreaterThan(2000); // If not overridden this would be 1582
expect(Math.round(result.rawValue)).toMatchSnapshot();
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you revert with a comment?

@@ -26,7 +26,7 @@ describe('Performance: first-contentful-paint-3g audit', () => {

const result = await FCP3G.audit(artifacts, {settings: {}, options, computedCache: new Map()});
// Use InlineSnapshot here so changes to Lantern coefficients can be easily updated en masse
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh puh-lease 😛 there's like 40 freaking values to manually and copy and paste when lantern changes and I've had to do it like 8 times. do you want to volunteer to manually fix every expectation every time this happens from here on out?

@brendankenny
Copy link
Member Author

brendankenny commented Apr 19, 2019

In memoriam:

The earliest reference to rawValue I can find is in #61 in a proposed audit output format, where you can see me worrying about tags (what were those going to be?) and the complexity of a possible emerging "audits of audits" architecture. We don't discuss the rawValue name, so it may have already been decided upon.

Also we were going to have auditResult.fault as the explanation of why the audit screwed up and couldn't handle your site, which is the modern day LH.Audit.Result['warnings']. I kind of like fault :)

The types landed a day later in the great Aggregator PR from @paullewis. At that point, audits had a value and a rawValue.

rawValue rapidly became the dumping ground for whatever seemed raw-ish. Finally, a few months
later, there's issue #458 from @paulirish suggesting we rename value to score, and describing rawValue as not exactly "raw" :) That issue birthed displayValue and gave us a refined rawValue of either a number or boolean [and eventually null], never a string that we kept around for some reason for another three years :)

@@ -37,7 +37,7 @@ class PreloadAsAudit extends Audit {
const passed = noAsLinks.length === 0;

return {
rawValue: passed,
score: passed ? 1 : 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

+passed? idk how hacky you'll allow js to be :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I did something like Number(passed) for real audits, but since this is a recipe I thought I'd be more explicit. Not sure if this is actually more self explanatory, though :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like the explicitness of this for the recipe :)

@brendankenny
Copy link
Member Author

@patrickhulce you're still requesting changes

@patrickhulce
Copy link
Collaborator

Oh my bad sorry thought I came back to this already :)

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

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.

Remove rawValue from Audit.Result
4 participants