restore() gains retry argument for non-interactive recovery#2307
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
retryargument torenv::restore(), addressing the non-interactive gap in #1893.The retry-with-latest recovery added in #1893 (renv 1.2.1) was interactive-only:
renv_restore_recover()callsask(), which returns the default (FALSE) in non-interactive sessions, so the retry was silently skipped in CI,pre-commit,Rscript, etc. This was flagged by @froggleston.Behavior
retryis tri-state, so the existing interactive prompt is preserved:retry = NULL(default) -- prompt if interactive, leave failures unresolved otherwise (unchanged).retry = TRUE-- retry failed packages with their latest available versions without prompting (the CI case).retry = FALSE-- skip recovery entirely.When retrying without a prompt, renv prints a short "Retrying with the latest available versions of: ..." line. The detailed per-package failure summary is already emitted by
renv_graph_install_errors()beforehand.Notes
pak-delegated restore returns early and never had this recovery, soretryis a no-op there (matches the pre-existing limitation).Testing
devtools::test(filter = "restore")-> FAIL 0, PASS 93. Added a test assertingretry = FALSEskips recovery andretry = TRUEinstalls the latest version.