Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

ID collision: a node with no source_file beats a sourced node with the same id (dedup._collision_rank)

クローズ 初心者向け
#4,492 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #4496 @ayushcodes10 による — マージされずにクローズ

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
tooling

調査の方向性

衝突のランキングは graphify/dedup.py の _collision_rank にあり、deduplicate_entities がこれを呼び出します。まず issue の再現手順を、sourced と blank を使って両方の到着順で実行してください。その後、_pick_winner が実際の source_file をすでにどのように優先しているかと比較します。完了条件は、到着順のどちらでも sourced のノードが残り、同じ id を持つ sourced の2つのノードが従来どおり解決されることです。リンクされた PR #4496 はマージされずにクローズされているため、まずその議論を確認してください。

索引モデルが issue の本文から書いたものです。

説明

Version: graphifyy 0.9.91 (unchanged since at least 0.9.49)

When two nodes share an id that neither node's file encodes, so that _defines_id is False for both, _collision_rank ties them on every key but the reversed path. An empty source_file gives (), which sorts before any real path. So the source-less node always survives, and the sourced one is dropped:

from graphify.dedup import deduplicate_entities, _collision_rank
sourced = {"id": "x", "label": "X", "source_file": "a.md"}
blank = {"id": "x", "label": "X"}
print(_collision_rank(sourced))   # (True, 1, 1, 'X', ('a.md',))
print(_collision_rank(blank))     # (True, 1, 1, 'X', ())
nodes, _ = deduplicate_entities([sourced, blank], [], communities={})
print(nodes)                      # [{'id': 'x', 'label': 'X'}]

It is the same in either arrival order, and graphify warns "keeping 'X' from '', dropping 'X' from 'a.md'". Source-less semantic nodes reach dedup because the out-of-scope filter (#1895) returns early on an empty source_file, and since such a node is never in the per-file semantic cache, every incremental merge carries it forward.

#3775/#3786 made "a real source_file beats none" the rule in _pick_winner. The exact-ID path does not have it (its reversed-path tie-break dates from #2532's fix in 0.9.36). A key such as not node.get("source_file") right after not _defines_id(node) would match. It changes no collision between two sourced nodes.

主要言語
Python
スター
124k
フォーク
11.9k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Graphify-Labs/graphify のほかの issue

Graphify-Labs/graphify の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。