Skip to content

CRAN check failures in 0.3.21 on Fedora and macOS arm64 #827

Closed

Description

@randy3k

Summary

CRAN check results for languageserver 0.3.21 (CRAN check page) show ERROR in tests/testthat.R on three flavors:

  • r-devel-linux-x86_64-fedora-gcc (3 FAIL)
  • r-release-macos-arm64 (3 FAIL)
  • r-oldrel-macos-arm64 (7 FAIL)

(r-devel-linux-x86_64-fedora-clang is OK.)

Failure Details

1. test-completion-metadata.R (fails on r-devel-linux-x86_64-fedora-gcc, r-release-macos-arm64, r-oldrel-macos-arm64)

── Failure ('test-completion-metadata.R:334:5'): Quoted workspace and imported names complete with decoded prefixes ──
Expected `items` to have length 1.
Actual length: 45.
── Failure ('test-completion-metadata.R:335:5'): Quoted workspace and imported names complete with decoded prefixes ──
Expected `items[[1L]]$textEdit$newText` to be identical to "`run task`".
Differences:
`actual`: "DepDoubleTruncKS"
`expected`: "`run task`"
── Error ('test-completion-metadata.R:362:5'): Quoted local names and argument prefixes retain their context ──
<subscriptOutOfBoundsError/error/condition>
Error in `Filter(function(item) identical(item$detail, "parameter"), items)[[1L]]`: subscript out of bounds

2. test-s3-dispatch.R (fails on r-oldrel-macos-arm64)

── Failure ('test-s3-dispatch.R:345:5'): S3 argument completion runs through the real provider ──
Expected `all(c("digits", "mode") %in% labels)` to be TRUE.
Differences:
`actual`: FALSE
`expected`: TRUE
── Error ('test-s3-dispatch.R:346:5'): S3 argument completion runs through the real provider ──
<subscriptOutOfBoundsError/error/condition>
Error in `which(labels == "mode")[[1L]]`: subscript out of bounds
── Failure ('test-s3-dispatch.R:381:5'): S3 dispatch resolves cross-file source definitions and namespace aliases ──
Expected `result$method$name` to be identical to "numeric_impl".
Differences:
`actual` is NULL
`expected` is a character vector ('numeric_impl')
── Error ('test-s3-dispatch.R:382:5'): S3 dispatch resolves cross-file source definitions and namespace aliases ──
Error in `expect_match(result$signature, "digits", fixed = TRUE)`: `object` must be a character vector, not `NULL`.

Activity

  1. randy3k commented on Oct 31, 2026

    @randy3k
    MemberAuthor

    Root Cause Analysis

    1. test-completion-metadata.R (Fedora GCC, macOS arm64 release & oldrel)

    • completion_reply() unconditionally calls package_completion(token) (R/completion.R:1330), which scans rownames(installed.packages()) using subsequence matching (match_with()).
    • provider_fixture() (tests/testthat/helper-provider.R) creates a mock workspace without mocking package_completion() or installed.packages().
    • Unlike GitHub Actions CI (which only has languageserver's dependencies installed), CRAN check machines have thousands of CRAN packages installed:
      • At line 334–335, package_completion("run") subsequence-matches installed CRAN packages (e.g., DepDoubleTruncKS), returning 45 items instead of 1.
      • At line 360–362 (target(a)), package_completion("a") matches thousands of installed packages containing "a", and completion_reply() caps items at max_completions (default 200), pushing the local parameter `a b` (item$detail == "parameter") out of the returned items list.

    2. test-s3-dispatch.R (macOS arm64 oldrel)

    • All other tests in test-s3-dispatch.R use s3_fixture() (an in-memory mock workspace) and pass on r-oldrel-macos-arm64.
    • The two failing tests ("S3 argument completion runs through the real provider" at line 336 and "S3 dispatch resolves cross-file source definitions and namespace aliases" at line 358) are the only tests in test-s3-dispatch.R that instantiate a real Workspace$new().
    • In both tests, resolve_s3_call() returns NULL on r-oldrel-macos-arm64 (causing digits/mode to be omitted from completion items at lines 345–346, and result$method$name / result$signature to be NULL at lines 381–382).
    • This points to an interaction between Workspace$new()'s callr::r() startup initialization (workspace_startup_packages(), workspace_startup_members(), workspace_startup_s3()) or WorkspaceIndex and CRAN's R 4.4 macOS arm64 environment, though CRAN's 00check.log only reports the testthat assertion failure and does not show which internal return(NULL) guard in resolve_s3_call() was triggered.
  2. renkun-ken commented on Oct 31, 2026

    @renkun-ken
    Member

    We can include #826, fix the check failures and re-submit?

  3. randy3k commented on Oct 31, 2026

    @randy3k
    MemberAuthor

    Still not quite sure the cause of the second issue. But we can skip those tests on CRAN if needed.

  4. randy3k commented on Oct 31, 2026

    @randy3k
    MemberAuthor

    826 is a bit long, will try to review tomorrow (1:22am my time now).

  5. renkun-ken commented on Oct 31, 2026

    @renkun-ken
    Member

    I checked the released CRAN 0.3.21 source and reproduced both failure patterns on R 4.6.1/macOS arm64. I would keep the provider/index coverage and make the fixtures deterministic:

    1. The completion failures expose both test isolation and a ranking bug. In 0.3.21, package enumeration goes through installed_package_names(), which caches .packages(all.available = TRUE). A scoped mock of this helper is therefore the appropriate isolation point; mocking installed.packages() would miss it.

      With c("DepDoubleTruncKS", sprintf("aPkg%03d", 1:250)) as the inventory, the imported quoted-name fixture returns DepDoubleTruncKS plus `run task`, and target(a) returns 200 package items with no parameter. The selector compares raw labels with the decoded prefix before sortText: the backtick at the start of the parameter label prevents its prefix match, so aPkg… wins despite the parameter's priority. Decoding quoted symbol labels for prefix comparison restores `a b` = under the same inventory. I suggest isolating these quoted-name tests, fixing prefix comparison in both the C selector and R fallback, and retaining a crowded-library regression.

    2. Missing startup S3 catalogs reproduce both oldrel failures. Stubbing workspace_startup_s3() to return list() while retaining the real Workspace, completion provider and index makes the same-file call omit digits/mode and the cross-file registration return NULL. Populating complete startup catalogs in those same workspaces restores g.numeric and numeric_impl.

      The mechanism is that .class2(1) yields c("double", "numeric"): after failing to find g.double, s3_lookup_method() returns when context$incomplete is true, before reaching g.numeric. workspace_startup_s3() has an eight-second worker limit and caches the empty result after an error, so one startup failure can affect both tests. Its error logging is enabled only under debug/trace. The actual CRAN trigger remains unconfirmed.

      I suggest supplying known complete startup catalogs at these fixture boundaries, testing worker failure/recovery separately, and recording catalog keys/errors when an integration assertion fails. Failed startup preparation should also have a bounded recovery path. Keep the incomplete-catalog guard conservative: missing metadata for an earlier class can otherwise select the wrong fallback method.

    One environment correction: the oldrel CRAN log reports R 4.5.2 Patched, rather than R 4.4. These targeted fixes and regressions would be useful alongside #826 before resubmission.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions