From 0f1f0f9272b2e963f48736fc7e62dd4ec5d8d9e7 Mon Sep 17 00:00:00 2001 From: Neel Date: Thu, 19 Mar 2026 19:04:43 +0000 Subject: [PATCH] cloud_llm_client: Add derives for edit prediction fields (#51968) ## Context This PR adds some derives which make tracing easier on cloud side. ## Self-Review Checklist - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --- crates/cloud_llm_client/src/cloud_llm_client.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/cloud_llm_client/src/cloud_llm_client.rs b/crates/cloud_llm_client/src/cloud_llm_client.rs index d2d25ff5b84ef524f4e573a13149b26fe32fc4a5..8c06bd7ebb10b48acca46a4fc7c8afd82eb1a979 100644 --- a/crates/cloud_llm_client/src/cloud_llm_client.rs +++ b/crates/cloud_llm_client/src/cloud_llm_client.rs @@ -111,7 +111,8 @@ pub struct PredictEditsBody { pub trigger: PredictEditsRequestTrigger, } -#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize)] +#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize, strum::AsRefStr)] +#[strum(serialize_all = "snake_case")] pub enum PredictEditsRequestTrigger { Testing, Diagnostics, @@ -170,7 +171,10 @@ pub struct EditPredictionRejection { pub e2e_latency_ms: Option, } -#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] +#[derive( + Default, Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash, strum::AsRefStr, +)] +#[strum(serialize_all = "snake_case")] pub enum EditPredictionRejectReason { /// New requests were triggered before this one completed Canceled,