Catch case where state from older version could be unexpected #396
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.
A change in v0.28.1 moved to use
cloned_version
much more heavily. Thismade a few assumptions that during import/create, the cloned_version
would be set, and that therefore in a usual Read, this would already be
taken care of. However this missed a situation where the user has an
existing state file from v0.28.0 or earlier and upgrades to v0.28.1. In
this situation, neither the Create nor the Import logic would be
triggered and the
cloned_version
would have evaded attention. This thencauses problems in the Update function where we assume
cloned_version
iscorrect and use it to clone a new version to make changes. In particular
this commit addresses the case where
cloned_version
is 0, which leads toan error message when calling CloneVersion:
To get around this, we look for the case where
cloned_version
is 0 inthe Read function and use the same logic as Import in that case too.