Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Protocol changes can result in a oneof not being cleared #25

Open
joshgarnett opened this issue Mar 9, 2018 · 0 comments
Open

Protocol changes can result in a oneof not being cleared #25

joshgarnett opened this issue Mar 9, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@joshgarnett
Copy link
Collaborator

At the moment we currently only have a single event for setting a oneof. This can cause issues if an entry in a oneof is removed.

For example:

message Foo {
  oneof bar {
    int32 a = 1;
    int32 b = 2;
  }
}

Assuming the following actions:

var foo = new Foo();
foo.A = 1;
foo.B = 2;

When you apply the events you would expect that A would no longer be set and B would have the value 2.

Now assume we make the following protocol change:

message Foo {
  oneof bar {
    int32 a = 1;
    // remove b
  }
}

If we apply those same events from before, we actually end up in a case where A is set to 1 still as the B set event is no longer valid and was just dropped in the ApplyEvent code.

We have a few options here. We can just document the edge case or we can look at generating two events for each oneof set. One that clears the old value and one that sets the new value.

@joshgarnett joshgarnett added the bug Something isn't working label Mar 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant