Repository navigation
Conversation
A derived value whose initialiser folds to a whole number was typed `Int` by the pharmsol DSL front end, while its slot lives in the runtime's f64 buffer. The backend then stored a double and read it back as an integer, so the value came out as its own f64 bit pattern (4.607182e18 for 1.0). Outputs, conditionals and derivatives built from it were garbage, which is what drove a reported model to 10^19. pharmsol-dsl 0.29.3 (LAPKB/pharmsol#372) registers derived and output symbols as real-valued. Pmetrics 3.2.6 pins pmcore 0.28.0 -> pharmsol 0.29.0 and is affected; this branch pins pmcore 0.29.0 -> pharmsol 0.29.3 and is not. These tests pin the numbers the compiled DSL produces for whole-number, fractional and conditional derived values, so the regression cannot return silently. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The tests accurately cover the reported regression and relevant execution paths.
Review effort: Balanced
Findings: None
What changed in this PR
Adds regression coverage ensuring whole-number derived DSL values retain floating-point semantics.
Changes:
- Adds reusable simulation fixtures.
- Tests output, conditional derivative, and direct derivative paths.
- Includes a fractional-value control case.
| File | Description |
|---|---|
tests/testthat/test-model-dsl-derived-constants.R |
Adds regression tests for derived-value typing. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #395 +/- ##
=======================================
Coverage 64.77% 64.77%
=======================================
Files 52 52
Lines 22964 22964
=======================================
Hits 14876 14876
Misses 8088 8088 🚀 New features to boost your workflow:
|
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.
Adds regression tests for whole-number derived values, which were read back as their f64 bit pattern (
4.607182e18for1.0) on pharmsol < 0.29.3.Fixed upstream in LAPKB/pharmsol#372; these tests pin the numbers so it cannot return silently.