Repository navigation
fix(tests,paths): skip the POSIX-mode assertion on Windows, and stop leaking a temp file on failed atomic writes - #2623
Conversation
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 2 advisory finding(s) below merit a look before merge.
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
This PR reverts the unreleased 0.9.39 changelog section back to 0.9.38 status and removes several features that were associated with it. Specifically, it deletes the fuzzy-dedup _content_token_swap/_same_word_variant logic (the #2576 content-word distinction) from dedup.py and their call sites in deduplicate_entities and _llm_tiebreak, and simplifies the JS dynamic-import rescue in extract.py so it keys/skips on the resolved target rather than checking whether the deferred edge originates from the file's node (#2584). The change touches dedup, JS/dynamic-import extraction, and related engine/resolution helpers, along with corresponding updates across the watch, dedup, extract, atomic-writes, and JS-dynamic-imports test suites and changelog entries. Reviewers should focus on the dedup and dynamic-import behavior being rolled back and whether the test suite changes match that reduced surface area.
Worth a look
- Dynamic-import dedupe reverts to target-only keying, dropping file-level edge for in-function imports —
graphify/extract.py:1271· Escalate · high- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
- Reintroduced dedupe by target alone drops file-level dynamic_import edges for in-function imports —
graphify/extract.py:1271· Escalate · high- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 2774 functions depend on the 1525 functions this change touches.
Health — grade A; 10 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):
extract()— 400 callers, 39 callees (high)_rebuild_code()— 93 callers, 51 callees (high)deduplicate_entities()— 53 callers, 19 callees (high)build_merge()— 41 callers, 14 callees (high)_extract_generic()— 18 callers, 22 callees (high)extract_xaml()— 19 callers, 17 callees (high)save_manifest()— 29 callers, 11 callees (high)to_json()— 42 callers, 6 callees (high)- …and 2 more
Verification — 2774 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 2581 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify \_llm\_tiebreak.
The verifier did not have enough to check \_llm\_tiebreak, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: not verifiable: all 105 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly TypeError — names the real obstacle, not a sampling gap)
Could not verify: Could not verify deduplicate\_entities.
The verifier did not have enough to check deduplicate\_entities, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: not verifiable: all 7 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly TypeError — names the real obstacle, not a sampling gap)
Could not verify: Could not verify \_rescue\_js\_dynamic\_imports.
The verifier did not have enough to check \_rescue\_js\_dynamic\_imports, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
Could not verify: Could not verify \_resolve\_objc\_member\_calls.
The verifier did not have enough to check \_resolve\_objc\_member\_calls, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: non-vacuity: domain too small (only 1 distinct inputs exercised, need 3) — 'no divergence' would be near-vacuous
Could not verify: Could not verify \_extract\_generic.
The verifier did not have enough to check \_extract\_generic, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
Could not verify: Could not verify extract\_objc.
The verifier did not have enough to check extract\_objc, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
Could not verify: Could not verify \_merge\_decl\_def\_classes.
The verifier did not have enough to check \_merge\_decl\_def\_classes, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: not verifiable: the input domain has 49 values but only 7 distinct were tested — a small finite domain must be EXHAUSTED, not sampled (an untested input could invert the result)
Could not verify: Could not verify \_atomic\_replace.
The verifier did not have enough to check \_atomic\_replace, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `'str | Path'` — outside the synthesizable primitive/collection set
Could not verify: Could not verify watch.
The verifier did not have enough to check watch, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `watch_path` is annotated `Path` — outside the synthesizable primitive/collection set
|
Shipped in v0.9.42 ( |
Fixes #2622.
Problem
test_write_text_atomic_preserves_existing_modesets0o644and asserts the atomic writepreserves it. Windows does not implement POSIX permission bits, so the assertion can never
hold:
33206is0o100666. Confirmed on this platform —chmodonly toggles the read-onlyattribute, and any writable file reports
0o666:So the
os.chmod(p, 0o644)on line 4 is a no-op and the test fails on a completely healthywrite_text_atomic.Fix
Skip it on Windows. The property under test — "an atomic replace must not tighten a 0644 file
to mkstemp's 0600 default" — is POSIX-only and has no Windows equivalent.
The issue's open question, answered
The issue asked whether the suggested Windows analogue (read-only attribute survives a
replace) is actually desired behaviour, flagging it as "possibly its own papercut". I
checked, and it is worse than a papercut:
Two findings:
A read-only destination is refused, not silently overwritten. The existing
PermissionError→shutil.copy2fallback does not help, because copying onto aread-only file fails the same way. This diverges from POSIX, where
os.replaceneeds onlydirectory write permission and so happily replaces a read-only file. Left as-is and
documented: refusing to overwrite a file the user marked read-only is the defensible
behaviour, and changing it is out of scope for a test fix.
The failed write leaks a temp file — a real bug, fixed here.
_atomic_replacechmodsthe temp to match the destination, so against a read-only target the temp is read-only
too. Windows then refuses to unlink it, and the cleanup's
except OSError: passswallowedthe failure — dropping a
.graph.json.*.tmpintographify-out/on every failedwrite, accumulating silently. The cleanup now clears the read-only bit and retries.
Changes
tests/test_atomic_writes.py—skipif(os.name == "nt")on the POSIX-mode test, with thereason spelling out why it can never hold rather than just "Windows".
tests/test_atomic_writes.py— newtest_write_text_atomic_refuses_a_readonly_destination_without_leaking_a_temp,the Windows analogue: pins that the original survives, the write raises rather than
clobbering, and no temp is left behind.
graphify/paths.py— the temp-file leak fix (9 lines).Verification
POSIX coverage is untouched.
paths.pyfix, with the leak visible: