Skip to content

fix(incremental): re-extract importers of deleted files to keep unresolved placeholders - #5638

Closed
Aadithya-kl wants to merge 3 commits into
Graphify-Labs:v8from
Aadithya-kl:fix/issue-5633-incremental-deleted-import
Closed

Aadithya-kl wants to merge 3 commits into
Graphify-Labs:v8from
Aadithya-kl:fix/issue-5633-incremental-deleted-import

Conversation

@Aadithya-kl

Copy link
Copy Markdown
Contributor

Closes #5633.

When a file is deleted, unchanged importers still reference its pruned nodes in the persisted graph, so incremental merge drops the dangling edge instead of emitting an unresolved placeholder node/edge like a full build does.

This adds _deleted_import_partners in graphify/watch.py (used by both watch and cli incremental update paths) to schedule unchanged live files that import or re-export a deleted file (including transitively through JS/TS barrel re-exports) for re-extraction.

Tested with pytest -q tests/test_watch.py -k "keeps_unresolved_placeholder_after_delete or incremental_rebuild or deleted".

@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @Aadithya-kl. 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.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify review View in Graphify

Nothing blocking · 5 possible issues to check · Merge confidence 5/5

5 possible issues to check · High impact

The CLI and watch rebuild paths now use saved import, re-export and include edges to schedule live files affected by deletions for re-extraction.

5 possible issues we couldn't confirm
  • Importing the partner helpers from graphify.watch inside the broad try block can silently disable the whole resolution context · graphify/cli.py:5309
  • Importers of deleted files are only re-extracted on the saved-graph path, so they are skipped when the JavaScript refresh flag is set · graphify/cli.py:5328
  • Importers of deleted files are only re-extracted if their stored edges carry source_file, so the fix can silently do nothing · graphify/watch.py:362
  • +2 more in Graphify

They don't change the score.

What this review covered
  • Some lookups asked for files or lines that do not exist; the review was told and carried on.
  • 3 of 3 changed files inspected. This is scope, not a correctness guarantee.
Code graph · 1280 functions depend on this change
  • 1 function became more coupled. dispatch_command() (8 callers).
  • 103 of 658 test files are affected by this change.
  • Gate, test list and every flagged function: in the Graphify check.

Reviewed 06e51d7 · 4 earlier findings not re-checked

Added 'includes' to the set of import edge relations to cover template composition.
safishamsi pushed a commit that referenced this pull request Nov 30, 2026
safishamsi added a commit that referenced this pull request Nov 30, 2026
Extractor accuracy (Swift #5641, Apex #5627, Python #5647, TypeScript
#5604/#5614/#5612, Bash caller-var #5602), GitHub Actions run-step
extraction (#5603), incremental correctness (#5634/#5638/#5636), symlink
and semantic-cache fixes (#5617/#5618), export/report hardening and perf
(#5643/#5644/#5645/#5646/#5619/#5620/#5621), and CLI/docs/skill/install
work (#5629/#5628/#5626/#5624/#5623/#5625/#5642/#5583). AST cache schema
59 to 60; Swift/Apex/Python/Bash/GHA inputs re-extract on first build.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@safishamsi

Copy link
Copy Markdown
Member

Landed in v0.9.124 (just released to PyPI), cherry-picked with your authorship preserved so it shows under your name in the history. Thanks @Aadithya-kl for re-extracting importers of deleted files for placeholder parity — verified green in the full suite and, where applicable, smoke-tested against the published package. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: incremental update drops an importer's edge to a deleted file instead of leaving the unresolved-import placeholder

2 participants