diff --git a/defs.bzl b/defs.bzl index d618725eb8..7c89a05aea 100644 --- a/defs.bzl +++ b/defs.bzl @@ -80,7 +80,7 @@ def codex_rust_crate( `CARGO_BIN_EXE_*` environment variables. These are only needed for binaries from a different crate. """ test_env = { - "INSTA_WORKSPACE_ROOT": ".", + "INSTA_WORKSPACE_ROOT": "codex-rs", "INSTA_SNAPSHOT_PATH": "src", } @@ -127,7 +127,9 @@ def codex_rust_crate( crate = name, env = test_env, deps = all_crate_deps(normal = True, normal_dev = True) + maybe_deps + deps_extra, - rustc_flags = rustc_flags_extra, + # Keep `file!()` paths Cargo-like (`core/src/...`) instead of + # Bazel workspace-prefixed (`codex-rs/core/src/...`) for snapshot parity. + rustc_flags = rustc_flags_extra + ["--remap-path-prefix=codex-rs="], rustc_env = rustc_env, data = test_data_extra, tags = test_tags, @@ -178,7 +180,7 @@ def codex_rust_crate( rustc_flags = rustc_flags_extra + ["--remap-path-prefix=codex-rs="], rustc_env = rustc_env, # Important: do not merge `test_env` here. Its unit-test-only - # `INSTA_WORKSPACE_ROOT="."` can point integration tests at the + # `INSTA_WORKSPACE_ROOT="codex-rs"` can point integration tests at the # runfiles cwd and cause false `.snap.new` churn on Linux. env = cargo_env, tags = test_tags,