Skip to content

Commit

Permalink
[crater] Work around diffs rounded to 100%
Browse files Browse the repository at this point in the history
Sometimes ttx_diff reports a diff with ratio of 1.0, and we were
treating this the same as if it was identical. This patch makes sure we
are distinguishing between 'identical' and 'very very close' by manually
nudging the percent in this case.
  • Loading branch information
cmyr committed Feb 28, 2025
1 parent 18e5109 commit 801963c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fontc_crater/src/ci/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,12 @@ fn make_diff_report(
k,
match v {
DiffOutput::Identical => 100.0,
DiffOutput::Diffs(d) => d.get("total").unwrap().ratio().unwrap() * 100.0,
DiffOutput::Diffs(d) => {
// sometimes the output is rounded up to 100 but is
// not actually identical: we want to not show that as 100!
let diff_perc = d.get("total").unwrap().ratio().unwrap() * 100.0;
diff_perc.min(99.999)
}
},
)
})
Expand Down

0 comments on commit 801963c

Please sign in to comment.