Skip to content

incompatible_config_setting_private_default_visibility #12933

Open

Description

@gregestren

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.

Activity

  1. added
    P2We'll consider working on this in future. (Assignee optional)
    team-Configurabilityplatforms, toolchains, cquery, select(), config transitions
    on Jan 29, 2021
  2. self-assigned this
    on Jan 29, 2021
  3. changed the title [-]Incompatible change: --incompatible_config_setting_public_default_visibility[/-] [+]Incompatible change: --incompatible_config_setting_private_default_visibility[/+] on Jan 29, 2021
  4. added
    migration-readyIncompatible flag is ready for migration with Bazel rolling releases or Bazel@last_green
    on Sep 14, 2022
  5. meteorcloudy commented on Sep 14, 2022

    @meteorcloudy
    Member

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

  6. gregestren commented on Sep 14, 2022

    @gregestren
    ContributorAuthor

    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.

  7. changed the title [-]Incompatible change: --incompatible_config_setting_private_default_visibility[/-] [+]incompatible_config_setting_private_default_visibility[/+] on Sep 15, 2022
  8. 51 remaining items

  9. removed this from the 6.0.0 nice to have milestone on Jan 4, 2023
  10. self-assigned this
    on Jan 30, 2023
  11. gregestren commented on Feb 1, 2023

    @gregestren
    ContributorAuthor

    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?

  12. keertk commented on Feb 1, 2023

    @keertk
    Member

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

  13. added 2 commits that reference this issue on Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2We'll consider working on this in future. (Assignee optional)incompatible-changeIncompatible/breaking changemigration-readyIncompatible flag is ready for migration with Bazel rolling releases or Bazel@last_greenteam-Configurabilityplatforms, toolchains, cquery, select(), config transitionstype: process

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions