first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+26 -1
View File
@@ -1,8 +1,24 @@
use simple_logger::manager::resolve_log_path;
use std::path::PathBuf;
use simple_logger::manager::resolve_log_path;
use uuid::Uuid;
/// Per-server MCP log rotation policy.
///
/// Caps each server's on-disk log footprint at `MCP_LOG_MAX_FILE_SIZE_BYTES *
/// (1 + MCP_LOG_MAX_ROTATION)` — one active file plus the rotated tail. For
/// the chosen values that's 10 MiB × 6 = 60 MiB per MCP server, which is far
/// below the 20 GB single-server growth observed in #7723 and large enough to
/// preserve a useful debugging window for a misbehaving server.
///
/// Gated to non-wasm: the only consumer is the native MCP manager, which is
/// itself `#[cfg(not(target_family = "wasm"))]`, so these would be dead code
/// on the wasm build.
#[cfg(not(target_family = "wasm"))]
const MCP_LOG_MAX_FILE_SIZE_BYTES: u64 = 10 * 1024 * 1024;
#[cfg(not(target_family = "wasm"))]
const MCP_LOG_MAX_ROTATION: usize = 5;
pub fn relative_log_file_path_from_uuid(uuid: &Uuid) -> PathBuf {
PathBuf::from(format!("{uuid}.log"))
}
@@ -11,3 +27,12 @@ pub fn relative_log_file_path_from_uuid(uuid: &Uuid) -> PathBuf {
pub fn log_file_path_from_uuid(uuid: &Uuid) -> PathBuf {
resolve_log_path("mcp", relative_log_file_path_from_uuid(uuid))
}
/// Rotation policy applied to every MCP server log writer. Returns `None` only
/// if a future change accidentally sets one of the cap constants to zero;
/// callers can treat `None` as "rotation disabled" and the existing
/// truncate-on-create behavior is preserved.
#[cfg(not(target_family = "wasm"))]
pub fn mcp_log_rotation_config() -> Option<simple_logger::RotationConfig> {
simple_logger::RotationConfig::new(MCP_LOG_MAX_FILE_SIZE_BYTES, MCP_LOG_MAX_ROTATION)
}