Summary
GrpcMethodType in crates/samvad-models/src/lib.rs exposes as_reqwest() and as_str() methods that map gRPC streaming types to HTTP verbs (GET, POST, PUT, PATCH). This mapping is semantically incorrect — gRPC operates entirely over HTTP/2 and the streaming classification has no mapping to HTTP verbs. The methods are never called in the current codebase.
Location
crates/samvad-models/src/lib.rs · lines 640–658
Code
impl GrpcMethodType {
pub fn as_reqwest(&self) -> reqwest::Method {
match self {
GrpcMethodType::Unary => reqwest::Method::GET, // wrong
GrpcMethodType::ClientStreaming => reqwest::Method::POST, // wrong
GrpcMethodType::ServerStreaming => reqwest::Method::PUT, // wrong
GrpcMethodType::BidirectionalStreaming => reqwest::Method::PATCH, // wrong
}
}
pub fn as_str(&self) -> &'static str {
match self {
GrpcMethodType::Unary => "GET", // wrong
GrpcMethodType::ClientStreaming => "POST", // wrong
GrpcMethodType::ServerStreaming => "PUT", // wrong
GrpcMethodType::BidirectionalStreaming => "PATCH", // wrong
}
}
}
These appear to be copy-paste artefacts from the HttpMethod implementation.
Fix
Remove both as_reqwest() and as_str() from GrpcMethodType. If a display string is needed later, implement Display with proper names ("Unary", "ClientStreaming", etc.) and derive it from the enum variant names or a proper match.
Impact
- Dead code kept in the public API of
samvad-models creates confusion for contributors.
- A future refactor that accidentally calls
.as_reqwest() on a GrpcMethodType will get silently wrong data with no compiler warning.
Summary
GrpcMethodTypeincrates/samvad-models/src/lib.rsexposesas_reqwest()andas_str()methods that map gRPC streaming types to HTTP verbs (GET, POST, PUT, PATCH). This mapping is semantically incorrect — gRPC operates entirely over HTTP/2 and the streaming classification has no mapping to HTTP verbs. The methods are never called in the current codebase.Location
crates/samvad-models/src/lib.rs· lines 640–658Code
These appear to be copy-paste artefacts from the
HttpMethodimplementation.Fix
Remove both
as_reqwest()andas_str()fromGrpcMethodType. If a display string is needed later, implementDisplaywith proper names ("Unary", "ClientStreaming", etc.) and derive it from the enum variant names or a proper match.Impact
samvad-modelscreates confusion for contributors..as_reqwest()on aGrpcMethodTypewill get silently wrong data with no compiler warning.