Procházet zdrojové kódy

fix: add env_lock guard to git discovery tests

YeonGyu-Kim před 2 měsíci
rodič
revize
543b7725ee

+ 5 - 5
rust/crates/runtime/src/conversation.rs

@@ -118,7 +118,7 @@ where
             tool_executor,
             permission_policy,
             system_prompt,
-            &RuntimeFeatureConfig::default(),
+            RuntimeFeatureConfig::default(),
         )
     }
 
@@ -129,7 +129,7 @@ where
         tool_executor: T,
         permission_policy: PermissionPolicy,
         system_prompt: Vec<String>,
-        feature_config: &RuntimeFeatureConfig,
+        feature_config: RuntimeFeatureConfig,
     ) -> Self {
         let usage_tracker = UsageTracker::from_session(&session);
         Self {
@@ -140,7 +140,7 @@ where
             system_prompt,
             max_iterations: usize::MAX,
             usage_tracker,
-            hook_runner: HookRunner::from_feature_config(feature_config),
+            hook_runner: HookRunner::from_feature_config(&feature_config),
         }
     }
 
@@ -609,7 +609,7 @@ mod tests {
             }),
             PermissionPolicy::new(PermissionMode::DangerFullAccess),
             vec!["system".to_string()],
-            &RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
+            RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
                 vec![shell_snippet("printf 'blocked by hook'; exit 2")],
                 Vec::new(),
             )),
@@ -675,7 +675,7 @@ mod tests {
             StaticToolExecutor::new().register("add", |_input| Ok("4".to_string())),
             PermissionPolicy::new(PermissionMode::DangerFullAccess),
             vec!["system".to_string()],
-            &RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
+            RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
                 vec![shell_snippet("printf 'pre hook ran'")],
                 vec![shell_snippet("printf 'post hook ran'")],
             )),

+ 2 - 0
rust/crates/runtime/src/prompt.rs

@@ -600,6 +600,7 @@ mod tests {
 
     #[test]
     fn discover_with_git_includes_status_snapshot() {
+        let _guard = env_lock();
         let root = temp_dir();
         fs::create_dir_all(&root).expect("root dir");
         std::process::Command::new("git")
@@ -624,6 +625,7 @@ mod tests {
 
     #[test]
     fn discover_with_git_includes_diff_snapshot_for_tracked_changes() {
+        let _guard = env_lock();
         let root = temp_dir();
         fs::create_dir_all(&root).expect("root dir");
         std::process::Command::new("git")

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

@@ -1933,7 +1933,7 @@ fn build_runtime(
         CliToolExecutor::new(allowed_tools, emit_output),
         permission_policy(permission_mode),
         system_prompt,
-        &feature_config,
+        feature_config,
     ))
 }