lablup / lablup/backend.ai

Apply the virtual scope chain to the session template entity

Open
#14,074 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

Settle every scope operation of the `session_template` entity on the virtual scope chain. The wiring declares 4 scope operations for it; each one is accounted for below. Resolve ownership through `entity_memberships` joined to `virtual_scopes`; helpers live in `src/ai/backend/manager/models/virtual_scope/queries.py`.

## Convert

- `list_task_templates` and `list_cluster_templates` — `SessionTemplateRow.user_uuid` joined to users and outer joined to groups on `group_id` (`repositories/template/db_source/db_source.py:134`, `:271`); extract into an OperationScope first

## Write side

Missing. No session template creator declaring `member_of()` exists under models/, so `create_task_template` and `create_cluster_template` never record the template in its owner's virtual scope. The write side has to land first.

## Done when

- A session template creator declares member_of() and existing templates are backfilled.
- Neither listing filters on the owner column.
- Each converted read has a test proving it returns the same rows as the column-based query on backfilled data.

JIRA Issue: BA-7551

Contributor guide

Open the contributing guide

Research direction

Read src/ai/backend/manager/models/virtual_scope/queries.py and the SessionTemplateRow queries at repositories/template/db_source/db_source.py:134 and :271. Trace create_task_template and create_cluster_template, then inspect how existing templates are backfilled. Done means a member_of() creator exists, listings no longer filter on the owner column, and both reads have tests matching the column-based results on backfilled data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authorization, backend, databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.