Describe the bug
I had a player accidentally delete their token. The token was configured as a Character. I told them to just Ctrl+Z to get it back. They did so and it appeared back for them, but not for the rest of us. I dragged the Character onto the map from the side panel and everyone saw this one, including the player who deleted the old one. They saw 2 of their token while the rest of us only saw the one I added. After them refreshing, the extra token was gone for them too. There is an error printed in the server log as well. See at the bottom.
To Reproduce
Steps to reproduce the behavior:
Have another player join to see the effects
Create a Character
Delete the Character's shape
Undo (Ctrl+Z) to get the shape back
The player does not see the shape return.
Refresh. The shape is gone for you too.
Expected behavior
Undoing a character deletion should function just like undoing any other shape deletion.
CRITICAL - Uncaught async exception UNIQUE constraint failed: shape.uuid (logs.py:38)
Task exception was never retrieved
future: <Task finished name='Task-15697' coro=<AsyncServer._handle_event_internal() done, defined at ${planarally_location}/server/venv/lib/python3.12/site-packages/socketio/async_server.py:608> exception=IntegrityError('UNIQUE constraint failed: shape.uuid')>
Traceback (most recent call last):
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 3322, in execute_sql
cursor.execute(sql, params or ())
sqlite3.IntegrityError: UNIQUE constraint failed: shape.uuid
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "${planarally_location}/server/venv/lib/python3.12/site-packages/socketio/async_server.py", line 610, in _handle_event_internal
r = await server._trigger_event(data[0], namespace, sid, *data[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/socketio/async_server.py", line 637, in _trigger_event
ret = await handler(*args)
^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/src/auth.py", line 55, in wrapped
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/src/api/socket/shape/__init__.py", line 74, in add_shape
shape = create_shape(data.shape, layer=layer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/src/api/common/shapes/__init__.py", line 19, in create_shape
shape = Shape.create(index=index, **reduce_data_to_model(Shape, data_dict))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 6741, in create
inst.save(force_insert=True)
File "${planarally_location}/server/venv/lib/python3.12/site-packages/playhouse/signals.py", line 71, in save
ret = super(Model, self).save(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 6951, in save
pk = self.insert(**field_dict).execute()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 2036, in inner
return method(self, database, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 2107, in execute
return self._execute(database)
^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 2912, in _execute
return super(Insert, self)._execute(database)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 2625, in _execute
cursor = database.execute(self)
^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 3330, in execute
return self.execute_sql(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 3320, in execute_sql
with __exception_wrapper__:
^^^^^^^^^^^^^^^^^^^^^
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 3088, in __exit__
reraise(new_type, new_type(exc_value, *exc_args), traceback)
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 196, in reraise
raise value.with_traceback(tb)
File "${planarally_location}/server/venv/lib/python3.12/site-packages/peewee.py", line 3322, in execute_sql
cursor.execute(sql, params or ())
peewee.IntegrityError: UNIQUE constraint failed: shape.uuid
Describe the bug I had a player accidentally delete their token. The token was configured as a Character. I told them to just Ctrl+Z to get it back. They did so and it appeared back for them, but not for the rest of us. I dragged the Character onto the map from the side panel and everyone saw this one, including the player who deleted the old one. They saw 2 of their token while the rest of us only saw the one I added. After them refreshing, the extra token was gone for them too. There is an error printed in the server log as well. See at the bottom.
To Reproduce Steps to reproduce the behavior:
Expected behavior Undoing a character deletion should function just like undoing any other shape deletion.
Screenshots
https://github.com/user-attachments/assets/8cfc393b-c0e0-4e2e-b46c-ae2d68c4cf90
Desktop:
Additional context Server error: