GrooveSeek

Semantic search over a Markdown knowledge base, served over MCP.

View the Project on GitHub alphabet-h/grooveseek

28. Re-read unchanged docx once and settle each row

Context and problem

ADR-0027 changed how a .docx is split, but an index answers “unchanged” for a file whose content hash still matches before the parser runs, so a .docx nobody edits keeps the chunks the previous rule cut for as long as the index exists. --force repairs that, but the desktop application never passes it, and its users never see stderr.

The question is how an existing index catches up once — every unchanged .docx, on the first ordinary run — without re-embedding the documents that already split correctly, and without a document that cannot be read holding the catch-up open for every other one.

Decision drivers

Options considered

  1. When is the catch-up done.
    • When every .docx was read, as the frontmatter check of #251 is. Rejected: one .docx that cannot be read (over a size cap, or failing to parse) keeps it open, and then every run re-reads every .docx; the desktop has neither --force nor stderr to get out of that.
    • A column on each document row saying which rule split it. Exact, but a schema change with a migration, a column every write path has to fill — including the ones that skip unchanged work — and a record of its own.
    • Settle each row in the run: rewritten, re-read and found to match, dropped, or marked with a content hash no file hashes to, so the fast path cannot keep it. Taken. It needs no schema change, and its cost is one read per run for each .docx that cannot be read yet.
  2. The marker. A key of its own, index_meta.docx_heading_policy, beside frontmatter_policy (#251) rather than shared with it: the two passes cover different files, do different work and finish under different conditions, and sharing would make either one’s unfinished state hold the other open.

Decision

Consequences

References