Skip to content

Fix visibility for implicit deps of parent rules#28627

Closed
fmeum wants to merge 1 commit intobazelbuild:masterfrom
fmeum:28618-extension-implicit-dep
Closed

Fix visibility for implicit deps of parent rules#28627
fmeum wants to merge 1 commit intobazelbuild:masterfrom
fmeum:28618-extension-implicit-dep

Conversation

@fmeum
Copy link
Collaborator

@fmeum fmeum commented Feb 11, 2026

The visibility of a default value of an implicit dep in an extended rule should be checked relative to the definition of the rule that introduced it, which may not be the child rule.

Fixes #28618

@fmeum fmeum marked this pull request as ready for review February 11, 2026 08:14
@fmeum fmeum requested a review from a team as a code owner February 11, 2026 08:14
@fmeum fmeum requested review from dabanki and gregestren and removed request for a team February 11, 2026 08:14
@github-actions github-actions bot added team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels Feb 11, 2026
@fmeum fmeum requested review from brandjon and removed request for dabanki February 11, 2026 08:14
@fmeum
Copy link
Collaborator Author

fmeum commented Feb 11, 2026

@bazel-io fork 8.6.0

@fmeum
Copy link
Collaborator Author

fmeum commented Feb 11, 2026

@bazel-io fork 9.0.1

@fmeum
Copy link
Collaborator Author

fmeum commented Feb 11, 2026

@bazel-io fork 9.1.0

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes a bug in visibility checking for implicit dependencies in extended Starlark rules. The change correctly identifies the original rule that introduced an attribute by traversing the inheritance hierarchy. This ensures that the visibility of a default value for an implicit dependency is checked against the package where it was defined, not where it was inherited. The implementation is clean and is accompanied by a thorough test case that validates the fix. The changes look good.

The visibility of a default value of an implicit dep in an extended rule should be checked relative to the definition of the rule that introduced it, which may not be the child rule.
Copy link
Member

@brandjon brandjon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware people were actually using rule inheritance. The docstring lists it as experimental, though it's not flag guarded...

In any case, the PR looks ok.

@Wyverald Wyverald added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Feb 11, 2026
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Feb 17, 2026
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Feb 17, 2026
The visibility of a default value of an implicit dep in an extended rule should be checked relative to the definition of the rule that introduced it, which may not be the child rule.

Fixes bazelbuild#28618

Closes bazelbuild#28627.

PiperOrigin-RevId: 871303947
Change-Id: I0027e277dc9f01396fa4674297d2a73e1e9d257e
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Feb 17, 2026
The visibility of a default value of an implicit dep in an extended rule should be checked relative to the definition of the rule that introduced it, which may not be the child rule.

Fixes bazelbuild#28618

Closes bazelbuild#28627.

PiperOrigin-RevId: 871303947
Change-Id: I0027e277dc9f01396fa4674297d2a73e1e9d257e
github-merge-queue bot pushed a commit that referenced this pull request Feb 17, 2026
…8688)

The visibility of a default value of an implicit dep in an extended rule
should be checked relative to the definition of the rule that introduced
it, which may not be the child rule.

Fixes #28618

Closes #28627.

PiperOrigin-RevId: 871303947
Change-Id: I0027e277dc9f01396fa4674297d2a73e1e9d257e

Commit
a16489f

Co-authored-by: Fabian Meumertzheim <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Feb 18, 2026
…8687)

The visibility of a default value of an implicit dep in an extended rule
should be checked relative to the definition of the rule that introduced
it, which may not be the child rule.

Fixes #28618

Closes #28627.

PiperOrigin-RevId: 871303947
Change-Id: I0027e277dc9f01396fa4674297d2a73e1e9d257e

Commit
a16489f

Co-authored-by: Fabian Meumertzheim <[email protected]>
@brentleyjones
Copy link
Contributor

iancha1992 pushed a commit to iancha1992/bazel that referenced this pull request Feb 19, 2026
The visibility of a default value of an implicit dep in an extended rule should be checked relative to the definition of the rule that introduced it, which may not be the child rule.

Fixes bazelbuild#28618

Closes bazelbuild#28627.

PiperOrigin-RevId: 871303947
Change-Id: I0027e277dc9f01396fa4674297d2a73e1e9d257e
github-merge-queue bot pushed a commit that referenced this pull request Feb 19, 2026
…hub.com/… (#28722)

…/pull/28627)

The visibility of a default value of an implicit dep in an extended rule
should be checked relative to the definition of the rule that introduced
it, which may not be the child rule.

Fixes #28618

Closes #28627.

PiperOrigin-RevId: 871303947
Change-Id: I0027e277dc9f01396fa4674297d2a73e1e9d257e

<!--
Thank you for contributing to Bazel!
Please read the contribution guidelines:
https://bazel.build/contribute.html
-->

### Description
<!--
Please provide a brief summary of the changes in this PR.
-->

### Motivation
<!--
Why is this change important? Does it fix a specific bug or add a new
feature?
If this PR fixes an existing issue, please link it here (e.g. "Fixes
#1234").
-->

### Build API Changes
<!--
Does this PR affect the Build API? (e.g. Starlark API, providers,
command-line flags, native rules)
If yes, please answer the following:
1. Has this been discussed in a design doc or issue? (Please link it)
2. Is the change backward compatible?
3. If it's a breaking change, what is the migration plan?
-->

No

### Checklist

- [ ] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

### Release Notes

<!--
If this is a new feature, please add 'RELNOTES[NEW]: <description>'
here.
If this is a breaking change, please add 'RELNOTES[INC]: <reason>' here.
If this change should be mentioned in release notes, please add
'RELNOTES: <reason>' here.
-->

RELNOTES: None

Commit
a16489f

---------

Co-authored-by: Fabian Meumertzheim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Configurability platforms, toolchains, cquery, select(), config transitions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visibility of labels used in attributes of parent rule are checked against rule extension package

4 participants