-
Notifications
You must be signed in to change notification settings - Fork 36
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
Refactor audit #1235
Refactor audit #1235
Conversation
expect_error( | ||
expect_warning( |
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.
Hmm, so there are some cases in user code where what would have been an error will now just be a warning after this change?
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.
Yes. I must have been on edge when writing the NM stuff.
What about reversing this and making it an error all the time now? I was wondering about this ... it probably should be an error and users can opt out from this audit in fringe cases where each compartment isn't explicitly written into the $ODE
block (like writing in a loop).
What do you think?
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.
Thanks for confirming. I don't have a strong leaning there, and don't have any objections to going with the warning if you prefer to go with the less aggressive behavior when consolidating the nm-vars and non-nmvars checks.
@kyleam I didn't see this warning before? https://github.com/metrumresearchgroup/mrgsolve/actions/runs/11194343722/job/31120704962?pr=1235#step:6:57 But can't say I looked either. |
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.
Thanks for the updates. Looking good to me.
Left an updated suggestion for the grepl_dxdt_ode
regex for you consideration.
expect_error( | ||
expect_warning( |
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.
Thanks for confirming. I don't have a strong leaning there, and don't have any objections to going with the warning if you prefer to go with the less aggressive behavior when consolidating the nm-vars and non-nmvars checks.
Yeah, I have noticed that showing up under the annotations of the CI summary. An example from 4 months ago: Here are the relevant docs and comments for this check:
Given these are jobs running older R versions, I think we can safely ignore the warning. We could set |
warning versus error: if I was doing this new today, I'd probably make it an error. But I think the majority of users have been getting a warning so will keep it at that for now. But I'm going to open an issue about transitioning that at some point ... it's probably worth considering again. |
Summary
When a model contains ODE, we need an equation written for every compartment in
$ODE
block. "audit" means we look for some evidence that every compartment has been referenced somewhere.The audit code was totally different when
nm-vars
plugin was invoked compared to when it wasn't invoked.nm-vars
: ODE useDADT(n) =
on the lhsnm-vars
: ODE usedxdt_CMT =
on the lhsThe code for checking in the two different approaches was different because there is special handling for
nm-vars
style and it was a little easier at the time to just keep that down in the code where all thenm-vars
functionality was handled.One bad decision from
nm-vars
is that we would only audit if there was at least oneDADT(n)
found. That wasn't safe because #1182 is a report from a user who invokednm-vars
, but used the non-nm-vars
style, which is allowed. And of course the name of adxdt_CMT
variable was misspelled. The missing ODE wasn't detected and we spent some time trying to figure that out.So here we centralize checking
$ODE
for the required lhs.