Solver fails with Config/Needs/... indirect dependency configuration

Open
#351 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
r
Domain
devtools

Research direction

Reproduce the failure with the supplied deps_3 example, starting at new_pkg_installation_proposal(), solve(), and get_solution(). Trace how the solver handles the indirect config/needs/bar dependency and the value that triggers the coercion error; done means the example completes without the error and returns a valid solution.

Written by the indexing model from the issue text.

Description

documentation feature
library(pkgdepends)

deps_1 <- c("config/needs/foo", pkg_dep_types_hard())
deps_2 <- list(
    direct = c("config/needs/foo", pkg_dep_types_hard()),
    indirect = pkg_dep_types()
)
deps_3 <- list(
    direct = c("config/needs/foo", pkg_dep_types_hard()),
    indirect = c("config/needs/bar", pkg_dep_types()) # <- here!
)

foo <- function(deps) {
    ip <- new_pkg_installation_proposal("r-lib/rlang", config = list(dependencies = deps))
    ip$solve()
    ip$get_solution()
}

foo(deps_1) # OK
#> ℹ Loading metadata database
#> ✔ Loading metadata database ... done
#> 
#> <pkg_solution>
#> + result: OK
#> + refs:
#>   - r-lib/rlang
#> + constraints (2):
#>   - select rlang exactly once
#>   - `r-lib/rlang` is not satisfied by `installed::/Users/ruckip/Library/R/arm64/4.3/library/rlang`
#> + solution:
#>   - r-lib/rlang
foo(deps_2) # OK
#> <pkg_solution>
#> + result: OK
#> + refs:
#>   - r-lib/rlang
#> + constraints (27915):
#>   - `rnaturalearthhires` resolution failed
#>   - `starsdata` resolution failed
#>   - `cmdstanr` resolution failed
#>   - `glmmADMB` resolution failed
#>   - `ffbase` resolution failed
#>   - `spDataLarge` resolution failed
#>   - `mnlogit` resolution failed
#>   - `Zelig` resolution failed
#>   - `ergm.userterms` resolution failed
#>   - `corpus.useR.2008.abstracts` resolution failed
#>   ...
#> + solution:
#>   - r-lib/rlang
foo(deps_3) # FAIL
#> Error in value$ref %in% private$state$ref && !value$direct: 'length = 18' in coercion to 'logical(1)'

Created on 2024-01-04 with reprex v2.0.2

Dominant language
C
Stars
135
Forks
47
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/pkgdepends

All issues in r-lib/pkgdepends

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.