search_text returns text from a file that was withdrawn from the index (its full-text row survives as an anchor of a superseded generation) #592

Open
opened 2026-11-15 21:49:10 +01:00 by buildagent · 0 comments
Member

What happens

search_text can return lines from a file that is no longer indexed. When a file leaves the index through a configuration change (an added extra_ignores entry in the reproduction), the reconcile withdraws its live contribution, but its full-text row stays as an anchor of the superseded generation, kept for rollback. search_text joins the full-text table to files without requiring a contribution in the live generation, so the withdrawn file's text is still found.

Evidence

Found by lane K1 of the v0.42 train while testing "no stale answer after a configuration repair" (config_session_e2e::repaired_configuration_applies_new_ignore_before_serving, no-daemon leg). After the repaired configuration with the new ignore was reconciled, read-only inspection of the index showed: the full-text row of marker.txt still present; its only contribution in generation 1 (superseded); generation 2 active. search_text for the marker returned the file.

The daemon leg of the same test passes; the difference between the two legs is not explained yet.

Not checked: whether v0.41.53 behaves the same (the query has no live-contribution predicate there either, by reading), and whether other readers of files (list_files, read_code by path, index_coverage, file counts in project_overview) have the same gap. A registry test (every_daemon_row_read_is_generation_gated) exists for row reads and did not catch this path.

Acceptance

  • A file without a contribution in the live generation is not returned by search_text, on both the daemon and the no-daemon path; the test above is green on both legs.
  • Every other reader that joins files is audited for the same predicate, and the registry that gates generation-aware reads covers the full-text path.
  • The added predicate does not turn a text search into a scan: per-statement cost before and after on a corpus repository.
  • A rollback to the superseded generation still finds the text (the anchor is kept for that).
## What happens `search_text` can return lines from a file that is no longer indexed. When a file leaves the index through a configuration change (an added `extra_ignores` entry in the reproduction), the reconcile withdraws its live contribution, but its full-text row stays as an anchor of the superseded generation, kept for rollback. `search_text` joins the full-text table to `files` without requiring a contribution in the live generation, so the withdrawn file's text is still found. ## Evidence Found by lane K1 of the v0.42 train while testing "no stale answer after a configuration repair" (`config_session_e2e::repaired_configuration_applies_new_ignore_before_serving`, no-daemon leg). After the repaired configuration with the new ignore was reconciled, read-only inspection of the index showed: the full-text row of `marker.txt` still present; its only contribution in generation 1 (superseded); generation 2 active. `search_text` for the marker returned the file. The daemon leg of the same test passes; the difference between the two legs is not explained yet. Not checked: whether v0.41.53 behaves the same (the query has no live-contribution predicate there either, by reading), and whether other readers of `files` (`list_files`, `read_code` by path, `index_coverage`, file counts in `project_overview`) have the same gap. A registry test (`every_daemon_row_read_is_generation_gated`) exists for row reads and did not catch this path. ## Acceptance - A file without a contribution in the live generation is not returned by `search_text`, on both the daemon and the no-daemon path; the test above is green on both legs. - Every other reader that joins `files` is audited for the same predicate, and the registry that gates generation-aware reads covers the full-text path. - The added predicate does not turn a text search into a scan: per-statement cost before and after on a corpus repository. - A rollback to the superseded generation still finds the text (the anchor is kept for that).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
h-dv/code-index#592
No description provided.