bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Fix `visible` query operator for Macro-Aware Visibility

Open brandjon opened this issue 1 year ago • 3 comments

@bazel-io flag 8.0.0 This is likely something we can cherrypick into 8.0 in October.


The visible operator for bazel query commands has a separate implementation from Bazel's actual visibility check done in the analysis phase. We have not yet updated that implementation to take into account the new Macro-Aware Visibility model. The consequence is that visible(...) may return incorrect results for consuming targets created inside symbolic macros.

brandjon avatar Oct 03 '24 03:10 brandjon

@bazel-io fork 8.0.0

brandjon avatar Oct 15 '24 18:10 brandjon

It's infeasible to fix this in time for Bazel 8.0. It requires not just an update to the visible() query function's implementation, but also a change to the QueryVisibility machinery in order to consider the attributes in the target's declaring macro chain.

brandjon avatar Oct 29 '24 14:10 brandjon

This also has value for IDE integrations. macros that do not pass along visibility are implementation details should not be advertised in code action.

e.g. The Copy X | Build X | Run X | ... code lens in BazelBuild.vscode-bazel.

Silic0nS0ldier avatar Dec 02 '25 23:12 Silic0nS0ldier