mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Remove fs/join and fs/parent from exec-server protocol (#27700)
## Summary Path composition is already handled by `PathUri`, leaving `fs/join` and `fs/parent` as redundant exec-server protocol surface. Because app-server and exec-server are deployed atomically, these obsolete methods can be removed without a compatibility shim. This removes the protocol constants and payloads, public client APIs, server registrations and handlers, and endpoint-only tests. Existing in-process `PathUri` join/parent coverage remains. ## Validation - `just test -p codex-exec-server` (215 passed, 2 skipped)
This commit is contained in:
1 parent
b7a5d81f84
commit
e069153f2a
6 files changed
-182
No files matched your search
@@ -3,7 +3,6 @@ use std::io;
|
||||
use base64::Engine as _;
|
||||
use base64::engine::general_purpose::STANDARD;
|
||||
use codex_app_server_protocol::JSONRPCErrorError;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
|
||||
use crate::CopyOptions;
|
||||
use crate::CreateDirectoryOptions;
|
||||
@@ -20,10 +19,6 @@ use crate::protocol::FsCreateDirectoryParams;
|
||||
use crate::protocol::FsCreateDirectoryResponse;
|
||||
use crate::protocol::FsGetMetadataParams;
|
||||
use crate::protocol::FsGetMetadataResponse;
|
||||
use crate::protocol::FsJoinParams;
|
||||
use crate::protocol::FsJoinResponse;
|
||||
use crate::protocol::FsParentParams;
|
||||
use crate::protocol::FsParentResponse;
|
||||
use crate::protocol::FsReadDirectoryEntry;
|
||||
use crate::protocol::FsReadDirectoryParams;
|
||||
use crate::protocol::FsReadDirectoryResponse;
|
||||
@@ -125,33 +120,6 @@ impl FileSystemHandler {
|
||||
Ok(FsCanonicalizeResponse { path })
|
||||
}
|
||||
|
||||
pub(crate) async fn join(
|
||||
&self,
|
||||
params: FsJoinParams,
|
||||
) -> Result<FsJoinResponse, JSONRPCErrorError> {
|
||||
// TODO(anp): remove and migrate callers to PathUri.
|
||||
let base_path = params.base_path.to_abs_path().map_err(map_fs_error)?;
|
||||
let path = base_path.join(params.path);
|
||||
let path = PathUri::from_abs_path(&path).map_err(map_fs_error)?;
|
||||
Ok(FsJoinResponse { path })
|
||||
}
|
||||
|
||||
pub(crate) async fn parent(
|
||||
&self,
|
||||
params: FsParentParams,
|
||||
) -> Result<FsParentResponse, JSONRPCErrorError> {
|
||||
// TODO(anp): remove and migrate callers to PathUri.
|
||||
let path = params
|
||||
.path
|
||||
.to_abs_path()
|
||||
.map_err(map_fs_error)?
|
||||
.parent()
|
||||
.map(|path| PathUri::from_abs_path(&path))
|
||||
.transpose()
|
||||
.map_err(map_fs_error)?;
|
||||
Ok(FsParentResponse { path })
|
||||
}
|
||||
|
||||
pub(crate) async fn read_directory(
|
||||
&self,
|
||||
params: FsReadDirectoryParams,
|
||||
@@ -297,68 +265,4 @@ mod tests {
|
||||
assert_eq!(response.data_base64, STANDARD.encode("ok"));
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn protocol_join_and_parent_preserve_native_path_operations() {
|
||||
let temp_dir = tempfile::tempdir().expect("tempdir");
|
||||
let runtime_paths = ExecServerRuntimePaths::new(
|
||||
std::env::current_exe().expect("current exe"),
|
||||
/*codex_linux_sandbox_exe*/ None,
|
||||
)
|
||||
.expect("runtime paths");
|
||||
let handler = FileSystemHandler::new(runtime_paths);
|
||||
let native_base =
|
||||
AbsolutePathBuf::from_absolute_path(temp_dir.path()).expect("absolute tempdir");
|
||||
let base_path = PathUri::from_abs_path(&native_base).expect("path URI");
|
||||
|
||||
let joined = handler
|
||||
.join(FsJoinParams {
|
||||
base_path: base_path.clone(),
|
||||
path: "nested/file.txt".into(),
|
||||
})
|
||||
.await
|
||||
.expect("join path");
|
||||
assert_eq!(
|
||||
joined.path,
|
||||
PathUri::from_abs_path(&native_base.join("nested/file.txt")).expect("joined path URI")
|
||||
);
|
||||
|
||||
let parent = handler
|
||||
.parent(FsParentParams {
|
||||
path: joined.path.clone(),
|
||||
})
|
||||
.await
|
||||
.expect("parent path");
|
||||
assert_eq!(
|
||||
parent.path,
|
||||
native_base
|
||||
.join("nested/file.txt")
|
||||
.parent()
|
||||
.map(|path| PathUri::from_abs_path(&path).expect("parent path URI"))
|
||||
);
|
||||
|
||||
let absolute_path = native_base.join("absolute.txt");
|
||||
let joined = handler
|
||||
.join(FsJoinParams {
|
||||
base_path,
|
||||
path: absolute_path.as_path().to_path_buf(),
|
||||
})
|
||||
.await
|
||||
.expect("join absolute path");
|
||||
assert_eq!(
|
||||
joined.path,
|
||||
PathUri::from_abs_path(&absolute_path).expect("absolute path URI")
|
||||
);
|
||||
|
||||
let native_root = native_base
|
||||
.ancestors()
|
||||
.last()
|
||||
.expect("absolute path should have a root");
|
||||
let root = PathUri::from_abs_path(&native_root).expect("root path URI");
|
||||
let parent = handler
|
||||
.parent(FsParentParams { path: root })
|
||||
.await
|
||||
.expect("root parent");
|
||||
assert_eq!(parent, FsParentResponse { path: None });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user