GrooveSeek

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

View the Project on GitHub alphabet-h/grooveseek

23. Index only the names the server can open, and ask one predicate for all of them

Context and problem

Which names reach the index and which names can be read back were decided by different code. The index walk (collect_source_files_under in grooveseek/src/indexer.rs) and the live watcher (should_process_parts in grooveseek/src/watcher.rs) looked at exclusion rules, extensions and links, never at the name. The read side — kb://doc/ URIs and the lexical check get_document runs before it touches the disk — asked is_safe_relative in grooveseek/src/resources.rs, which on Windows refused a colon and a reserved device name.

On Windows the verbatim \\?\ prefix, which a canonical knowledge-base path carries, lets files exist under names Win32 will not open as written: CON.md, or anything under a directory called dir.. The walk indexed them; search found them; no URI was offered for them and get_document refused them (AW-43). The same gap ran the other way for spellings that Win32 rewrites: b.md. and dir./x.md passed the lexical check and were only refused after a look at the disk (AW-42), and a/b?.md came back as “unavailable” rather than “not found” (AW-40).

Three review rounds on #319 each found another instance on this one axis. The question this record answers is where the rule for “a name the index can hold” lives, so the next instance is a change to one function rather than a fourth patch.

Decision drivers

Options considered

  1. Index such names and make them readable — open them through the verbatim prefix, and give them URIs. Rejected: every consumer of the path (gateways filtering on the requested string, clients, the URI parser) would have to learn that CON.md and b.md. are names on this server and not elsewhere, and get_document’s one-spelling rule would need an exception for names Win32 itself rewrites.
  2. Keep the current split and document it. Rejected: it is the state that produced three findings in a row, and the next one would be the same patch.
  3. One predicate, asked everywhere; leave such names out of the index.

Decision

Chosen option: 3.

Consequences

References