Skip to content

Commit f4bf5f8

Browse files
Test Userclaude
andcommitted
fix(terraphim_tinyclaw): add SAFETY comment to unsafe set_var in test Refs #2492
`crates/terraphim_tinyclaw/src/config.rs:619` used an `unsafe` block around `std::env::set_var("TEST_VAR", ...)` without a `// SAFETY:` comment documenting the invariant. `set_var` is unsafe because concurrent environment reads from other threads can race with the write. Add the required SAFETY comment with an accurate invariant: no other test in this binary reads or writes `TEST_VAR` (verified by grep — the symbol appears only in this test). This matches the pattern established for `terraphim_symphony` (#2497, PR #2865) and corrects the imprecise "single-threaded" claim of the prior stranded commit, since cargo runs tests in parallel threads by default. Comment-only change (+3 lines, zero executable code changed). Verification (all exit 0): - cargo fmt -p terraphim_tinyclaw -- --check - cargo clippy -p terraphim_tinyclaw --lib --tests -- -D warnings - cargo test -p terraphim_tinyclaw --lib (174 passed, 0 failed) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 61b5e37 commit f4bf5f8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

crates/terraphim_tinyclaw/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,9 @@ model = "llama3.2"
616616

617617
#[test]
618618
fn test_env_var_expansion() {
619+
// SAFETY: No other test in this binary reads or writes TEST_VAR.
620+
// Cargo runs tests in parallel threads by default; we accept this because
621+
// only this test touches this variable.
619622
unsafe {
620623
std::env::set_var("TEST_VAR", "test_value");
621624
}

0 commit comments

Comments
 (0)