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

fix(server): skip needless/verbose audit diffs #881

Merged
merged 3 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ const BIG_PICTURE_LIMITS = {
'largest-contentful-paint': [0, 15000],
'speed-index': [0, 15000],
'first-cpu-idle': [0, 15000],
interactive: [0, 20000],
'interactive': [0, 20000],
'estimated-input-latency': [0, 1500],
'max-potential-fid': [0, 1500],
'total-blocking-time': [0, 1500],
'experimental-interaction-to-next-paint': [0, 3500],
'cumulative-layout-shift': [0, 1],
__default__: [0, 30 * 1000],
};
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/utils/src/audit-diff-finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const {getGroupForAuditId} = require('./seed-data/lhr-generator.js');
/** @typedef {'better'|'worse'|'added'|'removed'|'ambiguous'|'no change'} RowLabel */
/** @typedef {{item: Record<string, any>, kind?: string, index: number}} DetailItemEntry */

// Hardcoded audit ids that arent worth diffing and generally regress the UX when done.
const auditsToNotDIff = ['main-thread-tasks', 'screenshot-thumbnails', 'metrics'];

/**
* @param {number} delta
* @param {'audit'|'score'} deltaType
Expand Down Expand Up @@ -383,6 +386,7 @@ function deepPruneItemForKeySerialization(item) {
function getItemKey(item) {
// For most opportunities, diagnostics, etc where 1 row === 1 resource
if (typeof item.url === 'string' && item.url) return item.url;
if (typeof item.origin === 'string' && item.origin) return item.origin;
// For sourcemapped opportunities that identify a source location
const source = item.source;
if (typeof source === 'string') return source;
Expand Down Expand Up @@ -580,6 +584,8 @@ function findAuditDiffs(baseAudit, compareAudit, options = {}) {
/** @type {Array<LHCI.AuditDiff>} */
const diffs = [];

if (auditsToNotDIff.includes(auditId)) return diffs;

if (typeof baseAudit.score === 'number' || typeof compareAudit.score === 'number') {
diffs.push(
createAuditDiff({
Expand Down