Skip to content

Keep the higher version floor when two branches of a GitHub package are requested - #253

Merged
eliotmcintire merged 1 commit into
developmentfrom
fix/preferGHrefDedup-branchSpecs
Dec 4, 2026
Merged

eliotmcintire merged 1 commit into
developmentfrom
fix/preferGHrefDedup-branchSpecs

Conversation

@eliotmcintire

Copy link
Copy Markdown
Contributor

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 for mpbutils (>= 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, before trimRedundancies(), which picks between branches by version, could see it. It runs on the user's raw list in step 4 of pakDepsToPkgDT() (user_pkgFN), so the module listed first won. Every GitHub ref with a version spec is now kept.

New case in the .preferGHrefDedup() test in test-15bugfixes_testthat.R: both refs survive, and trimRedundancies() then keeps acct/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-24 and test-29 pass.

🤖 Generated with Claude Code

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>
@eliotmcintire eliotmcintire added the bug Something isn't working label Dec 4, 2026
@eliotmcintire
eliotmcintire merged commit 4107540 into development Dec 4, 2026
21 checks passed
@eliotmcintire
eliotmcintire deleted the fix/preferGHrefDedup-branchSpecs branch December 4, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant