Can't add elements to Set of Text in Publishable Instance
Summary: Unclear what is going on, but this situation throws an Exception.
After quite a bit of digging, this appears to have nothing to do with Publication per se.
The actual issue (I think) seems to be an ancient bug, that may have existed in the system from the very beginning: the serialized form of a Set or List of Text, with a single empty element, serializes exactly the same as an empty Set/List -- that is, both serialize as an empty string. This problem was innocuous in ordinary circumstances: the recipe is:
- Create a Thing, with a Property that is a Set of Text.
- Hit "+" to add an element to that Set. Do not put anything into the Text field -- leave it empty.
- Initially, all looks as expected.
- Reload the Space.
- The empty element has disappeared.
I believe this problem shows up severely in Publication because of the separate between the main and Publication forks of the Space. They are communicating via serialized properties, and the result is that SpaceCore is creating the Event (with the serialized field), tossing it over to Publication (which stores that), and then the serialized form is being used to construct the record in the user view of the Space. Then, a moment later, it tries to actually set a value in the non-existent entry, and boom.
The fix is likely at the serialization level: use some sort of sentinel to represent the empty String, so that it serializes in a clearer way.