renv::record("<pkg>") doesn't write all of the new fields that were added in #2059 like renv::snapshot() does — only Package, Version, Source, Repository. Fields like Hash, Requirements, and the dependency lists (Depends, Imports, Suggests, LinkingTo) are dropped.
Originally surfaced in rstudio/rsconnect#1319.
Repro
Adding this test to tests/testthat/test-record.R reproduces it:
test_that("record() writes the same fields as snapshot() for an installed
package", {
renv_tests_scope("breakfast")
init()
lockfile <- renv_lockfile_read("renv.lock")
snap_record <- renv_lockfile_records(lockfile)$breakfast
record("breakfast")
lockfile <- renv_lockfile_read("renv.lock")
rec_record <- renv_lockfile_records(lockfile)$breakfast
expect_setequal(names(rec_record), names(snap_record))
})
Returns:
FAILURE: 'test-record.R:80:3' ---------------------
Expected `names(rec_record)` to have the same values as `names(snap_record)`.
Actual: "Package", "Version", "Source", "Repository"
Expected: "Package", "Version", "Source", "Type", "Depends", "Suggests",
"Repository", "License", "Description", ...
Absent: "Type", "Depends", "Suggests", "License", "Description", "Title",
"Author", "Maintainer", "Config/Needs/protein"
It looks (to Claude) like record() and snapshot() build records via completely different code paths and never converge:
snapshot() → renv_snapshot_description() (R/snapshot.R:715) reads the installed package's DESCRIPTION and (for v2, R/snapshot.R:815) keeps essentially every field except a small ignore list. For v1 it also computes Hash and a Requirements list.
record() → renv_remotes_resolve(spec, latest = TRUE) (R/record.R:36). For a CRAN/repository spec that lands in renv_remotes_resolve_repository() (R/remotes.R:463), which returns only: list(Package, Version, Source = "Repository", Repository) renv_lockfile_modify() (R/lockfile.R:241) then slots that minimal list straight into the lockfile with no enrichment from the installed DESCRIPTION.
renv::record("<pkg>")doesn't write all of the new fields that were added in #2059 likerenv::snapshot()does — onlyPackage,Version,Source,Repository. Fields likeHash,Requirements, and the dependency lists (Depends,Imports,Suggests,LinkingTo) are dropped.Originally surfaced in rstudio/rsconnect#1319.
Repro
Adding this test to
tests/testthat/test-record.Rreproduces it:Returns:
It looks (to Claude) like
record()andsnapshot()build records via completely different code paths and never converge:snapshot()→renv_snapshot_description()(R/snapshot.R:715) reads the installed package's DESCRIPTION and (for v2,R/snapshot.R:815) keeps essentially every field except a smallignorelist. For v1 it also computesHashand aRequirementslist.record()→renv_remotes_resolve(spec, latest = TRUE)(R/record.R:36). For a CRAN/repository spec that lands inrenv_remotes_resolve_repository()(R/remotes.R:463), which returns only:list(Package, Version, Source = "Repository", Repository)renv_lockfile_modify()(R/lockfile.R:241) then slots that minimal list straight into the lockfile with no enrichment from the installed DESCRIPTION.