Skip to content

Commit 8e33cfe

Browse files
Merge pull request #1568 from Mark-Simulacrum/fix-triage
Fix triage endpoint not going past current commit
2 parents 375af64 + f36ecb0 commit 8e33cfe

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

collector/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ pub struct DeltaTime(#[serde(with = "round_float")] pub f64);
2323
/// In the case of commits or tags this is an exact bound, but for dates
2424
/// it's a best effort (i.e., if the bound is a date but there are no artifacts
2525
/// for that date, we'll find the artifact that most closely matches).
26-
#[derive(Debug, Clone, PartialEq, Eq)]
26+
#[derive(Default, Debug, Clone, PartialEq, Eq)]
2727
pub enum Bound {
2828
/// An unverified git commit (in sha form) or a tag of a commit (e.g., "1.53.0")
2929
Commit(String),
3030
/// A date in time
3131
Date(NaiveDate),
3232
/// No bound
33+
#[default]
3334
None,
3435
}
3536

site/src/api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ pub mod triage {
448448
#[derive(Debug, Clone, Serialize, Deserialize)]
449449
pub struct Request {
450450
pub start: Bound,
451+
#[serde(default)]
451452
pub end: Bound,
452453
}
453454

site/src/comparison.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ pub async fn handle_triage(
3535
let start_artifact = ctxt
3636
.artifact_id_for_bound(start.clone(), true)
3737
.ok_or(format!("could not find start commit for bound {:?}", start))?;
38+
let end_artifact = ctxt
39+
.artifact_id_for_bound(end.clone(), false)
40+
.ok_or(format!("could not find end commit for bound {:?}", end))?;
3841
// This gives a better error, but is still not great -- the common case here
3942
// is that we've had a 422 error and as such had a fork. It's possible we
4043
// could diagnose that and give a nicer error here telling the user which
@@ -49,8 +52,6 @@ pub async fn handle_triage(
4952
let mut num_comparisons = 0;
5053
let metric = Metric::InstructionsUser;
5154
let benchmark_map = ctxt.get_benchmark_category_map().await;
52-
// Track whether we are on the known last iteration
53-
let mut last_iteration = false;
5455

5556
let end = loop {
5657
let comparison = match compare_given_commits(
@@ -83,7 +84,7 @@ pub async fn handle_triage(
8384
populate_report(&comparison, &benchmark_map, &mut report).await;
8485

8586
// If we already know this is the last iteration, we can stop
86-
if last_iteration {
87+
if comparison.b.artifact == end_artifact {
8788
break before;
8889
}
8990

@@ -93,8 +94,6 @@ pub async fn handle_triage(
9394
// We keep doing comparisons...
9495
Some(n) => {
9596
before = next;
96-
// The next iteration is the last if the next bound is equal to the end bound
97-
last_iteration = n != end;
9897
next = n;
9998
}
10099
// There is no next commit so we stop.

0 commit comments

Comments
 (0)