-
Notifications
You must be signed in to change notification settings - Fork 0
tmp directory model compilation #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ific path slashes.
… is still used for model compilation.
…ompilation of copied model file to temp.
… so we always have a baseline on the source model version.
…de mention of LICENSE file in DESCTIPTION and 2. add paper directory to .Rbuildignore as non-standard R package directory
MCSimMod Package UpdatesOverviewFixed critical bug in Key Bug Fix: Hash Calculation for writeTemp=TRUEProblem: Solution:
Modified
Updated loadModel() method:
Added TestNew test for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where models using loadModel(writeTemp = TRUE) would not recompile when the local .model file was edited. The fix introduces separate tracking of the source file (where users make edits) and the compilation file (in the temp directory), ensuring the hash is calculated from the source file to detect changes correctly.
Changes:
- Separated source file and compilation file tracking in the Model class
- Updated hash calculation to use the source file instead of the temp compilation file
- Added comprehensive test coverage for the writeTemp functionality
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| R/MCSim_model.R | Implements source_file/file separation, updates hash initialization and loadModel to track source changes |
| R/compileModel.R | Adds source_file parameter for hash calculation, replaces seq(length()) with seq_along() |
| R/fileHasChanged.R | Updates to use source_file parameter and tools::md5sum |
| R/fixPath.R | Removes Windows-specific path normalization code |
| tests/testthat/test-compareHash.R | Adds comprehensive test for writeTemp functionality |
| tests/testthat/test-sim.R | Adds showWarnings = FALSE to dir.create call |
| man/compileModel.Rd | Documents new source_file parameter |
| man/Model-class.Rd | Documents new recompiled field |
| DESCRIPTION | Updates RoxygenNote version and License format |
| .Rbuildignore | Adds paper directory to ignore list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
dfkapraun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! See comment for "MCSim_model.R" and let me know what you think.
…file in temp folder
dfkapraun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Approving...
Bug Fix: tmp model does not recompile when .model is edited locally
Summary
When using a local .model file with the
loadModel(writeTemp = TRUE), the compiled model intmp/does not recompile when the local .model file is edited.Root Cause Analysis
A
file.copyis used to copy the local .model file to thetmp/directory. The hash key is then created on the copied tmp model. If the local .model file is edited, the hash is not changed intmp/and the tmp model is not recompiled.Todo:
Information
Two files are now tracked:
source_fileandfile.source_file: Original file. This is the .model file in the user's local directory or the tmp file first written frommString. The hash for file changes is determined from this file.file: This is the file that is compiled bymod.