Move the fair share types off EntityType onto DanglingFieldType
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 368
Description
A fair share row is not an entity, and the code already says so: the actions module docstring states that nothing there names an entity, and _FairShareScopeResult.entity_ids() answers an empty tuple. Yet DomainFairShareEntityType, ProjectFairShareEntityType and UserFairShareEntityType are declared as EntityType and wired as entity groups, which is what puts them among the types no id class names a row for.
One fair share concept attaches to several entities — domain, project and user — so the owner is not one fixed entity kind. That is a DanglingFieldType.
Scope:
- Redeclare the three types as DanglingFieldType in common/data/entity/fair_share.py
- Rewire the fair share actions off the entity group onto a field group in manager/services/factory.py, which needs the service-backed FieldGroup wiring the entity KNOWLEDGE.md already names as the prerequisite
- Keep the resource-group scope targets the actions declare today
- Update src/ai/backend/common/data/entity/KNOWLEDGE.md, which records this move as still pending
Open decision: whether the three stay as three types or collapse into one fair share field type discriminated by its owner.
Done when:
- The three types are DanglingFieldType and answer None for their owner
- The fair share actions run through field wiring and their audit rows name no entity
- No unclassified entity type remains for fair share
JIRA Issue: BA-7786
Contributor guide
Research direction
Read common/data/entity/fair_share.py and manager/services/factory.py, then review the service-backed FieldGroup prerequisite in entity/KNOWLEDGE.md. Resolve whether the three fair share types remain separate or collapse into one owner-discriminated type before changing the wiring. Done means they are DanglingFieldType values with no owner, actions use field wiring, audit rows name no entity, and the knowledge document is updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100