Skip to content

Ensure graceful handling of serialization version mismatches on event trigger definitions#688

Open
konradkonrad wants to merge 1 commit intomainfrom
feat/etd_serialization_compat
Open

Ensure graceful handling of serialization version mismatches on event trigger definitions#688
konradkonrad wants to merge 1 commit intomainfrom
feat/etd_serialization_compat

Conversation

@konradkonrad
Copy link
Copy Markdown
Contributor

There are to my knowledge only two codepaths that unmarshal event trigger definitions. I've added an explicit version check that will log and skip any entries that do not match the currently implemented serialization version.

Fixes #687


trigger := EventTriggerDefinition{}
err := trigger.UnmarshalBytes(triggerRegisteredEvent.Definition)
if len(triggerRegisteredEvent.Definition) > 0 &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid unmarshaling a definition that will anyway be skipped, the version check should happen before UnmarshalBytes(), similarily to your previous update: https://github.com/shutter-network/rolling-shutter/pull/688/changes#diff-bf9d9e2e61cab2782870a4b2cf9bf3feae73dfe74d1265c1eec16652699a7d9dR95

return x
}

func TestInvalidVersionDoesNotCrash(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don’t think this test would be relevant once we check the version before unmarshalling, as that code path would be dead. A more relevant test for this PR would verify that outdated versions are skipped in the processor path instead.

@konradkonrad konradkonrad force-pushed the feat/etd_serialization_compat branch from 148764b to f2e7119 Compare March 31, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle version differences in shutter-api event trigger definitions

2 participants