Summary
Error types are implemented manually instead of using derive macros
Error types in src/server/src/error.rs and src/server/src/auth.rs have hand-written Display, Error, and From implementations. This is verbose boilerplate that the ecosystem has standardized solutions for, and the manual implementations lack proper error chaining.
Parseable types don't implement FromStr
Types like EvictionPolicy and UserRole define their ownfrom_str() -> Option<Self>methods instead of implementing the standard std::str::FromStr trait. This prevents them from working with .parse() and other standard library APIs that expect the trait.
Metrics JSON is built with format!()
Metrics::to_json() constructs JSON output using string formatting rather than a serialization library. This approach is fragile it won't handle escaping correctly and will silently produce invalid JSON if any value contains special characters.
Opcode definitions are duplicated across crates
src/server/src/opcodes.rs and src/ctl/src/opcodes.rs define identical opcode constants independently. Changes to one must be manually mirrored in the other, and since they're raw u16 constants rather than an enum, the compiler can't check for exhaustive matching.
Acceptance Criteria
Summary
Error types are implemented manually instead of using derive macros
Error types in
src/server/src/error.rsandsrc/server/src/auth.rshave hand-written Display, Error, and From implementations. This is verbose boilerplate that the ecosystem has standardized solutions for, and the manual implementations lack proper error chaining.Parseable types don't implement FromStr
Types like EvictionPolicy and UserRole define their own
from_str() -> Option<Self>methods instead of implementing the standardstd::str::FromStrtrait. This prevents them from working with.parse()and other standard library APIs that expect the trait.Metrics JSON is built with
format!()Metrics::to_json()constructs JSON output using string formatting rather than a serialization library. This approach is fragile it won't handle escaping correctly and will silently produce invalid JSON if any value contains special characters.Opcode definitions are duplicated across crates
src/server/src/opcodes.rsandsrc/ctl/src/opcodes.rsdefine identical opcode constants independently. Changes to one must be manually mirrored in the other, and since they're rawu16constants rather than an enum, the compiler can't check for exhaustive matching.Acceptance Criteria
DisplayorErrorimpls for error typesEvictionPolicyandUserRoleimplementFromStrcargo clippy --all-targets -- -D warningspasses