Skip to content

R version in deployment.toml should take precedence over renv.lock constraint #4268

Description

@zackverham

Problem

When a user explicitly sets an R version in deployment.toml (e.g., 4.5.2), but the renv.lock file contains a different R version (e.g., 4.4.0), Publisher derives a RequiresRVersion constraint from the renv.lock (~=4.4.0) and then fails deployment with:

Cannot find compatible environment: no compatible Local environment with R version 4.5.2 (~=4.4.0) and Quarto version 1.8.26.

Expected Behavior

  1. The R version explicitly set in deployment.toml should take precedence over the version recorded in renv.lock for the RequiresRVersion constraint
  2. Publisher should detect this conflict earlier and provide actionable guidance (e.g., "Your deployment.toml specifies R 4.5.2 but your renv.lock was created with R 4.4.0 — run renv::snapshot() with R 4.5.2 to update it")
  3. The error message should make it clear which file is the source of the conflicting constraint

Steps to Reproduce

  1. Have an R project with renv.lock created under R 4.4.x
  2. Update deployment.toml to specify R version 4.5.2
  3. Attempt to publish

Context

Related (but different): #2648

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions