lablup / lablup/backend.ai

Switch user update DTO to Unset

Closed
#14,389 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

## Scope

|Target|Change|
|---|---|
|DTO|`common/dto/manager/v2/user/request.py` — 9 fields|
|Adapter|`manager/api/adapters/user/adapter.py` — 9 branches; `manager/api/gql/user/resolver/mutation.py` — 8 branches|
|Tests|`tests/unit/common/dto/manager/v2/user/test_request.py` and any other `SENTINEL` references|

## Common work

- DTO: `X | Sentinel | None = Field(default=SENTINEL)` → `X | None | Unset = Field(default=UNSET)`, importing from `ai.backend.common.tristate.unset`
- Adapter: `TriState.from_unset` for nullable columns, `OptionalState.from_unset` for non-nullable columns
- Unify `Field(description=...)` wording to "Omit to leave unchanged; null clears." (drop "null clears" for non-nullable fields)
- Tests: `SENTINEL` → `UNSET`, `Sentinel` → `Unset`
- News fragment `changes/.enhance.md`

## Done when

- Zero `Sentinel` / `SENTINEL` references remain in this domain
- Verified with `./bai admin user update`: field omitted → unchanged, `null` → cleared, value → updated

JIRA Issue: BA-7764

Contributor guide

Open the contributing guide

Research direction

Start with common/dto/manager/v2/user/request.py, then trace the nine adapter branches in manager/api/adapters/user/adapter.py and eight resolver branches in manager/api/gql/user/resolver/mutation.py. Update the tests in tests/unit/common/dto/manager/v2/user/test_request.py and other SENTINEL references, add changes/.enhance.md, and run ./bai admin user update to verify omitted, null, and value inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.