Skip to content

fix: Replace unsafe env var mutation with thread-local#104

Open
2witstudios wants to merge 1 commit intomainfrom
pu/improve-4
Open

fix: Replace unsafe env var mutation with thread-local#104
2witstudios wants to merge 1 commit intomainfrom
pu/improve-4

Conversation

@2witstudios
Copy link
Owner

Summary

  • Replaced unsafe { std::env::set_var("HOME", ...) } in test isolation with a #[cfg(test)] thread-local override in paths::home_dir()
  • Fixed two pre-existing schedule_def test bugs that silently depended on leaked env var state from other tests
  • Zero production cost — all test infrastructure compiles out via #[cfg(test)]

Test plan

  • cargo test -p pu-core — 242 tests pass (including 2 previously flaky schedule_def tests)
  • cargo test --workspace — all tests pass
  • cargo clippy -p pu-core — clean

🤖 Generated with Claude Code

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>
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link

coderabbitai bot commented Mar 8, 2026

Warning

Rate limit exceeded

@2witstudios has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 26 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 23dda70f-8dd5-417a-b8dd-905ef501aa1c

📥 Commits

Reviewing files that changed from the base of the PR and between 55aa882 and bb68022.

📒 Files selected for processing (5)
  • crates/pu-core/src/agent_def.rs
  • crates/pu-core/src/paths.rs
  • crates/pu-core/src/schedule_def.rs
  • crates/pu-core/src/swarm_def.rs
  • crates/pu-core/src/template.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pu/improve-4

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant