Repository navigation
Keep the higher version floor when two branches of a GitHub package are requested - #253
Merged
Merged
Conversation
For a package with several GitHub refs it kept the first, and dropped refs on other branches even when they carried a higher version floor, before trimRedundancies() could compare them. Every GitHub ref with a version spec is now kept, and trimRedundancies() picks between branches by version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
When two modules ask for the same GitHub package on different branches with different minimum versions, Require kept whichever came first and ignored the other. In the MPB project, one module needs
mpbutils@development (>= 0.1.3.9003), four others ask formpbutils (>= 0.1.2), and the installed 0.1.3.9002 was never upgraded, so a run stopped with an error.Affects: the higher minimum version is now installed, from the branch that asked for it.
Technical details
.preferGHrefDedup()(R/pak.R:3150-3157) keeps the first GitHub ref per package, plus copies of that same ref that add a version spec. A ref on another branch was dropped even with a higher floor, beforetrimRedundancies(), which picks between branches by version, could see it. It runs on the user's raw list in step 4 ofpakDepsToPkgDT()(user_pkgFN), so the module listed first won. Every GitHub ref with a version spec is now kept.New case in the
.preferGHrefDedup()test intest-15bugfixes_testthat.R: both refs survive, andtrimRedundancies()then keepsacct/pkg@dev (>= 0.1.3.9003). It failed before the fix. End to end,Require(c("PredictiveEcology/mpbutils (>= 0.1.2)", "PredictiveEcology/mpbutils@development (>= 0.1.3.9003)"))with 0.1.3.9002 installed said "No packages to install/update"; it now installs 0.1.3.9003.test-15,test-22,test-24andtest-29pass.🤖 Generated with Claude Code