Skip to content

Craft Anything: understand how any software works, and craft your own.

Rust

Resolve remote setup fixture utilities from the host path (#1020)

Tomáš Doubek05bd9e9e92a5
diff --git a/crates/ai/src/cli_agents/adapters/opencode.rs b/crates/ai/src/cli_agents/adapters/opencode.rs
index 78bc8bd7..4dbc3cf9 100644
--- a/crates/ai/src/cli_agents/adapters/opencode.rs
+++ b/crates/ai/src/cli_agents/adapters/opencode.rs
@@ -388,6 +388,7 @@ mod tests {
assert_eq!(octal_escape(&[0x00, 0x27, 0x5C]), "\\000\\047\\134");
}
+ /// Check private config creation and refusal without writes when the remote helper is absent.
#[test]
#[cfg(unix)]
fn the_remote_line_runs_on_a_posix_shell() {
@@ -404,8 +405,10 @@ mod tests {
std::fs::set_permissions(bin.join("craft-anything-cli"), std::fs::Permissions::from_mode(0o755)).unwrap();
// Keep both paths isolated from any real helper installed on the test machine.
for utility in ["mkdir", "chmod", "mv"] {
- symlink(Path::new("/bin").join(utility), bin.join(utility)).unwrap();
- symlink(Path::new("/bin").join(utility), missing_bin.join(utility)).unwrap();
+ let installed = craft_anything_platform::which(utility).unwrap();
+ let executable = installed.canonicalize().unwrap();
+ symlink(&executable, bin.join(utility)).unwrap();
+ symlink(&executable, missing_bin.join(utility)).unwrap();
}
let home = root.path().join("home");
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index b0bb6c54..d4f62def 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -615,7 +615,8 @@ Owner: open · Status: in progress
agent over SSH. — claimed: jelassiaymen94, branch feature/r2.2-opencode-remote-mcp
- [x] Make `the_remote_line_runs_on_a_posix_shell` accept the shell's missing-command status:
assert failure rather than 127, isolate PATH from installed helpers, and verify that a
- missing helper writes nothing in a fresh home. The shell uses the bounded process runner.
+ missing helper writes nothing in a fresh home. Fixture utilities use host lookup rather than
+ assuming `/bin`; the shell uses the bounded process runner.
Reproduced the old failure on macOS; the AI suite now passes (446 passed, 2 ignored). PR #1018
— claimed: Codex, branch test/r2.2-posix-remote-helper
- [ ] Verify OpenCode model discovery and an explicit thinking selection on a live SSH host,
diff --git a/docs/pitfalls.md b/docs/pitfalls.md
index 71caf0af..b3102a06 100644
--- a/docs/pitfalls.md
+++ b/docs/pitfalls.md
@@ -78,6 +78,10 @@ names (`git merge-base --is-ancestor <fix> <release tag>`), and check the messag
## Tests
+**An isolated PATH still assumed system utilities lived in `/bin`.** The remote setup fixture
+linked `mkdir`, `chmod` and `mv` there, so a host with utilities elsewhere got dangling links.
+Resolve fixture utilities on the host, make their paths absolute, then populate the private PATH.
+
**Python compilation reused stale bytecode after a fast edit.** The new-project toolchain probe
changed valid Python to a syntax error within the same mtime second. `compileall` skipped it and
exited zero; the screenshot run then failed instead. Use `compileall -f` for a build check, and