Dependency updates, runtime pinning & package vetting

Stay current on purpose, pin what must not move, and look before you install

Manage dependencies through lockfiles, runtime pinning, and package vetting for reproducible R environments.
Published

2026-09-26

Modified

2026-09-27

Three separate questions

  1. Updates: how do we learn that a dependency has a new version, and apply it safely?
  2. Pinning: which versions (of R, of packages, of tools) must stay fixed, and where is that written down?
  3. Vetting: before adding a new dependency, is it trustworthy and maintained?

1 · Updates: Dependabot, and what it can’t do

On the website repo, Dependabot checks npm packages and GitHub Actions monthly, and groups minor/patch updates into one PR per group:

# .github/dependabot.yml (npm block)
groups:
  production:  { dependency-type: production,  update-types: [minor, patch] }
  development: { dependency-type: development, update-types: [minor, patch] }
ignore:
  # runtime pinned to Node 24; bump with .nvmrc
  - dependency-name: "@types/node"
    update-types: ["version-update:semver-major"]

Within minutes of the first push it opened three PRs, and all three passed CI. The decisions still needed judgement:

PR Decision Evidence
React 19.2.8 → 19.3.0 (grouped minor) Merge Inside Next’s declared peer range ^19.0.0
@types/node 24 → 26 (major) Close + ignore majors Runtime is pinned to Node 24; the types must match the runtime, not the latest
TypeScript 5.9 → 7.0 (major) Merge Next.js’s bundled docs have a “Using TypeScript 7” section

Green CI is necessary, not sufficient. Major updates arrive as separate PRs by design. Read the changelog, and check compatibility with what’s pinned.

For R: Dependabot has no R/CRAN/renv ecosystem (checked against GitHub’s list of supported ecosystems). It can still keep an R repo’s GitHub Actions and pre-commit hooks current (github-actions and pre-commit ecosystems). A ready-to-use configuration is in templates/github/dependabot.yml.

# Drop into .github/dependabot.yml.
# Dependabot cannot update R packages (no CRAN/renv ecosystem), but it CAN keep
# your GitHub Actions (r-lib/actions, checkout, ...) current.
version: 2
updates:
  - package-ecosystem: github-actions
    directory: /
    schedule:
      interval: monthly
    commit-message:
      prefix: "ci"
    groups:
      actions:
        patterns: ["*"]

For packages, schedule the update yourself:

renv::status()     # is the lockfile in sync with the library?
renv::update()     # update packages in the project library
# run tests / R CMD check, then:
renv::snapshot()   # record the new versions in renv.lock

Make it a routine, and review the diff of renv.lock like any other PR. A pattern that works:

  • A monthly scheduled workflow opens an issue listing the packages in renv.lock that have newer versions (compare the locked versions with available.packages() from the package manager’s latest snapshot). An issue, not a PR: by default the workflow token can’t open pull requests (the repository setting “Allow GitHub Actions to create and approve pull requests” is off), and a person should decide when to update anyway.
  • A small update script moves to a newer snapshot, runs renv::update(), runs the tests, and calls renv::snapshot() only if they pass. If they fail, renv::restore() puts the old versions back.

2 · Pinning: runtimes and repositories

What Web repo R project
Runtime version .nvmrc → CI reads it renv.lock records R; setup-r with r-version: renv reads it
Switching runtimes locally nvm/fnm rig: rig add release, rig list, rig default 4.5.1
Exact package versions package-lock.json + npm ci renv.lock + renv::restore()
Package source Project .npmrc: registry=https://registry.npmjs.org/ options(repos = …) or renv’s repos, e.g. a dated Posit Package Manager snapshot https://packagemanager.posit.co/cran/2026-09-01

Pin per project, not per machine. A CLI we needed (firebase-tools) refused to install on the Mac’s Node 26: one of its dependencies declared engines: node 20 || 22 || 24. The fix wasn’t downgrading the whole machine. We deferred the tool and let CI run the pinned Node 24. It’s the same idea as keeping one project on R 4.4 with rig while the rest move on.

A dated package-manager snapshot is the R superpower here. Every install in that project resolves to CRAN as it was on that date, on every machine and in CI.

Three things we learned setting this up with renv:

  • renv takes the repository from renv.lock. When the project loads, renv sets options(repos) from the lockfile, so a repos line in .Rprofile is quietly overridden. Record the snapshot URL in the lockfile instead: renv::snapshot(repos = c(CRAN = "https://packagemanager.posit.co/cran/2026-09-26")).
  • Binaries on macOS too. Posit Package Manager serves binaries for macOS as well as Linux. The path depends on the R build (for R 4.6 on Apple silicon it’s sonoma-arm64), so ask R rather than guessing: contrib.url(getOption("repos"), "binary"). On Linux, a binary still needs its system libraries (keyring needs libsecret, for example): renv::sysreqs() lists them, and CI must install them before renv::restore().
  • A project that isn’t a package can still declare its packages. Put them in a DESCRIPTION file and set renv::settings$snapshot.type("explicit"). renv then records exactly that list (plus dependencies) rather than whatever it finds in the code, which also covers packages you’ve planned for but not used yet.

3 · Vetting: look before you install.packages()

Our UI library’s installer quietly swapped two well-known helpers for a new package literally named cn. A name that generic is exactly what typosquatters use. Two minutes of checks:

  • Who publishes it? Its npm maintainer was the UI library’s author.
  • Where’s the source? It linked to a repo in the same GitHub organisation.
  • Is it used and maintained? Recent releases, and the issues get answered.

For R, the R Validation Hub’s tools make this systematic and documentable, which is useful for GxP package risk assessment:

library(riskmetric)
pkg_ref("ggsurvfit") |> pkg_assess() |> pkg_score()   # maintenance, testing, documentation, community metrics

riskassessment wraps riskmetric in a Shiny app for team review and sign-off.

Letting a second model do the legwork

We delegated the Dependabot analysis to a second LLM (Gemini). Its job was to read the peer ranges and the bundled docs and propose a decision per PR. Its conclusions held up, but every piece of evidence was re-checked by opening the cited files before anything was merged, and its diff was reviewed line by line. That review also caught a nuance it had glossed over: the related Next.js option is marked experimental. Delegate the reading; keep the decision and the verification.

Sources

Dependabot

R tooling

Vetting

NoteUpdates
  • 2026-09-26: Removed the end-of-post checklist.
  • 2026-09-26: Added what we learned putting a project on renv with a dated Posit Package Manager snapshot: renv takes the repository from renv.lock, binaries are available for macOS too (but Linux binaries still need system libraries), and explicit snapshots suit projects that aren’t packages. Described the monthly update issue and the test-gated update script.
  • 2026-09-27: Added a Sources section.
  • 2026-09-27: Linked every template file and showed it on the page.