extract_corpus_parallel raises AttributeError: 'str' object has no attribute 'parent' when passed string paths
Summary
graphify.llm.extract_corpus_parallel(files, backend="gemini") crashes when files is a list of str paths. It only works if the paths are pathlib.Path objects. The failure occurs in _pack_chunks_by_tokens, which calls f.parent on each entry.
Environment
- graphify 0.8.41
Steps to reproduce
from graphify.llm import extract_corpus_parallel
files = ["a/b/file1.md", "a/b/file2.md"] # str paths
extract_corpus_parallel(files, backend="gemini")
Actual behavior
File ".../graphify/llm.py", line 1420, in _pack_chunks_by_tokens
by_dir.setdefault(f.parent, []).append(f)
^^^^^^^^
AttributeError: 'str' object has no attribute 'parent'
Passing [Path(f) for f in files] instead works fine.
Expected behavior
extract_corpus_parallel should accept string paths (coerce to Path internally — e.g. f = Path(f) at the entry point or top of _pack_chunks_by_tokens), or validate the input type up front and raise a clear, actionable error. A raw AttributeError deep in a private helper is hard for callers to diagnose.
Fixed on v8 in 5038129. extract_corpus_parallel and extract_files_direct now coerce files = [Path(f) for f in files] at entry, so str paths work (the crash was at .suffix/.parent downstream; the AST extract() already coerced). Regression tests added for str/Path/mixed/empty inputs. Will ship in the next release.