Repository navigation
Conversation
Attributes of folder and task entities can resolve values inherited from parent folders and project with 'get_inherited', 'inherited_items' and 'to_dict(inherited=True)'. Values are resolved on each call from current values of entities in the hub. 'get_or_fetch_entity_by_id' returns project entity when project name is passed with 'project' entity type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks done
There was a problem hiding this comment.
🟡 Changes recommended
Integration tests are missing for the new inherited-entity API, leaving closest-parent precedence, project fallback, opt-out behavior, and uncommitted parent changes unverified.
1 open issue
What changed in this PR
Adds inherited attribute support to EntityHub, allowing folders and tasks to resolve effective values from their parent hierarchy while preserving access to their own values.
Changes:
- Adds
get_inherited,inherited_items, and inherited-awareto_dict. - Resolves parent attributes dynamically, including unloaded parents and uncommitted changes.
- Fixes lazy project entity lookup by project ID.
| File | Summary |
|---|---|
ayon_api/entity_hub.py |
Implements inherited attribute resolution and project lookup fixes. Review findings: treat a missing inherit schema flag as false (moderate, 1 vote); materialize one-shot entity_types iterables before membership checks (moderate, 1 vote); continue parent traversal when an intermediate schema lacks the attribute (moderate, 1 vote); add integration coverage for inheritance behavior (nit, 4 votes). |
Review effort: Lite
Comment on lines
+1384
to
+1389
| def get_inherited(self, key: str, default: Optional[Any] = None) -> Any: | ||
| """Get value of attribute with inheritance from parent entities. | ||
|
|
||
| Own value is returned if is set, otherwise value is taken from | ||
| the closest parent entity (folder or project) that has the value | ||
| set, if the attribute is inheritable. Value is resolved on each |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Changelog Description
Attributes of entities in
EntityHubcan return values inherited from parent entities. Folders inherit from parent folders and the project, tasks inherit from their folder.Additional info
EntityHub queries entities with
own_attributes=True, so there was no way to get the effective value of an attribute.inheritenabled in their schema, and only when the own value isNone.get_or_fetch_entity_by_idraisingValueErrorfor the project id with"project"entity type when the project was not loaded yet. It now returnsproject_entity.Testing notes:
EntityHubfor a project with nested folders, e.g./ep01/sq01/sh0100, where onlyep01hasframeStartset.sh0100(or its task) and checkattribs.get("frameStart")isNoneandattribs.get_inherited("frameStart")returns the value fromep01.attribs.to_dict(inherited=True, ignore_none=False)withattribof the same entity queried from server; they should match.frameStartonep01in the hub (without commit) and checkget_inheritedonsh0100returns the new value. Set a value onsq01and check it takes precedence.