From 84f1867a21ef229b9eaa671be3775fae3b69ac4b Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 9 Mar 2026 15:23:15 -0700 Subject: chore: upgrade axum 0.7 to 0.8 to deduplicate with tonic's axum atuin-server used axum 0.7 while tonic already pulled in axum 0.8, resulting in both versions compiled into the binary. Migrates to axum 0.8: path params use {param} syntax, FromRequestParts uses native async traits (dropping async-trait dep from atuin-server). --- Cargo.lock | 71 +++++---------------------------------- crates/atuin-server/Cargo.toml | 3 +- crates/atuin-server/src/router.rs | 6 ++-- 3 files changed, 12 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 989ef5c1..bc4e4da1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -491,12 +491,11 @@ name = "atuin-server" version = "18.13.0-beta.3" dependencies = [ "argon2", - "async-trait", "atuin-common", "atuin-server-database", "atuin-server-postgres", "atuin-server-sqlite", - "axum 0.7.9", + "axum", "clap", "config", "eyre", @@ -572,13 +571,13 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "axum" -version = "0.7.9" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" dependencies = [ - "async-trait", - "axum-core 0.4.5", + "axum-core", "bytes", + "form_urlencoded", "futures-util", "http", "http-body", @@ -586,13 +585,12 @@ dependencies = [ "hyper", "hyper-util", "itoa", - "matchit 0.7.3", + "matchit", "memchr", "mime", "percent-encoding", "pin-project-lite", - "rustversion", - "serde", + "serde_core", "serde_json", "serde_path_to_error", "serde_urlencoded", @@ -604,52 +602,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "axum" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" -dependencies = [ - "axum-core 0.5.6", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "itoa", - "matchit 0.8.4", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "serde_core", - "sync_wrapper", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "mime", - "pin-project-lite", - "rustversion", - "sync_wrapper", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "axum-core" version = "0.5.6" @@ -666,6 +618,7 @@ dependencies = [ "sync_wrapper", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -2749,12 +2702,6 @@ dependencies = [ "regex-automata", ] -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - [[package]] name = "matchit" version = "0.8.4" @@ -5418,7 +5365,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fec7c61a0695dc1887c1b53952990f3ad2e3a31453e1f49f10e75424943a93ec" dependencies = [ "async-trait", - "axum 0.8.8", + "axum", "base64", "bytes", "h2", diff --git a/crates/atuin-server/Cargo.toml b/crates/atuin-server/Cargo.toml index 9627cb7a..b7779899 100644 --- a/crates/atuin-server/Cargo.toml +++ b/crates/atuin-server/Cargo.toml @@ -32,8 +32,7 @@ serde = { workspace = true } serde_json = { workspace = true } rand = { workspace = true } tokio = { workspace = true } -async-trait = { workspace = true } -axum = "0.7" +axum = "0.8" fs-err = { workspace = true } tower = { workspace = true } tower-http = { version = "0.6", features = ["trace"] } diff --git a/crates/atuin-server/src/router.rs b/crates/atuin-server/src/router.rs index 0c41d5e6..2d679759 100644 --- a/crates/atuin-server/src/router.rs +++ b/crates/atuin-server/src/router.rs @@ -1,4 +1,3 @@ -use async_trait::async_trait; use atuin_common::api::{ATUIN_CARGO_VERSION, ATUIN_HEADER_VERSION, ErrorResponse}; use axum::{ Router, @@ -22,7 +21,6 @@ use atuin_server_database::{Database, DbError, models::User}; pub struct UserAuth(pub User); -#[async_trait] impl FromRequestParts> for UserAuth where DB: Database, @@ -118,14 +116,14 @@ pub fn router(database: DB, settings: Settings) -> Router { routes = routes .route("/sync/count", get(handlers::history::count)) .route("/sync/history", get(handlers::history::list)) - .route("/sync/calendar/:focus", get(handlers::history::calendar)) + .route("/sync/calendar/{focus}", get(handlers::history::calendar)) .route("/sync/status", get(handlers::status::status)) .route("/history", post(handlers::history::add)) .route("/history", delete(handlers::history::delete)); } let routes = routes - .route("/user/:username", get(handlers::user::get)) + .route("/user/{username}", get(handlers::user::get)) .route("/account", delete(handlers::user::delete)) .route("/account/password", patch(handlers::user::change_password)) .route("/register", post(handlers::user::register)) -- cgit v1.3.1