bazelbuild / bazelbuild/bazel

aspect_hints set on a native alias are invisible to aspects

Open
#31,071 1 comment 0 reactions 0 assignees View on GitHub
team-Rules-API type: bug untriaged
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

`aspect_hints` set directly on a `native.alias()` target are silently ignored by aspects. Aliases are transparent to aspect propagation — when an aspect is applied to a target and traverses through an `alias`, it is evaluated against the `actual`
target, not the alias itself. As a result, the alias's own attributes (including `aspect_hints`) are never visited by the aspect, and any `aspect_hints` set on the alias have no effect.

This is confusing because:
- Bazel accepts `aspect_hints` on an `alias` target without any warning or error.
- There is no documentation stating that `aspect_hints` on an `alias` are ineffective.
- The silent failure mode makes this very hard to debug — hints appear to be configured correctly, but the aspect implementation never sees them.

### Which category does this issue belong to?

_No response_

### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Repository with a minimal example: https://github.com/Fil-Den/bazel_native_alias_aspect_hint_bug_example#aspect_hints-set-on-a-native-alias-are-invisible-to-aspects

### Which operating system are you running Bazel on?

MacOS

### What is the output of `bazel info release`?

release 9.2.0

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse HEAD` ?

```text

```

### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by cloning the linked minimal repository and running its reproduction for aspect_hints on a native.alias() target. Trace Bazel's aspect traversal through the alias and compare the observed behavior with the issue description; done means the alias hint behavior is addressed and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.