Make cmdstan_version_compare() refuse a missing version - #1284
Merged
Merged
Conversation
It returned -1 for an empty or NA first argument and 1 for an empty second one, standing in for "no install found" during path discovery. That is the same -1 an older version gets, so a caller could not tell the two apart. Both arguments must now be non-empty strings, since utils::compareVersion() itself treats "" as older. cmdstan_default_path() handles a missing native or WSL install before comparing, and the startup check wraps the whole comparison in try(). Closes #1260.
The notes still described cmdstan_version_compare() as returning -1 for a missing version and the install-path code as relying on that. Both are false since the comparison started refusing a missing version, so the passage now records the old behavior as the removed instance of the tri-state collapse and says where the callers handle a missing version instead. The contract file did not change because the passage sits outside the contract markers. Part of #1260.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.0 #1284 +/- ##
=======================================
Coverage ? 93.10%
=======================================
Files ? 19
Lines ? 7320
Branches ? 0
=======================================
Hits ? 6815
Misses ? 505
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Submission Checklist
Summary
I had Claude generate the summary below
cmdstan_version_compare()returned -1 for an empty orNAfirstargument and 1 for an empty second one, standing in for "no install
found" during path discovery. That is the same -1 an older version
gets, so a caller could not tell the two apart.
Both arguments must now be non-empty strings. Dropping the guards alone
would not have been enough, since
utils::compareVersion("", "2.35.0")also returns -1. The callers that can meet a missing version handle it
on their own side:
cmdstan_default_path()picks the install that exists beforecomparing, so it only compares when both a native and a WSL install
were found.
.onAttach()wraps the whole comparison intry(), so a failed download, no CmdStan, or a bad version all skipthe "newer version available" message.
is_supported_cmdstan_version()already mapped an error toFALSE.$sample()compares the model's version, which onv1.0always comesfrom a validated build record or the executable's
infooutput, so itdoes not need a guard.
Closes #1260
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: