Commit 729b5c9
Fix crash on git dependencies: key "path" not found (#90)
## Problem
`_generate_hub_and_spokes` crashes with `key "path" not found in
dictionary` when a workspace member has git dependencies in Cargo.toml:
```toml
[dependencies]
ruff_python_parser = { git = "https://github.com/astral-sh/ruff.git", tag = "0.15.10" }
```
The crash is at `extensions.bzl:1028`:
```starlark
bazel_target = "//" + paths.join(workspace_package, _normalize_path(dep["path"]).removeprefix(repo_root + "/"))
```
Git deps don't have a `path` field — only path deps (workspace members)
do.
## Fix
Check for `dep.get("path")` before accessing it. Git/registry deps
without a `bazel_target` are resolved elsewhere as external crate repos,
so we skip them in the path-dep resolution path.
## Testing
Tested with a real-world workspace (ppl-ai/agi) that has a crate
depending on `ruff_python_parser` via git. Before: `bazel mod tidy`
crashes. After: builds successfully.
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 43adac4 commit 729b5c9
6 files changed
Lines changed: 35 additions & 1 deletion
File tree
- rs
- test
- workspace_git_dep
- app
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1025 | 1025 | | |
1026 | 1026 | | |
1027 | 1027 | | |
1028 | | - | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
1029 | 1034 | | |
1030 | 1035 | | |
1031 | 1036 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments