Read project deployments from the virtual scope chain instead of endpoints.project
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 368
Description
Replace the ownership predicate in `ProjectDeploymentOperationScope` (`src/ai/backend/manager/models/endpoint/scopes.py:20`) so the rows it bounds are read from the virtual scope chain instead of the legacy ownership column.
## Current
`EndpointRow.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/endpoint/creators.py:79 declares member_of() -> (project_id, session_owner_id).
## Entry points
- `services/deployment/processors.py:343` -> `SearchDeploymentsInProjectAction`
## Note
No API handler reaches this action yet; it is wired only as far as the processor. Converting it now keeps a legacy read from landing when the handler is added.
## 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-7529
Contributor guide
Research direction
Start in src/ai/backend/manager/models/endpoint/scopes.py:20 and inspect the virtual-scope query helpers in src/ai/backend/manager/models/virtual_scope/queries.py. Trace the read from services/deployment/processors.py:343 and compare it with member_of() in endpoint/creators.py:79. Done means to_condition() no longer uses the legacy ownership column and a test confirms identical rows on backfilled data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, databases
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100