test(agents): keep ide-agent tests off the user's profile and git settings (#2168)

Four ide-agent tests failed on a Windows machine with a normal setup: skill discovery walked up from a temp project into the real profile's skills, and a fixture repo inherited the global core.autocrlf. The fixtures now bound the walk at the project and turn autocrlf off.

Co-authored-by: panda-student <[email protected]>
Цей коміт міститься в:
SunZhiQiang authored and GitHub committed 2026-11-09 01:26:34 +08:00
1 джерело 8427e48975
коміт 25cd480c30
2 files changed
+8 -2

No files matched your search

+3 -1
Переглянути файл
@@ -211,7 +211,9 @@ mod tests {
#[test]
fn project_and_user_skills_and_commands() {
let tmp = tempfile::tempdir().unwrap();
let home = tmp.path().join("home");
// Home is an ancestor of the project, so the walk stops there instead of climbing
// past it into the real profile (a temp dir under the user's home holds its skills).
let home = tmp.path().to_path_buf();
let repo = tmp.path().join("work").join("idea");
let skills = repo.join(".claude/skills");
write(
+5 -1
Переглянути файл
@@ -357,7 +357,9 @@ fn manager_at(dir: &Path, models_file: &Path, agent: Arc<FakeAgent>) -> AgentMan
worktrees_dir: dir.join("worktrees"),
models_file: models_file.to_path_buf(),
custom_agents_dir: Some(agents),
home_dir: None,
// The project is the boundary of the skill walk: nothing above it (such as the
// user's profile, when temp lives under it) leaks into the test.
home_dir: Some(dir.to_path_buf()),
},
tokio::runtime::Handle::current(),
connector,
@@ -1939,6 +1941,7 @@ async fn task_project_root_controls_local_and_worktree_repositories() {
String::from_utf8_lossy(&out.stdout).trim().to_owned()
};
git(&["init", "-q", "-b", "member-main"]);
git(&["config", "core.autocrlf", "false"]);
std::fs::write(member.join("file.txt"), "original\n").unwrap();
git(&["add", "."]);
git(&["commit", "-qm", "initial"]);
@@ -2252,6 +2255,7 @@ async fn delete_running_agent(no_load: bool) {
assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
};
git(&["init", "-q", "-b", "main"]);
git(&["config", "core.autocrlf", "false"]);
std::fs::write(root.join("file.txt"), "original\n").unwrap();
git(&["add", "."]);
git(&["commit", "-qm", "initial"]);