graphify icon indicating copy to clipboard operation
graphify copied to clipboard

Office conversion sidecars are silently dropped when graphify-out/ is gitignored

Open jj954081-dotcom opened this issue 4 months ago • 3 comments

Environment

  • graphifyy 0.9.26 (pip install "graphifyy[office]" — openpyxl 3.1.5, python-docx 1.2.0)
  • Python 3.12.10, Windows 11
  • Project: TypeScript monorepo with two .xlsx files in import/
  • graphify-out/ is listed in the project's .gitignore (as the docs recommend for the index artifact)

What happens

With the office extra installed, .xlsx/.docx files are converted successfully — the markdown sidecars appear in graphify-out/converted/ — but the converted content never enters the corpus. detect() reports the same document count as if the office files did not exist, with no warning: skipped_sensitive is empty (it is only populated when conversion fails), and the sidecars are not in files['document'].

Root cause

In detect.py (0.9.26, around lines 1361–1372), after a successful conversion the sidecar path is checked against the ignore patterns before being added:

if p.suffix.lower() in OFFICE_EXTENSIONS:
    md_path = convert_office_file(p, converted_dir, root=root)
    if md_path:
        if _is_ignored(md_path, root, ignore_patterns, _cache=ignore_cache):
            continue          # <-- sidecar silently dropped
        files[ftype].append(str(md_path))

The sidecar lives inside graphify-out/converted/, and graphify-out/ matches the gitignore patterns that detect() honors — so the sidecar is always considered ignored and dropped. Anyone who follows the standard setup (gitignore the index artifact) hits this: office conversion becomes a silent no-op.

Steps to reproduce

  1. Repo with graphify-out/ in .gitignore and any book.xlsx in the tree.
  2. pip install "graphifyy[office]"
  3. Run detection (e.g. the /graphify . pipeline or graphify.detect.detect(Path('.'))).
  4. Observe: graphify-out/converted/book_<hash>.md exists, but the file is absent from files['document'], total_files unchanged, no entry in skipped_sensitive.

Expected

Converted sidecars are tool-generated artifacts and should be exempt from the ignore check (the original office file already passed it). Options:

  • skip _is_ignored for paths under graphify-out/converted/, or
  • run the ignore check against the original office file path instead of the sidecar path, or
  • at minimum, append a note to skipped_sensitive so the drop is visible instead of silent.

Workaround we used

Feed the sidecar text to the extraction step manually and set source_file to the original .xlsx path — works, but has to be redone on every re-extraction.

jj954081-dotcom avatar Jul 25 '26 16:07 jj954081-dotcom

Confirmed the same root cause on a different platform/extension — leaving a corroborating repro in case it's useful for prioritization.

Environment: graphifyy 0.9.50, Python 3.14, native Linux (WSL2/Ubuntu), .docx (not .xlsx) Setup: standard create-next-app-style .gitignore with /graphify-out/ (exactly the pattern graphify's own generated .gitignore entry recommends), 3 .docx files in one directory (docs/legal/).

Traced convert_office_file directly and confirmed all 3 conversions succeed and land on disk in graphify-out/converted/, but all 3 are silently absent from detect()'s returned files['document'] — not just one, all of them, every time, deterministically. skipped_sensitive is empty, unclassified is empty, pruned_noise_dirs is empty. The docs directory itself is walked fine (confirmed via os.walk trace); it's specifically the post-conversion _ignored_for_scan(md_path) check against the sidecar's own path (now living under the gitignored graphify-out/) that drops the continue silently, exactly as diagnosed in the issue body.

Scoping detect() to the subdirectory containing the .docx files directly (e.g. detect(Path('docs')) instead of the repo root) "fixes" it as a side effect — only because the ancestor .gitignore at the true repo root (which is what actually contains the /graphify-out/ rule) is then out of the loaded ignore chain. That's a good clue for anyone else chasing this: it isn't file-count- or extension-specific, it's purely about whether an ignored-graphify-out/ rule is in scope for the scan root being used.

+1 on the fix suggestion to skip _ignored_for_scan for paths already known to be tool-generated sidecars under <out_base>/graphify-out/converted/ — checking the original source file's ignore status (already done earlier in the loop) should be sufficient, and re-checking the derived sidecar path is the actual bug.

Cowen-se avatar Aug 27 '26 10:08 Cowen-se

Already fixed on current v8, via #3504.

graphify/detect.py's office-conversion branch explicitly exempts sidecars under converted_dir from the gitignore check now (the same fix also covers the analogous Google Workspace sidecar case, per the inline comment referencing this issue). A .xlsx/.docx sidecar written into graphify-out/converted/ is picked up even when graphify-out/ itself is gitignored.

ayushcodes10 avatar Sep 16 '26 09:09 ayushcodes10

This looks fixed on the v8 branch by 600e4e74 (Exempt Office/Workspace sidecars from the ignore check). Could a maintainer confirm and close?

omsenjalia avatar Oct 18 '26 09:10 omsenjalia