Reduce visibility & Introduce visibility check#641
Draft
castler wants to merge 2 commits into
Draft
Conversation
Add a hermetic golden-file test that tracks all Bazel targets with `//visibility:public`. The test parses BUILD files directly (no Bazel-in-Bazel) and fails with a unified diff when the set of public targets changes unexpectedly. Components: - parser.py: extracts public targets handling both explicit visibility and package(default_visibility) inheritance - visibility_guard_test.py: py_test comparing current state to golden - generate_golden.py: py_binary to regenerate when changes are intended - public_targets.golden: checked-in baseline (108 public targets) Usage: bazel test //quality/visibility_guard:visibility_guard_test bazel run //quality/visibility_guard:generate_golden Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
82b37ad to
41b53fc
Compare
Remove //visibility:public from targets that shall have no external consumers, replacing with appropriate scoped visibility.
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.
The first step for a clear public API is, what Bazel targets user can depend on.
Thus we clean this in the first step, and ensure that this will not be changed by accident anymore