Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix(ecc2): also sandbox the legacy ~/.claude/ecc2.toml path under cfg(test)

Toni Alatalo708d62137250
diff --git a/ecc2/src/config/mod.rs b/ecc2/src/config/mod.rs
index df7b30c2f..38fd467a1 100644
--- a/ecc2/src/config/mod.rs
+++ b/ecc2/src/config/mod.rs
@@ -547,6 +547,12 @@ impl Config {
})
}
+ #[cfg(test)]
+ fn legacy_global_config_path() -> PathBuf {
+ Self::config_root().join(".claude").join("ecc2.toml")
+ }
+
+ #[cfg(not(test))]
fn legacy_global_config_path() -> PathBuf {
dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("."))
@@ -1127,6 +1133,17 @@ focus_metrics = "e"
);
}
+ #[test]
+ fn legacy_config_path_under_test_is_sandboxed_away_from_user_home() {
+ let path = Config::legacy_global_config_path();
+ assert!(
+ path.starts_with(std::env::temp_dir()),
+ "tests must never read the real legacy user config, got {}",
+ path.display()
+ );
+ assert!(path.ends_with(".claude/ecc2.toml"));
+ }
+
#[test]
fn config_path_under_test_is_stable_within_a_test() {
assert_eq!(Config::config_path(), Config::config_path());