aspect-build / aspect-build/aspect-cli

[Bug]: aspect test --coverage fails when ctx.bazel.info() drops common flags

Open
#1,328 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Starlark
Stars
165
Forks
45
Avg merge
1d 47m
Merged PRs (30d)
35

Description

## What happened?

In a workspace that requires a `common` flag from `.bazelrc` to evaluate `MODULE.bazel`, `aspect test --coverage --coverage-report=...` successfully runs the test and generates Bazel's combined LCOV report, but then exits with status 1 and does not copy the requested report.

The minimal reproduction uses:

```text
common --experimental_isolated_extension_usages
```

and `use_extension(..., isolate = True)`.

The coverage path calls `ctx.bazel.info()` after the test to find `output_path`. That invocation preserves the resolved startup flags, including `--ignore_all_rc_files`, but does not replay the resolved common/command flags. It therefore behaves like:

```shell
bazel --ignore_all_rc_files info
```

and fails while loading `MODULE.bazel`:

```text
parameter 'isolate' is experimental and thus unavailable with the current flags.
```

I expected Aspect to exit successfully and copy Bazel's combined report to `coverage-report.lcov`, using the same effective Bazel configuration as the preceding test invocation.

Minimal reproduction:
https://github.com/tacascer/aspect-cli-coverage-info-repro/tree/34d2eb2ed843045afb0cacc8da3782bc5b44a1ae

## Version

Development (host) and target OS/architectures: Linux x86_64

Output of `bazel --version`: `bazel 9.2.0`

Aspect CLI version: `2026.28.13`

Language(s) and/or frameworks involved: Starlark/Bzlmod only; no external modules or language toolchains

## How to reproduce

```shell
git clone https://github.com/tacascer/aspect-cli-coverage-info-repro.git
cd aspect-cli-coverage-info-repro
git checkout 34d2eb2ed843045afb0cacc8da3782bc5b44a1ae

# Control: exits 0 and creates Bazel's combined report.
bazel coverage --combined_report=lcov //:passing_test
test -f bazel-out/_coverage/_coverage_report.dat

# Reproduction: the test passes, but Aspect exits 1 and does not copy the report.
aspect test --coverage \
--coverage-report=coverage-report.lcov \
//:passing_test

# Reproduces the underlying post-test info failure.
bazel --ignore_all_rc_files info
```

The generated LCOV report is empty because the dependency-free test has no instrumented source files. That is expected; the bug is the failing post-test `bazel info` invocation and missing copied report.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the provided aspect test --coverage command and the minimal repository, then locate the coverage path's ctx.bazel.info() invocation. The fix is done when the invocation uses the effective Bazel configuration, exits successfully, and copies the combined report to coverage-report.lcov.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.