[9.2.0] Gate external-repo source dir package boundary checks behind a flag (https://github.com/bazelbuild/bazel/pull/30019)#30040
Merged
Conversation
…a flag (#30019) This PR gates that new enforcement behind `--incompatible_check_external_repo_source_dir_package_boundary` (default off). When the flag is off, package boundary crossings by source directories in external repositories are skipped entirely rather than reverting to the old main-repo lookup. As a result, #29688 stays fixed regardless of the flag value. #29688 (comment) Yes: adds the command-line flag `--incompatible_check_external_repo_source_dir_package_boundary`. 1. Has this been discussed in a design doc or issue? N/A 2. Is the change backward compatible? Yes. The flag defaults to off, preserving the pre-#29692 (9.1.x) behavior for source directories in external repositories. 3. If it's a breaking change, what is the migration plan? Enabling the flag (eventually flipping the default to on in a future major release) restores the strict, repo-aware enforcement. - [x] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). RELNOTES: Source directories in external repositories are temporarily allowed to cross package boundaries. This will be disallowed in the future, gated by the new `--incompatible_check_external_repo_source_dir_package_boundary` flag. Closes #30019. PiperOrigin-RevId: 938703055 Change-Id: I5bf779d6ea0c10579564d77fc9eb0adf6aaacd03 (original commit 3ad37ef)
iancha1992
approved these changes
Jun 26, 2026
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.
Description
#29692 made the package-boundary check for source directories in
RecursiveFilesystemTraversalFunctionrepo-aware. Besides fixing the false positives reported in #29688, it also made the check effective for source directories in external repos, which is a breaking change.This PR gates that new enforcement behind
--incompatible_check_external_repo_source_dir_package_boundary(default off).When the flag is off, package boundary crossings by source directories in external repositories are skipped entirely rather than reverting to the old main-repo lookup. As a result, #29688 stays fixed regardless of the flag value.
Motivation
#29688 (comment)
Build API Changes
Yes: adds the command-line flag
--incompatible_check_external_repo_source_dir_package_boundary.Checklist
Release Notes
RELNOTES: Source directories in external repositories are temporarily allowed to cross package boundaries. This will be disallowed in the future, gated by the new
--incompatible_check_external_repo_source_dir_package_boundaryflag.Closes #30019.
PiperOrigin-RevId: 938703055
Change-Id: I5bf779d6ea0c10579564d77fc9eb0adf6aaacd03
(original commit 3ad37ef)