Scope
refactron/verification/checks/test_gate.py — _find_relevant_tests
Problem
Each verify() call runs search_root.rglob("*.py"), then for every candidate test file reads and parses the full source to see if it imports the module. On large projects this is O(number of Python files × number of autofix verifications).
Suggested direction
- Prefer conventional test roots (
tests/, test/) when present; exclude .venv, node_modules, etc.
- Optional: cache a mapping
module_stem → set[Path] on the gate instance or engine keyed by project_root mtime / file list hash; invalidate when project layout changes.
- Optional: static reverse import index built once per run.
Acceptance
- Verification latency scales with relevant tests, not entire repo size, on representative layouts.
Scope
refactron/verification/checks/test_gate.py—_find_relevant_testsProblem
Each
verify()call runssearch_root.rglob("*.py"), then for every candidate test file reads and parses the full source to see if it imports the module. On large projects this is O(number of Python files × number of autofix verifications).Suggested direction
tests/,test/) when present; exclude.venv,node_modules, etc.module_stem → set[Path]on the gate instance or engine keyed byproject_rootmtime / file list hash; invalidate when project layout changes.Acceptance