`extract()` raises `ValueError` on Windows when a symbol-less file and `root` are on different drives (regression in 0.9.75)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #4106 di @xiehuanyi — chiusa senza merge
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
Direzione di ricerca
Inizia in graphify/extract.py, nella costruzione del percorso _symbolless_files, e verifica come viene selezionato root quando viene passato solo cache_root. Riproduci il caso tra unità in Windows, quindi esegui tests/test_languages.py::test_objc_bridging_header_not_isolated, tests/test_languages.py::test_objc_paired_no_dangling_edges e tests/test_partial_extraction_warning.py. Il lavoro è concluso quando l’estrazione non si interrompe più tra unità e i test interessati hanno esito positivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- Python
- Stelle
- 124k
- Fork
- 11.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Graphify-Labs/graphify
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)Forse già presa @Deepjyoti-Sarmah l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Graphify-Labs/graphify#4563 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
GRAPHIFY_DISABLE_THINKING is ignored by the claude backend, so thinking eats max_tokens and extraction truncatesForse già presa @bercedev l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
Graphify-Labs/graphify#4546 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
--update runbook: graph.json backup instruction comes after the diff that needs it, so the graph diff never runsForse già presa @sunildivakar96-cpu l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Graphify-Labs/graphify#4539 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: graphify tree ignores the repo tag on merged graphs: no per-repo roots, and identical relative paths from different repos collapse togetherForse già presa @AromalBiju1 l’ha presa 4 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Graphify-Labs/graphify#4524 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Pi skill uses unsupported general-purpose subagent instead of delegateForse già presa @bercedev l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Graphify-Labs/graphify#4494 · 7 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Graphify-Labs/graphify
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
[Bug]: Queen's own Ollama model loses num_ctx when a running session switches to itForse già presa @anasamin26 l’ha presa oggi. Apertabug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aden-hive/hive#7508 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
llm translation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
BerriAI/litellm#47884 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug 🐛
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
netalertx/NetAlertX#1856 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno