Repository navigation
rebuild when a hook only sees a rename destination or an ignore file - #5353
SyedFahad7 wants to merge 2 commits into
Conversation
An incremental hook rebuild returned success without touching graph.json when the change list was only an untracked rename destination, such as util.py renamed to util.py.bak, or only an ignore file. The empty extraction batch returned before reconciliation, so stale nodes stayed in the graph. The rebuild now continues with an empty batch so reconciliation can drop sources that left the corpus, and a change to an ignore file also extracts newly included files.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Thanks @SyedFahad7! One small thing: our changelog and release notes are built from PR titles, so we use the conventional-commits format, for example: Prefixes we use: |
|
Thanks for the pull request, @SyedFahad7. 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.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify code review 
Review completed · fdc6e9459917
Warning
Merge confidence: 3/5 · Review before merging · 🟠 High impact
1 P2 bug checked against the code · 2 possible issues not confirmed
5 not re-checked
Incremental rebuilds now reconcile rename destinations that are not extractable and respond to ignore-file changes.
Full summary
Incremental rebuilds now reconcile rename destinations that are not extractable and respond to ignore-file changes. An ignore-file change also enables VCS-ignore eviction during reconciliation.
Bugs (1)
P2 · Preserve deliberately indexed VCS-ignored entries when reconciling .graphifyignore changes in graphify/watch.py: ignore_changed currently applies unchanged VCS ignore rules to corpus-absent files and evicts their graph records. Inspect source
Detailed review · checked against the code
Editing .graphifyignore can evict deliberately indexed VCS-ignored files
A .graphifyignore-only change can remove graph entries for files that still match an unchanged .gitignore rule, even though incremental rebuilds otherwise preserve those deliberately indexed files.
Expected: The incremental rebuild preserves deliberately indexed VCS-ignored entries unless the VCS ignore rule itself is being intentionally honored.
Actually: The .graphifyignore change enables the full ignore predicate during reconciliation, which treats the file as newly ignored and evicts its graph records.
An incremental change list containing .graphifyignore sets ignore_changed, which is passed as honor_vcs_ignore to reconciliation. For an alive source absent from code_files, _ignored_now then applies is_ignored_full; if the unchanged VCS ignore rule matches, reconciliation treats the source as newly ignored and evicts its records. This newly added path bypasses the documented incremental preservation policy for deliberately indexed .gitignore-matched files.
- Independent source review: The existing incremental-preservation test keeps a
.gitignore-matched file when an ordinary code file changes, but does not cover an ignore-file change. The.graphifyignore-only tests cover graphify-ignore eviction, not preservation of a file matched by an unchanged VCS rule. No guard on the ignore-file-change route prevents the full predicate from matching.
Not confirmed (2 possible issues)
Leads worth a look; we didn't double-check these. They don't change the score.
Not confirmed · Test fails if the rebuild log wording changes, because it checks the exact console text 'newly-ignored file(s)' Inspect source
Detailed review · not confirmed
The test passes only if the printed message contains the exact phrase 'newly-ignored file(s)', even though the graph assertions already check the behavior.
Line 1646 reads captured stdout and requires the literal text 'newly-ignored file(s)'. Lines 1643-1645 already confirm that vendor.py is removed from the graph and app.py remains, which is the behavior the test is about. The same pattern appears at line 1577 with 'No tracked code files in change set - skipping rebuild', so the wording of these messages is effectively part of the test contract.
-
The rebuild implementation in graphify/watch.py is not shown, so it is unknown whether this message is user-facing or meant to be a stable interface.
-
The check that no skip message appears at line 1577 is a negative match and would also pass if the message were reworded.
-
Found by the per-file sweep; not double-checked.
Not confirmed · Errors while adding newly included files after an ignore-file change are swallowed, so those files silently stay unindexed Inspect source
Detailed review · not confirmed
When .gitignore or .graphifyignore changes, the block meant to queue newly included files drops any error without a message.
Lines 2779-2812 are added by this PR to append code files that are not yet in the graph to wanted when an ignore file changes (#5329). The handler at 2811-2812 hides every failure, including from check_graph_file_size_cap and json.loads at 2784-2785. The later _reconcile_existing_graph call only catches RuntimeError and ValueError, so other failures in this block are never reported. The result is a rebuild that appears to succeed while the newly included files are missing from the graph.
-
Not checked whether
_StoredSourcePaths.absolute_identitycan raise for particular path values. -
Not checked whether the later extraction handles an empty
extract_targetslist when only deleted paths remain. -
Found by the per-file sweep; not double-checked.
Code graph and static checks · 1041 functions depend on this change
Impact & health
Impact — 1041 functions depend on the 600 functions this change touches.
Health — grade A; 10 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):
_rebuild_code()— 284 callers, 77 callees (high)dispatch_command()— 8 callers, 156 callees (high)main()— 128 callers, 3 callees (high)watch()— 8 callers, 15 callees (high)_reconcile_existing_graph()— 6 callers, 16 callees (high)_check_shrink()— 18 callers, 5 callees (high)_run_cli()— 11 callers, 8 callees (high)_reconcile_graph_html()— 8 callers, 5 callees (high)- …and 2 more
Formal checks — 1041 functions this change can affect weren't formally checked in this review. Formal checks are informational only.
Gate & verification
✅ PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 765 function(s) in the blast radius were not formally verified this run
Test selection
49 of 601 test file(s) selected (8%) via static blast radius.
tests/test_4978_reconcile_cost.py— impacttests/test_build.py— impacttests/test_cache_stale_import_target.py— impacttests/test_code_only_scope_4923.py— impacttests/test_compact_graph_json.py— impacttests/test_cpp_forward_declarations.py— impacttests/test_cpp_incremental_type_resolution.py— impacttests/test_cpp_member_declaration_identity.py— impacttests/test_csharp_method_owner_labels.py— impacttests/test_csharp_object_creation.py— impacttests/test_elixir_import_resolution.py— impacttests/test_elixir_qualified_calls.py— impacttests/test_elixir_unqualified_call_scope.py— impacttests/test_export_direction.py— impacttests/test_external_stub_endpoints.py— impacttests/test_go_receiver_member_calls.py— impacttests/test_incremental_unscanned_placeholders.py— impacttests/test_java_member_calls.py— impacttests/test_java_nested_type_identity.py— impacttests/test_kotlin_grammar.py— impacttests/test_labeling.py— impacttests/test_language_override_lifecycle.py— impacttests/test_linked_worktree_reconcile.py— impacttests/test_lost_saved_semantic_nodes.py— impacttests/test_markdown_code_spans.py— impacttests/test_markdown_sections.py— impacttests/test_no_cluster_undeclared_endpoints.py— impacttests/test_pr10_watch_overrides.py— impacttests/test_python_inherited_method_calls.py— impacttests/test_python_injected_factory_calls.py— impacttests/test_python_property_reads.py— impacttests/test_python_pytest_fixture_receivers.py— impacttests/test_qualified_type_competition.py— impacttests/test_rust_use_trees.py— impacttests/test_semantic_origin_stamp.py— impacttests/test_skill_persisted_scan_options.py— impacttests/test_solidity_inherited_calls.py— impacttests/test_terraform_modules.py— impacttests/test_undirected_two_file_import_cycle.py— impacttests/test_update_incremental.py— impacttests/test_update_js_resolution_inputs.py— impacttests/test_update_lock_contention.py— impacttests/test_update_missing_graph.py— impacttests/test_update_no_change_gate.py— impacttests/test_watch.py— impact, changed-testtests/test_watch_identity_cache.py— impacttests/test_watch_inotify_overflow.py— impacttests/test_watch_manifest_location.py— impacttests/test_watch_pruned.py— impact
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.
An incremental hook rebuild could return success and leave stale nodes in graph.json when the change list was only an untracked rename destination, such as util.py renamed to util.py.bak, or only an ignore file. The empty extraction batch returned before reconciliation, so sources that had left the corpus were never dropped, and files newly included by an ignore change were never indexed. The rebuild now continues with an empty batch so reconciliation can catch those sources, and a change to an ignore file also extracts files that are now in the corpus.