diff --git a/tests/test_issue31_purge_residual.py b/tests/test_issue31_purge_residual.py index 704ad86..abee332 100644 --- a/tests/test_issue31_purge_residual.py +++ b/tests/test_issue31_purge_residual.py @@ -554,6 +554,38 @@ def test_stop_purge_refuses_while_the_claude_process_lives(stop_box, conv): assert _row_left(stop_box, name) == (False, False) +@pytest.mark.parametrize("project_override", [False, True]) +def test_stop_purge_follows_claude_config_dir(stop_box, conv, monkeypatch, project_override): + """stop resolves the uuid before it purges: with CLAUDE_CONFIG_DIR alone + the transcript under /projects must be found too, or the row goes + and every artifact stays ("nothing purged").""" + cfg = stop_box / "custom-config" + monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(cfg)) + if project_override: + monkeypatch.setenv("CLAUDE_PROJECT_DIR", str(cfg / "projects")) + else: + monkeypatch.delenv("CLAUDE_PROJECT_DIR", raising=False) + name = "issue31-creator-claude" + t = _tree(stop_box, stop_box, conv, stop_box / "ctmp", cfg=cfg) + _stop_row(stop_box, name, conv) + + res = _stop(stop_box, name) + + assert res.returncode == 0, res.stdout + res.stderr + assert "nothing purged" not in res.stdout + assert "residual: none (agent: claude)" in res.stdout + assert not any(p.exists() for p in t.values()), {k: str(p) for k, p in t.items() if p.exists()} + assert _row_left(stop_box, name) == (False, False) + + +def test_discovery_context_projects_follow_claude_config_dir(tmp_path, monkeypatch): + from lib_py.agents.base import DiscoveryContext as Ctx + monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(tmp_path / "cfg")) + assert Ctx(str(tmp_path), "claude", home_dir=str(tmp_path / "h")).claude_dir == str(tmp_path / "cfg" / "projects") + monkeypatch.setenv("CLAUDE_PROJECT_DIR", str(tmp_path / "p")) + assert Ctx(str(tmp_path), "claude", home_dir=str(tmp_path / "h")).claude_dir == str(tmp_path / "p") + + # --------------------------------------------------------------------------- # orc_onboard --remove --purge-conversation # ---------------------------------------------------------------------------