Fix cursor dimensionality race condition #7295
Merged
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.
References and relevant issues
Closes #7248
Description
The cursor is supposed to have the same dimensionality as the full dims model.
However, #7248 exposed one of those situations where we want to simultaneously
update many objects, and the order winds up mattering: we try to update the
position of the cursor before the dimensionality of the cursor has been
updated, causing an IndexError.
In this PR, I simply check for the right dimensionality, and use a clear (all
zeros) position of the correct dimensionality if the cursor dimensionality is
out of date for the current slice request.
There's probably a better way to do this, but this fixes a rather severe bug
so I'd like to get this fix out quickly, and maybe refactor later.
The PR includes a new test to avoid a regression.