From d2c872809570fc027e696c194814ed8261ba7c54 Mon Sep 17 00:00:00 2001 From: altair823 Date: Thu, 30 Apr 2026 08:55:39 +0000 Subject: [PATCH] p0-1: address review (drop unused thiserror dep, document kb-core reserve) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Cargo.toml: remove `thiserror` from kb-config, kb-parse-types, kb-app (unused — none of those crates' src trees reference thiserror; CoreError in kb-core is the only consumer). - kb-config keeps the `kb-core` dep with a one-line comment marking CoreError reserved for P1-* config-error wiring per the review thread. - ids.rs: switch `validate_hex32` from a hand-rolled `matches!` byte range to `is_ascii_hexdigit()` so the hex check is the canonical idiom (and satisfies `clippy::manual_is_ascii_check` under `-D warnings`). Co-Authored-By: Claude Opus 4.7 (1M context) --- Cargo.lock | 3 --- crates/kb-app/Cargo.toml | 1 - crates/kb-config/Cargo.toml | 2 +- crates/kb-core/src/ids.rs | 5 +---- crates/kb-parse-types/Cargo.toml | 1 - 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9d47bea..58f8384 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -283,7 +283,6 @@ dependencies = [ "kb-core", "serde", "serde_json", - "thiserror 2.0.18", "toml", "tracing", "tracing-appender", @@ -311,7 +310,6 @@ dependencies = [ "kb-core", "serde", "serde_json", - "thiserror 2.0.18", "toml", ] @@ -335,7 +333,6 @@ version = "0.1.0" dependencies = [ "kb-core", "serde", - "thiserror 2.0.18", ] [[package]] diff --git a/crates/kb-app/Cargo.toml b/crates/kb-app/Cargo.toml index f9857de..b224590 100644 --- a/crates/kb-app/Cargo.toml +++ b/crates/kb-app/Cargo.toml @@ -11,7 +11,6 @@ description = "Facade — orchestrates components for kb-cli/tui/desktop" kb-core = { path = "../kb-core" } kb-config = { path = "../kb-config" } anyhow = { workspace = true } -thiserror = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } tracing = { workspace = true } diff --git a/crates/kb-config/Cargo.toml b/crates/kb-config/Cargo.toml index 000ccc2..f1430f8 100644 --- a/crates/kb-config/Cargo.toml +++ b/crates/kb-config/Cargo.toml @@ -8,9 +8,9 @@ repository = { workspace = true } description = "Config schema + XDG path resolution" [dependencies] +# kb-core::CoreError reserved for P1-* config errors kb-core = { path = "../kb-core" } anyhow = { workspace = true } -thiserror = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } toml = "0.8" diff --git a/crates/kb-core/src/ids.rs b/crates/kb-core/src/ids.rs index 9e09a5a..46f60ce 100644 --- a/crates/kb-core/src/ids.rs +++ b/crates/kb-core/src/ids.rs @@ -53,10 +53,7 @@ fn validate_hex32(s: &str) -> Result<(), CoreError> { s.len() ))); } - if !s - .bytes() - .all(|b| matches!(b, b'0'..=b'9' | b'a'..=b'f' | b'A'..=b'F')) - { + if !s.bytes().all(|b| b.is_ascii_hexdigit()) { return Err(CoreError::InvalidId(format!( "non-hex character in {s:?}" ))); diff --git a/crates/kb-parse-types/Cargo.toml b/crates/kb-parse-types/Cargo.toml index b0612a9..6f79453 100644 --- a/crates/kb-parse-types/Cargo.toml +++ b/crates/kb-parse-types/Cargo.toml @@ -10,4 +10,3 @@ description = "Parser intermediate representations (no parser libs allowed)" [dependencies] kb-core = { path = "../kb-core" } serde = { workspace = true } -thiserror = { workspace = true }