Commit ae27f17
committed
fix: address code review findings in invalidate/cleanup-snapshots
- C1/M4: eliminate TOCTOU race in delete_snapshots_for_environment by
calling state_sync.delete_snapshots(batch.expired_snapshot_ids) directly
instead of re-querying via delete_expired_snapshots, so physical drops
and state removal operate on the same snapshot ID set
- M1: remove always-truthy `if target_conditions:` guard in
get_expired_snapshots (snapshot_id_filter always yields >= 1 condition)
- M2: when cleanup_snapshots=True and the environment does not exist, log
a warning and return early instead of printing a misleading success message
- m1: unconditionally initialize target_snapshot_ids before the
cleanup_snapshots block to prevent potential UnboundLocalError
- n1: enforce `sync = sync or cleanup_snapshots` explicitly so the
implication is in code, not just docs; update docstring and CLI help
to say "cleanup runs synchronously" instead of "Implies --sync"1 parent 2e23f5f commit ae27f17
4 files changed
Lines changed: 13 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
626 | | - | |
| 626 | + | |
627 | 627 | | |
628 | 628 | | |
629 | 629 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
1849 | 1850 | | |
1850 | 1851 | | |
1851 | 1852 | | |
1852 | | - | |
| 1853 | + | |
| 1854 | + | |
1853 | 1855 | | |
1854 | 1856 | | |
| 1857 | + | |
1855 | 1858 | | |
| 1859 | + | |
1856 | 1860 | | |
1857 | 1861 | | |
1858 | 1862 | | |
1859 | | - | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
1860 | 1867 | | |
1861 | 1868 | | |
1862 | 1869 | | |
1863 | | - | |
| 1870 | + | |
1864 | 1871 | | |
1865 | 1872 | | |
1866 | 1873 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 254 | + | |
259 | 255 | | |
260 | 256 | | |
261 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
| |||
0 commit comments