Skip to content

# fix(dedup): merge same-ID node attributes instead of discarding them (#2091)#2104

Open
SinghAman21 wants to merge 1 commit into
Graphify-Labs:v8from
SinghAman21:fix/2091-dedup-merge-attributes
Open

# fix(dedup): merge same-ID node attributes instead of discarding them (#2091)#2104
SinghAman21 wants to merge 1 commit into
Graphify-Labs:v8from
SinghAman21:fix/2091-dedup-merge-attributes

Conversation

@SinghAman21

Copy link
Copy Markdown
Contributor

What

On the default dedup=True path, when two nodes share an ID the pre-dedup step
kept one whole node dict and threw the other away. In the AST↔semantic case
(where _semantic_id_remap forces the AST node and the LLM node onto one ID so
they merge), the LLM's summary / confidence_score / references were
silently dropped — even though build()'s docstring promises a key-wise union.

The user already paid API credits for those summaries, and the only output was a
note: about the label, never mentioning the lost attributes.

How

The survivor now gap-fills from the loser instead of replacing it wholesale:

  • Only keys the survivor lacks are copied over (setdefault).
  • Conflicting keys (label, source_file) still resolve to the survivor, so
    _collision_rank ordering and the collision reporting are unchanged.
  • The first insert now copies (dict(node)) so caller-owned node dicts are never
    mutated.

Before: dedup=Truesummary=None. After: dedup=Truesummary preserved,
survivor's label still wins the conflict.

Files

  • graphify/dedup.py — gap-fill merge in the same-ID pre-dedup loop.
  • tests/test_dedup.py — 3 tests: gap-fill preserves disjoint attrs,
    survivor wins on conflict, input nodes are not mutated.
  • CHANGELOG.md — entry under 0.9.24 (unreleased).

Reference

Conclusion

dedup=True now yields at least the attribute set dedup=False does, with the
survivor winning genuine conflicts. No public API change; full suite green
(pre-existing unrelated test_ollama_retry_cap.py failures aside).

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.

1 participant