Skip to content

fix: restore renv lockfiles from their own repositories - #58

Merged
novica merged 3 commits into
mainfrom
fix--renv-repos
Nov 1, 2026
Merged

novica merged 3 commits into
mainfrom
fix--renv-repos

Conversation

@novica

@novica novica commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

The Dockerfile set RENV_CONFIG_REPOS_OVERRIDE to the Posit Package Manager CRAN URL, so renv::restore() ignored every repository in the lockfile. Packages from r-universe, Bioconductor or an internal CRAN-like repo failed to restore. The image also had no git, which renv needs for packages from a git remote.

  • The PPM URL is defined once, as ENV R_REPO, and used by the base install, install_deps_line() and the restore.
  • The restore reads the lockfile's repositories and replaces only CRAN and PPM CRAN repositories (.../cran/... on packagemanager.posit.co or p3m.dev) with R_REPO, so they still install RHEL 9 binaries; other repositories are kept. A lockfile with no CRAN entry gets R_REPO as CRAN.
  • git is installed only when the lockfile has a package from a git remote (Source: git, or RemoteType git, xgit or git2r, which renv treats as git).
  • renv added to Suggests, for the test that mocks renv::restore().

Related GitHub Issues and PRs

Are these changes tested?

Yes. New tests run the generated restore code with renv::restore() mocked and check the repositories it gets: CRAN replaced and r-universe kept; a PPM entry for another OS (jammy) replaced; a PPM Bioconductor entry kept; R_REPO added when there is no CRAN entry. lockfile_has_git() is tested for each git form. The Docker image test (R2LAMBDA_TEST_DOCKER=true) was not run; it builds an image from a pinned renv.lock and is worth running before merge.

Are there any user-facing changes?

Yes. renv lockfiles with non-CRAN repositories or git remotes now restore.

Was AI used for this PR?

In accordance with the AI generation guidelines, please disclose whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Checklist

  • I understand and agree to the Code of Conduct.
  • The PR title follows Conventional Commits (fix:, feat:, docs:, ...); it becomes the NEWS.md entry.
  • I have run air format . and jarl check ..
  • I have updated roxygen comments and run devtools::document() if documentation changed.
  • I have added testthat unit tests to tests/testthat for any new functionality or fixed bug.

Assisted-by: Claude Code

A global repos override made renv ignore the lockfile's repositories, so
packages from r-universe or internal repos failed to restore.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Also keep non-CRAN Posit Package Manager repositories, such as Bioconductor.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
renv restores those with git too.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@novica
novica merged commit 2d9b944 into main Nov 1, 2026
8 checks passed
@novica
novica deleted the fix--renv-repos branch November 1, 2026 19:05
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.

Dockerfile: renv restores ignore the lockfile repositories and can't restore git packages

1 participant