fix: Replace unsafe env var mutation with thread-local#104
fix: Replace unsafe env var mutation with thread-local#1042witstudios wants to merge 1 commit intomainfrom
Conversation
Tests used `unsafe { std::env::set_var("HOME", ...) }` to isolate
global_pu_dir() lookups, which is thread-unsafe and caused schedule_def
tests to silently depend on leaked state from other tests. Adds a
`#[cfg(test)]` thread-local override in paths.rs that is safe for
parallel test execution and has zero production cost.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
unsafe { std::env::set_var("HOME", ...) }in test isolation with a#[cfg(test)]thread-local override inpaths::home_dir()schedule_deftest bugs that silently depended on leaked env var state from other tests#[cfg(test)]Test plan
cargo test -p pu-core— 242 tests pass (including 2 previously flaky schedule_def tests)cargo test --workspace— all tests passcargo clippy -p pu-core— clean🤖 Generated with Claude Code