feat: graph-based targeted test selection for health checker (#1451) - #1455
Closed
colehurwitz wants to merge 1 commit into
Closed
colehurwitz wants to merge 1 commit into
colehurwitz wants to merge 1 commit into
Conversation
…t#1451) Add reverse-import BFS over graph.json to select only tests affected by changed files, reducing health-check gate time from 8-10 min to 1-3 min for focused changes. Falls back to full suite on any ambiguity (stale graph, conftest changes, unknown files, >80% fan-out). - factory/graph.py: find_dependent_tests() with conservative None fallback - factory/eval/languages/python.py: optional test_paths parameter - factory/eval/runner.py + cli: --targeted flag with structlog auditing - factory/agents/prompts/health_checker.md: use factory eval --targeted - 21 new tests covering BFS, fan-out, triggers, and path threading Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
Duplicate of #1454 — closing this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
find_dependent_tests()tofactory/graph.py— reverse-import BFS over the existinggraph.jsonto compute which test files are transitively affected by changed source filestest_pathsparameter throughPythonEvaluator→compute_hygiene_results()→run_eval()so pytest runs only the affected subsetfactory eval --targetedCLI flag that computes changed files, resolves dependencies via the graph, and falls back to full suite when selection cannot be trusted--targetedby defaultSafety design
find_dependent_tests()returnsNone(not empty set) on any ambiguity → callers always fall back to full suiteconftest.py,__init__.py,pyproject.toml, CI filescheck_qa_execution()is unaffected (checks event presence, not pytest scope)Files changed
factory/graph.py— newfind_dependent_tests()(122 lines)factory/eval/languages/python.py—test_pathsparam onrun_tests_with_coverage()/run_tests()factory/eval/hygiene.py— threadtest_pathsthrough hygiene pipelinefactory/eval/runner.py— threadtest_pathsthroughrun_eval()factory/cli/eval_cmds.py—--targetedflag +_compute_targeted_test_paths()factory/cli/_parser_groups.py— argparse flag registrationfactory/agents/prompts/health_checker.md— one-line prompt updatetests/test_targeted_tests.py— 21 tests covering all critical pathsTest plan
Closes #1451
🤖 Generated with Claude Code
https://claude.ai/code/session_01YYiei7JyDnjMrt2Dg6jkJu