brain_ask.py is the retrieval path — the module the project is actually about — and it has zero tests. tests/test_index_notes.py covers the indexer only.
Two functions in it are pure and testable without a model download, a GPU, or a vault:
brain_ask.py:51 — looks_like_entity(q) — decides whether a query looks like a named entity, which is what switches the graph expansion on. Wrong here means graph hops happen on queries that should stay vector-only, or the reverse.
brain_ask.py:80 — _links_in(path) — parses [[wikilinks]] out of a markdown file. This is the whole graph: if it mis-parses, the edges are wrong and every downstream hop is wrong.
What "done" looks like
tests/test_brain_ask.py with table-driven cases for both. For _links_in, use tmp_path and write small markdown files — no fixtures directory needed. Worth covering explicitly, because these are the cases that bite in a real vault:
- a link with an alias,
[[note|display text]]
- a link with a heading anchor,
[[note#section]]
- a wikilink inside a fenced code block, which should not count as an edge
- a line with two links on it
- a file with no links at all
For looks_like_entity, include at least one case in a non-Latin script — the vault this was extracted from is largely Cyrillic, and that is exactly where entity heuristics quietly fall over.
Ground rules
Write the test so it fails against the current behaviour if you believe the current behaviour is wrong, and say so in the PR rather than adjusting the test to match. If a case is genuinely ambiguous (should an aliased link count once or twice?), open the question in the PR — that is a design answer, and it is fine for the test to be the place it gets decided.
Comment "claiming this" and it is yours.
brain_ask.pyis the retrieval path — the module the project is actually about — and it has zero tests.tests/test_index_notes.pycovers the indexer only.Two functions in it are pure and testable without a model download, a GPU, or a vault:
brain_ask.py:51—looks_like_entity(q)— decides whether a query looks like a named entity, which is what switches the graph expansion on. Wrong here means graph hops happen on queries that should stay vector-only, or the reverse.brain_ask.py:80—_links_in(path)— parses[[wikilinks]]out of a markdown file. This is the whole graph: if it mis-parses, the edges are wrong and every downstream hop is wrong.What "done" looks like
tests/test_brain_ask.pywith table-driven cases for both. For_links_in, usetmp_pathand write small markdown files — no fixtures directory needed. Worth covering explicitly, because these are the cases that bite in a real vault:[[note|display text]][[note#section]]For
looks_like_entity, include at least one case in a non-Latin script — the vault this was extracted from is largely Cyrillic, and that is exactly where entity heuristics quietly fall over.Ground rules
Write the test so it fails against the current behaviour if you believe the current behaviour is wrong, and say so in the PR rather than adjusting the test to match. If a case is genuinely ambiguous (should an aliased link count once or twice?), open the question in the PR — that is a design answer, and it is fine for the test to be the place it gets decided.
Comment "claiming this" and it is yours.