Skip to content

test(find): resolve exit-status oracle through PATH - #4612

Open
rotirotirafa wants to merge 1 commit into
rtk-ai:developfrom
rotirotirafa:fix/find-test-path-resolution
Open

rotirotirafa wants to merge 1 commit into
rtk-ai:developfrom
rotirotirafa:fix/find-test-path-resolution

Conversation

@rotirotirafa

Copy link
Copy Markdown

Summary

On Windows, run_from_args_propagates_find_exit_status can compare RTK's exit code with that of a different program: bare Command::new("find") can select System32's text-search utility while RTK's PATH resolver selects Git's GNU find. The test then fails with 1 versus 2 even though RTK propagates the child's status correctly.

Use crate::core::utils::resolved_command("find") for the test's reference invocation, matching the lookup already used by run_compress. Keep the exit-code assertion and existing fallback unchanged, and add a short comment explaining why the shared resolver matters. Only the existing test changes; runtime behavior is unchanged.

Fixes #4610.

Test plan

  • cargo fmt --all --check
  • cargo fmt --manifest-path proxy/Cargo.toml --all --check
  • cargo clippy --locked --all-targets
  • cargo test --locked --all — 4,953 passed, 0 failed, 8 ignored.
  • git diff --check
  • Confirmed the affected test passes locally, both before the change and in the full suite after it.

Validation was on macOS arm64 with Rust 1.99.1. The Windows System32/Git executable collision reported in #4610 was not reproduced locally; Windows GNU/MSVC execution remains unverified. No new test is added because this repairs the executable lookup in the existing exit-status regression test.

@CLAassistant

CLAassistant commented Oct 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes a flaky Windows-only test that could compare RTK's exit code against the wrong 'find' executable (System32 vs Git's GNU find) by using the project's shared resolved_command('find') helper instead of a bare Command::new. Only test code changes; no runtime behavior is affected.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4610


Analyzed automatically by wshm · This is an automated analysis, not a human review.

@bharvey42

Copy link
Copy Markdown

Verified on Windows, where #4610 was reported: Windows 11, x86_64-pc-windows-gnu, rustc 1.94.0. On this machine where find lists Git's usr\bin\find.exe before System32\find.exe.

So resolved_command("find") makes the oracle run the same program rtk does, which fixes it on the machine type that reproduces the bug. Thanks for picking it up.

@rotirotirafa

Copy link
Copy Markdown
Author

Verified on Windows, where #4610 was reported: Windows 11, x86_64-pc-windows-gnu, rustc 1.94.0. On this machine where find lists Git's usr\bin\find.exe before System32\find.exe.

* **Without this PR** (develop [e05c7bd](https://github.com/rtk-ai/rtk/commit/e05c7bdfacfcfe1f845d11f47339e4eae63eb3f5), plus [feat(tracking): record project_path on parse failures #3227](https://github.com/rtk-ai/rtk/pull/3227), which doesn't touch `find_cmd.rs`): `run_from_args_propagates_find_exit_status` fails exactly as in [Windows: run_from_args_propagates_find_exit_status compares rtk against a different `find` — std resolves System32's find.exe before PATH #4610](https://github.com/rtk-ai/rtk/issues/4610), at `find_cmd.rs:1534`, with `left: 1` / `right: 2`.

* **With this PR's diff applied** ([57a87d1](https://github.com/rtk-ai/rtk/commit/57a87d1e2f34b8999aa2c39e9ff0c6ba913dae36), applies cleanly): `cargo test --lib find_cmd` gives 62 passed, 0 failed, and the test passes.

So resolved_command("find") makes the oracle run the same program rtk does, which fixes it on the machine type that reproduces the bug. Thanks for picking it up.

Thanks for verifying this on Windows and confirming the before/after behavior! This covers the Windows GNU validation I couldn't run locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: run_from_args_propagates_find_exit_status compares rtk against a different find — std resolves System32's find.exe before PATH

3 participants