Skip to content

Commit 3b58fda

Browse files
List new errors on comparison pages
1 parent ac6acbd commit 3b58fda

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

site/src/api.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ pub mod comparison {
150150
pub b: ArtifactDescription,
151151
pub comparisons: Vec<Comparison>,
152152

153+
pub new_errors: Vec<(String, String)>,
154+
153155
/// The names for the next artifact after `b`, if any.
154156
pub next: Option<String>,
155157

site/src/comparison.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! comparison endpoints
44
55
use crate::api;
6-
use crate::db::{ArtifactId, Benchmark, Profile, Scenario};
6+
use crate::db::{ArtifactId, Benchmark, Lookup, Profile, Scenario};
77
use crate::github;
88
use crate::load::SiteCtxt;
99
use crate::selector::{self, Tag};
@@ -132,11 +132,14 @@ pub async fn handle_compare(
132132
})
133133
.collect();
134134

135+
let mut new_errors = comparison.new_errors.into_iter().collect::<Vec<_>>();
136+
new_errors.sort();
135137
Ok(api::comparison::Response {
136138
prev,
137139
a: comparison.a.into(),
138140
b: comparison.b.into(),
139141
comparisons,
142+
new_errors,
140143
next,
141144
is_contiguous,
142145
})
@@ -323,6 +326,21 @@ impl ComparisonSummary {
323326
write!(result, "- ").unwrap();
324327
change.summary_line(&mut result, Some(link))
325328
}
329+
330+
if !comparison.new_errors.is_empty() {
331+
write!(
332+
result,
333+
"- New errors in {}",
334+
comparison
335+
.new_errors
336+
.keys()
337+
.map(|k| k.as_str())
338+
.collect::<Vec<_>>()
339+
.join(", ")
340+
)
341+
.unwrap();
342+
}
343+
326344
result
327345
}
328346
}
@@ -368,6 +386,7 @@ async fn compare_given_commits(
368386
master_commits: &[collector::MasterCommit],
369387
calc_new_sig: bool,
370388
) -> Result<Option<Comparison>, BoxedError> {
389+
let idx = ctxt.index.load();
371390
let a = ctxt
372391
.artifact_id_for_bound(start.clone(), true)
373392
.ok_or(format!("could not find start commit for bound {:?}", start))?;
@@ -408,10 +427,22 @@ async fn compare_given_commits(
408427
})
409428
})
410429
.collect();
430+
431+
let mut errors = conn.get_error(b.lookup(&idx).unwrap()).await;
432+
for (name, error) in conn.get_error(a.lookup(&idx).unwrap()).await {
433+
if error.is_some() {
434+
errors.remove(&name);
435+
}
436+
}
437+
411438
Ok(Some(Comparison {
412439
a: ArtifactDescription::for_artifact(&*conn, a.clone(), master_commits).await,
413440
b: ArtifactDescription::for_artifact(&*conn, b.clone(), master_commits).await,
414441
statistics,
442+
new_errors: errors
443+
.into_iter()
444+
.filter_map(|(k, v)| v.map(|v| (k, v)))
445+
.collect(),
415446
}))
416447
}
417448

@@ -557,6 +588,7 @@ pub struct Comparison {
557588
pub b: ArtifactDescription,
558589
/// Statistics based on test case
559590
pub statistics: HashSet<TestResultComparison>,
591+
pub new_errors: HashMap<String, String>,
560592
}
561593

562594
impl Comparison {

site/static/compare.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,14 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
431431
</div>
432432
</div>
433433
</div>
434+
<div v-if="data.new_errors.length">
435+
<p><b>Newly broken benchmarks</b>:</p>
436+
<details v-for="[crate, error] in data.new_errors">
437+
<summary>{{ crate }}</summary>
438+
<pre>{{ error }}</pre>
439+
</details>
440+
<hr />
441+
</div>
434442
<table id="benches" class="compare">
435443
<thead>
436444
<tr>
@@ -835,4 +843,4 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
835843
</script>
836844
</body>
837845

838-
</html>
846+
</html>

0 commit comments

Comments
 (0)