Repository navigation
Commit 5b666c6
fix(S2): step 9 — the three narrow HOLD defects
1. THE HARNESS GUARD WAS TOO LOOSE. test_harness_contract.py skipped ANY top-level `if`
(so `if True: sys.exit(0)` slid through) and broke traversal at the first nested
FunctionDef (so a module-scope exit inside a top-level `try` was missed). The guard is
rewritten as a proper recursive walk: it skips ONLY a structurally-recognised
`__name__ == "__main__"` (a real ast.Compare of __name__ == "__main__"), does NOT
descend into function / class / lambda scopes, and DOES descend through module-scope
compound statements (if / try / with / for / while) — so an exit inside `if True:` or a
top-level `try:` is caught. Added 8 guard self-tests: five that MUST be caught (bare
exit, `if True:` exit, exit in a top-level try, `raise SystemExit`, exit in a for loop)
and three that MUST pass (the guarded entrypoint, an exit inside a function, an exit
inside a lambda).
2. NO-NEWLINE STATE WAS PER-HUNK. old_closed/new_closed reset each hunk, so a no-newline
marker in the first hunk did not forbid a second hunk after it — the marker means
EOF-without-newline, so nothing can follow on that side. State is now FILE-level
(`saw_marker`): once any no-newline marker appears, a following hunk header is a
PATCH_STRUCTURE refusal (previously it would have slipped to APPLY_CHECK — the right
refusal via the wrong branch). Added a two-hunk fixture asserting PATCH_STRUCTURE.
3. CLAIM/PUBLICATION EQUALITY WAS NOT PLATFORM-AWARE, AND A POST-mkdir FAILURE LEAKED THE
DIRECTORY. Both the workdir self-resolution proof and the publication parent re-proof
used a raw string `realpath(x) != y`, which on case-insensitive Windows disagrees with
the accepted _same_or_inside rule and could give a casing-only false refusal. A new
platform-aware `_same_path` (normcase+normpath, the same rule) is now used in both. And
`_claim_workdir` created the directory before the outer cleanup scope began, so a proof
failure after the mkdir would strand it — the post-mkdir proofs are now wrapped so the
just-created directory is removed on ANY failure before raising. Added a pure-function
regression (symlink-capable platforms): a claim under a symlinked parent fails the
self-resolution proof with PUBLICATION and leaves NO directory behind, plus _same_path
platform cases.
Nothing else in Step 9 reopened. Steps 10-12 not started.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JxKjqdGEFzq4UzZupw379G1 parent ea47d45 commit 5b666c6
3 files changed
Lines changed: 132 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
101 | 112 | | |
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
105 | | - | |
106 | | - | |
| 116 | + | |
| 117 | + | |
107 | 118 | | |
108 | 119 | | |
109 | 120 | | |
| |||
572 | 583 | | |
573 | 584 | | |
574 | 585 | | |
575 | | - | |
| 586 | + | |
| 587 | + | |
576 | 588 | | |
577 | 589 | | |
578 | 590 | | |
| 591 | + | |
| 592 | + | |
579 | 593 | | |
580 | 594 | | |
581 | 595 | | |
| |||
614 | 628 | | |
615 | 629 | | |
616 | 630 | | |
| 631 | + | |
617 | 632 | | |
618 | 633 | | |
619 | 634 | | |
| |||
827 | 842 | | |
828 | 843 | | |
829 | 844 | | |
830 | | - | |
831 | | - | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
832 | 850 | | |
833 | 851 | | |
834 | 852 | | |
| |||
840 | 858 | | |
841 | 859 | | |
842 | 860 | | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
851 | 874 | | |
852 | 875 | | |
853 | 876 | | |
| |||
860 | 883 | | |
861 | 884 | | |
862 | 885 | | |
863 | | - | |
| 886 | + | |
864 | 887 | | |
865 | 888 | | |
866 | 889 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
27 | 30 | | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
381 | 385 | | |
382 | 386 | | |
383 | 387 | | |
384 | | - | |
| 388 | + | |
385 | 389 | | |
386 | 390 | | |
387 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
388 | 398 | | |
389 | 399 | | |
390 | 400 | | |
| |||
396 | 406 | | |
397 | 407 | | |
398 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
399 | 438 | | |
400 | 439 | | |
401 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
35 | 50 | | |
36 | 51 | | |
37 | 52 | | |
| |||
46 | 61 | | |
47 | 62 | | |
48 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
49 | 79 | | |
50 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
51 | 92 | | |
52 | 93 | | |
53 | 94 | | |
| |||
0 commit comments