Skip to content

fix(tests): freshness tests read the store the indexer actually uses - #126

Open
ManSio wants to merge 1 commit into
mainfrom
fix/freshness-slow-tests
Open

ManSio wants to merge 1 commit into
mainfrom
fix/freshness-slow-tests

Conversation

@ManSio

@ManSio ManSio commented Nov 13, 2026

Copy link
Copy Markdown
Owner

What changed

tests/test_freshness_checker.py — 5 красных тестов, которые не видел ни один гейт.

Симптом. На main (a6524d6, 801621d) файл даёт 5 failed, 2 passed, но помечен
pytestmark = pytest.mark.slow и в дефолтный прогон не попадает.

Корень. Тесты читали indexer.table (LanceDB), а дефолтное хранилище — SQLite:
src/core/indexing/indexer.py:146-154 создаёт SQLiteChunkStore, когда
SearchConfig.sqlite_chunks (src/config/settings.py) истинно (по умолчанию true).
Запись шла в SQLite, таблица LanceDB оставалась пустой → set() в
assert "b.py" in set(df["file_path"]) и 0 == 1 в проверке схемы.
Это не регресс Цели 1/2: те же 5 падают на до-мержевом main a6524d6.

Fix (только тесты, код не менялся).

  • _file_rows(indexer, columns) читает слой, который реально использует индексатор;
    для SQLite агрегирует чанки по file_path (одна строка на файл).
  • test_store_is_the_default_one пиннит дефолт (sqlite) — при смене бэкенда падает.
  • Снят slow-маркер: файл занимает 4.2 s и обязан быть в гейте.

Доказательства

до фикса:  pytest tests/test_freshness_checker.py -m "not benchmark"  -> 5 failed, 2 passed
после:     pytest tests/test_freshness_checker.py -q                  -> 8 passed, 4.22 s
мутация:   verify_index_freshness() -> return 0                        -> 4 failed, 4 passed (код восстановлен)
ruff check src/ tests/                                                 -> All checks passed
полный гейт: pytest tests/ -q -n auto                                  -> 2518 passed, 11 skipped, 0 failed (102.68 s)

Планка: было 2507 passed (без этого файла) → стало 2518 passed, 0 failed;
slow-тесты больше не прячутся.

Documentation = code

AGENT_DIARY.md — запись со ссылками на src/core/indexing/indexer.py:146-154,
src/config/settings.py::SearchConfig.sqlite_chunks, src/core/indexing/chunk_store.py::all_records.

Risks

  • Тест test_concurrent_verify_parallel остаётся многопоточным (он был в наборе и раньше,
    просто не запускался). Прогон файла 3× подряд: 8 passed каждый (3.15 / 3.12 / 3.16 s).

@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1e5f1a0-003a-470e-bace-4e6e86a9ab89

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant