test(issue31): stop purges a session kept under CLAUDE_CONFIG_DIR

End to end through stop_session.sh with CLAUDE_CONFIG_DIR alone and with a
matching CLAUDE_PROJECT_DIR; plus the DiscoveryContext default. The
config-only stop case and the default check fail on 872d5f1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GodopuandClaude Opus 5.5 committed 2026-10-15 16:29:16 +00:00
1 parent f0af98971e
commit 6f4f40a4ad
1 file changed
+32
+32
View File
@@ -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 <cfg>/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
# ---------------------------------------------------------------------------