Skip to content

Fix 'get_activities' crashing when 'limit' is passed - #365

Merged
iLLiCiTiT merged 1 commit into
developfrom
bugfix/get-activities-limit
Oct 5, 2026
Merged

iLLiCiTiT merged 1 commit into
developfrom
bugfix/get-activities-limit

Conversation

@BigRoy

@BigRoy BigRoy commented Oct 5, 2026

Copy link
Copy Markdown
Member

Changelog Description

Fix get_activities raising AttributeError: 'NoneType' object has no attribute 'set_limit' whenever a non-zero limit is passed.

Additional info

activities_graphql_query() nests the activities field under project, so its path is project/activities. get_activities looked it up with get_field_by_path("activities"), which returns None, so the call crashed before any request was sent. The same pattern in get_events works only because events is a top-level field. The bug is also present in released versions (seen in 1.2.9, 1.2.16, 1.2.22).

With the correct path the limit bounds the result end to end for both orders: page size is min(300, limit - fetched) (sent as first for ascending, last for descending) and paging stops once the limit is reached.

get_activity_by_id does not pass limit and was not affected. No other get_field_by_path call in the repository uses a wrong nested path.

Testing notes:

  1. Run pytest tests/test_get_activities_limit.py - does not require a running AYON server.
  2. Against a server, list(ayon_api.get_activities(project_name, limit=5)) should return at most 5 activities instead of raising, and with order=SortOrder.descending the 5 newest.

The 'activities' field is nested under 'project' in the GraphQl query so
it must be looked up by 'project/activities' path. Lookup by 'activities'
returned 'None' and raised AttributeError on 'set_limit'.
@BigRoy BigRoy added the type: bug Something isn't working label Oct 5, 2026
@BigRoy BigRoy self-assigned this Oct 5, 2026
@BigRoy
BigRoy requested a review from iLLiCiTiT October 5, 2026 09:39
@iLLiCiTiT
iLLiCiTiT merged commit 445acab into develop Oct 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants