Skip to content

Reduce visibility & Introduce visibility check#641

Draft
castler wants to merge 2 commits into
mainfrom
js_reduce_visibility
Draft

Reduce visibility & Introduce visibility check#641
castler wants to merge 2 commits into
mainfrom
js_reduce_visibility

Conversation

@castler

@castler castler commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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

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>
Remove //visibility:public from targets that shall have no external
consumers, replacing with appropriate scoped visibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant