lablup / lablup/backend.ai

Read project vfolders from the virtual scope chain instead of vfolders.group

Open
#14,053 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

Replace the ownership predicate in `ProjectVFolderOperationScope` (`src/ai/backend/manager/models/vfolder/scopes.py:27`) so the rows it bounds are read from the virtual scope chain instead of the legacy ownership column.

## Current

`VFolderRow.group == :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/vfolder/creators.py:60 declares member_of() -> (ProjectID,) for a group-owned folder.

## Entry points

- `api/gql/vfolder_v2/resolver/query.py:106`
- `api/rest/v2/vfolder/handler.py:45`
- `api/adapters/vfolder/adapter.py:324`

## 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-7526

Contributor guide

Open the contributing guide

Research direction

Start with ProjectVFolderOperationScope in src/ai/backend/manager/models/vfolder/scopes.py:27 and read the virtual-scope query helpers in src/ai/backend/manager/models/virtual_scope/queries.py. Review the write-side declaration in src/ai/backend/manager/models/vfolder/creators.py:60 and the listed API entry points to understand usage. Add coverage showing the converted read returns the same rows as the column-based query on backfilled data, with no legacy ownership reference remaining in to_condition().

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
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.