Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
112
akode-rs/app-server/tests/suite/v2/server_diagnostics.rs
Normal file
112
akode-rs/app-server/tests/suite/v2/server_diagnostics.rs
Normal file
@@ -0,0 +1,112 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Result;
|
||||
use app_test_support::DEFAULT_CLIENT_NAME;
|
||||
use app_test_support::MockResponsesConfig;
|
||||
use app_test_support::TestAppServer;
|
||||
use app_test_support::create_mock_responses_server_repeating_assistant;
|
||||
use akode_app_server_protocol::ClientInfo;
|
||||
use akode_app_server_protocol::ClientRequest;
|
||||
use akode_app_server_protocol::InitializeCapabilities;
|
||||
use akode_app_server_protocol::JSONRPCMessage;
|
||||
use akode_app_server_protocol::RequestId;
|
||||
use akode_app_server_protocol::ServerDiagnosticsGauge;
|
||||
use akode_app_server_protocol::ServerDiagnosticsParams;
|
||||
use akode_app_server_protocol::ServerDiagnosticsResponse;
|
||||
use akode_app_server_protocol::ThreadStartParams;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::json;
|
||||
use tempfile::TempDir;
|
||||
use tokio::time::timeout;
|
||||
|
||||
const READ_TIMEOUT: Duration = Duration::from_secs(20);
|
||||
|
||||
#[tokio::test]
|
||||
async fn server_diagnostics_exposes_process_and_registered_thread_gauge() -> Result<()> {
|
||||
let server = create_mock_responses_server_repeating_assistant("Done").await;
|
||||
let codex_home = TempDir::new()?;
|
||||
MockResponsesConfig::new(&server.uri()).write(codex_home.path())?;
|
||||
let mut app_server = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.build_initialized()
|
||||
.await?;
|
||||
app_server
|
||||
.start_thread(ThreadStartParams::default())
|
||||
.await?;
|
||||
|
||||
let diagnostics: ServerDiagnosticsResponse = app_server
|
||||
.request(|request_id| ClientRequest::ServerDiagnostics {
|
||||
request_id,
|
||||
params: ServerDiagnosticsParams::default(),
|
||||
})
|
||||
.await?;
|
||||
|
||||
assert!(diagnostics.process.id > 0);
|
||||
assert!(diagnostics.process.resident_memory_bytes.is_some());
|
||||
#[cfg(target_os = "macos")]
|
||||
assert!(diagnostics.process.physical_footprint_bytes.is_some());
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
assert_eq!(diagnostics.process.physical_footprint_bytes, None);
|
||||
// Startup may still be finishing after its response was queued.
|
||||
assert!(matches!(
|
||||
diagnostics
|
||||
.gauges
|
||||
.iter()
|
||||
.find(|gauge| gauge.name == "app.requests.in_flight")
|
||||
.map(|gauge| gauge.value),
|
||||
Some(1 | 2)
|
||||
));
|
||||
assert_eq!(
|
||||
diagnostics
|
||||
.gauges
|
||||
.iter()
|
||||
.find(|gauge| gauge.name == "core.threads.live"),
|
||||
Some(&ServerDiagnosticsGauge {
|
||||
name: "core.threads.live".to_string(),
|
||||
value: 1,
|
||||
})
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn server_diagnostics_requires_experimental_capability() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let mut app_server = TestAppServer::builder()
|
||||
.with_codex_home(codex_home.path())
|
||||
.build()
|
||||
.await?;
|
||||
let initialization = app_server
|
||||
.initialize_with_capabilities(
|
||||
ClientInfo {
|
||||
name: DEFAULT_CLIENT_NAME.to_string(),
|
||||
title: None,
|
||||
version: "0.1.0".to_string(),
|
||||
},
|
||||
Some(InitializeCapabilities {
|
||||
experimental_api: false,
|
||||
..Default::default()
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
assert!(matches!(initialization, JSONRPCMessage::Response(_)));
|
||||
|
||||
let request_id = app_server
|
||||
.send_raw_request("server/diagnostics", Some(json!({})))
|
||||
.await?;
|
||||
let error = timeout(
|
||||
READ_TIMEOUT,
|
||||
app_server.read_stream_until_error_message(RequestId::Integer(request_id)),
|
||||
)
|
||||
.await??;
|
||||
|
||||
assert_eq!(error.error.code, -32600);
|
||||
assert_eq!(
|
||||
error.error.message,
|
||||
"server/diagnostics requires experimentalApi capability"
|
||||
);
|
||||
assert_eq!(error.error.data, None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user