feat(core,logging): attach location/dependency where wasm_pkg_core::wit::resolve_dependencies failed#179
Merged
lann merged 12 commits intobytecodealliance:mainfrom Jan 7, 2026
Conversation
clippy cleand up logging typos ./crates --write-changes
a8e8464 to
f5126b1
Compare
lann
reviewed
Jan 6, 2026
Collaborator
lann
left a comment
There was a problem hiding this comment.
Mostly looks good. Some style and error message suggestions.
crates/wasm-pkg-common/src/config.rs
Outdated
| return Some(reg); | ||
| } | ||
|
|
||
| self.fallback_namespace_registries.get(package.namespace()) |
Collaborator
There was a problem hiding this comment.
Not a huge problem but the previous if/else if/else structure seems like more typical rust code.
Member
Author
There was a problem hiding this comment.
I can revert the style, I had a hard time understanding the else if let Some(_) chains because they all did things slightly differently and it made it tricky to reason about without a consistent corollary.
Only after I broke it down did I realize it was really the same lookup for two different fields.
Member
Author
There was a problem hiding this comment.
For code golf's sake the function could be rewritten as this:
pub fn resolve_registry(&self, package: &PackageRef) -> Option<&Registry> {
let namespace = package.namespace();
// look in `self.package_registry_overrides `
// then in `self.namespace_registries`
self.package_registry_overrides
.get(package)
.or_else(|| self.namespace_registries.get(namespace))
.map(|pkg| pkg.registry())
.or(self.default_registry.as_ref())
.or_else(|| self.fallback_namespace_registries.get(namespace))
}EDIT: I went with a simpler (hopefully more rusty) approach.
Co-authored-by: Lann <github-lann@lannbox.com>
Co-authored-by: Lann <github-lann@lannbox.com>
Co-authored-by: Lann <github-lann@lannbox.com>
Co-authored-by: Lann <github-lann@lannbox.com>
Co-authored-by: Lann <github-lann@lannbox.com>
mkatychev
commented
Jan 6, 2026
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
wkg wit buildcurrently returns an unhelpful report when path resolution fails duringresolve_dependencies:In the case above,
pkg3was the cause of the failure with logging failing to show it.Changes
Displayimpl forDependencyresolve_dependenciesnow attaches paths/dependencies to the relevantanyhow::Error:cargo clippy --fixtypos ./crates --write-changes