sandpaper
sandpaper copied to clipboard
[validation] add validation step for differences between working env and package cache
Problem
When folks are iteratively working on lessons, they may not want to be running sandpaper::serve()
since it will rerun an entire file on save and instead run individual chunks (which can take time if things need to be downloaded or there are intensive computational steps.
The effect of this is that people may stop running sandpaper::serve()
, losing not only the pre-flight validation steps, but also validating that the packages for the lesson exist and are up-to-date. This normally will not be too much of a problem because packages don't often introduce breaking changes or new features that folks want to use in lessons.
That being said, there are situations where someone is building a lesson for an in-development package and they want to introduce a new feature, but they avoid using sandpaper::serve()
for the above reason.
Solution
Have validate_lesson()
check if {renv} is used and then validate that the packages in the package cache are at least as recent as the packages in the default library.
Example
The {ratdat} package provides datasets for educational use. It is not currently on CRAN, and was last updated two weeks ago, adding a data set called complete_old
to be used in a lesson.
That lesson was initially created in December 2021 at this point: https://github.com/weecology/ratdat/tree/4a5f39985aab598d612ffdf0146731fc950738bf
When The lesson was updated with the complete_old
data set, a pre-flight check of the cache status could have detected the differences between the local version of {ratdat} and the cache version, showing the user a message that they needed to run sandpaper::update_cache()
before pushing changes.