Skip to content

Drop pre-2.35 CmdStan support in cmdstanr v1.0#1144

Open
jgabry wants to merge 15 commits intomasterfrom
min-cmdstan-2-35
Open

Drop pre-2.35 CmdStan support in cmdstanr v1.0#1144
jgabry wants to merge 15 commits intomasterfrom
min-cmdstan-2-35

Conversation

@jgabry
Copy link
Member

@jgabry jgabry commented Feb 24, 2026

Submission Checklist

  • Run unit tests
  • Declare copyright holder and agree to license (see below)

Summary

Some of the code was developed with the help of codex. I also had it take a look at the code changes and generate this summary:

In cmdstanr v1.0 we will only support CmdStan >= 2.35.0. Users needing older CmdStan versions can install an older cmdstanr release. This simplifies legacy compatibility code and tightens behavior around version/path handling.

Main changes:

  • Require CmdStan >= 2.35.0.
  • Enforce this minimum in install_cmdstan() for:
    • explicit version,
    • release_url/release_file when the archive name is parseable,
    • and the unpacked archive itself.
  • Reject unsupported existing installations in set_cmdstan_path() and
    cmdstanr_initialize().

Windows/toolchain updates:

  • Deprecate CMDSTANR_USE_MSYS_TOOLCHAIN and ignore it (with warning).
  • Remove legacy MSYS/pacman/Rtools35 code paths.
  • Add ABI-aware Rtools fallback resolution.
  • Add/extend Windows CI diagnostics for toolchain candidate selection.
  • In CI debug checks, use cmdstanr:::is_rtools4x_toolchain_usable() for consistency
    with package logic.

WSL/path state handling:

  • Reset cached .cmdstanr$WSL state when path/version state is explicitly cleared.
  • Scope cmdstan_default_path(dir=...) to the supplied directory (do not fall back to
    unrelated WSL CmdStan installs when an explicit dir is provided).

Compatibility/docs/tests/CI:

  • Bump minimum R version to >= 4.0.0.
  • Remove obsolete pre-R-3.5 tempdir branches.
  • Update NEWS + install docs (and regenerate Rd).
  • Add/extend tests for version parsing/rejection, env-var init behavior, Windows
    fallback behavior, and WSL state reset behavior.
  • Keep a pinned windows-2022 (R 4.1) CI job for legacy toolchain coverage; skip
    posterior::pareto_smooth-dependent init tests only on that configuration.
  • Harden recursive make test subprocess env (R_HOME/R_LIBS/R_LIBS_USER) and Makefile quoting.

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Jonah Gabry

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

Raise cmdstanr support floors and remove legacy Windows toolchain compatibility paths tied to older CmdStan versions.

Core behavior updates:

- Require CmdStan >= 2.35.0 across installation and path initialization flows.

- Enforce version floor for install_cmdstan() inputs (version, release_url/release_file when parseable) and after archive unpack.

- Reject unsupported existing installations in set_cmdstan_path()/cmdstanr_initialize().

- Keep CMDSTANR_USE_MSYS_TOOLCHAIN as deprecated/ignored with a once-per-session warning and migration guidance.

Windows/toolchain cleanup:

- Remove legacy MSYS/pacman/mingw32-make toolchain-install code paths.

- Remove Rtools35/R3.x-specific branching and simplify toolchain path selection for current Rtools flows.

R floor + compatibility cleanup:

- Bump package Depends: R to >= 4.0.0.

- Remove obsolete tempdir branches for R < 3.5 in code/tests.

Docs and tests:

- Update NEWS and install documentation, including note about using older cmdstanr releases for older CmdStan/MSYS workflows.

- Add tests for archive version extraction, unsupported version rejection (including release_file and RC boundary), unsupported CMDSTAN env initialization, and ignored MSYS env warning behavior.
@jgabry jgabry marked this pull request as draft February 25, 2026 00:19
@codecov-commenter
Copy link

codecov-commenter commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 86.15385% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.92%. Comparing base (f429f12) to head (9c579c3).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
R/install.R 86.41% 11 Missing ⚠️
R/path.R 83.33% 5 Missing ⚠️
R/zzz.R 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1144      +/-   ##
==========================================
+ Coverage   87.95%   89.92%   +1.96%     
==========================================
  Files          14       14              
  Lines        5935     5913      -22     
==========================================
+ Hits         5220     5317      +97     
+ Misses        715      596     -119     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Avoid backend-specific assumptions that caused failures on WSL

- The test had expected cmdstanr_initialize() to leave PATH/VERSION NULL after rejecting an unsupported CmdStan version

- On WSL CI, initialization can apparently fall back to an existing supported installation, so NULL is not guaranteed.
@jgabry jgabry requested a review from SteveBronder February 25, 2026 17:09
@jgabry
Copy link
Member Author

jgabry commented Feb 25, 2026

@SteveBronder @WardBrian If we require CmdStan 2.35 in cmdstanr v1.0 then I think we can simplify a lot of the Windows toolchain stuff. But I don't fully trust myself with Windows, so would be great to get your feedback if you have time. (You don't necessarily need to look at every line of code if you don't have time, but at least at a high level do these changes make sense?).

@jgabry jgabry marked this pull request as ready for review February 25, 2026 17:15
@jgabry jgabry marked this pull request as draft February 25, 2026 23:44
- Scope cmdstan_default_path(dir=...) to the provided directory and avoid unrelated WSL fallback.\n- Keep Windows toolchain debug validation aligned with is_rtools4x_toolchain_usable().\n- Add a windows-2022 (R 4.1) CI-only skip flag for pareto_smooth-dependent init tests.\n- Centralize that skip logic in a shared test helper and apply it to all affected tests.\n- Harden recursive make test subprocess env and Makefile quoting for Windows reliability.
we need `posterior::pareto_smooth()`
@jgabry jgabry marked this pull request as ready for review February 27, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants