-
Notifications
You must be signed in to change notification settings - Fork 3
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
Introduce ModelVarContext
as a generalisation of ModelLookup
and ModelFindVariables
#25
Open
jorisdral
wants to merge
2
commits into
main
Choose a base branch
from
jdral/model-var-context
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
jorisdral
force-pushed
the
jdral/model-var-context
branch
from
November 4, 2024 10:27
8a724c0
to
71616aa
Compare
Occurrences of `ModelFindVariables` and `ModelLookup` in the `InLockstep` class are replaced by the newly exposed `ModelVarContext`. A `ModelFindVariables` can be recovered from a `ModelVarContext` using the new `findVars` functions. A `ModelLookup` can be recovered from a `ModelVarContext` using the new `lookupVars` function. Since these functions can be recovered from `ModelVarContext`, existing tests are guaranteed to be adaptable to the new `InLockstep` API. Motivation: previously in the `InLockstep` class, member functions would be passed a `ModelFindVariables` or a `ModelLookup`, but never both. In practice this turned out to be too restrictive, because one might want access to both in the same function, see IntersectMBO/lsm-tree#431. For example, `arbitraryWithVars` was previously only passed a `ModelFindVariables`, but without a `ModelLookup` one can not filter these variables based on the (modelled) outcome of the corresponding actions. The use case for #431 in particular was to filter variables that reference stateful handles (e.g., file handles) for handles that are open. Because of this filtering, one can skew the action distribution to generate more actions on open handles. It is often more interesting to test actions on open handles than it is to test actions on closed handles, which will presumably always return the same error.
jorisdral
force-pushed
the
jdral/model-var-context
branch
from
November 4, 2024 10:32
71616aa
to
1852cf8
Compare
dcoutts
approved these changes
Nov 5, 2024
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.
LGTM, but I'll see what @edsko thinks! :-)
`findVars` functions. A `ModelLookup` can be recovered from a | ||
`ModelVarContext` using the new `lookupVars` function. Since these functions | ||
can be recovered from `ModelVarContext`, existing tests are guaranteed to be | ||
adaptable to the new `InLockstep` API. |
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.
Might be nice to give an example of what you need to change?
arbitraryWithVars lookupVars = ...
(lookupVars ...)
becomes
arbitraryWithVars vctx = ...
(lookupVars vctx ...)
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.
Occurrences of
ModelFindVariables
andModelLookup
in theInLockstep
class are replaced by the newly exposedModelVarContext
. AModelFindVariables
can be recovered from aModelVarContext
using the newfindVars
functions. AModelLookup
can be recovered from aModelVarContext
using the newlookupVars
function. Since these functions can be recovered fromModelVarContext
, existing tests are guaranteed to be adaptable to the newInLockstep
API.Motivation: previously in the
InLockstep
class, member functions would be passed aModelFindVariables
or aModelLookup
, but never both. In practice this turned out to be too restrictive, because one might want access to both in the same function, see IntersectMBO/lsm-tree#431. For example,arbitraryWithVars
was previously only passed aModelFindVariables
, but without aModelLookup
one can not filter these variables based on the (modelled) outcome of the corresponding actions. The use case for #431 in particular was to filter variables that reference stateful handles (e.g., file handles) for handles that are open. Because of this filtering, one can skew the action distribution to generate more actions on open handles. It is often more interesting to test actions on open handles than it is to test actions on closed handles, which will presumably always return the same error.