`extract()` raises `ValueError` on Windows when a symbol-less file and `root` are on different drives (regression in 0.9.75)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #4106 @xiehuanyi による — マージされずにクローズ
評価
調査の方向性
graphify/extract.py の _symbolless_files パス構築から始め、cache_root だけが渡された場合に root がどのように選択されるかを確認してください。Windows でドライブをまたぐケースを再現し、その後 tests/test_languages.py::test_objc_bridging_header_not_isolated、tests/test_languages.py::test_objc_paired_no_dangling_edges、tests/test_partial_extraction_warning.py を実行してください。抽出がドライブをまたいでも中断されず、影響を受けるテストがパスすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
The "cleanly parsed code file yields no symbols" warning added in 0.9.75 (#4009, fixes #3946) builds the displayed path with an unguarded os.path.relpath in graphify/extract.py:
_symbolless_files.append((os.path.relpath(str(_p), str(root)).replace("\\", "/"), _size))
On Windows os.path.relpath raises ValueError: path is on mount 'D:', start on mount 'C:' when the file and root are on different drives, so a diagnostic warning aborts the whole extraction.
The automated review on #4009 already flagged this risk ("os.path.relpath can raise ValueError and crash extract() for out-of-root paths on Windows", medium severity). This issue adds a concrete reproduction, the affected tests, and a verified fix.
Environment
Windows 11, Python 3.12.13, graphify v0.9.75 (48d7c0e8).
Reproduction
root is not passed, so extract() falls back to cache_root (elif cache_root is not None: root = cache_root).
import tempfile
from pathlib import Path
from graphify.extract import extract
p = Path(r"D:\proj\a.py") # contains only: "# comment\nX = 1\n" -> the file yields exactly 1 node
with tempfile.TemporaryDirectory() as td: # %TEMP% is on C:
extract([p], cache_root=Path(td))
Result on v0.9.75:
ValueError: path is on mount 'D:', start on mount 'C:'
- On v0.9.74 the same call succeeds.
- On v0.9.75 the same call succeeds when
root=p.parentis passed explicitly. - The test suite hits it too when the checkout is on a different drive from
%TEMP%:tests/test_languages.py::test_objc_bridging_header_not_isolatedandtests/test_languages.py::test_objc_paired_no_dangling_edgesfail, because the_corpus()helper passes onlycache_root=<tmp dir>. A clean v0.9.75 checkout onD:gives 2 failed; the same checkout onC:gives 2 passed.
Scope
- The
graphify extractCLI is not affected: it passesroot=targetexplicitly (ast_kwargs: dict = {"cache_root": out_root, "root": target}). Checked end to end with the repo onD:,GRAPHIFY_OUTonC:and one symbol-less.pyfile: the warning is printed,graph.jsonis written, exit code 0. - Affected: callers of
extract()that passcache_rootwithoutrooton a different drive from the scanned files, and the test suite on Windows checkouts outside the temp drive.
Suggested fix
try:
_rel = os.path.relpath(str(_p), str(root)).replace("\\", "/")
except ValueError: # different drive on Windows
_rel = _p.as_posix()
_symbolless_files.append((_rel, _size))
Applied to a clean v0.9.75 checkout on D:: the reproduction above succeeds, the -k objc tests in tests/test_languages.py pass (33 passed), and tests/test_partial_extraction_warning.py passes (11 passed).
- 主要言語
- Python
- スター
- 124k
- フォーク
- 11.9k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Graphify-Labs/graphify のほかの issue
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)対応中かも @Deepjyoti-Sarmah が 7 日前に担当しました。 オープン
難易度 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 が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
Graphify-Labs/graphify#4546 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
--update runbook: graph.json backup instruction comes after the diff that needs it, so the graph diff never runs対応中かも @sunildivakar96-cpu が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Graphify-Labs/graphify#4539 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] Pi skill uses unsupported general-purpose subagent instead of delegate再び着手できるかも @bercedev が 10 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Graphify-Labs/graphify#4494 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
Graphify-Labs/graphify#3763 ·
メンテナーはふだん 1 日以内に返信
Graphify-Labs/graphify の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
ocr_data_to_elements() raises AttributeError when a layout element is a List対応中かも @Eapp1e が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
Unstructured-IO/unstructured#4616 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
area:codegen backend:metal bug direction:output
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信