Repository navigation
Conversation
The error argument was passed to CmdStan as epsilon=<error>. The output directory was created with mkdtemp and never removed; it is now a TemporaryDirectory. Closes stan-dev#871 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013imjkuZ1miKJ7HzHWg6Ku2
This branch has not been deployed
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
Closes #871.
CmdStanModel.diagnosehad two defects.errorargument was sent to CmdStan asepsilon=<error>, so CmdStan never receivederror=, and passing both arguments putepsilonon the command line twice. It now sendserror=<error>.tempfile.mkdtemp(prefix=self.name, dir=_TMPDIR)and never removed. It is now atempfile.TemporaryDirectory(prefix=self.name, dir=_TMPDIR)in the samewithstatement as the JSON inputs, as in Remove log_prob's temporary output directory when the call returns #869. It is still nested under_TMPDIR. The output is read inside thewithblock, so the returned DataFrame is unchanged.Tests (
test/test_model.py):test_diagnose_error_argumentchecks that the logged command carrieserror=and a singleepsilon=.test_diagnose_removes_output_dircallsdiagnosethree times on the success path and on theRuntimeErrorpath, and asserts that the entries of_TMPDIRare unchanged and that the output was written under_TMPDIR.Testing
Python 3.12,
pip install -e ".[all,test]":pytest test/test_model.py test/test_log_prob.py: 33 passed, 2 failed. The failures aretest_compile_forceandtest_model_paths. They fail the same way without this change (my sandbox cannot write to/and has a read-only compile path), so they are unrelated.pytest test/test_model.py -k diagnosewithout themodel.pychange: the 3 new tests fail (test_diagnose_error_argument,test_diagnose_removes_output_dir[False],[True]); the existingtest_diagnosepasses.AI disclosure, per the Stan AI Contribution Policy: this change was prepared with Claude Code (Anthropic).
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):
Aleksandr Tarutin
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:
🤖 Generated with Claude Code
https://claude.ai/code/session_013imjkuZ1miKJ7HzHWg6Ku2