aspect-build / aspect-build/rules_lint
[Bug]: aspect lint CLI doesn't work with `bytestream:` files
- Dominant language
- Starlark
- Stars
- 154
- Forks
- 125
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 20
Description
### What happened?
When running `aspect lint //...` with a remote cache, it fails with
```
Error: × Traceback (most recent call last):
│ File , in
│ * /home/tacascer/Projects/bazel-repo/lint.axl:52, in impl
│ report = ctx.std.fs.read_to_string(filepath)
│ error: No such file or directory (os error 2)
│ --> /home/tacascer/Projects/bazel-repo/lint.axl:52:30
│ |
│ 52 | report = ctx.std.fs.read_to_string(filepath)
│ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│ |
```
### Version
Development (host) and target OS/architectures: x86 Linux / x86 Linux
Output of `bazel --version`: 9.0.0
Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file: 2.0.0
Language(s) and/or frameworks involved: Any
### How to reproduce
```shell
1. git clone git@github.com:bazel-starters/java.git
2. follow https://github.com/bazel-starters/java/blob/main/README.md#try-it-out
3. Set up a build cache (I use buildbuddy here)
# Put in .bazelrc
common --bes_results_url=https://app.buildbuddy.io/invocation/
common --bes_backend=grpcs://remote.buildbuddy.io
common --remote_cache=grpcs://remote.buildbuddy.io
4. aspect lint //...
```
### Any other information?
I debugged/ fixed this by applying
```
--- a/lint.axl (upstream from aspect-build/rules_lint)
+++ b/lint.axl (local version with debug output)
@@ -42,6 +42,13 @@ def impl(ctx: TaskContext) -> int:
if event.kind == "named_set_of_files":
for file in event.payload.files:
filepath = file.file.removeprefix("file://")
+ # Add debug output to show which file is being processed
+ ctx.std.io.stderr.write("Processing lint file: " + filepath + "\n")
+
+ # Skip remote bytestream files that can't be read locally
+ if filepath.startswith("bytestream://"):
+ ctx.std.io.stderr.write("Skipping remote file (not downloaded locally): " + filepath + "\n")
+ continue
+
if file.name.endswith(".out"):
generated = ctx.std.fs.read_to_string(filepath)
ctx.std.io.stderr.write(generated)
```
Contributor guide
Research direction
Start with lint.axl, especially the named_set_of_files handling, and reproduce with aspect lint //... using the remote-cache settings shown. Trace how bytestream:// paths reach the file-reading logic. Done means the command completes without missing-file errors while still reporting locally readable lint output.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100