Files
ECC/ecc2/src
Toni AlataloandClaude Sonnet 5.5 708d621372 fix(ecc2): also sandbox the legacy ~/.claude/ecc2.toml path under cfg(test)
Addresses review feedback on #3277: the previous commit sandboxed the
primary config path, but Config::global_config_paths() also reads the
legacy $HOME/.claude/ecc2.toml. A test that called Config::load() would
pick up (or fail on a malformed) developer-local legacy config.

Under cfg(test), legacy_global_config_path() now resolves inside the same
per-test-thread scratch root as config_path().

Proof of red (new test, before the fix):

$ cargo test legacy_config_path_under_test
    running 1 test
    test config::tests::legacy_config_path_under_test_is_sandboxed_away_from_user_home ... FAILED
    failures:
    ---- config::tests::legacy_config_path_under_test_is_sandboxed_away_from_user_home stdout ----
    tests must never read the real legacy user config, got /Users/<me>/.claude/ecc2.toml
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    failures:
        config::tests::legacy_config_path_under_test_is_sandboxed_away_from_user_home
    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 491 filtered out; finished in 0.00s
    error: test failed, to rerun pass `--bin ecc-tui`

After the fix:

$ cargo test legacy_config_path_under_test
    test config::tests::legacy_config_path_under_test_is_sandboxed_away_from_user_home ... ok
    test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 491 filtered out

$ cargo test   # full suite
    test result: ok. 491 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out

Refs #3276

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y54kLgLGzLGqAxwLMFEc9
2026-09-30 23:08:55 +09:30
..