Skip to content

Commit 006f7d7

Browse files
committed
fix(test): add env_lock to plugin lifecycle test — closes ROADMAP #24
build_runtime_runs_plugin_lifecycle_init_and_shutdown was the only test that set/removed ANTHROPIC_API_KEY without holding the env_lock mutex. Under parallel workspace execution, other tests racing on the same env var could wipe the key mid-construction, causing a flaky credential error. Root cause: process-wide env vars are shared mutable state. All other tests that touch ANTHROPIC_API_KEY already use env_lock(). This test was the only holdout. Fix: add let _guard = env_lock(); at the top of the test.
1 parent 82baaf3 commit 006f7d7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • rust/crates/rusty-claude-cli/src

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10816,6 +10816,9 @@ UU conflicted.rs",
1081610816

1081710817
#[test]
1081810818
fn build_runtime_runs_plugin_lifecycle_init_and_shutdown() {
10819+
// Serialize access to process-wide env vars so parallel tests that
10820+
// set/remove ANTHROPIC_API_KEY do not race with this test.
10821+
let _guard = env_lock();
1081910822
let config_home = temp_dir();
1082010823
// Inject a dummy API key so runtime construction succeeds without real credentials.
1082110824
// This test only exercises plugin lifecycle (init/shutdown), never calls the API.

0 commit comments

Comments
 (0)