Commit 842e72f
Codex preflight: scan all paths in rename/copy --name-status lines
R8 review on PR #421:
P1: `_scan_prompt_artifacts()` only inspected the substring after the
first tab in each --name-status line, treating it as a single path. For
rename (`R*`) and copy (`C*`) lines the format is multi-column:
R100\told_path\tnew_path
C100\told_path\tnew_path
So `R100\tconfig/.env\tconfig/renamed.txt` was parsed as one pseudo-path
"config/.env\tconfig/renamed.txt", whose os.path.basename is just
"renamed.txt" — completely missing the sensitive old path. The diff
body still contains the renamed file's prior content, so the abort gate
should have fired but didn't.
Fix: split each line on \t into status + N paths, scan EACH path
independently for sensitive basenames. Empty paths skipped.
Tests added (5 new, all assert the abort/detection that R8 said was
unpinned):
- test_changed_files_rename_old_sensitive_new_safe
(R100\tconfig/.env\tconfig/renamed.txt → detect)
- test_changed_files_copy_old_sensitive_new_safe
(C100\tconfig/.env\tconfig/copy.txt → detect)
- test_changed_files_rename_new_path_also_scanned
(R100\tconfig/old.txt\tconfig/.env → detect)
- test_delta_changed_files_rename_also_scanned
(same pattern via delta_changed_files_text)
- test_aborts_on_renamed_sensitive_file_in_changed_files
(non-dry-run integration: rename triggers main()-gate abort)
Tests: 252 pass (5 new).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5109720 commit 842e72f
2 files changed
Lines changed: 96 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1425 | 1425 | | |
1426 | 1426 | | |
1427 | 1427 | | |
1428 | | - | |
1429 | | - | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
1430 | 1437 | | |
1431 | 1438 | | |
1432 | 1439 | | |
1433 | 1440 | | |
1434 | 1441 | | |
1435 | | - | |
1436 | | - | |
1437 | | - | |
1438 | | - | |
1439 | | - | |
1440 | | - | |
1441 | | - | |
1442 | | - | |
1443 | | - | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
1447 | 1459 | | |
1448 | 1460 | | |
1449 | 1461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2424 | 2424 | | |
2425 | 2425 | | |
2426 | 2426 | | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
2427 | 2479 | | |
2428 | 2480 | | |
2429 | 2481 | | |
| |||
2865 | 2917 | | |
2866 | 2918 | | |
2867 | 2919 | | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
2868 | 2938 | | |
2869 | 2939 | | |
2870 | 2940 | | |
| |||
0 commit comments