refactor(utils): dedupe atomic JSONL write helper
Extract atomic_write_lines so history.jsonl, session JSONL saves, and WebUI transcript rewrites share unique temp files, optional fsync, and BaseException cleanup. Closes #5290
This commit is contained in:
1 parent
27b3e81434
commit
23de1f1e34
7 files changed
+287
-89
No files matched your search
@@ -241,8 +241,9 @@ class TestHistoryWithCursor:
|
||||
with pytest.raises(RuntimeError):
|
||||
store._write_entries(entries)
|
||||
|
||||
# Temp file should be cleaned up
|
||||
# Temp file should be cleaned up, including uniquely named temps.
|
||||
assert not tmp_path_obj.exists()
|
||||
assert list(store.history_file.parent.glob("*.tmp")) == []
|
||||
|
||||
# Original file should still exist (because replace failed)
|
||||
assert store.history_file.exists()
|
||||
|
||||
Reference in new issue
Block a user