Summary
detect() writes into the tree it is scanning. When the root contains an Office
or Google-Workspace document, detection converts it and writes the markdown
sidecar to <root>/graphify-out/converted/. That makes detect() a mutating
operation on its own input, which breaks any caller that treats the scanned tree
as immutable.
Observed on 0.9.44.
Why this is a problem, not a quirk
We scan pinned third-party sources in disposable clones and assert afterwards
that the clone is byte-identical to the commit we materialized — the check exists
so that a detector can never silently alter reviewed source. Detection itself
trips that assertion:
disposable clone changed during detection: 2 dirty path(s):
['?? graphify-out/converted/example_8a530a1d.md',
'?? graphify-out/converted/example_d1c39225.md']
The two sidecars come from cognee/tests/test_data/example.docx and
example.pptx. It is fully deterministic: every source shipping an Office
document drifts, and no other source does.
More generally, a read-shaped API that writes to its argument is surprising for
read-only mounts, immutable checkouts, concurrent scans of one tree, and anything
doing provenance or reproducibility checks.
There is no way to redirect it
converted_dir is hardcoded (detect.py, 0.9.44):
converted_dir = root / GRAPHIFY_OUT / "converted"
detect() does accept cache_root, which reads like the knob for this, but it
only reaches _cache.cached_word_count(...) — the word-count cache. Nothing
routes conversion output through it.
Reproduce
mkdir -p repro && cd repro && git init -q
cp /path/to/any.docx .
git add -A && git commit -qm fixture
python -c "from pathlib import Path; from graphify.detect import detect; detect(Path('.'))"
git status --porcelain --untracked-files=all
# ?? graphify-out/converted/any_<hash>.md
Suggested resolution
Any of these would resolve it for us, in preference order:
- Honour
cache_root for conversion output as well, so a caller can direct
sidecars outside the scanned tree.
- Add an explicit
converted_dir / out_dir parameter to detect().
- Make conversion opt-in during
detect(), given that detection's documented
job is classification rather than materialization.
Happy to send a PR if you have a preference on the shape.
Summary
detect()writes into the tree it is scanning. When the root contains an Officeor Google-Workspace document, detection converts it and writes the markdown
sidecar to
<root>/graphify-out/converted/. That makesdetect()a mutatingoperation on its own input, which breaks any caller that treats the scanned tree
as immutable.
Observed on 0.9.44.
Why this is a problem, not a quirk
We scan pinned third-party sources in disposable clones and assert afterwards
that the clone is byte-identical to the commit we materialized — the check exists
so that a detector can never silently alter reviewed source. Detection itself
trips that assertion:
The two sidecars come from
cognee/tests/test_data/example.docxandexample.pptx. It is fully deterministic: every source shipping an Officedocument drifts, and no other source does.
More generally, a read-shaped API that writes to its argument is surprising for
read-only mounts, immutable checkouts, concurrent scans of one tree, and anything
doing provenance or reproducibility checks.
There is no way to redirect it
converted_diris hardcoded (detect.py, 0.9.44):detect()does acceptcache_root, which reads like the knob for this, but itonly reaches
_cache.cached_word_count(...)— the word-count cache. Nothingroutes conversion output through it.
Reproduce
Suggested resolution
Any of these would resolve it for us, in preference order:
cache_rootfor conversion output as well, so a caller can directsidecars outside the scanned tree.
converted_dir/out_dirparameter todetect().detect(), given that detection's documentedjob is classification rather than materialization.
Happy to send a PR if you have a preference on the shape.