path-uri: clarify host-native path conversion (#29501)

## Why

Downstream refactors are producing confusing code with this
functionality having a very generic name. Encoding the specific
conversion approach in the method name makes it clearer.

## What

Rename `PathUri::from_path` to `PathUri::from_host_native_path` and
update its Rust call sites.
This commit is contained in:
Adam Perry @ OpenAI
2026-06-23 00:02:33 +00:00
committed by GitHub
parent c53b1dae09
commit 11fab432be
31 changed files with 250 additions and 198 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ use tempfile::tempdir;
fn convert_apply_patch_maps_add_variant() {
let tmp = tempdir().expect("tmp");
let path = tmp.path().join("a.txt");
let path_uri = PathUri::from_path(&path).expect("absolute test path");
let path_uri = PathUri::from_host_native_path(&path).expect("absolute test path");
let action = ApplyPatchAction::new_add_for_test(&path_uri, "hello".to_string());
let got = convert_apply_patch_to_protocol(&action);
+3 -3
View File
@@ -645,7 +645,7 @@ mod tests {
make_session_and_context_with_dynamic_tools_and_rx(Vec::new()).await;
let tracker = Arc::new(Mutex::new(TurnDiffTracker::new()));
let dir = tempdir().expect("tempdir");
let cwd = PathUri::from_path(dir.path()).expect("absolute cwd");
let cwd = PathUri::from_host_native_path(dir.path()).expect("absolute cwd");
let mut stdout = Vec::new();
let mut stderr = Vec::new();
let delta = codex_apply_patch::apply_patch(
@@ -729,7 +729,7 @@ mod tests {
make_session_and_context_with_dynamic_tools_and_rx(Vec::new()).await;
let tracker = Arc::new(Mutex::new(TurnDiffTracker::new()));
let dir = tempdir().expect("tempdir");
let cwd = PathUri::from_path(dir.path()).expect("absolute cwd");
let cwd = PathUri::from_host_native_path(dir.path()).expect("absolute cwd");
for patch in [
"*** Begin Patch\n*** Add File: a.txt\n+one\n*** End Patch",
@@ -782,7 +782,7 @@ mod tests {
make_session_and_context_with_dynamic_tools_and_rx(Vec::new()).await;
let tracker = Arc::new(Mutex::new(TurnDiffTracker::new()));
let dir = tempdir().expect("tempdir");
let cwd = PathUri::from_path(dir.path()).expect("absolute cwd");
let cwd = PathUri::from_host_native_path(dir.path()).expect("absolute cwd");
let mut stdout = Vec::new();
let mut stderr = Vec::new();
let delta = codex_apply_patch::apply_patch(
+1 -1
View File
@@ -18,7 +18,7 @@ fn git_blob_sha1_hex(data: &str) -> String {
}
async fn apply_verified_patch(root: &Path, patch: &str) -> AppliedPatchDelta {
let cwd = PathUri::from_path(root).expect("absolute tempdir path");
let cwd = PathUri::from_host_native_path(root).expect("absolute tempdir path");
let argv = vec!["apply_patch".to_string(), patch.to_string()];
match codex_apply_patch::maybe_parse_apply_patch_verified(
&argv,