-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[build] File-level test target indexing for precise affected test detection #17033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
PR TypeEnhancement, Bug fix Description
|
| Relevant files | |||
|---|---|---|---|
| Enhancement |
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the Bazel test target indexing to operate at the file level instead of the package level, enabling more precise affected test detection. The change addresses an issue where any Python file change would trigger all Python tests.
Changes:
- Implements file-level indexing that maps individual source files to test targets
- Adds high-impact directory detection to trigger all tests for changes in
common/,rust/src/,javascript/atoms/, andjavascript/webdriver/atoms/ - Improves fallback mechanism for unindexed files (e.g., newly added files) by querying Bazel to find containing targets and their dependent tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
c0fd7cf to
192a52a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
e43e353 to
31155fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Existing implementation is good for Java, and ok for Ruby, but bad for Python
Even after #17012, the current indexing would still run all python tests for any Python change
This PR will be good for Python and improve things for Ruby as well
💥 What does this PR do?
Refactors the Bazel test target indexing in
rake_tasks/bazel.raketo work at the file level instead of the package level.This enables more precise affected test detection when files change.
Key changes:
common/,rust/src/,javascript/atoms/,javascript/webdriver/atoms/trigger all tests//:*deps and srcs to avoid indexing generated files (node_modules, LICENSE, etc.)The new approach:
deps(test) intersect //... except attr(testonly, 1, //...)labels(srcs, dep)(cached)source_file → [test_targets]For files not in the index (new files in PRs), the fallback:
attr(srcs, 'filename', //pkg:*)rdeps(//..., containing_target)🔧 Implementation Notes
This is more queries during index building but results in a much more precise index for lookups.
Dependency source lookups are cached since many tests share the same dependencies (e.g.,
//py:common,//py:remote), so each dep is only queried once.💡 Additional Considerations
HIGH_IMPACT_DIRSif we need🔄 Types of changes