Skip to content

No tests for brain_ask.py: cover looks_like_entity() and _links_in() #4

Description

@tonydzi

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:51looks_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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedWe want this and it is free to take - comment 'claiming this'good first issueaccepted + small and self-contained - start here

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions