Skip to content

Commit e35aa07

Browse files
Jeadieclaude
andcommitted
Remove dead error check in client and add PartialEq to protocol response types
Remove duplicate JSON-RPC error check in `call_typed` that was already handled by `call_raw`, and derive `PartialEq`/`Eq` on all response types to make assertion-based testing easier for consumers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: d2372e19bd45
1 parent 026cb00 commit e35aa07

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

crates/system-adapter-protocol/src/client.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,6 @@ impl Client {
227227
let request_value = serde_json::to_value(request)?;
228228
let response_value = self.call_raw(request_value).await?;
229229
let response: JsonRpcResponse<Resp> = serde_json::from_value(response_value)?;
230-
231-
if let Some(error) = response.error {
232-
return Err(ClientError::JsonRpc(error));
233-
}
234-
235230
Ok(response)
236231
}
237232

crates/system-adapter-protocol/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub struct SetupRequest {
164164
}
165165

166166
/// Response from setup request
167-
#[derive(Debug, Clone, Serialize, Deserialize)]
167+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
168168
pub struct SetupResponse {
169169
/// Indicates if setup was successful
170170
pub ok: bool,
@@ -180,7 +180,7 @@ pub struct QueryMethodRequest {
180180
}
181181

182182
/// Response containing database connection information
183-
#[derive(Debug, Clone, Serialize, Deserialize)]
183+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
184184
pub struct QueryMethodResponse {
185185
/// ADBC driver to use for database connections
186186
pub driver: AdbcDriver,
@@ -198,7 +198,7 @@ pub struct TeardownRequest {
198198
}
199199

200200
/// Response from teardown request
201-
#[derive(Debug, Clone, Serialize, Deserialize)]
201+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
202202
pub struct TeardownResponse {
203203
/// Indicates if teardown was successful
204204
pub ok: bool,
@@ -214,7 +214,7 @@ pub struct MetricsRequest {
214214
}
215215

216216
/// Resource utilization snapshot from the system under test
217-
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
217+
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
218218
pub struct ResourceMetrics {
219219
/// CPU utilization as a percentage (0.0–100.0)
220220
#[serde(skip_serializing_if = "Option::is_none")]
@@ -237,7 +237,7 @@ pub struct ResourceMetrics {
237237
}
238238

239239
/// Ingestion progress snapshot from the system under test
240-
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
240+
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
241241
pub struct IngestionMetrics {
242242
/// Total rows ingested so far
243243
#[serde(skip_serializing_if = "Option::is_none")]
@@ -254,7 +254,7 @@ pub struct IngestionMetrics {
254254
}
255255

256256
/// Response containing current SUT metrics
257-
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
257+
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
258258
pub struct MetricsResponse {
259259
/// Resource utilization metrics (CPU, memory, disk, IOPS)
260260
pub resource: ResourceMetrics,

0 commit comments

Comments
 (0)