Skip to content

Commit d558d85

Browse files
authored
fix: Pkce variant serialization (#1788)
* remove mcp_client crate, install.rs, and fix small bug * fix tests
1 parent ff7ade2 commit d558d85

File tree

17 files changed

+4
-2266
lines changed

17 files changed

+4
-2266
lines changed

Cargo.lock

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ indicatif = "0.17.11"
8787
indoc = "2.0.6"
8888
insta = "1.43.1"
8989
libc = "0.2.172"
90-
mcp_client = { path = "crates/mcp_client" }
9190
mimalloc = "0.1.46"
9291
nix = { version = "0.29.0", features = [
9392
"feature",

crates/chat-cli/src/auth/builder_id.rs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,10 @@ use crate::database::secret_store::{
6262
pub enum OAuthFlow {
6363
DeviceCode,
6464
// This must remain backwards compatible
65-
#[serde(rename = "PKCE")]
65+
#[serde(alias = "PKCE")]
6666
Pkce,
6767
}
6868

69-
impl std::fmt::Display for OAuthFlow {
70-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
71-
match *self {
72-
OAuthFlow::DeviceCode => write!(f, "DeviceCode"),
73-
OAuthFlow::Pkce => write!(f, "PKCE"),
74-
}
75-
}
76-
}
77-
7869
/// Indicates if an expiration time has passed, there is a small 1 min window that is removed
7970
/// so the token will not expire in transit
8071
fn is_expired(expiration_time: &OffsetDateTime) -> bool {
@@ -565,20 +556,10 @@ mod tests {
565556
const US_EAST_1: Region = Region::from_static("us-east-1");
566557
const US_WEST_2: Region = Region::from_static("us-west-2");
567558

568-
macro_rules! test_ser_deser {
569-
($ty:ident, $variant:expr, $text:expr) => {
570-
let quoted = format!("\"{}\"", $text);
571-
assert_eq!(quoted, serde_json::to_string(&$variant).unwrap());
572-
assert_eq!($variant, serde_json::from_str(&quoted).unwrap());
573-
574-
assert_eq!($text, format!("{}", $variant));
575-
};
576-
}
577-
578559
#[test]
579-
fn test_oauth_flow_ser_deser() {
580-
test_ser_deser!(OAuthFlow, OAuthFlow::DeviceCode, "DeviceCode");
581-
test_ser_deser!(OAuthFlow, OAuthFlow::Pkce, "PKCE");
560+
fn test_oauth_flow_deser() {
561+
assert_eq!(OAuthFlow::Pkce, serde_json::from_str("\"PKCE\"").unwrap());
562+
assert_eq!(OAuthFlow::Pkce, serde_json::from_str("\"Pkce\"").unwrap());
582563
}
583564

584565
#[tokio::test]

crates/chat-cli/src/install.rs

Lines changed: 0 additions & 31 deletions
This file was deleted.

crates/chat-cli/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ mod auth;
33
mod aws_common;
44
mod cli;
55
mod database;
6-
mod install;
76
mod logging;
87
mod mcp_client;
98
mod platform;

crates/mcp_client/Cargo.toml

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)