Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Undoing a deletion of a Character's Shape does not succeed #1523

Open
rexy712 opened this issue Nov 26, 2024 · 1 comment
Open

[BUG] Undoing a deletion of a Character's Shape does not succeed #1523

rexy712 opened this issue Nov 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rexy712
Copy link
Contributor

rexy712 commented Nov 26, 2024

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:

  1. Have another player join to see the effects
  2. Create a Character
  3. Delete the Character's shape
  4. Undo (Ctrl+Z) to get the shape back
  5. The player does not see the shape return.
  6. Refresh. The shape is gone for you too.

Expected behavior
Undoing a character deletion should function just like undoing any other shape deletion.

Screenshots

character-bug.mp4

Desktop:

  • OS: gentoo linux
  • Browser: ungoogled-chromium-130.0.6723.116, firefox-132.0.2
  • Version: dev branch commit 39eea47

Additional context
Server error:

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
@Kruptein
Copy link
Owner

As a remedy until this is fixed, you should be able to drag the character back on the map from the characters tab.

@Kruptein Kruptein added the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants