Skip to content

feat: warn when boosterpak and the project's recorded version drift apart - #46

Merged
seanthimons merged 1 commit into
mainfrom
feat/version-drift-checks
Nov 13, 2026
Merged

seanthimons merged 1 commit into
mainfrom
feat/version-drift-checks

Conversation

@seanthimons

Copy link
Copy Markdown
Owner

Adds three checks so a mismatch between the installed boosterpak and a project is reported without anyone running status() first.

What changes

  1. status() warns when the project is ahead of the package. A [project].boosters_version record 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_needed stays FALSE in that case.
  2. sync() and restore_project() report drift themselves.
    • Record newer than the installed boosterpak: a warning of class boosterpak_version_newer, always (scripts see it; expect_warning(class = ) / tryCatch can single it out).
    • Record older: the upgrade_project(dry_run = TRUE) hint, in interactive sessions only.
    • Restore paths (sync(mode = "restore"), restore_project()) check after restoring and read the boosterpak installed in the project library, because renv.lock can 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.
    • Projects without boosters.toml (pack-less, including the generated setup.R path) get nothing.
  3. status() compares a generated setup.R pin with the installed boosterpak. New result field setup_pin_current (TRUE/FALSE, or NA without a generated setup.R or without a GitHub-installed boosterpak), plus a setup.R pin: line. A different pin is information, not a warning, because keeping an older pin can be deliberate; it points to write_portable_setup().

Every change

  • R/config.R: version_drift_hint() and library_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_current field and output; roxygen.
  • R/portable.R: installed_boosterpak_sha() (now shared with portable_pin(), which loses its own copy of that logic) and portable_setup_pin().
  • man/restore_project.Rd, man/status.Rd, man/sync.Rd: regenerated.
  • Tests: test-status.R, test-sync.R, test-environment.R, test-portable.R.
  • Vignettes: upgrading-a-project.qmd, getting-started.qmd, restoring-a-project.qmd.

Known limits

  • add_pack(), remove_pack() and the GitHub pack import write boosters.toml and pack files before they call sync(), so a newer-record warning arrives after those writes (and not at all with sync = FALSE). Adding a second check before the writes would print the warning twice; the wording does not promise a warning before writes.
  • Development only: under 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 without boosters.toml; re-running write_portable_setup() is their refresh.

Validation

Full testthat suite passes; jarl check clean on the changed R files; the three edited vignettes render with quarto. air format was applied only where it touches no unrelated lines (it reformats existing code in R/sync.R, R/status.R and the test files).

@seanthimons
seanthimons merged commit da84f0f into main Nov 13, 2026
6 checks passed
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.

1 participant