Skip non-matching platform binaries during resolve#43
Merged
Conversation
Yangmoooo
approved these changes
Mar 23, 2026
There was a problem hiding this comment.
Pull request overview
This PR updates platform-aware binary resolution so that binaries whose platform-specific names don’t match the current platform are skipped during PkgDef::resolve, preventing incorrect fallback lookups (notably for Linux codex installs).
Changes:
- Adjust
PkgDef::resolveto skip non-matching platform-mapped binary names rather than falling back to the package name. - Rename/update a unit test to assert that non-matching platform entries are skipped.
- Update the
codexTOML deserialization + resolution test expectations (Linux keeps only the Linux payload).
Comments suppressed due to low confidence (1)
src/package.rs:129
b.nameis moved by value in thematch, which partially movesband makes the later access tob.linkillegal (this should fail to compile). Borrowb.name(e.g.,match &b.name) or destructureBinDef { name, link }up-front so both fields can be used while still allowingresolve_for_platform()returningNoneto skip the binary.
// Resolve name from PlatformAwareString; if it doesn't match the current
// platform, skip this binary instead of falling back to the package name.
let raw_name = match b.name {
Some(s) => s.resolve_for_platform(),
None => Some(pkg_name.to_string()),
}?;
let name = normalize_name(raw_name);
// Resolve link from PlatformAwareString, defaulting to the resolved name
let raw_link =
b.link.as_ref().and_then(|s| s.resolve_for_platform()).unwrap_or_else(|| name.clone());
let link = normalize_name(raw_link);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -701,6 +700,7 @@ repo = "example/codex" | |||
| { | |||
| assert_eq!(resolved.bin.len(), 3); | |||
There was a problem hiding this comment.
The Windows-only assertions contain a duplicate assert_eq!(resolved.bin.len(), 3); (it appears twice), which is redundant and adds noise to the test. Remove one of them (and keep the one that best matches the comment) to make failures clearer.
Suggested change
| assert_eq!(resolved.bin.len(), 3); |
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.
Which issue does this PR resolve?
Linux installs for codex failed because the resolver fell back to the package name when platform-specific binaries didn’t match, leading to searches for a non-existent
codexbinary inside the Linux archive.Description of this PR
PkgDef::resolvenow drops binaries whose platform-specific names don’t match the current platform instead of falling back to the package name, preventing phantom lookups on Linux codex archives.Example: