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

Fix resetting project anatomy during project update #87

Merged
merged 6 commits into from
Nov 11, 2024

Conversation

martastain
Copy link
Member

@martastain martastain commented Oct 29, 2024

Changelog

Previously, updating a project in Kitsu caused non-pairable attributes in Ayon to reset to default values. This occurred because the primary anatomy preset was being used as the base instead of the actual project anatomy.

Additional info

A new helper function extract_ayon_project_anatomy was introduced. Since this is a useful function, it should eventually become a part of ayon_server.helpers but now it is included in this addon to maintain compatibility with the current (and previous) Ayon versions.

Testing Instructions

  1. Pair a Kitsu project.
  2. In Ayon, modify non-synced attributes (e.g., handles, tools, applications) to non-default values.
  3. Make a change to production settings in Kitsu.
  4. Verify that only pairable attributes are updated, while non-pairable attributes remain unchanged.

@martastain martastain linked an issue Oct 29, 2024 that may be closed by this pull request
@martastain martastain self-assigned this Oct 29, 2024
@martastain martastain added type: bug Something isn't working sponsored This is directly sponsored by a client or community member labels Oct 29, 2024
@martastain martastain marked this pull request as ready for review October 30, 2024 07:02
@MustafaJafar MustafaJafar self-requested a review October 30, 2024 11:19
server/kitsu/anatomy.py Outdated Show resolved Hide resolved
server/kitsu/extract_ayon_project_anatomy.py Outdated Show resolved Hide resolved
server/kitsu/extract_ayon_project_anatomy.py Show resolved Hide resolved
Copy link
Contributor

@MustafaJafar MustafaJafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pairing a project fails. (it works in develop branch)
image

I found these in the logs in the event viewer:

Description
[POST] /addons/kitsu/1.2.4-dev.1/pairing: UNHANDLED EXCEPTION
Message
[POST] /addons/kitsu/1.2.4-dev.1/pairing: UNHANDLED EXCEPTION
Description
'NoneType' object has no attribute 'name'
Message
'NoneType' object has no attribute 'name'

Here's the sever docker log:


server-1  | 2024-10-31T09:55:01.497971369Z 2024-10-31 12:55:01 ERROR      anonymous       [POST] /enroll: UNHANDLED EXCEPTION
server-1  | 2024-10-31T09:55:01.497995414Z 2024-10-31 12:55:01 ERROR      server          1 validation errors:
server-1  | 2024-10-31T09:55:01.497998068Z   {'loc': ('response',), 'msg': 'none is not an allowed value', 'type': 'type_error.none.not_allowed'}
server-1  | 2024-10-31T09:55:01.498000101Z 
server-1  | 2024-10-31T09:55:01.551128472Z [2024-10-31 12:55:01 +0300] [26] [ERROR] Exception in ASGI application
server-1  | 2024-10-31T09:55:01.551144455Z Traceback (most recent call last):
server-1  | 2024-10-31T09:55:01.551147139Z   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi
server-1  | 2024-10-31T09:55:01.551149282Z     result = await app(  # type: ignore[func-returns-value]
server-1  | 2024-10-31T09:55:01.551151135Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
server-1  | 2024-10-31T09:55:01.551152937Z   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
server-1  | 2024-10-31T09:55:01.551154810Z     return await self.app(scope, receive, send)
server-1  | 2024-10-31T09:55:01.551156573Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
server-1  | 2024-10-31T09:55:01.551158325Z   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
server-1  | 2024-10-31T09:55:01.551160148Z     await super().__call__(scope, receive, send)
server-1  | 2024-10-31T09:55:01.551161901Z   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
server-1  | 2024-10-31T09:55:01.551163693Z     await self.middleware_stack(scope, receive, send)
server-1  | 2024-10-31T09:55:01.551165446Z   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
server-1  | 2024-10-31T09:55:01.551167248Z     raise exc
server-1  | 2024-10-31T09:55:01.551168931Z   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
server-1  | 2024-10-31T09:55:01.551170723Z     await self.app(scope, receive, _send)
server-1  | 2024-10-31T09:55:01.551172446Z   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
server-1  | 2024-10-31T09:55:01.551174279Z     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
server-1  | 2024-10-31T09:55:01.551176071Z   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
server-1  | 2024-10-31T09:55:01.551177894Z     raise exc
server-1  | 2024-10-31T09:55:01.551179596Z   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
server-1  | 2024-10-31T09:55:01.551181419Z     await app(scope, receive, sender)
server-1  | 2024-10-31T09:55:01.551183142Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__
server-1  | 2024-10-31T09:55:01.551184954Z     await self.middleware_stack(scope, receive, send)
server-1  | 2024-10-31T09:55:01.551186687Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
server-1  | 2024-10-31T09:55:01.551188479Z     await route.handle(scope, receive, send)
server-1  | 2024-10-31T09:55:01.551190212Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
server-1  | 2024-10-31T09:55:01.551192025Z     await self.app(scope, receive, send)
server-1  | 2024-10-31T09:55:01.551193777Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
server-1  | 2024-10-31T09:55:01.551203722Z     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
server-1  | 2024-10-31T09:55:01.551205835Z   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
server-1  | 2024-10-31T09:55:01.551207718Z     raise exc
server-1  | 2024-10-31T09:55:01.551209450Z   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
server-1  | 2024-10-31T09:55:01.551211283Z     await app(scope, receive, sender)
server-1  | 2024-10-31T09:55:01.551213075Z   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
server-1  | 2024-10-31T09:55:01.551217061Z     response = await func(request)
server-1  | 2024-10-31T09:55:01.551218824Z                ^^^^^^^^^^^^^^^^^^^
server-1  | 2024-10-31T09:55:01.551220556Z   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 296, in app
server-1  | 2024-10-31T09:55:01.551222369Z     content = await serialize_response(
server-1  | 2024-10-31T09:55:01.551224072Z               ^^^^^^^^^^^^^^^^^^^^^^^^^
server-1  | 2024-10-31T09:55:01.551225794Z   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 155, in serialize_response
server-1  | 2024-10-31T09:55:01.551227597Z     raise ResponseValidationError(
server-1  | 2024-10-31T09:55:01.551229329Z fastapi.exceptions.ResponseValidationError: 1 validation errors:
server-1  | 2024-10-31T09:55:01.551231102Z   {'loc': ('response',), 'msg': 'none is not an allowed value', 'type': 'type_error.none.not_allowed'}
server-1  | 2024-10-31T09:55:01.551232894Z 

@martastain
Copy link
Member Author

@MustafaJafar i was not able to reproduce the problem, but I've found two spots where the issue might originate from and fixed it. Could you pls try again?

@MustafaJafar
Copy link
Contributor

MustafaJafar commented Nov 11, 2024

paring works.
on assets: I changed the handle start and end on AYON, changed the description on kitsu.
After clicking sync, the handle start and end didn't change, description on AYON is synced to kitsu.


on project level:
changing the production on kitsu doesn't change them on AYON.
image
image

@MustafaJafar
Copy link
Contributor

on project level:
changing the production on kitsu doesn't change them on AYON.

ignore me. it is working now. maybe there was an issue in my network.

Copy link
Contributor

@MustafaJafar MustafaJafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works on my side.

@martastain martastain merged commit e421522 into develop Nov 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sponsored This is directly sponsored by a client or community member type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AY-7019_Kitsu resets project anatomy
3 participants