Dependency updates, runtime pinning & package vetting
Stay current on purpose, pin what must not move, and look before you install
Three separate questions
- Updates: how do we learn that a dependency has a new version, and apply it safely?
- Pinning: which versions (of R, of packages, of tools) must stay fixed, and where is that written down?
- 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.
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.lockMake 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.lockthat have newer versions (compare the locked versions withavailable.packages()from the package manager’slatestsnapshot). 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 callsrenv::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 setsoptions(repos)from the lockfile, so areposline in.Rprofileis 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 (keyringneedslibsecret, for example):renv::sysreqs()lists them, and CI must install them beforerenv::restore(). - A project that isn’t a package can still declare its packages. Put them in a
DESCRIPTIONfile and setrenv::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 metricsriskassessment 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
- Dependabot overview: GitHub Docs: Dependabot
- Supported ecosystems (no R/CRAN/renv ecosystem): GitHub Docs: Ecosystems supported by Dependabot
R tooling
- renv: rstudio.github.io/renv
- rig: github.com/r-lib/rig
- Posit Package Manager: packagemanager.posit.co
- keyring (system library requirement,
libsecret): keyring.r-lib.org
Vetting
- R Validation Hub: pharmar.org
- riskmetric: pharmar.github.io/riskmetric
- riskassessment: pharmar.github.io/riskassessment
- 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.