Skip to content

[Bug]: graphify update false positive on semantic nodes deduplicated into canonical AST twins #4389

Closed

Description

@AndresDiagoM

Pre-flight checks

  • I have checked the Troubleshooting section in the README

What happened?

When updating an existing graph via graphify update ., build_from_json() dedupes semantic nodes that share (source_file, label) with a canonical AST node (per #1145 (extended): non-AST nodes sharing (source_file, label) with an AST node have their ghost IDs removed from the graph, and their edges are rewired to the canonical node).

However, the shrink guard _lost_saved_semantic_nodes(saved_nodes, new_nodes, deleted_sources) checks whether any saved semantic node is missing from new_nodes only by looking up node_id in new_ids and legacy stem renames (_renamed_present). Because the ghost ID was intentionally pruned during deduplication, _lost_saved_semantic_nodes() falsely classifies the deduplicated node as "lost".

The shrink guard then aborts the update with:

[graphify] WARNING: Refusing to overwrite — saved semantic node(s) are missing from the new graph: src/models/user.ts:User.
Nothing to update or rebuild failed

requiring --force even though no symbols were lost.

Steps to reproduce

  1. Build a graph where a symbol has a semantic node (e.g. id: "src/models/user.ts:User", label: "User", source_file: "src/models/user.ts", _origin: "semantic").
  2. Run graphify update . to perform an AST-only code rebuild.
  3. The AST extractor emits the canonical AST node for User (_origin: "ast").
  4. build_from_json() collapses the semantic ghost node into the AST canonical node.
  5. _check_shrink() runs _lost_saved_semantic_nodes(), which reports src/models/user.ts:User as lost and aborts with exit code 1.

Error output or graph output

[graphify] WARNING: Refusing to overwrite — saved semantic node(s) are missing from the new graph: src/models/user.ts:User.
Nothing to update or rebuild failed

Graphify version

0.9.87

Operating System

Windows / Linux / macOS

Python Version

3.11 / 3.12 / 3.13

Activity

  1. github-actions commented on Oct 12, 2026

    @github-actions

    Thanks for opening this issue, @AndresDiagoM. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. safishamsi commented on Oct 12, 2026

    @safishamsi
    Member

    Fixed in v0.9.88 (graphifyy 0.9.88 on PyPI) via #4391.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions