Name the transcript deletion for what it does: delete_transcript_files, not end_session

This commit is contained in:
2026-09-26 14:41:53 +02:00
parent 39b4829ef0
commit e86b15888e
3 changed files with 5 additions and 6 deletions
+2 -2
View File
@@ -133,7 +133,7 @@ def session_file(session_id):
return hit[0] if hit else ""
def end_session(path):
def delete_transcript_files(path):
for sibling in glob.glob(glob.escape(path.removesuffix(".jsonl")) + "*"):
try:
shutil.rmtree(sibling) if os.path.isdir(sibling) else os.remove(sibling)
@@ -358,7 +358,7 @@ def run_cycle(root, task, premises, name, session_id):
verdict = judge(root, task, premises, render(entries(path)))
if verdict["finished"]:
archive(root, path, f"Task: {task}\n\nVerdict: finished")
end_session(path)
delete_transcript_files(path)
return ""
+3 -3
View File
@@ -174,8 +174,8 @@ class Said(unittest.TestCase):
self.assertEqual(loop.said("not a part"), "")
class EndSession(unittest.TestCase):
def test_removes_the_transcript_and_its_siblings_and_closes_the_session(self):
class DeleteTranscriptFiles(unittest.TestCase):
def test_deletes_the_transcript_and_its_siblings_so_the_session_is_gone(self):
with tempfile.TemporaryDirectory() as home, unittest.mock.patch.dict(os.environ, {"HOME": home}):
root = os.path.join(home, ".claude", "projects", "p")
os.makedirs(root)
@@ -185,7 +185,7 @@ class EndSession(unittest.TestCase):
os.makedirs(os.path.join(root, f"{SESSION_ID}.superseded-1", "tool-results"))
open(os.path.join(root, f"{SESSION_ID}.orphaned-1-ab.jsonl"), "w").write("{}\n")
self.assertTrue(loop.session_open(SESSION_ID))
loop.end_session(transcript)
loop.delete_transcript_files(transcript)
self.assertEqual(os.listdir(root), [])
self.assertFalse(loop.session_open(SESSION_ID))