GrooveSeek

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

View the Project on GitHub alphabet-h/grooveseek

32. Report why each file was not indexed; the count is derived from the list

Context and problem

A desktop front end for groove wants to show its user which files the index could not read and why, so the user can decide whether to ignore a file or act on it (remove a password, raise a limit, save it again under another name). The user is not a developer and does not see stderr.

Until now the library could not answer that:

Decision drivers

Options considered

  1. Where the list lives. (a) IndexResult only. (b) A new ProgressEvent::Skipped only: the desktop would rebuild the list from events itself, and MCP has no events, so the library would need the list anyway. (c) Both: (b) means rewriting the one-file-one-event order of ProgressEvent, including what a file read twice in one run (a crossed rename read again) reports, with nothing needing it now. (a) taken.
  2. How the count is kept. Keep adding to and subtracting from skipped at each write point and push to and pop from the list beside it, or write only the list during the run and derive skipped from it once at the end. The first is the shape that lets the two drift apart silently. The second taken.
  3. How a parser reports why. Replace the anyhow errors with a new error type (changes every message path), carry an English detail string in the reason (no longer Copy, its size follows the parser’s message, and the plain-language text belongs to the front end), or carry a typed mark inside the anyhow::Error whose Display is the old message. The mark taken. A nested reason (ParseFailed { why }) was rejected: a front end maps each variant to a sentence, and nesting only adds a level to map.
  4. Hard links and names the index cannot hold. Leave skipped as it was and add a second count and list (left_out) beside it, or count them in skipped. The first makes the invariant “list == skipped + left_out” and has every consumer add the two. Counting them in skipped taken (decided by the project owner): they were already inside the published definition and had been missed, so this corrects the count rather than changing what the field means.
  5. A directory left out for its name. List it only when it holds a file the index would have read, or list it once whatever it holds. The first means walking the subtree the walk never enters, at a cost that grows with its contents, and deciding again how links and names inside it are treated. Once, marked as a directory, taken.
  6. The MCP reply. No cap (unbounded), counts per reason (the desktop uses the library and a model reading the reply is served by the first entries), a nested reason object (one level deeper, with no key collision to avoid). The first N entries, flat keys and the number left out, taken.
  7. #[non_exhaustive] on each struct variant. Code outside the crate could then not build those variants, so a front end could not unit-test its mapping without running an index. Rejected; the enum as a whole is #[non_exhaustive].
  8. Returning the list outside IndexResult. It would change the type every caller of rebuild_index receives and split the invariant across two values. Rejected; IndexResult derives Clone instead, which the ..struct updates in three existing tests needed once it held a Vec.

Decision

Consequences

References