bazelbuild / bazelbuild/bazel

`rdeps` behavior differs between standard and skyquery when `--notool_deps` is set

Open
#15,977 5 comments 0 reactions 0 assignees View on GitHub
P2 team-Core 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:

When querying for the `rdeps` of a file that is part of a tool with `--notool_deps`, the tool is returned even though it is outside of the `rdeps` scope (but not outside of the universe scope), only with skyquery.

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

Using this project: [rdepsrepro.zip](https://github.com/bazelbuild/bazel/files/9184591/rdepsrepro.zip)

```
$ USE_BAZEL_VERSION=rolling bazelisk query 'rdeps(//src/..., set(tools/main.c))'
INFO: Empty results
$ USE_BAZEL_VERSION=rolling bazelisk query --config=repro 'rdeps(//src/..., set(tools/main.c))'
//tools:main.c
//tools:tool
```

(flags are set in the `.bazelrc`)

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

macOS

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

release 6.0.0-pre.20220706.4 (also repros with the latest release)

### 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 master; git rev-parse HEAD` ?

_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 unpacking rdepsrepro.zip, checking the .bazelrc flags, and running the two provided bazel query commands with and without --config=repro. Trace the standard and SkyQuery handling of rdeps with --notool_deps; done means both modes exclude //tools:tool and otherwise agree on the rdeps scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.