Make all JSON saves atomic (temp file + os.replace) #11
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: high
Category: data-integrity
Location:
app.py:199, bills.py:18, debts.py:126/138, sinking.py:37, income.py:31, assets.py:59, mortgage.py:19Problem
Every save does
open(path,'w')+json.dump, which truncates first. A crash/power-loss mid-write leaves an empty/partial file and the next load wipes or crashes.Suggested fix
Write to a
.tmpsibling thenos.replace(tmp, path)(atomic on POSIX). Centralize asatomic_save().Filed by automated code review.