Skip to content

refactor(BA-6619): consolidate AppConfigScopeType into common.data (single definition)#12403

Merged
seedspirit merged 2 commits into
mainfrom
feat/BA-6619-app-config-scope-type-consolidation
Jun 25, 2026
Merged

refactor(BA-6619): consolidate AppConfigScopeType into common.data (single definition)#12403
seedspirit merged 2 commits into
mainfrom
feat/BA-6619-app-config-scope-type-consolidation

Conversation

@jopemachine

@jopemachine jopemachine commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

AppConfigScopeType was defined three times — in the app_config_allow_list DTO, the app_config_allow_list data, and the app_config_fragment data. This consolidates it to a single definition in ai.backend.common.data.app_config.types (with the to_rbac_scope_type / to_rbac_scope_id helpers), and has every layer (data, DTO, GraphQL, models, repositories, client, tests) import it directly from there.

No re-exports: the DTO types module keeps the import only for its AppConfigScopeTypeFilter model and drops it from __all__; all other modules import from common.data directly.

Split out of the AppConfigFragment service PR (#12358) so the enum consolidation lands independently at the base of the stack.

Changes

  • New common/data/app_config/types.py — the single AppConfigScopeType.
  • Removed the 3 duplicate class AppConfigScopeType definitions; repointed all importers to common.data.

📚 Stacked PRs

Part of the AppConfigFragment / AppConfig stack under BEP-1052 (epic BA-5781). Merge in order:

  1. feat(BA-6552): add app_config_fragments DB model and Alembic migration #12306feat(BA-6552): app_config_fragments DB model and Alembic migration
  2. feat(BA-6553): add app_config_fragments repository layer #12307feat(BA-6553): repository layer
  3. 👉 refactor(BA-6619): consolidate AppConfigScopeType into common.data (single definition) #12403refactor(BA-6619): consolidate AppConfigScopeType into common.data ← you are here
  4. refactor(BA-6620): ExistsQuerier ops primitive + AppConfigAllowList.exists #12405refactor(BA-6620): ExistsQuerier + AppConfigAllowList.exists
  5. feat(BA-6554): add app_config_fragment service layer #12358feat(BA-6554): AppConfigFragment service layer
  6. feat(BA-6618): app_config_fragment bulk CRUD service layer #12401feat(BA-6618): AppConfigFragment bulk CRUD service layer
  7. feat(BA-6555): add app_config service layer #12359feat(BA-6555): app_config service layer
  8. feat(BA-6556): AppConfig REST v2 API (raw fragments and merged read/update) #12377feat(BA-6556): AppConfig REST v2 API

…ingle definition)

AppConfigScopeType was defined three times — in the app_config_allow_list DTO, the
app_config_allow_list data, and the app_config_fragment data. Define it once in
ai.backend.common.data.app_config.types (with the to_rbac_scope_type/to_rbac_scope_id
helpers) and have every layer (data, DTO, GraphQL, models, repositories, client, tests)
import it directly from there. No re-exports: the DTO types module keeps the import only
for its filter model and drops it from __all__.

Split out of the AppConfigFragment service PR (BA-6554) to land at the base of the stack.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the size:L 100~500 LoC label Jun 25, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added comp:manager Related to Manager component comp:client Related to Client component comp:common Related to Common component comp:cli Related to CLI component labels Jun 25, 2026
@jopemachine jopemachine marked this pull request as ready for review June 25, 2026 03:52
@jopemachine jopemachine requested a review from a team as a code owner June 25, 2026 03:52
Copilot AI review requested due to automatic review settings June 25, 2026 03:52

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 removes a duplicated AppConfigScopeType enum that had drifted into three separate definitions (the app_config_allow_list DTO, the app_config_allow_list data module, and the app_config_fragment data module) and replaces them with a single source of truth in a new ai.backend.common.data.app_config.types module. Every layer — data, DTO, GraphQL, models, repositories, client/CLI, and tests — now imports the enum directly from common.data, with no re-exports. It is the base PR of the BEP-1052 AppConfigFragment/AppConfig stack, deliberately landed first so the enum consolidation is independent of the downstream service/API PRs.

Changes:

  • Adds common/data/app_config/types.py containing the single AppConfigScopeType plus new to_rbac_scope_type / to_rbac_scope_id helpers (the helpers are foundation for the later service layer and are not yet consumed).
  • Deletes the three duplicate class AppConfigScopeType definitions and repoints all importers (including the DTO module, which keeps the import only for its AppConfigScopeTypeFilter and drops the enum from __all__).
  • Updates all affected unit tests to import from the new location.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/ai/backend/common/data/app_config/types.py New single definition of AppConfigScopeType with RBAC scope helpers.
src/ai/backend/common/data/app_config/init.py New empty package marker.
src/ai/backend/common/dto/manager/v2/app_config_allow_list/types.py Drops the local enum class and re-imports it from common.data for the filter model; removes it from __all__.
src/ai/backend/common/dto/manager/v2/app_config_allow_list/request.py Repoints AppConfigScopeType import to common.data.
src/ai/backend/common/dto/manager/v2/app_config_allow_list/response.py Repoints AppConfigScopeType import to common.data.
src/ai/backend/manager/data/app_config_allow_list/types.py Removes the duplicate enum; imports from common.data.
src/ai/backend/manager/data/app_config_fragment/types.py Removes the duplicate enum; imports from common.data.
src/ai/backend/manager/models/app_config_allow_list/row.py Repoints enum import.
src/ai/backend/manager/models/app_config_allow_list/conditions.py Repoints enum import.
src/ai/backend/manager/models/app_config_fragment/row.py Repoints enum import.
src/ai/backend/manager/models/app_config_fragment/conditions.py Repoints enum import.
src/ai/backend/manager/repositories/app_config_allow_list/creators.py Repoints enum import.
src/ai/backend/manager/repositories/app_config_fragment/creators.py Repoints enum import.
src/ai/backend/manager/api/gql/app_config_allow_list/types.py Repoints enum import to common.data, keeps the DTO filter alias.
src/ai/backend/manager/api/adapters/app_config_allow_list/adapter.py Repoints imports; leaves a redundant double-import of the same symbol (see comment).
src/ai/backend/client/cli/v2/admin/app_config_allow_list.py Repoints enum import.
tests/unit/... (5 files) Update test imports to the new location.
changes/12403.misc.md Changelog entry for the consolidation.

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

Comment on lines +8 to +9
from ai.backend.common.data.app_config.types import AppConfigScopeType
from ai.backend.common.data.app_config.types import AppConfigScopeType as AppConfigScopeTypeDTO
@seedspirit seedspirit merged commit b17cd62 into main Jun 25, 2026
39 checks passed
@seedspirit seedspirit deleted the feat/BA-6619-app-config-scope-type-consolidation branch June 25, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:cli Related to CLI component comp:client Related to Client component comp:common Related to Common component comp:manager Related to Manager component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants