Description
AgentError::Db in crates/zeph-core/src/agent/error.rs:115 is declared as Db(String), which erases the typed DbError from zeph-db. All three call sites in shadow_sentinel.rs use .map_err(|e| AgentError::Db(e.to_string())), destroying the original DbError structure.
zeph-db is already a direct dependency of zeph-core, and DbError implements std::error::Error, so a transparent #[from] conversion is possible without adding any new dependency.
Reproduction Steps
crates/zeph-core/src/agent/error.rs:115 — Db(String) variant
crates/zeph-core/src/agent/shadow_sentinel.rs:334, :364, :397 — all call .map_err(|e| AgentError::Db(e.to_string()))
Expected Behavior
#[error(transparent)]
Db(#[from] zeph_db::DbError),
This allows callers to pattern-match on DbError::Sqlx, DbError::Migration, etc., and preserves the full error chain for structured logging and observability.
Actual Behavior
DbError is converted to a string at the call site. Callers cannot distinguish between a connection failure, migration failure, or query error.
Environment
- Version: HEAD 1d8a03a
- Features: core
Logs / Evidence
crates/zeph-core/src/agent/error.rs:115
crates/zeph-core/src/agent/shadow_sentinel.rs:334,364,397
Description
AgentError::Dbincrates/zeph-core/src/agent/error.rs:115is declared asDb(String), which erases the typedDbErrorfromzeph-db. All three call sites inshadow_sentinel.rsuse.map_err(|e| AgentError::Db(e.to_string())), destroying the originalDbErrorstructure.zeph-dbis already a direct dependency ofzeph-core, andDbErrorimplementsstd::error::Error, so a transparent#[from]conversion is possible without adding any new dependency.Reproduction Steps
crates/zeph-core/src/agent/error.rs:115—Db(String)variantcrates/zeph-core/src/agent/shadow_sentinel.rs:334,:364,:397— all call.map_err(|e| AgentError::Db(e.to_string()))Expected Behavior
This allows callers to pattern-match on
DbError::Sqlx,DbError::Migration, etc., and preserves the full error chain for structured logging and observability.Actual Behavior
DbErroris converted to a string at the call site. Callers cannot distinguish between a connection failure, migration failure, or query error.Environment
Logs / Evidence
crates/zeph-core/src/agent/error.rs:115crates/zeph-core/src/agent/shadow_sentinel.rs:334,364,397