Commit 792df27
committed
fix: guard os.chown for Windows, reject non-string JSON keys
- _atomic.py: guard os.chown calls with hasattr(os, 'chown') so
the fix command works on Windows where os.chown does not exist.
Both atomic_write_text and atomic_write_bytes now skip ownership
restoration on platforms without chown support.
- cli.py JSON write: reject non-string keys before json.dumps to
prevent type coercion (int 1 → string 1) that causes perpetual
drift on reload, or duplicate keys when the target already
contains the string form.
Addresses Codex review: _atomic.py:43 (P1), cli.py:481 (P2)1 parent 0a6d925 commit 792df27
2 files changed
Lines changed: 31 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| |||
79 | 85 | | |
80 | 86 | | |
81 | 87 | | |
82 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
83 | 95 | | |
84 | 96 | | |
85 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
472 | 487 | | |
473 | 488 | | |
474 | 489 | | |
475 | 490 | | |
476 | 491 | | |
477 | 492 | | |
478 | | - | |
479 | | - | |
480 | | - | |
| 493 | + | |
481 | 494 | | |
482 | 495 | | |
483 | 496 | | |
| |||
487 | 500 | | |
488 | 501 | | |
489 | 502 | | |
490 | | - | |
| 503 | + | |
491 | 504 | | |
492 | 505 | | |
493 | 506 | | |
| |||
0 commit comments