Repository navigation
fix(detect): drop a previous checkout's absolute manifest keys - #4175
SrijanSriv wants to merge 2 commits into
Conversation
A re-clone copies graphify-out while the old checkout is still on disk, so those absolute rows survive Path.exists() and never collapse into the new relative keys.
|
Thanks for the pull request, @SrijanSriv. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
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.
Graphify review — findings
Makes save_manifest drop absolute keys left over from a previous checkout when a graphify-out directory is copied into a fresh clone (#3581). _previous_checkout_absolute_keys groups absolute keys by the longest existing-directory prefix whose remainder matches a relative key the current save writes. Groups of two or more are discarded whether or not scan_corpus is passed, while a lone match stays as an include row and nothing is pruned when root is unset.
Worth a look
- save_manifest now prunes out-of-root absolute rows even for subset saves —
graphify/detect.py:2645· Escalate · medium- 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 — 3011 functions depend on the 601 functions this change touches.
Health — this change adds coupling hotspots:
- new:
extract()— 778 callers, 50 callees - new:
_rebuild_code()— 149 callers, 56 callees - new:
detect()— 121 callers, 16 callees - new:
save_manifest()— 47 callers, 15 callees - new:
_extract_generic()— 18 callers, 31 callees - new:
extract_js()— 87 callers, 4 callees - new:
extract_files_direct()— 17 callers, 20 callees - new:
extract_xaml()— 19 callers, 17 callees - …and 56 more — each is listed as a finding
Verification — 3011 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: 1118 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
64 of 334 test file(s) selected (19%) via static blast radius.
tests/test_astro_extraction.py— impacttests/test_atomic_writes.py— impacttests/test_build.py— impacttests/test_cargo_introspect.py— impacttests/test_charmap_encoding.py— impacttests/test_chunking.py— impacttests/test_cjs_module_extension.py— impacttests/test_claude_cli_backend.py— impacttests/test_cpp_nested_and_cli.py— impacttests/test_detect.py— impact, changed-testtests/test_docx_to_markdown.py— impacttests/test_dotnet.py— impacttests/test_evidence_binding.py— impacttests/test_extract.py— impacttests/test_extract_cli.py— impacttests/test_extract_php_closures.py— impacttests/test_file_slice.py— impacttests/test_file_truncation_warning.py— impacttests/test_ignore_file_encoding.py— impacttests/test_image_vision.py— impacttests/test_import_extension_resolution.py— impacttests/test_incremental_mtime_collision.py— impacttests/test_indirect_call_block_scoped_shadow.py— impacttests/test_indirect_dispatch.py— impacttests/test_indirect_dispatch_assign_return.py— impacttests/test_indirect_dispatch_getattr.py— impacttests/test_js_exported_scalar_bindings.py— impacttests/test_languages.py— impacttests/test_llm_backends.py— impacttests/test_long_path_hashing.py— impacttests/test_manifest_ingest.py— impacttests/test_markdown_code_spans.py— impacttests/test_mcp_ingest.py— impacttests/test_multilang.py— impacttests/test_non_regular_files.py— impacttests/test_office_incremental.py— impacttests/test_office_limits.py— impacttests/test_ollama.py— impacttests/test_out_dir_evidence.py— impacttests/test_oversized_document_slicing.py— impacttests/test_package_json_subpath_imports.py— impacttests/test_pdf_extra_warning.py— impacttests/test_pdf_slicing.py— impacttests/test_pdf_token_estimate.py— impacttests/test_phantom_external_import.py— impacttests/test_pipeline.py— impacttests/test_python_underscore_resolution.py— impacttests/test_rationale.py— impacttests/test_ruby_resolution.py— impacttests/test_scala_context_bounds.py— impact- … and 14 more
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
· 1 grounded finding(s) anchored inline below; 63 more finding(s) on lines outside this diff (see the check run).
A hook that omits scan_corpus was dropping include rows whose names matched the files it restamped. The previous-checkout drop now runs only when scan_corpus is set.
A re-clone that copies graphify-out/ while the old checkout is still on disk left absolute manifest keys pointing at the old path, which survived the exists()/in-root prune and persisted alongside the new relative keys. On a full scan, drop stale absolute keys that duplicate a freshly-written relative key under a real shared directory prefix. Co-Authored-By: Claude Opus 4.8 <[email protected]>
* upstream/v8: (184 commits) release: 0.9.80 — include Graphify-Labs#4195, Graphify-Labs#4198 feat(python): resolve obj.method() through an annotated/constructor-bound local (Graphify-Labs#4198) perf(extract): resolve and parse each path once in the id remap and call tie-break release: 0.9.80 fix(deps): raise tree-sitter runtime floor to >=0.25 for ABI 15 grammars (Graphify-Labs#4148) fix(build): give --no-cluster graph.json the same endpoint rules as build_from_json fix(watch): keep extract()'s run-only keys out of --no-cluster graph.json fix(watch): drop an external import stub once no edge references it fix(detect): drop a previous checkout's absolute manifest keys (Graphify-Labs#4175) fix(python): keep TYPE_CHECKING-only imports out of import cycles (Graphify-Labs#3159) fix(python): resolve self.<attr>.<method>() calls through the attribute's constructor type (Graphify-Labs#2860) fix(cache): treat an AST hit whose import target is gone as a miss fix(extract): preserve cross-drive syntax warnings fix(extract): let the Windows console script use the extraction pool fix(resolution): keep re_exports from both files whose ids collide fix(markdown): resolve links to file names that contain a space fix(java): capture methods and calls inside anonymous class bodies test: skip optional-extra tests when the extra is not installed (Graphify-Labs#4190) fix(serve): show the graph's build commit in graph_stats perf(serve): build the MCP traversal view and shortest-path graphs once per graph ... # Conflicts: # CHANGELOG.md # graphify/extract.py # graphify/extractors/engine.py # graphify/serve.py # pyproject.toml # uv.lock
* upstream/v8: (184 commits) release: 0.9.80 — include Graphify-Labs#4195, Graphify-Labs#4198 feat(python): resolve obj.method() through an annotated/constructor-bound local (Graphify-Labs#4198) perf(extract): resolve and parse each path once in the id remap and call tie-break release: 0.9.80 fix(deps): raise tree-sitter runtime floor to >=0.25 for ABI 15 grammars (Graphify-Labs#4148) fix(build): give --no-cluster graph.json the same endpoint rules as build_from_json fix(watch): keep extract()'s run-only keys out of --no-cluster graph.json fix(watch): drop an external import stub once no edge references it fix(detect): drop a previous checkout's absolute manifest keys (Graphify-Labs#4175) fix(python): keep TYPE_CHECKING-only imports out of import cycles (Graphify-Labs#3159) fix(python): resolve self.<attr>.<method>() calls through the attribute's constructor type (Graphify-Labs#2860) fix(cache): treat an AST hit whose import target is gone as a miss fix(extract): preserve cross-drive syntax warnings fix(extract): let the Windows console script use the extraction pool fix(resolution): keep re_exports from both files whose ids collide fix(markdown): resolve links to file names that contain a space fix(java): capture methods and calls inside anonymous class bodies test: skip optional-extra tests when the extra is not installed (Graphify-Labs#4190) fix(serve): show the graph's build commit in graph_stats perf(serve): build the MCP traversal view and shortest-path graphs once per graph ... # Conflicts: # CHANGELOG.md # graphify/extract.py # graphify/extractors/engine.py # graphify/serve.py # pyproject.toml # uv.lock
|
Thanks for this, @SrijanSriv. This same fix already landed earlier (released in 0.9.80), so the manifest-key detection you add is present on the default branch. Closing as already shipped. Your other PRs in this batch did land in 0.9.87. |
What does this PR do?
A re-clone must not keep absolute manifest keys that point at the previous checkout.
save_manifestdrops a row whenPath(f).exists()is false, so a move is already clean. A re-clone copiesgraphify-out/while the old checkout is still on disk, so that check keeps the old absolute keys. The scan prune then skips them because_in_rootis false, and_to_relative_for_storagewrites them absolute again. They never share a stored key with the new relative rows, so both halves stay. The drop runs only whenscan_corpusis set. A subset save omits it and keeps every live out-of-root row (#917)._previous_checkout_absolute_keysdrops a group only when_to_relative_for_storagewould keep the keys absolute, at least two of them share one directory prefix, and each path under that prefix is a relative key this save writes. The longest suffix wins, sosrc/c.pybeatsc.py.save_manifestcalls it only whenscan_corpusis set, after the exists check and before the #1908 scan prune. A row that relativizes into the storage root is not a candidate, so a sibling directory from #3785 stays.Related to #3581. This does not use a closing keyword. Part 2 of that issue,
graph.jsonafter--force, is not in this diff. #3583 is a different path spelling and is not touched.Type of change
Verification & Invariants
Read the CONTRIBUTING.md guide.
Reproduced the issue and identified the invariant.
Made the smallest fix necessary.
Added a regression test (if bug fix) or isolated boundary test.
Kept the PR description synchronized with the final implementation.
Documented any limitations / unsupported cases explicitly.
Reproduced on v8 at
5c7b847:uv run pytest tests/test_detect.py::test_save_manifest_reclone_drops_other_checkout_when_scan_corpus_is_set tests/test_detect.py::test_save_manifest_drops_other_checkout_keys_mixed_with_relative_keys -qfailed. The manifest had six keys. Extra items were the absolute paths ofa.py,b.py, andsrc/c.pyundercheckout-a.Follow-up on
3a05b3b:uv run pytest tests/test_detect.py::test_save_manifest_subset_save_keeps_other_checkout_absolute_keys tests/test_detect.py::test_save_manifest_subset_save_keeps_includes_that_share_basenames -qfailed. The subset save left onlya.py,b.py, andsrc/c.py. The include paira.pyandb.pyoutside the root was gone.Decoy: one include row named
a.py, while the project also hasa.py, stays absolute. Two include rows,notes.mdandextra.md, stay when those suffixes are not relative keys this save writes. A subset save that restampsa.pyandb.pykeeps two include rows with those same names. A fix that drops every absolute key, or every shared file name, or every out-of-root row on a subset save, fails one of those tests.test_save_manifest_full_scan_keeps_out_of_root_rowsstill passes.Left alone: the exists check that already cleans a move,
_to_relative_for_storage,_manifest_storage_anchor,graph.json, and--force.Limitations: one absolute key alone stays, because it cannot be told apart from one include row. On a full scan, two include rows whose paths under one outside directory equal relative keys of this project are dropped. Pass those files in
fileson each full scan if they must stay. A subset save keeps them.How was this tested?
Python 3.12.12 and Python 3.13.3. Python 3.10 is not installed here.
Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments.