Skip to content

Ensure lockfile is invalid if repo not present in config anymore #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

Keats
Copy link
Collaborator

@Keats Keats commented Apr 2, 2025

Closes #112

@dpastoor
Copy link
Member

dpastoor commented Apr 4, 2025

@wes-a2ai could you add an e2e test for this for us to formally test before we merge this

@wes-a2ai
Copy link
Contributor

wes-a2ai commented Apr 7, 2025

I think I'm struggling to understand what/how this PR is trying to address #112 and how to test. Even when I'm just running manually and changing my repository snapshot dates, I am still getting the packages are being sourced from the original repository.

Original config:

[project]
name = "simple"
r_version = "4.4"
repositories = [ {alias = "posit", url = "https://packagemanager.posit.co/cran/2024-12-16/"} ]
dependencies = [ "dplyr", ]

Results (expected):

$ cargo run --features=cli -- -c example_projects/simple/rproject.toml sync
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10s
     Running `target/debug/rv -c example_projects/simple/rproject.toml sync`
+ cli (3.6.3, binary from https://packagemanager.posit.co/cran/2024-12-16) in 1ms
+ dplyr (1.1.4, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ fansi (1.0.6, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ generics (0.1.3, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ glue (1.8.0, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ lifecycle (1.0.4, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ magrittr (2.0.3, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ pillar (1.9.0, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ pkgconfig (2.0.3, binary from https://packagemanager.posit.co/cran/2024-12-16) in 1ms
+ R6 (2.5.1, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ rlang (1.1.4, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ tibble (3.2.1, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ tidyselect (1.2.1, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ utf8 (1.2.4, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ vctrs (0.6.5, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ withr (3.0.2, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms

Remove library:

$ rm -rf example_projects/simple/rv

Changed config:

[project]
name = "simple"
r_version = "4.4"
repositories = [ {alias = "posit", url = "https://packagemanager.posit.co/cran/2024-12-18/"} ]
dependencies = [ "dplyr", ]

Results:

$ cargo run --features=cli -- -c example_projects/simple/rproject.toml sync
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/rv -c example_projects/simple/rproject.toml sync`
+ cli (3.6.3, binary from https://packagemanager.posit.co/cran/2024-12-16) in 1ms
+ dplyr (1.1.4, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ fansi (1.0.6, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ generics (0.1.3, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ glue (1.8.0, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ lifecycle (1.0.4, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ magrittr (2.0.3, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ pillar (1.9.0, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ pkgconfig (2.0.3, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ R6 (2.5.1, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ rlang (1.1.4, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ tibble (3.2.1, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ tidyselect (1.2.1, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ utf8 (1.2.4, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ vctrs (0.6.5, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms
+ withr (3.0.2, binary from https://packagemanager.posit.co/cran/2024-12-16) in 0ms

@Keats Keats force-pushed the invalidate-missing-repo branch 2 times, most recently from 84cc812 to 9f83b3c Compare April 14, 2025 10:48
@Keats
Copy link
Collaborator Author

Keats commented Apr 14, 2025

I forgot to invalidate the deps in the resolution as well, that should work now

@Keats Keats force-pushed the invalidate-missing-repo branch from 9f83b3c to ccd45ab Compare April 14, 2025 12:51
@Keats Keats force-pushed the invalidate-missing-repo branch from ccd45ab to ec3f98c Compare April 14, 2025 13:01
@wes-a2ai
Copy link
Contributor

wes-a2ai commented Apr 15, 2025

config

[project]
name = "rv-test"
r_version = "4.4"

# any CRAN-type repository, order matters. Additional ability to force source package installation
# Example: {alias = "CRAN", url = "https://cran.r-project.org", force_source = true}
repositories = [
    {alias = "repo1", url = "https://a2-ai.github.io/rv-test-repo/repo1"},
    {alias = "RSPM", url = "https://packagemanager.posit.co/cran/2025-04-12"},
]

# package to install and any specifications. Any descriptive dependency can have the `install_suggestions` specification
# Examples:
    # "dplyr",
    # {name = "dplyr", repository = "CRAN", force_source = true},
    # {name = "dplyr", git = "https://github.com/tidyverse/dplyr.git", tag = "v1.1.4"},
    # {name = "dplyr", path = "/path/to/local/dplyr"},
dependencies = [
    "rv.git.pkgA",
    "R6",
]
$ rv sync
+ rv.git.pkgA (0.0.5, source from https://a2-ai.github.io/rv-test-repo/repo1) in 2891ms
+ R6 (2.6.1, binary from https://packagemanager.posit.co/cran/2025-04-12) in 14ms
$ vim rproject.toml # replaced repo1 with repo2
$ rv sync
- rv.git.pkgA
+ rv.git.pkgA (0.0.4, source from https://a2-ai.github.io/rv-test-repo/repo2) in 1ms

@wes-a2ai wes-a2ai merged commit d9a52d4 into main Apr 15, 2025
6 checks passed
@wes-a2ai wes-a2ai deleted the invalidate-missing-repo branch April 15, 2025 16:48
wes-a2ai added a commit that referenced this pull request Apr 17, 2025
Keats added a commit that referenced this pull request May 1, 2025
* Check whether to load databases after sync mode check

Closes #205

* replace `from_lockfile` in resolution if upgrading. Still need to test

* database loading + adjusting resolved deps

* Remove extra test element from .gitignore

* upgrade project example updated from #196

* addressing PR comments by simplifying matching fxn and creating new resolved vector

* format + address PR comments

---------

Co-authored-by: wes-a2ai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rv plan doesn't consult new repos if repos change but deps don't...maybe? or other?
3 participants