You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CRAN check failures in 0.3.21 on Fedora and macOS arm64 #827
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`.
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.
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:
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.
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.
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.
Activity
randy3k commentedon Oct 31, 2026
Root Cause Analysis
1.
test-completion-metadata.R(Fedora GCC, macOS arm64release&oldrel)completion_reply()unconditionally callspackage_completion(token)(R/completion.R:1330), which scansrownames(installed.packages())using subsequence matching (match_with()).provider_fixture()(tests/testthat/helper-provider.R) creates a mock workspace without mockingpackage_completion()orinstalled.packages().languageserver's dependencies installed), CRAN check machines have thousands of CRAN packages installed:package_completion("run")subsequence-matches installed CRAN packages (e.g.,DepDoubleTruncKS), returning 45 items instead of 1.target(a)),package_completion("a")matches thousands of installed packages containing"a", andcompletion_reply()capsitemsatmax_completions(default200), pushing the local parameter`a b`(item$detail == "parameter") out of the returneditemslist.2.
test-s3-dispatch.R(macOS arm64oldrel)test-s3-dispatch.Ruses3_fixture()(an in-memory mock workspace) and pass onr-oldrel-macos-arm64."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 intest-s3-dispatch.Rthat instantiate a realWorkspace$new().resolve_s3_call()returnsNULLonr-oldrel-macos-arm64(causingdigits/modeto be omitted from completion items at lines 345–346, andresult$method$name/result$signatureto beNULLat lines 381–382).Workspace$new()'scallr::r()startup initialization (workspace_startup_packages(),workspace_startup_members(),workspace_startup_s3()) orWorkspaceIndexand CRAN's R 4.4 macOS arm64 environment, though CRAN's00check.logonly reports thetestthatassertion failure and does not show which internalreturn(NULL)guard inresolve_s3_call()was triggered.renkun-ken commentedon Oct 31, 2026
We can include #826, fix the check failures and re-submit?
randy3k commentedon Oct 31, 2026
Still not quite sure the cause of the second issue. But we can skip those tests on CRAN if needed.
randy3k commentedon Oct 31, 2026
826 is a bit long, will try to review tomorrow (1:22am my time now).
renkun-ken commentedon Oct 31, 2026
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:
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; mockinginstalled.packages()would miss it.With
c("DepDoubleTruncKS", sprintf("aPkg%03d", 1:250))as the inventory, the imported quoted-name fixture returnsDepDoubleTruncKSplus`run task`, andtarget(a)returns 200 package items with no parameter. The selector compares raw labels with the decoded prefix beforesortText: the backtick at the start of the parameter label prevents its prefix match, soaPkg…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.Missing startup S3 catalogs reproduce both oldrel failures. Stubbing
workspace_startup_s3()to returnlist()while retaining the realWorkspace, completion provider and index makes the same-file call omitdigits/modeand the cross-file registration returnNULL. Populating complete startup catalogs in those same workspaces restoresg.numericandnumeric_impl.The mechanism is that
.class2(1)yieldsc("double", "numeric"): after failing to findg.double,s3_lookup_method()returns whencontext$incompleteis true, before reachingg.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.