Skip to content

Require() returns FALSE when a package fails to attach; cloning no longer deletes from the source library; other round-6 follow-ups - #254

Open
eliotmcintire wants to merge 4 commits into
developmentfrom
fix/round6-odd-items
Open

eliotmcintire wants to merge 4 commits into
developmentfrom
fix/round6-odd-items

Conversation

@eliotmcintire

Copy link
Copy Markdown
Contributor

Fixes six bugs found while writing the round-6 tests. The two that matter most: Require said TRUE for a package it could not load, and cloning from another library could delete folders in that library.

Affects: Require() now returns FALSE for a package that did not attach. A broken package in a Require.cloneFrom library is skipped, not deleted along with other folders there. Dependency lookups for archived packages can no longer loop forever.

Technical details

Each fix has a test in test-31 ("follow-ups from round 6") that fails on the old code.

  • doLoads() (R/Require2.R): Require() builds its return value from pkgDT$require, not from doLoads()'s result, so a package whose require() returned FALSE still came back TRUE. doLoads() now sets require := FALSE for those rows. The line that reordered out and discarded the result is removed.
  • clonablePackages() called clearErrorReadRDSFile() on each cloneFrom source library. On any readRDS error it deleted every folder there without a readable Meta/package.rds: the broken package, and also other processes' 00LOCK-* folders. The call and function are removed; packageHasError() already filters broken packages out. Its test in test-28 is removed.
  • pakPkgDep() (R/pak.R): when the archive retry added the same supplement refs again, pkgDone was reset, so it called pak::pkg_deps forever. It now gives up when there are no new refs.
  • .downloadFileMasterMainAuth() with a git token: a failed GET went to httr::content() on a try-error ("is.response(x) is not TRUE"). It also used url where it should have used URL. It now keeps the error and retries, like the no-token path.
  • masterMainHEAD(need = "HEAD") returned the HEAD url twice; it now returns it once.
  • setupOff() passes verbose to its messages.
  • tibble is removed from Suggests; Unit tests (coverage round 6) and the bugs they found; remove dead code #251 removed its last use.
  • test-08: ianmseddy/LandR.CS renamed master to main, so LandR.CS@master could not be installed. The test now asks for @main. It failed the same way on unchanged development.

Checked and left alone: the PAT-strip in the muffled warning handler has no effect (harmless); withCloneLock taking over an empty lock after 60 s is deliberate; pakSerialInstall's captured messages never show (harmless); downloadRepo() is used by SpaDES.project.

Full local devtools::test() (2.1.1.9055): 561 tests, 2474 passed, 0 failed/errors/warnings/skipped.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lx3DXgG6hSA1CRAMhvKajR

eliotmcintire and others added 2 commits December 4, 2026 13:41
…no longer deletes, pakPkgDep loop, token download retry

- doLoads sets pkgDT$require FALSE for a package require() could not attach;
  Require() returns pkgDT$require, so it said TRUE.
- clonablePackages no longer calls clearErrorReadRDSFile, which deleted every
  folder without readable metadata (incl. other installs' 00LOCK-) from
  cloneFrom source libraries. Function removed.
- pakPkgDep gives up when the same archive supplement refs fail again.
- .downloadFileMasterMainAuth with a token keeps the error and retries,
  instead of httr::content() on a try-error; uses URL, not url.
- masterMainHEAD(need = "HEAD") returns the HEAD url once.
- setupOff passes verbose to its messages.
- tibble dropped from Suggests (last use removed in #251).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXgG6hSA1CRAMhvKajR
eliotmcintire and others added 2 commits December 4, 2026 21:50
…folder without rprojroot (#255)

* Drop unused packages from Suggests; setupOff finds the .Rproj folder with base R (no rprojroot)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXgG6hSA1CRAMhvKajR

* Require's token-authenticated GitHub downloads go through curl; GETWauthThenNonAuth() stays on httr (#256)

.downloadFileMasterMainAuth() now uses a new internal curlGETauth()
(curl::curl_fetch_memory(), same bad-credentials/404 fallback). The exported
GETWauthThenNonAuth() is unchanged and still returns an httr response,
because SpaDES.core (module-repository.R) reads it with httr::content() and
httr::stop_for_status(); httr stays in Suggests for it. checkForToken() now
needs curl, not httr.


Claude-Session: https://claude.ai/code/session_01Lx3DXgG6hSA1CRAMhvKajR

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…) needs it

checkForToken() asks for both gitcreds and curl. The tests skipped only on a
missing curl, so on the nosuggests runner (curl present, gitcreds absent) the
token was never read and the tests failed. Same skip as test-31's token test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lx3DXgG6hSA1CRAMhvKajR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant