From c10cbe1e990f9fc3deb3b120c0f9336720b21f0e Mon Sep 17 00:00:00 2001 From: christophe dervieux Date: Thu, 23 Apr 2026 19:33:02 +0200 Subject: [PATCH] Fail early when renv packages are not synchronized after restore When renv::restore() encounters network errors (e.g. package manager returning HTTP errors), it can complete without failing even though some packages were not properly installed. Downstream steps then fail with cryptic errors like missing package functions. Add renv::status() after restore and exit with status 1 if the library is not synchronized with the lockfile, surfacing the failure at the right point rather than later in the test run. --- .github/workflows/test-smokes.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test-smokes.yml b/.github/workflows/test-smokes.yml index 84aef3ad3e..a36b160af9 100644 --- a/.github/workflows/test-smokes.yml +++ b/.github/workflows/test-smokes.yml @@ -175,6 +175,13 @@ jobs: cat("::group::Restoring R packages from renv.lock\n") renv::restore() cat("::endgroup::\n") + cat("::group::Verifying R packages are synchronized after restore\n") + status <- renv::status() + if (!isTRUE(status$synchronized)) { + cat("::error::R packages are not synchronized after restore - some packages may have failed to install\n") + quit(status = 1) + } + cat("::endgroup::\n") cat("::group::Installing dev versions of knitr and rmarkdown\n") # Install dev versions for our testing # Use r-universe to avoid github api calls