Repository navigation
feat: warn when boosterpak and the project's recorded version drift apart - #46
Merged
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 three checks so a mismatch between the installed boosterpak and a project is reported without anyone running
status()first.What changes
status()warns when the project is ahead of the package. A[project].boosters_versionrecord newer than the installed boosterpak used to be a label only. It is now a warning that asks you to install that version or later.upgrade_neededstaysFALSEin that case.sync()andrestore_project()report drift themselves.boosterpak_version_newer, always (scripts see it;expect_warning(class = )/tryCatchcan single it out).upgrade_project(dry_run = TRUE)hint, in interactive sessions only.sync(mode = "restore"),restore_project()) check after restoring and read the boosterpak installed in the project library, becauserenv.lockcan install a newer boosterpak. If the library is now new enough but the session still runs the old copy, they say to restart R instead of warning.boosters.toml(pack-less, including the generatedsetup.Rpath) get nothing.status()compares a generatedsetup.Rpin with the installed boosterpak. New result fieldsetup_pin_current(TRUE/FALSE, orNAwithout a generatedsetup.Ror without a GitHub-installed boosterpak), plus asetup.R pin:line. A different pin is information, not a warning, because keeping an older pin can be deliberate; it points towrite_portable_setup().Every change
R/config.R:version_drift_hint()andlibrary_boosterpak_version().R/sync.R: hint in apply mode (before reading config) and in restore mode (after the restore); roxygen details.R/environment.R:restore_project()runs the hint after restoring; roxygen details.R/status.R: newer-record warning;setup_pin_currentfield and output; roxygen.R/portable.R:installed_boosterpak_sha()(now shared withportable_pin(), which loses its own copy of that logic) andportable_setup_pin().man/restore_project.Rd,man/status.Rd,man/sync.Rd: regenerated.test-status.R,test-sync.R,test-environment.R,test-portable.R.upgrading-a-project.qmd,getting-started.qmd,restoring-a-project.qmd.Known limits
add_pack(),remove_pack()and the GitHub pack import writeboosters.tomland pack files before they callsync(), so a newer-record warning arrives after those writes (and not at all withsync = FALSE). Adding a second check before the writes would print the warning twice; the wording does not promise a warning before writes.devtools::load_all(), a restore in a project whose library has no boosterpak can compare the record with an older copy in the user library and warn.upgrade_project()still does not apply to projects withoutboosters.toml; re-runningwrite_portable_setup()is their refresh.Validation
Full testthat suite passes;
jarl checkclean on the changed R files; the three edited vignettes render with quarto.air formatwas applied only where it touches no unrelated lines (it reformats existing code inR/sync.R,R/status.Rand the test files).