bazelbuild / bazelbuild/bazel-watcher

ibazel failing to restart JS application with heavy external dependencies

Open
#825 9 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
513
Forks
143
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Hey folks! I'm evaluating the use of `ibazel` with our monorepo and stumbled onto a relatively nasty bug where ibazel would fail to restart my relatively large JS application.

**Reproduction instructions**

https://github.com/markovejnovic/ibazel-js-repro

```bash
git clone https://github.com/markovejnovic/ibazel-js-repro.git
cd ibazel-js-repro
ibazel run //:dev
# wait until it prints 'hello world'
# edit src/main.ts to print a different string
# note ibazel doesn't catch it
```

**Expected behavior**

Ibazel restarts my target after a source file changes.

**Actual behavior**

Ibazel doesn't restart my target.

**Version (please complete the following information):**
- OS: macOS
- ibazel Version: iBazel - Version 0.29.0, present on `HEAD`
- Bazel version: 9.1.0

**Additional context**

I think the bug is in `ibazel.go:650`. When `labelsToWatch` filters for labels that should be watched, it has special handling for `localRepositories`. `aspect`'s external targets start with `@` and are referenced as `localRepositories`, which means that we hit the `break` in `ibazel.go:650`.

To be 100% honest, I don't really understand the intent behind this function and this was discovered by getting claude to sprinkle debug statements across the program, so I might be wrong in my guess, but changing the `break` to a `continue` does populate the `toWatch` list as I would expect.

Contributor guide

Open the contributing guide

Research direction

Clone the linked ibazel-js-repro repository and run `ibazel run //:dev`, then edit `src/main.ts` to reproduce the missed restart. Read `ibazel.go:650` and the surrounding `labelsToWatch` handling, including `localRepositories`. Done means ibazel detects the source change and restarts the target with the external dependencies present.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.