I found that the game list was wiped out (again) and I suspect that the
issue was that some client pushed an update to the game list before
receiving the current data for the top-level object. That would have
caused it to create new objects for the game and metadata lists
containing only the single newly-created game and store links to them in
the 'games' and 'meta' fields of the top-level object. This data would
not be merged because the new objects have no connection to the original
objects which should have been linked from those fields. The top-level
object would be merged, but only to the extent of updating the links.
To fix this, I moved the 'meta' object to the top level with a fixed
identifier (UUID + '/meta'). This identifier _is_ the object's identity
("soul") so even if a client initializes it with an empty object the new
fields should be merged when syncing resumes. I removed the 'games'
object altogether, since the meta object keeps track of which game IDs
are available. Individual games are assigned "souls" based on their game
IDs (UUID + ('/game/' or '/meta/') + game ID). The resulting structure
looks like:
'UUID/meta': {
'12345abcde': <link to 'UUID/meta/12345abcde'>,
'3a2b5c7e1f': <link to 'UUID/meta/3a2b5c7e1f'>,
...
},
'UUID/meta/12345abcde': { ... darkName, lightName, moves, etc. ... },
'UUID/game/12345abcde': { 'board': 'JSON' },
'UUID/meta/3a2b5c7e1f': { ... darkName, lightName, moves, etc. ... },
'UUID/game/3a2b5c7e1f': { 'board': 'JSON' },
...
Besides being more resilient, this structure should also be more
performant since there are fewer links to traverse to access the game
data. So far in my admittedly limited testing I haven't seen any of the
syncronization issues that plagued the older version.