WIP fase 2b-2: rimosso login ChatGPT/OAuth/device code, agent/workload identity, backend-client; resta solo chiave API (test non tutti verdi)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-10 06:00:44 +01:00
parent 82347a58ed
commit 231e8cd136
661 changed files with 4924 additions and 64817 deletions

View File

@@ -2,10 +2,9 @@ use std::sync::Arc;
use std::time::Duration;
use anyhow::Result;
use app_test_support::ChatGptAuthFixture;
use app_test_support::TestAppServer;
use app_test_support::to_response;
use app_test_support::write_chatgpt_auth;
use app_test_support::write_api_key_auth;
use axum::Json;
use axum::Router;
use axum::extract::State;
@@ -41,7 +40,6 @@ use codex_app_server_protocol::ScheduledTaskSummary;
use codex_app_server_protocol::ScheduledTaskWeekday;
use codex_app_server_protocol::SkillInterface;
use codex_app_server_protocol::SkillSummary;
use codex_config::types::AuthCredentialsStoreMode;
use codex_utils_absolute_path::AbsolutePathBuf;
use pretty_assertions::assert_eq;
use serde_json::json;
@@ -184,14 +182,7 @@ async fn plugin_read_selects_remote_onboarding_skill(
codex_home.path(),
&format!("{}/backend-api/", server.uri()),
)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let mut plugin = json!({
"id": "plugins_123",
"name": "demo-plugin",
@@ -353,14 +344,7 @@ apps = true
server.uri()
),
)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let detail_body = r#"{
"id": "plugins~Plugin_00000000000000000000000000000000",
@@ -575,14 +559,7 @@ async fn plugin_read_returns_share_context_for_shared_remote_plugin() -> Result<
codex_home.path(),
&format!("{}/backend-api/", server.uri()),
)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let detail_body = r#"{
"id": "plugins~Plugin_11111111111111111111111111111111",
@@ -727,14 +704,7 @@ async fn plugin_read_includes_share_url_for_admin_disabled_remote_plugin() -> Re
codex_home.path(),
&format!("{}/backend-api/", server.uri()),
)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let detail_body = r#"{
"id": "plugins~Plugin_00000000000000000000000000000000",
@@ -969,14 +939,7 @@ async fn plugin_skill_read_reads_remote_skill_contents_when_remote_plugin_enable
codex_home.path(),
&format!("{}/backend-api/", server.uri()),
)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let skill_body = r##"{
"plugin_id": "plugins~Plugin_00000000000000000000000000000000",
@@ -1032,14 +995,7 @@ async fn plugin_read_maps_missing_remote_plugin_to_invalid_request() -> Result<(
codex_home.path(),
&format!("{}/backend-api/", server.uri()),
)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
Mock::given(method("GET"))
.and(path("/backend-api/ps/plugins/plugins~Plugin_missing"))
@@ -1095,14 +1051,7 @@ remote_plugin = true
server.uri()
),
)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
@@ -1231,14 +1180,7 @@ async fn plugin_read_returns_share_context_for_shared_local_plugin() -> Result<(
codex_home.path(),
&format!("{}/backend-api/", server.uri()),
)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
write_plugin_marketplace(
repo_root.path(),
"codex-curated",
@@ -1373,14 +1315,7 @@ async fn plugin_read_keeps_remote_version_when_share_principals_are_missing() ->
codex_home.path(),
&format!("{}/backend-api/", server.uri()),
)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
write_plugin_marketplace(
repo_root.path(),
"codex-curated",
@@ -1636,14 +1571,7 @@ async fn plugin_read_agent_plugin_excludes_nested_skills() -> Result<()> {
#[tokio::test]
async fn plugin_read_returns_plugin_details_with_bundle_contents() -> Result<()> {
let codex_home = TempDir::new()?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let repo_root = TempDir::new()?;
let plugin_root = repo_root.path().join("plugins/demo-plugin");
std::fs::create_dir_all(repo_root.path().join(".git"))?;
@@ -1961,14 +1889,7 @@ async fn plugin_read_batches_large_app_metadata_requests() -> Result<()> {
let codex_home = TempDir::new()?;
write_connectors_config(codex_home.path(), &server_url)?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let repo_root = TempDir::new()?;
write_plugin_marketplace(
@@ -2056,14 +1977,7 @@ async fn plugin_read_stops_batching_after_app_metadata_failure() -> Result<()> {
let codex_home = TempDir::new()?;
write_connectors_config(codex_home.path(), &server.uri())?;
write_chatgpt_auth(
codex_home.path(),
ChatGptAuthFixture::new("chatgpt-token")
.account_id("account-123")
.chatgpt_user_id("user-123")
.chatgpt_account_id("account-123"),
AuthCredentialsStoreMode::File,
)?;
write_api_key_auth(codex_home.path())?;
let repo_root = TempDir::new()?;
write_plugin_marketplace(