graphify icon indicating copy to clipboard operation
graphify copied to clipboard

Office files (.docx/.xlsx): modified sources never re-enter --update (sidecar keyed on path hash, source content never checked)

Open Ns2384-star opened this issue 4 months ago • 1 comments

Version: graphifyy 0.9.5 (Windows 11, docs-heavy corpus: ~6800 nodes, 76% documents, ~800 files incl. many .docx/.xlsx)

Problem

A .docx/.xlsx that is modified after its first conversion never re-enters an --update.

  • convert_office_file (detect.py:604) names the sidecar {stem}_{sha256(NFC path)[:8]}.md — a hash of the path, not the content — and early-returns if the sidecar already exists (detect.py:636) without ever looking at the source file.
  • detect_incremental (detect.py:1389+) compares mtime/hash of the sidecar, never of the Office source.

Repro

  1. Convert a .docx (first extract) → sidecar created.
  2. Edit the .docx.
  3. Run detect_incremental → file reported "unchanged"; the stale sidecar is what gets (not) re-extracted. Forever.

On our corpus this forces a manual pre-update pass that purges stale sidecars by comparing source.st_mtime > sidecar.st_mtime — workable, but any user with a living Office corpus silently gets a frozen graph otherwise.

Proposal

Store the md5 of the SOURCE file in the sidecar (header comment) or in the manifest entry, and re-convert when it differs. Minimal alternative: regenerate the sidecar when source.st_mtime > sidecar.st_mtime.

Related (closed, different angles): #1226 (NFC/NFD duplicate sidecars), #861 (.graphifyignore bypass for sidecars).

Ns2384-star avatar Jul 04 '26 16:07 Ns2384-star

Fixed in f917494 (on v8, ships in 0.9.7). Thanks — your root-cause trace (sidecar keyed on path hash, source content never checked) was exactly right.

convert_office_file now re-converts when the source is newer than its sidecar, which bumps the sidecar's mtime/content so detect_incremental's hash check picks it up and re-extracts. An unchanged source still skips the rewrite so it never churns (#1226). Went with the mtime comparison (your minimal alternative) rather than storing the source md5 in a header — it's simpler and the sidecar-mtime bump is enough for the incremental path to notice. Your manual purge pass shouldn't be needed anymore.

safishamsi avatar Jul 04 '26 21:07 safishamsi