fix: handle missing 'path' key in dependency resolution#70
Closed
rejuvenile wants to merge 1 commit intohermeticbuild:mainfrom
Closed
fix: handle missing 'path' key in dependency resolution#70rejuvenile wants to merge 1 commit intohermeticbuild:mainfrom
rejuvenile wants to merge 1 commit intohermeticbuild:mainfrom
Conversation
Registry deps in workspace package dependency lists may lack a `path` key — they only have `source`. The extension assumed all deps without a bazel_target have a path, causing KeyError when processing workspace packages that include registry dependencies. Skip these deps since they're handled via the crate hub.
Member
|
@rejuvenile I'm not sure I understand the scenario you hit, could you possibly add an e2e smoke test to |
Contributor
|
#90 fixes the same thing with test I believe |
Member
|
@rejuvenile please let us know if you're still seeing issues after Long's fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Registry deps in workspace package dependency lists may lack a
pathkey — they only havesource. The extension code in_generate_hub_and_spokesassumed all deps without abazel_targethave apath, causingKeyErrorwhen processing workspace packages that include registry dependencies.Problem
When a workspace
Cargo.tomlhas dependencies on both local path crates and registry crates (from crates.io),cargo metadataoutput for the workspace package includes both types in itsdependencieslist. Registry deps only havesource(e.g.,registry+https://github.com/rust-lang/crates.io-index) but nopathkey. The current code does:This crashes with
KeyErroron registry deps becausedep["path"]doesn't exist.Fix
Check for the
pathkey withdep.get("path")before using it. If the dep has no path, skip it withcontinuesince registry crates are already handled via the crate hub mechanism.Changes
rs/extensions.bzl: Guard against missingpathkey in workspace package dependency iteration