From 8c6070fa1ba3f4e27d2654ac34bc41a8cedddedc Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Tue, 12 May 2026 15:30:09 -0700 Subject: [PATCH 1/3] fix: handle malformed token from backend better --- src/api_client.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/api_client.rs b/src/api_client.rs index ce9ef6fc..ef4be1b2 100644 --- a/src/api_client.rs +++ b/src/api_client.rs @@ -385,7 +385,10 @@ impl CodSpeedAPIClient { .await; match response { Ok(data) => Ok(data.session), - Err(err) if err.contains_error_code("UNAUTHENTICATED") => { + Err(err) + if err.contains_error_code("UNAUTHENTICATED") + || err.contains_error_code("UNAUTHORIZED") => + { Err(SessionError::Unauthenticated) } Err(err) => Err(SessionError::Other(anyhow!( @@ -423,7 +426,10 @@ impl CodSpeedAPIClient { session: data.session, repository_overview: data.repository_overview, }), - Err(err) if err.contains_error_code("UNAUTHENTICATED") => { + Err(err) + if err.contains_error_code("UNAUTHENTICATED") + || err.contains_error_code("UNAUTHORIZED") => + { Err(SessionAndRepositoryOverviewError::Unauthenticated) } Err(err) if err.contains_error_code("REPOSITORY_NOT_FOUND") => { From 974385801d410d15070e713f8fb3173afef7fdbb Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Tue, 12 May 2026 15:31:49 -0700 Subject: [PATCH 2/3] chore: remove the cursor hiding The benefits of this are really not worth the hassle of making sure the cursor gets re-enabled. For this, we'll want some actual TUI frontend that is solved these issues for us. --- Cargo.lock | 11 ----------- Cargo.toml | 8 ++++++-- src/cli/mod.rs | 43 +------------------------------------------ 3 files changed, 7 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8dcb4eb6..3e32d34f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4836,16 +4836,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - [[package]] name = "simd-adler32" version = "0.3.7" @@ -5382,7 +5372,6 @@ dependencies = [ "libc", "mio", "pin-project-lite", - "signal-hook-registry", "socket2 0.6.1", "tokio-macros", "windows-sys 0.61.2", diff --git a/Cargo.toml b/Cargo.toml index cf387bdf..88e63201 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ serde = { workspace = true } serde_json = { workspace = true, features = ["preserve_order"] } url = "2.4.1" sha256 = "1.4.0" -tokio = { version = "1", features = ["macros", "rt", "signal"] } +tokio = { version = "1", features = ["macros", "rt"] } tokio-tar = { package = "astral-tokio-tar", version = "0.6.0" } tokio-util = "0.7.16" md5 = "0.7.0" @@ -132,7 +132,11 @@ lto = "thin" strip = true [package.metadata.dist] -targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-musl", "x86_64-unknown-linux-musl"] +targets = [ + "aarch64-apple-darwin", + "aarch64-unknown-linux-musl", + "x86_64-unknown-linux-musl", +] binaries.aarch64-apple-darwin = ["codspeed"] binaries.aarch64-unknown-linux-musl = ["codspeed"] binaries.x86_64-unknown-linux-musl = ["codspeed"] diff --git a/src/cli/mod.rs b/src/cli/mod.rs index cc1bca16..7aa0a6f6 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -18,7 +18,7 @@ use crate::{ api_client::CodSpeedAPIClient, config::CodSpeedConfig, executor::helpers::command::CommandBuilder, - local_logger::{CODSPEED_U8_COLOR_CODE, IS_TTY, init_local_logger}, + local_logger::{CODSPEED_U8_COLOR_CODE, init_local_logger}, prelude::*, project_config::DiscoveredProjectConfig, }; @@ -26,27 +26,6 @@ use clap::{ Parser, Subcommand, builder::{Styles, styling}, }; -use console::Term; - -/// Guard that hides the terminal cursor on creation and restores it on drop. -struct CursorGuard; - -impl CursorGuard { - fn new() -> Self { - if *IS_TTY { - let _ = Term::stderr().hide_cursor(); - } - Self - } -} - -impl Drop for CursorGuard { - fn drop(&mut self) { - if *IS_TTY { - let _ = Term::stderr().show_cursor(); - } - } -} fn create_styles() -> Styles { styling::Styles::styled() @@ -151,26 +130,6 @@ impl InternalCommands { pub async fn run() -> Result<()> { let cli = Cli::parse(); - // Important: keep this after the Cli::parse() because the function can exit the process by itself, skipping the drop of the CursorGuard - let _cursor_guard = CursorGuard::new(); - if *IS_TTY { - // Ctrl+C terminates the process before `CursorGuard::drop` runs, - // so we restore the cursor explicitly, then re-raise SIGINT with - // the default disposition so the parent shell sees the expected - // signal-terminated status. - tokio::spawn(async { - if tokio::signal::ctrl_c().await.is_ok() { - drop(_cursor_guard); // explicitly drop to restore cursor before re-raising - } - // Safety: resetting SIGINT to SIG_DFL and raising it are - // async-signal-safe and have no Rust-level invariants to break. - unsafe { - libc::signal(libc::SIGINT, libc::SIG_DFL); - libc::raise(libc::SIGINT); - } - }); - } - let mut api_client = build_api_client(&cli)?; // Discover project configuration file From fa0bfcb0f1aa5c2ba17064f08dfa292f39775902 Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Tue, 12 May 2026 16:15:29 -0700 Subject: [PATCH 3/3] fix: keep old name aliases to for deserialization purposes --- crates/runner-shared/src/fifo.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/runner-shared/src/fifo.rs b/crates/runner-shared/src/fifo.rs index 2af3bf1a..db309433 100644 --- a/crates/runner-shared/src/fifo.rs +++ b/crates/runner-shared/src/fifo.rs @@ -25,7 +25,11 @@ const _: () = assert!( pub enum MarkerType { SampleStart(u64), SampleEnd(u64), + // Old name is kept as an alias for backwards compatibility. + #[serde(alias = "BenchmarkStart")] RoundStart(u64), + // Old name is kept as an alias for backwards compatibility. + #[serde(alias = "BenchmarkEnd")] RoundEnd(u64), }