From 3cdee1cada62b2014eba05ca4f3d27f6c82faa69 Mon Sep 17 00:00:00 2001 From: Colin Rofls Date: Thu, 31 Oct 2024 13:07:22 -0400 Subject: [PATCH] [crater] Use timestamp to key crater results We were using the fontc rev as the key to a map of runs -> detailed results, which doesn't work because it's possible for multiple runs to share the same git rev (e.g. if the inputs or the installed python packages have changed) --- fontc_crater/src/ci.rs | 2 +- fontc_crater/src/ci/html.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fontc_crater/src/ci.rs b/fontc_crater/src/ci.rs index c2a58f2a..496ebb33 100644 --- a/fontc_crater/src/ci.rs +++ b/fontc_crater/src/ci.rs @@ -85,7 +85,7 @@ fn run_crater_and_save_results(args: &CiArgs) -> Result<(), Error> { let mut prev_runs: Vec = load_json_if_exists_else_default(&summary_file)?; // todo: fontc_repo should be checked out by us, and have a known path let fontc_rev = super::get_git_rev(None).unwrap(); - let pip_freeze_sha = super::pip_freeze_sha(); + let pip_freeze_sha = dbg!(super::pip_freeze_sha()); if let Some(last_run) = prev_runs.last() { if last_run.fontc_rev == fontc_rev && Some(last_run.input_file.as_os_str()) == args.to_run.file_name() diff --git a/fontc_crater/src/ci/html.rs b/fontc_crater/src/ci/html.rs index 59b32bea..23febac9 100644 --- a/fontc_crater/src/ci/html.rs +++ b/fontc_crater/src/ci/html.rs @@ -12,6 +12,7 @@ use crate::{ ttx_diff_runner::{CompilerFailure, DiffError, DiffOutput, DiffValue}, TargetId, }; +use chrono::{DateTime, Utc}; use maud::{html, Markup, PreEscaped}; use super::{DiffResults, RunSummary}; @@ -27,7 +28,7 @@ pub(super) fn generate(target_dir: &Path) -> Result<(), Error> { let details = summary .iter() .flat_map(|run| match run.try_load_results(target_dir) { - Some(Ok(results)) => Some(Ok((run.fontc_rev.clone(), results))), + Some(Ok(results)) => Some(Ok((run.began, results))), None => None, Some(Err(e)) => Some(Err(e)), }) @@ -41,7 +42,7 @@ pub(super) fn generate(target_dir: &Path) -> Result<(), Error> { fn make_html( summary: &[RunSummary], sources: &BTreeMap, - results: &HashMap, + results: &HashMap, DiffResults>, ) -> Result { let table_body = make_table_body(summary); let css = include_str!("../../resources/style.css"); @@ -65,8 +66,8 @@ fn make_html( }; let detailed_report = match summary { [.., prev, current] => make_detailed_report( - results.get(¤t.fontc_rev).unwrap(), - results.get(&prev.fontc_rev).unwrap(), + results.get(¤t.began).unwrap(), + results.get(&prev.began).unwrap(), sources, ), _ => html!(),