lablup / lablup/backend.ai

Switch artifact update DTO to Unset

Open
#14,370 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

## Scope

|Target|Change|
|---|---|
|DTO|`common/dto/manager/v2/artifact/request.py` — 1 field|
|Adapter|`manager/api/adapters/artifact/adapter.py` — 1 branch|
|CLI|`client/cli/v2/artifact/commands.py` L60-62 — `SENTINEL` → `UNSET`|
|Tests|`tests/unit/common/dto/manager/v2/artifact/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 artifact update`: field omitted → unchanged, `null` → cleared, value → updated

JIRA Issue: BA-7745

Contributor guide

Open the contributing guide

Research direction

Start with common/dto/manager/v2/artifact/request.py, manager/api/adapters/artifact/adapter.py, and client/cli/v2/artifact/commands.py lines 60-62, then inspect the named unit tests and other SENTINEL references. Run the artifact update command to verify omitted fields remain unchanged, null clears nullable fields, and values update fields; confirm no Sentinel or SENTINEL references remain in this domain.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend, cli, testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.