diff --git a/AGENTS.md b/AGENTS.md index 50c10b1da1..e924ceeae1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -77,6 +77,12 @@ If you don’t have the tool: - Prefer deep equals comparisons whenever possible. Perform `assert_eq!()` on entire objects, rather than individual fields. - Avoid mutating process environment in tests; prefer passing environment-derived flags or dependencies from above. +### Spawning workspace binaries in tests (Cargo vs Buck2) + +- Prefer `codex_utils_cargo_bin::cargo_bin("...")` over `assert_cmd::Command::cargo_bin(...)` or `escargot` when tests need to spawn first-party binaries. + - Under Buck2, `CARGO_BIN_EXE_*` may be project-relative (e.g. `buck-out/...`), which breaks if a test changes its working directory. `codex_utils_cargo_bin::cargo_bin` resolves to an absolute path first. +- When locating fixture files under Buck2, avoid `env!("CARGO_MANIFEST_DIR")` (Buck codegen sets it to `"."`). Prefer deriving paths from `codex_utils_cargo_bin::buck_project_root()` when needed. + ### Integration tests (core) - Prefer the utilities in `core_test_support::responses` when writing end-to-end Codex tests.