Skip to content

feat(BA-6644): Add domain id, resource group id in session row#12452

Merged
HyeockJinKim merged 6 commits into
mainfrom
feat/BA-6644
Jul 3, 2026
Merged

feat(BA-6644): Add domain id, resource group id in session row#12452
HyeockJinKim merged 6 commits into
mainfrom
feat/BA-6644

Conversation

@seedspirit

@seedspirit seedspirit commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add nullable domain/resource group id columns to sessions and backfill existing rows.
  • Populate session scope ids across session, registry, model-serving, and deployment enqueue paths.
  • Keep resource group name compatibility while adding resource_group_id request support.

Test plan

  • pants fmt --changed-since=HEAD~1
  • pants fix --changed-since=HEAD~1
  • pants lint --changed-since=HEAD~1
  • pants check --changed-since=HEAD~1
  • pants test --changed-since=HEAD~1
  • push hook lint/check/test on origin/main..HEAD

Resolves BA-6644


📚 Documentation preview 📚: https://sorna--12452.org.readthedocs.build/en/12452/


📚 Documentation preview 📚: https://sorna-ko--12452.org.readthedocs.build/ko/12452/

@github-actions github-actions Bot added size:L 100~500 LoC comp:manager Related to Manager component comp:common Related to Common component require:db-migration Automatically set when alembic migrations are added or updated area:docs Documentations labels Jun 30, 2026
@seedspirit seedspirit changed the title feat(BA-6644): populate session scope ids feat(BA-6644): store session scope IDs Jun 30, 2026
seedspirit added a commit that referenced this pull request Jun 30, 2026
@seedspirit seedspirit changed the title feat(BA-6644): store session scope IDs feat(BA-6644): Add domain id, resource group id in session row Jun 30, 2026
@seedspirit seedspirit marked this pull request as ready for review June 30, 2026 08:10
@seedspirit seedspirit requested a review from a team as a code owner June 30, 2026 08:10
Copilot AI review requested due to automatic review settings June 30, 2026 08:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR denormalizes ownership/placement identifiers onto session rows by adding nullable domain_id and resource_group_id columns to the sessions table, backfilling existing rows, and propagating these IDs through every session-enqueue path (interactive sessions, registry, model-serving dry-run, and deployment enqueue). It also extends the v2 GraphQL/REST EnqueueSessionInput with a new resource_group_id field while deprecating the name-based resource_group, and changes pick_default_resource_group to return a combined id+name identifier.

Changes:

  • Add domain_id/resource_group_id columns + Alembic migration (ada41cb881bb) with backfill and indexes.
  • Resolve and populate domain/resource-group IDs in the session, registry, model-serving, and deployment scope-building flows; introduce ResourceGroupIdentifier and new id-by-name repository lookups.
  • Add a resource_group_id request field (GQL/REST DTO) and deprecate resource_group, with schema docs updated.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
models/alembic/versions/ada41cb881bb_add_session_scope_id_columns.py New migration adding/backfilling the two ID columns and indexes
models/session/row.py Adds domain_id/resource_group_id ORM columns (uses bare GUID for typed columns)
services/session/service.py Resolves domain/RG IDs during enqueue; RG selection still gated on the deprecated name
services/session/actions/enqueue_session.py Adds resource_group_id to the resource spec
services/model_serving/services/model_serving.py Builds session scope with resolved domain/RG IDs
registry.py Builds session scope with resolved domain/RG IDs
repositories/scheduler/repository.py / db_source/db_source.py New get_domain_id_by_name/get_resource_group_id_by_name; pick_default_resource_group returns identifier
repositories/scheduler/types/session_creation.py New ResourceGroupIdentifier; AllowedScalingGroup gains typed id/name
repositories/deployment/db_source/db_source.py Resolves and threads domain/RG IDs into DeploymentContext
repositories/scheduler/creators.py Persists domain_id/resource_group_id on the row
data/session/spec.py, draft.py, creation.py Adds id fields to scope/draft/deployment-context models
sokovan/deployment/deployment_draft_builder.py Passes context IDs into the session scope draft
api/gql/session/types.py, api/adapters/session/adapter.py, dto/.../session/request.py Adds resource_group_id input field, deprecates resource_group, maps it into the action
docs/manager/graphql-reference/*.graphql Schema docs for the new/deprecated input fields
tests/..., changes/12452.feature.md Updates fixtures/assertions for new repos and identifier types; changelog

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ai/backend/manager/services/session/service.py Outdated
Comment thread src/ai/backend/manager/models/session/row.py Outdated
Comment thread src/ai/backend/manager/models/session/row.py Outdated
@seedspirit seedspirit requested a review from HyeockJinKim June 30, 2026 10:04
Comment thread src/ai/backend/common/dto/manager/v2/session/request.py Outdated
Comment thread src/ai/backend/manager/models/session/row.py Outdated
Comment thread src/ai/backend/manager/models/session/row.py Outdated
Comment thread src/ai/backend/manager/data/session/spec.py Outdated
Comment thread src/ai/backend/manager/api/gql/session/types.py Outdated
Comment thread src/ai/backend/manager/repositories/scheduler/db_source/db_source.py Outdated
@github-actions github-actions Bot added size:XL 500~ LoC and removed size:L 100~500 LoC labels Jul 3, 2026
self,
db_sess: SASession,
deployment_info: DeploymentInfo,
) -> tuple[DomainID, ResourceGroupID]:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote it this way because this method is used in only one place, and since it will be removed during future refactoring based on the ID, I didn't wrap it in a separate data class or split it into two methods.

seedspirit added a commit that referenced this pull request Jul 3, 2026
Comment on lines +138 to +142
sessions: Mapped[list[SessionRow]] = relationship(
"SessionRow",
back_populates="domain",
foreign_keys="[SessionRow.domain_name]",
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

Comment thread src/ai/backend/testutils/fixtures.py Outdated
HyeockJinKim
HyeockJinKim previously approved these changes Jul 3, 2026
seedspirit and others added 3 commits July 3, 2026 16:45
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@HyeockJinKim HyeockJinKim merged commit ef6302b into main Jul 3, 2026
36 checks passed
@HyeockJinKim HyeockJinKim deleted the feat/BA-6644 branch July 3, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:common Related to Common component comp:manager Related to Manager component require:db-migration Automatically set when alembic migrations are added or updated size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants