Skip to content

Added activity when attribute gets changed#992

Open
kalisp wants to merge 10 commits into
developfrom
enhancement/YN-0316_attribute_change_event
Open

Added activity when attribute gets changed#992
kalisp wants to merge 10 commits into
developfrom
enhancement/YN-0316_attribute_change_event

Conversation

@kalisp

@kalisp kalisp commented Jun 22, 2026

Copy link
Copy Markdown
Member

Description of changes

This PR adds activity creation after attribute gets changed to log it of posterity.

This should be used in production to backtrack changes to attributes as fps, width, height

@kalisp kalisp requested a review from martastain June 22, 2026 15:29
@kalisp kalisp self-assigned this Jun 22, 2026
Comment thread api/attributes/attributes.py Fixed
@kalisp

kalisp commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

Probably outside of this PR but I am not understanding this part of existing code:

image

@kalisp kalisp linked an issue Jun 23, 2026 that may be closed by this pull request
@kalisp

kalisp commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

Not completely sure, if this is actually solving requested use case. I followed existing event trigger in ayon-backend/api/tasks/tasks.py for change of assignee, but maybe I should have use ayon-backend/ayon_server/activities/event_hook.py

@kalisp

kalisp commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

I think I misunderstood the use case. I reverted commits which triggered event IF attribute definition was changed.

I implemented creating of activity when attribute changes, in similar fashion as status change.

But there will be need to update frontend a bit as right this changes is breaking display of entity with newly created activity.

I'll try to experiment with FE for a bit if I could figure it out myself, but if not, I'll punt it FE team way.

@martastain

Copy link
Copy Markdown
Member

I am REALLY concerned about this running when a project uses calculated attributes tbh.

@kalisp

kalisp commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

You mean it will be spawning a too many activities? Can we separate attribute changes of calculated attributes?

@kalisp kalisp added type: enhancement Improvement of existing functionality or minor addition sponsored This is directly sponsored by a client or community member labels Jun 23, 2026
@kalisp kalisp changed the title Added event after attribute is changed Added activity when attribute gets changed Jun 23, 2026
@martastain

martastain commented Jun 25, 2026

Copy link
Copy Markdown
Member

Maybe. It will require a changes both in calculated attributes and the server. I'll take a look how that could be done. I don't assume it is necessary to track changes of calc attrs anyways.

Edit: This is now available

Comment thread ayon_server/activities/event_hook.py Outdated
origin_link = f"[{entity.name}]({entity_type}:{entity.id})"
body = f"{origin_link} attrib changed from {old_value} to {new_value}"

await create_activity(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similarly to assignee activities, split the event to individual attributes, throw away calculated attributes (available since #995 ) and create an activity for each attribute. with data like:

{
   "key": "priority",
   "oldValue": "low",
   "newValue": "high",
}

(i'd use generic name "key" rather than "attrib" or "attrib name" since we can then add a simple index that will cover data->'key' that could be useful for more activity types)

kalisp added 2 commits June 25, 2026 16:48
Skip keys in 'calculated_attributes' which denote dynamically calculated ones from real attribute change.
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: enhancement Improvement of existing functionality or minor addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

YN-0316: Entity changes show as activities in feed

2 participants