Skip to content

Commit 27ffd75

Browse files
committed
fix: #140 isolate test cwd + env in punctuation_bearing_single_token test
Previously this test inherited the cargo test runner's CWD, which could contain a stale .claw/settings.json with "permissionMode": "acceptEdits" written by another test. The deprecated-field resolver then silently downgraded the default permission mode to WorkspaceWrite, breaking the test's assertion. Fix: wrap the assertion in with_current_dir() + env_lock() so the test runs in an isolated temp directory with no stale config. Full workspace test now passes except for pre-existing resume_latest flake (unrelated to #140, environment-dependent, tracked separately). Closes ROADMAP #140.
1 parent 0cf8241 commit 27ffd75

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

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

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10061,9 +10061,19 @@ mod tests {
1006110061

1006210062
#[test]
1006310063
fn punctuation_bearing_single_token_still_dispatches_to_prompt() {
10064-
assert_eq!(
10064+
// #140: Guard against test pollution — isolate cwd + env so this test
10065+
// doesn't pick up a stale .claw/settings.json from other tests that
10066+
// may have set `permissionMode: acceptEdits` in a shared cwd.
10067+
let _guard = env_lock();
10068+
let root = temp_dir();
10069+
let cwd = root.join("project");
10070+
std::fs::create_dir_all(&cwd).expect("project dir should exist");
10071+
let result = with_current_dir(&cwd, || {
1006510072
parse_args(&["PARITY_SCENARIO:bash_permission_prompt_approved".to_string()])
10066-
.expect("scenario token should still dispatch to prompt"),
10073+
.expect("scenario token should still dispatch to prompt")
10074+
});
10075+
assert_eq!(
10076+
result,
1006710077
CliAction::Prompt {
1006810078
prompt: "PARITY_SCENARIO:bash_permission_prompt_approved".to_string(),
1006910079
model: DEFAULT_MODEL.to_string(),

0 commit comments

Comments
 (0)