heartwood every commit a ring

Drop noisy score column and pure diagnostics from lighthouse opportunities

be692dbe by Isaac Bythewood · 1 day ago

Drop noisy score column and pure diagnostics from lighthouse opportunities

Modern Lighthouse leaves TTI as `group: "hidden"` and reports diagnostics
(forced-reflow, network-dependency-tree, LCP request discovery) alongside
real opportunities, all with score 0. The score column was therefore
nearly always 0.0 and added no signal. Filter to audits with actual
savings (ms, bytes, or metricSavings), drop hidden, and remove the column.
modified frontend/static_src/base/styles/base.scss
@@ -865,6 +865,11 @@ footer {  }}.insight-header.insight--3col,.insight-row.insight--3col {  grid-template-columns: 1fr 1fr 140px;}@media (max-width: 767px) {  .insight-header { display: none; }  .insight-row {
modified src/lighthouse.rs
@@ -210,6 +210,11 @@ pub fn parse_details(results: &Value) -> Option<Details> {            }            // Opportunities/diagnostics: skip passing/manual/not-applicable.            // `group: "hidden"` covers TTI and other audits Lighthouse keeps            // around but no longer scores; they shouldn't masquerade as wins.            if group == "hidden" {                continue;            }            let mode = audit                .get("scoreDisplayMode")                .and_then(|v| v.as_str())
@@ -226,13 +231,30 @@ pub fn parse_details(results: &Value) -> Option<Details> {                .and_then(|d| d.get("overallSavingsMs"))                .and_then(|v| v.as_f64())                .unwrap_or(0.0);            let savings_bytes = audit                .get("details")                .and_then(|d| d.get("overallSavingsBytes"))                .and_then(|v| v.as_f64())                .unwrap_or(0.0);            let has_metric_savings = audit                .get("metricSavings")                .and_then(|v| v.as_object())                .map(|m| {                    m.values()                        .any(|v| v.as_f64().map(|n| n > 0.0).unwrap_or(false))                })                .unwrap_or(false);            // Require at least one actionable signal; pure diagnostics            // (forced-reflow, network-dependency-tree, etc.) carry none and            // would otherwise show up with a meaningless 0 score.            if savings_ms == 0.0 && savings_bytes == 0.0 && !has_metric_savings {                continue;            }            opportunities.push(serde_json::json!({                "id": id,                "title": audit.get("title"),                "display_value": audit.get("displayValue"),                "score": s,                "savings_ms": savings_ms,                "weight": weight,            }));        }    }
modified templates/properties/property.html
@@ -276,19 +276,13 @@  {% if property.lighthouse_details.opportunities %}  <div class="section-label mb-2">top opportunities</div>  <div class="insight-header">    <span>Score</span>  <div class="insight-header insight--3col">    <span>Audit</span>    <span>Detail</span>    <span class="text-end">Est. savings</span>  </div>  {% for opp in property.lighthouse_details.opportunities %}  <div class="insight-row">    <span>      <span class="chip {% if opp.score >= 0.9 %}chip-ok{% elif opp.score >= 0.5 %}chip-warn{% else %}chip-down{% endif %}">        {{ opp.score | round(2) }}      </span>    </span>  <div class="insight-row insight--3col">    <span class="insight-col-trunc" title="{{ opp.title }}">{{ opp.title }}</span>    <span class="insight-col-trunc text-muted small" title="{{ opp.display_value or '' }}">      {{ opp.display_value or "—" }}