Read project model cards from the virtual scope chain instead of model_cards.project
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
Replace the ownership predicate in `ProjectModelCardOperationScope` (`src/ai/backend/manager/models/model_card/scopes.py:50`) so the rows it bounds are read from the virtual scope chain instead of the legacy ownership column.
## Current
`ModelCardRow.project == :project_id`
## Target
Resolve membership through `entity_memberships` joined to `virtual_scopes`, keyed on the parent scope's virtual scope node.
Helpers live in `src/ai/backend/manager/models/virtual_scope/queries.py`.
## Write side
Present. src/ai/backend/manager/models/model_card/creators.py:59 declares member_of() -> (ProjectID,).
## Entry points
- `api/gql/model_card/resolver.py:99`
- `api/adapters/model_card/adapter.py:219`
## Done when
- The scope's `to_condition()` no longer references the legacy ownership column.
- A test proves the converted read returns the same rows as the column-based query on backfilled data.
JIRA Issue: BA-7530
Contributor guide
Research direction
Start with ProjectModelCardOperationScope in src/ai/backend/manager/models/model_card/scopes.py and compare its helpers with src/ai/backend/manager/models/virtual_scope/queries.py. Read the write-side declaration in src/ai/backend/manager/models/model_card/creators.py, then inspect the listed resolver and adapter entry points. Add a test showing the converted read returns the same rows as the legacy column query on backfilled data, and confirm to_condition() no longer references that column.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, databases
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100