Fix `visible` query operator for Macro-Aware Visibility
@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.
@bazel-io fork 8.0.0
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.
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.