graphify
graphify copied to clipboard
fix(llm): unwrap FileSlice via unit_path in the checkpoint allowlist (#1870)
Fixes #1870
_checkpoint_chunk resolved each unit's source file with getattr(item, "rel", None) or item, but FileSlice carries its file in .path — it has no .rel — so for every sliced document the FileSlice object itself leaked into allowed_source_files. save_semantic_cache then raised on Path(FileSlice), the best-effort guard downgraded that to the incremental cache checkpoint failed warning, and every chunk containing a slice silently lost its checkpoint — so a resumed run re-billed those chunks instead of reusing the cache.
llm.py: build the allowlist withunit_path(...)—file_slice.py's canonical unwrap (parentPathfor a slice, barePathunchanged), already imported and used elsewhere in the module — and fix the stale.relcommenttests/test_chunking.py: regression test that drivesextract_corpus_parallelover a corpus whose document slices into 7 units and asserts the checkpoint fires with real paths; on currentv8it fails with the exactFileSliceleak from the report
Since a slice's .path is the same value the file would have had as a bare Path, the allowlist entries for sliced files now match unsliced behavior exactly.