mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
## What changed - Add `Platform` to `codex-utils-path-uri` with metadata parsing, native platform detection, and path convention mapping. Preserve missing or unrecognized metadata as `Unknown`. - Replace `NetworkProxyExecutorOs` with the shared type and keep executor-specific socket path validation in the network proxy. - Extract `effective_sandbox_mode` with explicit platform and Windows sandbox level inputs, preserving the native Windows fallback from `workspace-write` to `read-only` when the sandbox is disabled. ## Testing Add unit tests for platform metadata, path conventions, native platform detection, and sandbox mode selection across platforms and Windows sandbox levels. GitOrigin-RevId: 4fe0972e3a91040e35f2a6dfa5bcdf6c9a29be88
44 lines
1.2 KiB
Rust
44 lines
1.2 KiB
Rust
//! Coverage for platform metadata and platform-derived path conventions.
|
|
|
|
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn platform_metadata_preserves_missing_and_unrecognized_values() {
|
|
for (metadata, expected) in [
|
|
(Some("linux"), Platform::Linux),
|
|
(Some("macos"), Platform::Macos),
|
|
(Some("windows"), Platform::Windows),
|
|
(None, Platform::Unknown),
|
|
(Some("freebsd"), Platform::Unknown),
|
|
(Some("Windows"), Platform::Unknown),
|
|
(Some(""), Platform::Unknown),
|
|
] {
|
|
assert_eq!(
|
|
Platform::from_platform_os(metadata),
|
|
expected,
|
|
"{metadata:?}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn path_convention_is_derived_from_platform() {
|
|
for (platform, expected) in [
|
|
(Platform::Linux, Some(PathConvention::Posix)),
|
|
(Platform::Macos, Some(PathConvention::Posix)),
|
|
(Platform::Windows, Some(PathConvention::Windows)),
|
|
(Platform::Unknown, None),
|
|
] {
|
|
assert_eq!(platform.path_convention(), expected, "{platform:?}");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn native_platform_matches_current_process_metadata() {
|
|
assert_eq!(
|
|
Platform::native(),
|
|
Platform::from_platform_os(Some(std::env::consts::OS)),
|
|
);
|
|
}
|