forge
Explore
Log in

Don't you dare go Hollow

A run's jobs are listed in the order they run, not by name

Browse files at this commit

b67eb9a8ce5f458dddf4a454a79b4c3328c51281Ahmet Kaan GümüşParent: c7331fd
  • fix
    • a run's jobs are listed in the order they run, not by name
Show full message
🐛 fix: a run's jobs are listed in the order they run, not by name

A run's jobs come from ci_jobs in insertion order, which is dependency
order from the scheduler. The query sorted them by name, so a job drawn
after its dependency could appear above it on the timeline. Order by
rowid instead; matrix combinations stay grouped as they were inserted.
crates/forge-core/src/store/ci.rsmodified+2 -2
@@ -249,7 +249,7 @@ async fn load_job(conn: &Connection, id: &str) -> Result<Option<CiJob>> {
249 async fn jobs_of_run(conn: &Connection, run_id: &str) -> Result<Vec<CiJob>> {249 async fn jobs_of_run(conn: &Connection, run_id: &str) -> Result<Vec<CiJob>> {
250 fetch_all(250 fetch_all(
251 conn,251 conn,
252- &format!("SELECT {JOB_COLS} FROM ci_jobs WHERE run_id = ?1 ORDER BY name"),252+ &format!("SELECT {JOB_COLS} FROM ci_jobs WHERE run_id = ?1 ORDER BY rowid"),
253 (run_id.to_string(),),253 (run_id.to_string(),),
254 map_job,254 map_job,
255 )255 )
@@ -1550,7 +1550,7 @@ impl Store {
1550 Ok((runs, total))1550 Ok((runs, total))
1551 }1551 }
1552 1552
1553- /// The jobs of a run, by name.1553+ /// The jobs of a run, in insertion order: dependency order, matrix combinations grouped.
1554 pub async fn jobs_for_run(&self, run_id: &str) -> Result<Vec<CiJob>> {1554 pub async fn jobs_for_run(&self, run_id: &str) -> Result<Vec<CiJob>> {
1555 let conn = self.read_conn().await;1555 let conn = self.read_conn().await;
1556 jobs_of_run(&conn, run_id).await1556 jobs_of_run(&conn, run_id).await