AST extraction emits source_location=L1 for zero-byte source files (unsatisfiable provenance anchor)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #4086 @Mpasha17 による — マージされずにクローズ
評価
調査の方向性
Start with the two-file fixture described in the issue: an empty.py file and witness.py containing VALUE = 1. Run graphify extract ./fixture --out ./out --code-only and inspect the AST extraction output for the zero-byte file. Done means empty.py produces no code node or no source_location, while witness.py retains its valid L1 anchor.
索引モデルが issue の本文から書いたものです。
説明
Summary
AST extraction emits a provenance anchor for zero-byte source files:
source_file = empty.py
file_type = code
_origin = ast
source_location = L1
empty.py is 0 bytes / 0 lines, so L1 designates a line that does not exist. The anchor is unsatisfiable by construction: it can neither be resolved nor rejected by reading the file.
Versions tested
| version | behavior |
|---|---|
graphifyy 0.9.72 |
reproduces |
graphifyy 0.9.74 |
reproduces (identical) |
Behavior is identical on both versions — 0.9.74 does not change it.
Minimal fixture
Two files, one of them empty:
fixture/
empty.py 0 bytes
witness.py VALUE = 1
Commands
graphify extract ./fixture --out ./out --code-only
Expected result
empty.py contains no code, so it should produce no code node. A file with 0 lines cannot carry a source_location.
Actual result
wrote graph.json: 2 nodes, 0 edges, 2 communities
Nodes emitted:
id=empty file_type=code _origin=ast source_file=empty.py source_location=L1
id=witness file_type=code _origin=ast source_file=witness.py source_location=L1
witness.py has 1 line, so L1 is correct there. Only the zero-byte file produces the impossible anchor.
Why L1 is invalid for a 0-byte file
source_location is a provenance anchor: it must designate a line that actually exists in the target file. For a 0-byte file:
- the file has 0 lines;
L1designates a non-existent line;- no line range is valid, so no anchor can be emitted at all.
Any provenance validator that compares source_location against the real file length will reject this. The node is therefore unusable for provenance purposes regardless of how the validator is configured.
Impact
Affects any project containing zero-byte Python files — in practice, any Python package, since __init__.py files are frequently empty. Because the anchor is provably unsatisfiable, such nodes block strict provenance validation of the whole graph.
Suggested fixes
Any one of these would resolve it:
- do not emit a node for a 0-byte file;
- emit the node without
source_location; - emit the node as
file_type=fileinstead ofcode.
Environment
graphify 0.9.72 / 0.9.74
Python 3.13
Windows
- 主要言語
- Python
- スター
- 124k
- フォーク
- 11.9k
- 平均マージ
- 2時間 35分
- マージ済み PR(30日)
- 6
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Graphify-Labs/graphify のほかの issue
-
`file_hash` opens the lowercased path on Windows, so files with uppercase names fail on case-sensitive dirs (`\wsl.localhost`)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Graphify-Labs/graphify#4925 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
watch liveness check resolves relative source identities against process CWD instead of watch root対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Graphify-Labs/graphify#4896 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
extract --out <dir>: semantic cache never saved, docs missing from manifest (relative source_file resolved against --out)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Graphify-Labs/graphify#4831 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)対応中かも @Deepjyoti-Sarmah が 13 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Graphify-Labs/graphify#4563 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
GRAPHIFY_DISABLE_THINKING is ignored by the claude backend, so thinking eats max_tokens and extraction truncates対応中かも @bercedev が 14 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
Graphify-Labs/graphify#4546 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
Graphify-Labs/graphify の issue をすべて見る
似ている issue
-
URLValidator ignores an explicit empty scheme allowlist対応中かも @IlyaKhalafi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
tortoise/tortoise-orm#2393 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
frappe/frappe_docker#2046 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
complete_box_iou_loss / complete_box_iou: NaN gradients for zero-height boxes, NaN for point boxesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
AXI SMU SPEC
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
tenstorrent/tt-oca-harness#3556 ·
メンテナーはふだん 1 日以内に返信