Skip to content

perf: Cache or narrow TestSuiteGate test discovery (avoid full rglob per verify) #153

@omsherikar

Description

@omsherikar

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions