Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incompatible_config_setting_private_default_visibility #12933

Open
gregestren opened this issue Jan 29, 2021 · 19 comments
Open

incompatible_config_setting_private_default_visibility #12933

gregestren opened this issue Jan 29, 2021 · 19 comments
Assignees
Labels
breaking-change-7.0 Incompatible flags to be flipped in Bazel 7.0 incompatible-change Incompatible/breaking change migration-ready Incompatible flag is ready for migration with Bazel rolling releases or Bazel@last_green P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: process

Comments

@gregestren
Copy link
Contributor

gregestren commented Jan 29, 2021

Visibility on config_setting isn't historically enforced. This is purely for legacy reasons. There's no philosophical reason to distinguish them.

This flag, in conjunction with --incompatible_enforce_config_setting_visibility (#12932), removes that distinction.

Values:

  • --incompatible_config_setting_private_default_visibility=off: if --incompatible_enforce_config_setting_visibility=off, every config_setting is visible to every target, regardless of visibility settings. Else, every config_setting without an explicit visibility setting is //visibility:public (ignoring package visibility defaults)
  • --incompatible_config_setting_private_default_visibility=on: if --incompatible_enforce_config_setting_visibility=off, every config_setting is visible to every target, regardless of visibility settings. Else, config_setting follows the same visibility rules as all other targets.

Incompatibility error:

ERROR: myapp/BUILD:4:1: in config_setting rule //myapp:my_config: target 'myapp:my_config' is not visible from target '//some:other_target. Check the visibility declaration of the former target if you think the dependency is legitimate

Migration:

Treat all config_settings as if they follow standard visibility logic at https://docs.bazel.build/versions/master/visibility.html: have them set visibility explicitly if they'll be used anywhere outside their own package. The ultimate goal of this migration is to fully enforce that expectation.

@gregestren gregestren added incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions labels Jan 29, 2021
@gregestren gregestren self-assigned this Jan 29, 2021
@gregestren gregestren changed the title Incompatible change: --incompatible_config_setting_public_default_visibility Incompatible change: --incompatible_config_setting_private_default_visibility Jan 29, 2021
bazel-io pushed a commit that referenced this issue Feb 1, 2021
This was rolled back in 36d228b
 because of depot breakages.

This version adds incompatible flags to safely introduce enforcement.
See #12932 and
#12933 for flag settings.

*** Original change description ***

Roll back #12877.

***

Fixes #12669.

RELNOTES: enforce config_setting visibility. See #12932 for details.
PiperOrigin-RevId: 354930807
gregestren added a commit to gregestren/bazel that referenced this issue Jul 16, 2021
This was rolled back in bazelbuild@36d228b
 because of depot breakages.

This version adds incompatible flags to safely introduce enforcement.
See bazelbuild#12932 and
bazelbuild#12933 for flag settings.

*** Original change description ***

Roll back bazelbuild#12877.

***

Fixes bazelbuild#12669.

RELNOTES: enforce config_setting visibility. See bazelbuild#12932 for details.
PiperOrigin-RevId: 354930807
katre pushed a commit that referenced this issue Jul 19, 2021
This was rolled back in 36d228b
 because of depot breakages.

This version adds incompatible flags to safely introduce enforcement.
See #12932 and
#12933 for flag settings.

*** Original change description ***

Roll back #12877.

***

Fixes #12669.

RELNOTES: enforce config_setting visibility. See #12932 for details.
PiperOrigin-RevId: 354930807
@meteorcloudy meteorcloudy added the migration-ready Incompatible flag is ready for migration with Bazel rolling releases or Bazel@last_green label Sep 14, 2022
@meteorcloudy
Copy link
Member

I assume this flag is migration ready? Should we flip it before 6.0 cut?

@gregestren
Copy link
Contributor Author

gregestren commented Sep 14, 2022

What was the risk calculation for flipping? I can't guarantee repos won't break. If that's okay, I support pushing this forward.

More specifically, if we're not worried about initial breakages, I'd flip both this and #12932. If we want to be more careful I'd just flip #12932. If we don't want any change of any breakages I wouldn't flip.

I'm hoping the answer is "flip both and adjust whatever breakages we see."

The reason this isn't trivial is repos can already set visibility on config_setting. So if a repo has config_setting, visibility = '//visibility:private'), today it's actually public and may be depended on by targets in other packages. If we flip these flags then suddenly we give that declaration meaning and, while technically correct, existing dependencies may no longer be valid.

So it's definitely a strict improvement but we have to get mislabeled repo code fixed up for it to finally stick.

@meteorcloudy meteorcloudy changed the title Incompatible change: --incompatible_config_setting_private_default_visibility incompatible_config_setting_private_default_visibility Sep 15, 2022
@meteorcloudy
Copy link
Member

meteorcloudy commented Sep 15, 2022

I'm hoping the answer is "flip both and adjust whatever breakages we see."

We should do it in the reverse order to make sure downstream is green, otherwise we'll lose the ability to catch other CI breakages.

I recently updated our incompatible change process: https://bazel.build/contribute/breaking-changes#update-repos

With the incompatible flags pipeline, we can detect those breakages before flipping the flag, check this doc

I just added the "migration-ready" label for both flag, fixed the issue name and triggered a rerun, you can see the result here https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/1256

@meteorcloudy
Copy link
Member

image

The result looks good. You can ignore the rules_nodejs failure. But except that,

--incompatible_config_setting_private_default_visibility didn't break any downstream project, so you can flip it.

--incompatible_enforce_config_setting_visibility is breaking Envoy and TensorFlow, if you can file issue or send PR to fix them before flipping the flag, it will be great!

@gregestren
Copy link
Contributor Author

Great! What's my deadline for fixing Envoy and TensorFlow and flipping --incompatible_enforce_config_setting_visibility? That's the more important one to set first.

@meteorcloudy
Copy link
Member

6.0 is currently scheduled to be cut on Sep 26, see #16159

But there are still many release blockers, see https://github.com/bazelbuild/bazel/issues?q=is%3Aopen+is%3Aissue+milestone%3A%226.0.0+release+blockers%22, and it's likely the cut day will be postponed again.

We can add the milestone to both tracking issues, so we won't forget ;)

@meteorcloudy meteorcloudy added this to the 6.0.0 release blockers milestone Sep 16, 2022
@meteorcloudy meteorcloudy added P1 I'll work on this now. (Assignee required) and removed P2 We'll consider working on this in future. (Assignee optional) labels Sep 20, 2022
@meteorcloudy
Copy link
Member

Bumping to P1 since it's blocking 6.0 release

@meteorcloudy meteorcloudy added the breaking-change-6.0 Incompatible flags to be flipped in Bazel 6.0 label Sep 22, 2022
@lberki lberki added P2 We'll consider working on this in future. (Assignee optional) and removed P1 I'll work on this now. (Assignee required) labels Oct 4, 2022
@keertk
Copy link
Member

keertk commented Nov 23, 2022

For tracking:
cc @meteorcloudy

Failures: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/1341

image

To fix:

@meteorcloudy meteorcloudy removed the breaking-change-6.0 Incompatible flags to be flipped in Bazel 6.0 label Dec 2, 2022
copybara-service bot pushed a commit to google/tsl that referenced this issue Dec 13, 2022
…bazelrc to prevent regression

Imported from GitHub PR tensorflow/tensorflow#58832

Related: bazelbuild/bazel#12932 and bazelbuild/bazel#12933
Copybara import of the project:

--
b4edfd47bd9a0c0363a9feb1eb1b48d067e4644e by Yun Peng <[email protected]>:

Flip two incompatible flags in .bazelrc to prevent regression

--
c33c0dd6e5744393fe2b1909efc91dc19bd6dda1 by Yun Peng <[email protected]>:

Add visibility to more targets

--
34d1bfe1564f0905993c26a891f2385b83480e3d by Yun Peng <[email protected]>:

--incompatible_config_setting_private_default_visibility cannot be flipped yet

Merging this change closes #58832

PiperOrigin-RevId: 494895621
copybara-service bot pushed a commit to openxla/xla that referenced this issue Dec 13, 2022
…bazelrc to prevent regression

Imported from GitHub PR tensorflow/tensorflow#58832

Related: bazelbuild/bazel#12932 and bazelbuild/bazel#12933
Copybara import of the project:

--
b4edfd47bd9a0c0363a9feb1eb1b48d067e4644e by Yun Peng <[email protected]>:

Flip two incompatible flags in .bazelrc to prevent regression

--
c33c0dd6e5744393fe2b1909efc91dc19bd6dda1 by Yun Peng <[email protected]>:

Add visibility to more targets

--
34d1bfe1564f0905993c26a891f2385b83480e3d by Yun Peng <[email protected]>:

--incompatible_config_setting_private_default_visibility cannot be flipped yet

Merging this change closes #58832

PiperOrigin-RevId: 494895621
@meteorcloudy meteorcloudy removed this from the 6.0.0 nice to have milestone Jan 4, 2023
@keertk keertk self-assigned this Jan 30, 2023
@gregestren
Copy link
Contributor Author

Thanks for recent updates, @keertk . I'm excited to see you making this 7.0 compatible. Is there an appropriate 7.0 Github label for this issue? Or does migration-ready already cover it?

@keertk keertk added the breaking-change-7.0 Incompatible flags to be flipped in Bazel 7.0 label Feb 1, 2023
@keertk
Copy link
Member

keertk commented Feb 1, 2023

Hey @gregestren, just created/added breaking-change-7.0. Thanks!

lripoche pushed a commit to lripoche/bazel that referenced this issue Jun 13, 2023
…g_private_default_visibility to true

This was rolled back in bazelbuild@d4fc6db
due to failing Bazel downstream tests. I fixed as many as I was aware of: see latest comments on bazelbuild#12933.

Fixes bazelbuild#12933.

PiperOrigin-RevId: 485694298
Change-Id: Ie38ce2f6cdbf952a208de37a96658770004b2bf8
lripoche pushed a commit to lripoche/bazel that referenced this issue Jun 13, 2023
*** Reason for rollback ***

Incompatible pipeline still showing failures: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/1320

Need to investigate why some fixes @Head seem not to work.

*** Original change description ***

Roll forward bazelbuild@1fdc628: default --incompatible_config_setting_private_default_visibility to true

This was rolled back in bazelbuild@d4fc6db
due to failing Bazel downstream tests. I fixed as many as I was aware of: see latest comments on bazelbuild#12933.

Fixes bazelbuild#12933.

PiperOrigin-RevId: 485901094
Change-Id: Ifed7424c482d4feda76811838209e3e10607471b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change-7.0 Incompatible flags to be flipped in Bazel 7.0 incompatible-change Incompatible/breaking change migration-ready Incompatible flag is ready for migration with Bazel rolling releases or Bazel@last_green P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: process
Projects
None yet
Development

No branches or pull requests

6 participants