File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
crates/stackable-versioned-macros/src/codegen/container/struct Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -186,9 +186,11 @@ impl Struct {
186186 . as_str( )
187187 . ok_or_else( || #parse_object_error:: FieldNotStr { field: "kind" . to_string( ) } ) ?;
188188
189- // Note(@sbernauer): One could argue we don't need to check the kind, but this
190- // is a nice sanity check. If for *some* reason a unexpected kind ends up at a
191- // conversion, the problem might be very hard to spot without this.
189+ // Note(@sbernauer): The kind must be checked here, because it is
190+ // possible for the wrong object to be deserialized.
191+ // Checking here stops us assuming the kind is correct and
192+ // accidentally updating upgrade/downgrade information in the
193+ // status in a later step.
192194 if object_kind != stringify!( #enum_ident) {
193195 return Err ( #parse_object_error:: UnexpectedObjectKind {
194196 kind: object_kind. to_string( ) ,
You can’t perform that action at this time.
0 commit comments