Repository navigation
Description
Summary
graphify 0.8.43 regresses semantic extraction for oversized Markdown/text files that are expanded into FileSlice units. The string-path coercion added for #1386 now runs inside extract_files_direct() and attempts Path(FileSlice(...)), which crashes before any backend call is made.
This breaks normal graphify extract . --backend <backend> --out . when the changed semantic/doc corpus includes large Markdown files.
This looks related to the interaction between:
- feat: intra-file markdown slicing and adaptive retry (1/3) #1369 / v0.8.42: oversized Markdown/text slicing via
FileSlice - extract_corpus_parallel raises AttributeError: 'str' object has no attribute 'parent' when passed string paths #1386 / v0.8.43:
strpath coercion in semantic extract entry points - fix: accept string paths in corpus extraction #1389: appears to move coercion to
extract_corpus_parallel()and allowextract_files_direct()to receivePath | FileSlice, but it is currently open/conflicting while v0.8.43 is released with the regression.
Environment
- graphify:
0.8.43 - install:
uv tool upgrade graphifyy - OS: WSL2 Ubuntu
- backend: observed with
--backend deepseek; the minimal repro also shows the failure happens before any backend request, so this is not DeepSeek-specific
Minimal reproduction without making an API call
from pathlib import Path
from tempfile import TemporaryDirectory
from graphify.file_slice import expand_oversized_files
from graphify.llm import extract_files_direct
with TemporaryDirectory() as d:
root = Path(d)
doc = root / "large.md"
doc.write_text("# Large doc\n\n" + ("body text\n" * 5000), encoding="utf-8")
units = expand_oversized_files([doc], 20_000)
print([type(u).__name__ for u in units]) # includes FileSlice
# api_key is dummy; the failure happens before any backend request.
extract_files_direct(units, backend="deepseek", api_key="dummy", root=root)Actual behavior
TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'FileSlice'
In the CLI path this is surfaced as:
[graphify extract] semantic extraction on 2 files via <backend>...
[graphify] chunk 1/1 failed: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'FileSlice'
[graphify] WARNING: 1/1 semantic chunk(s) failed — see errors above. Partial results returned.
[graphify extract] error: all semantic chunks failed for backend '<backend>' (2 uncached files)
Expected behavior
extract_corpus_parallel() may coerce user-supplied str | Path inputs before slicing, but after expand_oversized_files() the internal units are Path | FileSlice. extract_files_direct() should preserve FileSlice units and use existing helpers such as unit_path() / _partition_semantic_files() / _read_files() instead of coercing every unit through Path(...).
Suspected root cause
In the v0.8.43 installed package, graphify/llm.py contains:
def extract_files_direct(...):
...
files = [Path(f) for f in files]That line is safe for str/Path inputs, but unsafe for FileSlice units produced by the slicer. The PR #1389 head appears to remove this coercion from extract_files_direct() and type it as Sequence[Path | FileSlice], which matches the needed behavior. A patch release with that fix would unblock large-doc semantic extraction.
Activity
shopEngineering commentedon Jun 19, 2026
Confirming on a second backend + OS — hit this independently on
--backend ollama(macOS,graphify 0.8.43viauv tool install). SameTypeError: ... not 'FileSlice'on[graphify] chunk 1/1 failed, triggered by adocs/corpus containing Markdown over the 20,000-char_FILE_CHAR_CAP(so it's not DeepSeek-specific — it's any backend, before the request).Verified the one-line fix resolves it (
extract_semantic/extract_files_direct,llm.py:1311):All downstream helpers (
unit_path(),_partition_semantic_files(),_read_files(),_estimate_file_tokens()) already handleFileSlice, so just sparing it from the blanketPath(f)coercion is sufficient. Matches the approach in #1389.Don't Path()-coerce FileSlice units in the extract entry points (#1397,
safishamsi commentedon Jun 19, 2026
Fixed on v8 in
7d07a24. Root cause confirmed: the 0.8.43 str-path coercion (#1386) ranPath(f)over every item inextract_files_direct, butextract_corpus_parallelfeeds itFileSliceunits from the oversized-document slicing (#1369), andPath(FileSlice)raisesTypeErrorbefore any backend call. Now only non-Path/non-FileSliceentries are coerced (str→Path); FileSlice and Path pass through untouched. The #1386 regression tests used tiny files so slicing never triggered — added a regression test with a file larger than_FILE_CHAR_CAPthat actually slices. Will ship in 0.8.44.safishamsi commentedon Jun 19, 2026
Released in 0.8.44 (now on PyPI). Upgrade with
uv tool install --upgrade graphifyy(orpip install -U graphifyy). Fix commit: 7d07a24.Don't Path()-coerce FileSlice units in the extract entry points (Grap…