Better validation errors when cell type changes #908
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.
Fixes #878
Phew, I thought this would be a relatively straightforward PR, but turns out I was wrong!
The reason this wasn't straightforward is that the original cell type wasn't actually stored anywhere in the notebook metadata---only in the database. So, this meant that while the cell type would be fixed when
nbgrader autograde
was run, it would fail on validation but not provide a useful error message to the user. To address this, I created a new version of the metadata which now includes a key for the cell type. This key is added whennbgrader assign
is run, and then the validation code looks to see whether the stored cell type is the same as the current cell type.In implementing all of this I added a bit more tooling to make the metadata updating more obvious (see #883). For example, the create assignment extension will complain now if the metadata version is too old.