lablup / lablup/backend.ai

Switch v2 domain registry field type from list[str] (names) to list[UUID] (ids)

Open
#11,201 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

## Description

Change the existing `allowed_docker_registries` field in the v2 stack so it carries container registry UUIDs instead of names. Field name is preserved; only the element type changes from `list[str]` to `list[UUID]`. The gql_legacy graphene schema is unchanged (covered by a separate compatibility story).

## Changes by Layer

### DTO v2 (common/dto/manager/v2/domain/)

- `request.py`: `CreateDomainInput.allowed_docker_registries: list[UUID] | None` and `UpdateDomainInput.allowed_docker_registries: list[UUID] | Sentinel | None`.
- `response.py`: `DomainRegistryInfo.allowed_docker_registries: list[UUID]`.

### GQL v2 (api/gql/domain_v2/types/)

- `nested.py`: `DomainRegistryInfoGQL.allowed_docker_registries: list[UUID]`.
- `mutations.py`: `CreateDomainInputGQL` and `UpdateDomainInputGQL` accept `list[UUID]`.
- Update field description text to reflect that values are registry UUIDs.

### Adapter (api/adapters/domain.py)

- `admin_create` passes the UUID list through to `DomainCreatorSpec.allowed_docker_registries`.
- `admin_update` maps the `Sentinel | None | list[UUID]` input into `OptionalState[list[UUID]]` on `DomainNodeUpdaterSpec`.
- `_domain_data_to_node` emits UUIDs from the canonical `DomainData` (sourced via ASE — see the read-path story).

### Internal Data Type (data/domain/types.py)

- `DomainData.allowed_docker_registries: list[UUID]`.
- `DomainCreatorSpec.allowed_docker_registries: list[UUID] | None`.
- `DomainNodeUpdaterSpec.allowed_docker_registries: OptionalState[list[UUID]]`.

### v2 SDK and CLI

- `client/v2/domains_v2/domain.py` and `client/cli/v2/admin/domain.py` forward JSON straight into the Pydantic DTO, so no per-field code changes are required — callers now pass UUID strings.

## Out of Scope

- Anything in `api/gql_legacy/`, `client/func/domain.py`, or `client/cli/admin/domain.py` (handled by the gql_legacy compatibility story).

## Success Criteria

- v2 REST and v2 GQL create/update accept registry UUIDs; invalid UUIDs are rejected by Pydantic with a clear error.
- v2 GQL query and REST GET responses return registry UUIDs in the field.
- v2 SDK and CLI flows succeed end-to-end with UUID input (verified via ./bai admin domain create/update).
- pants test passes for the affected packages.

JIRA Issue: BA-5788

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.