Commit 4485bd9
committed
fix: make _safe_write_json actually atomic with mkstemp + os.replace
Despite its name, _safe_write_json used write_text() which truncates the
file before writing. A crash or power loss mid-write leaves a partial
JSON file. Now uses tempfile.mkstemp + os.replace for atomic writes,
matching the pattern used in _utils.py, shared_infra.py, and other
safe-write utilities in the codebase.1 parent f8b3d60 commit 4485bd9
1 file changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
2010 | 2011 | | |
2011 | 2012 | | |
2012 | 2013 | | |
2013 | | - | |
| 2014 | + | |
2014 | 2015 | | |
2015 | 2016 | | |
2016 | | - | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
2017 | 2031 | | |
2018 | 2032 | | |
2019 | 2033 | | |
| |||
0 commit comments