Repository navigation
fix(tests): compare paths separator-agnostically so Windows assertions aren't vacuous - #2621
rajarshidattapy wants to merge 2 commits into
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 1 advisory finding(s) below merit a look before merge.
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
This pull request appears to revert a set of changes that were previously staged as "unreleased" (version 0.9.39). The changes: - Remove the _content_token_swap, _same_word_variant, _STOPWORDS, and related fuzzy-dedup logic from graphify/dedup.py, along with their call sites in deduplicate_entities and _llm_tiebreak, and drop the DamerauLevenshtein import. - Revert the JS dynamic-import rescue logic in graphify/extract.py back to keying on target alone rather than on the importing file's node, simplifying the associated docstring and comments. - Update the CHANGELOG to remove the 0.9.39 section and reset 0.9.38 back to "unreleased." The surface area touched spans dedup, extract, watch/LLM helpers, and a large number of associated tests referenced in the changed-symbols list.
Worth a look
- Dynamic-import dedupe reverts to target-only key, dropping 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 — 3352 functions depend on the 2000 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
_build_image_refs()— 14 callers, 3 callees - worse:
_read_files()— 6 callers, 6 callees
Verification — 3352 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: 3190 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 \_cpp\_preprocess.
The verifier did not have enough to check \_cpp\_preprocess, 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 \_build\_image\_refs.
The verifier did not have enough to check \_build\_image\_refs, 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 `root` is annotated `Path` — outside the synthesizable primitive/collection set
Could not verify: Could not verify \_read\_files.
The verifier did not have enough to check \_read\_files, 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 `units` is annotated `'list[Path | FileSlice]'` — 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
· 2 more finding(s) on lines outside this diff (see the check run).
|
Shipped in v0.9.42 ( |
Fixes #2620.
Problem
Several tests compare produced paths against string literals containing forward slashes. On
Windows the produced paths use
\, so the assertions fail.The failures are the visible half. The damaging half is silent: some of these tests put a
negative assertion first —
— and a
not any(...)against a literal that can never match passes unconditionally. Intest_path_pattern_single_star_does_not_cross_segmentthat first line is the subject ofthe test (that
*did not cross a separator). On Windows it proved nothing, and the test thenfailed on the next line for an unrelated reason.
These are test defects — with two exceptions
I checked the underlying behaviour separator-agnostically before touching anything. The
gitignore precedence logic and
_match_anchored_ignore_patternare correct, as #2620 says.Two of the six turned out to be product bugs rather than assertion bugs, so I fixed the
product and left those tests as written:
llm._build_image_refsandllm._read_filesemittedrelwith native separators. Thatstring is handed to the model as the literal
source_fileto emit —_image_prompt_blockinstructs "with the listed source_file", and
_wrap_untrustedembeds it as<untrusted_source path="…">. So on Windowssub\diagram.pnglands in the graph and splitsone file across two
source_fileforms (Graph fragmentation: path-separator inconsistency splits same file into 2 components + Louvain over-merging via doc-hub edges #683 / source_file written as absolute path on some runs, relative on others — causes --update to duplicate the whole graph #2259). Both sites now useas_posix().The existing assertion
ref.rel == "sub/diagram.png"was right; the code was wrong.extractors/fortran.pycarried the comment "An absolute path always begins with/" —the same POSIX assumption that produced the bad assertion. The hardening itself is still
sound on Windows (a drive-letter path cannot begin with
-); only the stated reasoning waswrong. Comment corrected, behaviour unchanged.
Changes
test_gitignore_nested_negation_overrides_broader_root_ruleas_posix_list()helpertest_nested_ignore_overrides_git_info_exclude_and_roottest_path_pattern_single_star_does_not_cross_segmenttest_build_image_refs_sets_rel_media_and_bytesllm.pyfixed insteadtest_queue_and_drain_pending_round_trip[Path(line) for line in lines] == paths; the documented contract is "one path per line", not a separator conventiontest_cpp_preprocess_passes_absolute_pathos.path.isabs(...)instead ofstartswith("/")Verification: every repaired assertion was mutation-tested
A test-hygiene PR is worthless if the repaired tests merely pass — that is exactly the false
signal being fixed. Each one was re-run against a deliberately broken product:
*allowed to cross a path segment_queue_pendingwrites every path on one line_build_image_refsreverted to native separators_cpp_preprocesspasses a relative path6/6 caught. Before this PR, four of the six could not fail on Windows at all.
One extra test, found by that exercise
test_cpp_preprocess_passes_absolute_pathsurvived its mutation at first: it hands in analready-absolute
tmp_path / "weird.F90", so removing.resolve()changes nothing and thetest passes either way — vacuous on every platform, not just Windows. The original
startswith("/")had the same hole, so #2620's suggested one-line swap would have left itvacuous. Added
test_cpp_preprocess_absolutises_a_relative_attacker_named_file, exercising thecase the hardening exists for: a corpus file named
-Ietc.F90reached by a relative path.That mutation is now caught.
Not in scope
tests/test_astro_import_ids.py::test_astro_relative_inputs_keep_canonical_idslooks like thesame class but is a genuine product defect — the astro/TS extractor really does write
src\lib\content.tsintosource_file. Tracked separately, as #2620 notes.