aKode fase 1: niente sync plugin OpenAI, CDN pets, CIMD chatgpt.com, npm registry; pulizia codice morto
This commit is contained in:
@@ -309,12 +309,7 @@ impl AccountRequestProcessor {
|
||||
refresh_config_manager.clone(),
|
||||
);
|
||||
});
|
||||
thread_manager
|
||||
.plugins_manager()
|
||||
.maybe_start_curated_repo_sync_for_config(
|
||||
&plugins_config,
|
||||
Some(Arc::clone(&on_effective_plugins_changed)),
|
||||
);
|
||||
// aKode: no curated marketplace sync after account changes.
|
||||
if let Err(err) = runtime_auth {
|
||||
warn!("failed to initialize runtime auth for remote plugin refresh: {err}");
|
||||
return;
|
||||
|
||||
@@ -539,8 +539,9 @@ fn assert_dynamic_status(response: &ListMcpServerStatusResponse, process_label:
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn oauth_login_automatically_selects_callback_specific_cimd_without_metadata_issuer()
|
||||
-> Result<()> {
|
||||
// aKode: CIMD (a ChatGPT-hosted client metadata document) is never offered; automatic
|
||||
// registration uses DCR even when the server advertises CIMD.
|
||||
async fn oauth_login_uses_dcr_even_when_cimd_is_advertised() -> Result<()> {
|
||||
let responses_server = create_mock_responses_server_sequence_unchecked(Vec::new()).await;
|
||||
let listener = TcpListener::bind("127.0.0.1:0").await?;
|
||||
let base_url = format!("http://{}", listener.local_addr()?);
|
||||
@@ -596,11 +597,16 @@ async fn oauth_login_automatically_selects_callback_specific_cimd_without_metada
|
||||
)
|
||||
.route(
|
||||
"/register",
|
||||
post(move || {
|
||||
post(move |body: Bytes| {
|
||||
let registrations = Arc::clone(®istration_count);
|
||||
async move {
|
||||
registrations.fetch_add(1, Ordering::SeqCst);
|
||||
Json(json!({"client_id": "unexpected-dcr-client"}))
|
||||
let registration: serde_json::Value =
|
||||
serde_json::from_slice(&body).unwrap_or_default();
|
||||
Json(json!({
|
||||
"client_id": "dcr-client",
|
||||
"redirect_uris": registration["redirect_uris"],
|
||||
}))
|
||||
}
|
||||
}),
|
||||
)
|
||||
@@ -660,14 +666,15 @@ async fn oauth_login_automatically_selects_callback_specific_cimd_without_metada
|
||||
let callback_id = callback_url
|
||||
.path()
|
||||
.strip_prefix("/callback/")
|
||||
.expect("issuerless CIMD should use a resource-specific callback");
|
||||
let client_id = format!("https://chatgpt.com/oauth/codex/{callback_id}/client.json");
|
||||
.expect("issuerless servers should use a resource-specific callback");
|
||||
assert!(!callback_id.is_empty());
|
||||
let client_id = "dcr-client".to_string();
|
||||
assert_eq!(parameters.get("client_id"), Some(&client_id));
|
||||
assert_eq!(
|
||||
parameters.get("code_challenge_method").map(String::as_str),
|
||||
Some("S256")
|
||||
);
|
||||
assert_eq!(registrations.load(Ordering::SeqCst), 0);
|
||||
assert_eq!(registrations.load(Ordering::SeqCst), 1);
|
||||
|
||||
callback_url
|
||||
.query_pairs_mut()
|
||||
@@ -682,7 +689,7 @@ async fn oauth_login_automatically_selects_callback_specific_cimd_without_metada
|
||||
let (token_request, token_authorization) =
|
||||
timeout(DEFAULT_READ_TIMEOUT, token_request_rx.recv())
|
||||
.await?
|
||||
.expect("CIMD authorization should exchange its authorization code");
|
||||
.expect("DCR authorization should exchange its authorization code");
|
||||
let token_parameters = url::form_urlencoded::parse(token_request.as_bytes())
|
||||
.into_owned()
|
||||
.collect::<BTreeMap<String, String>>();
|
||||
@@ -714,7 +721,7 @@ async fn oauth_login_automatically_selects_callback_specific_cimd_without_metada
|
||||
error: None,
|
||||
}
|
||||
);
|
||||
assert_eq!(registrations.load(Ordering::SeqCst), 0);
|
||||
assert_eq!(registrations.load(Ordering::SeqCst), 1);
|
||||
|
||||
let request_id = app_server
|
||||
.send_raw_request("config/mcpServer/reload", /*params*/ None)
|
||||
@@ -742,7 +749,7 @@ async fn oauth_login_automatically_selects_callback_specific_cimd_without_metada
|
||||
.expect("MCP startup should use the access token"),
|
||||
"Bearer cimd-access-token"
|
||||
);
|
||||
assert_eq!(registrations.load(Ordering::SeqCst), 0);
|
||||
assert_eq!(registrations.load(Ordering::SeqCst), 1);
|
||||
|
||||
oauth_server_handle.abort();
|
||||
let _ = oauth_server_handle.await;
|
||||
|
||||
Reference in New Issue
Block a user