Skip to content

feat(BA-6552): add app_config_fragments DB model and Alembic migration#12306

Merged
fregataa merged 2 commits into
mainfrom
feat/BA-6552-app-config-fragments-model
Jun 22, 2026
Merged

feat(BA-6552): add app_config_fragments DB model and Alembic migration#12306
fregataa merged 2 commits into
mainfrom
feat/BA-6552-app-config-fragments-model

Conversation

@jopemachine

@jopemachine jopemachine commented Jun 18, 2026

Copy link
Copy Markdown
Member

📚 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 ← you are here
  2. feat(BA-6553): add app_config_fragments repository layer #12307feat(BA-6553): repository layer
  3. feat(BA-6554): add app_config_fragment service layer #12358feat(BA-6554): service layer (admin/self write paths, allow-list write-gate)
  4. feat(BA-6555): add app_config service layer #12359feat(BA-6555): merge engine (deep-merge across applicable fragments)

Summary

  • Add the app_config_fragments table — the single source-of-truth for scoped app-config values (BEP-1052).
  • Columns: id (UUID PK), config_name (FK → app_config_definitions.config_name, ON DELETE NO ACTION), scope_type (public | domain | user), scope_id, rank (merge priority within a config_name), config (JSONB), created_at / updated_at.
  • Natural-key uniqueness on (config_name, scope_type, scope_id).
  • Adds the SQLAlchemy AppConfigFragmentRow, the AppConfigFragmentData value type, and the AppConfigFragmentID identifier.

Notes

  • The migration chains off 9fc9e6bfe695 (the app_config_definitions migration), which is the same head the unmerged AppConfigAllowList migration (feat(BA-6543): add app_config_allow_list DB model and Alembic migration #12289) also chains off. Expect a diverged-alembic-heads conflict when both lines land — resolve by re-chaining one migration onto the other.
  • AppConfigScopeType (public/domain/user) is defined locally in this stack's data module; it duplicates the identical enum on the unmerged AppConfigAllowList stack (cross-stack import isn't possible while both are open). A follow-up should consolidate both into a shared app_config module once the stacks land.
  • DB-only PR; no tests (matches the AppConfigDefinition / AppConfigAllowList DB PRs). The table is exercised by the repository PR's with_tables tests (BA-6553).

Resolves BA-6552.

@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 labels Jun 18, 2026
@jopemachine jopemachine force-pushed the feat/BA-6552-app-config-fragments-model branch from ee2522e to e5fdd83 Compare June 19, 2026 01:01
jopemachine and others added 2 commits June 22, 2026 16:52
Introduce the app_config_fragments table (BEP-1052): the single
source-of-truth for scoped app-config values, keyed by
(config_name, scope_type, scope_id) with a rank for the merge order
and a schema-less JSONB config payload. config_name references the
registered app_config_definitions set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jopemachine jopemachine force-pushed the feat/BA-6552-app-config-fragments-model branch from e5fdd83 to 7fa8339 Compare June 22, 2026 07:52
@jopemachine jopemachine marked this pull request as ready for review June 22, 2026 07:55
@jopemachine jopemachine requested a review from a team as a code owner June 22, 2026 07:55
Copilot AI review requested due to automatic review settings June 22, 2026 07:55

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

Adds the initial persistence layer for scoped AppConfig fragments in the manager, introducing a new SQLAlchemy row model + identifier/value types, and an Alembic migration to create the backing app_config_fragments table.

Changes:

  • Add app_config_fragments DB table (UUID PK, (config_name, scope_type, scope_id) natural-key uniqueness, JSONB config payload, rank, timestamps).
  • Add AppConfigFragmentRow ORM model + to_data() conversion to a frozen AppConfigFragmentData value type.
  • Add AppConfigFragmentID typed identifier and a changelog entry.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/ai/backend/manager/models/app_config_fragment/row.py Defines the AppConfigFragmentRow ORM mapping and to_data() conversion.
src/ai/backend/manager/models/app_config_fragment/init.py Exposes AppConfigFragmentRow via package import.
src/ai/backend/manager/models/alembic/versions/a8e06485829f_create_app_config_fragments_table.py Creates/drops the app_config_fragments table via Alembic.
src/ai/backend/manager/data/app_config_fragment/types.py Adds AppConfigFragmentData and scope typing for fragment records.
src/ai/backend/manager/data/app_config_fragment/init.py Initializes the app_config_fragment data package.
src/ai/backend/common/identifier/app_config_fragment.py Introduces AppConfigFragmentID as a NewType UUID identifier.
changes/12306.feature.md Adds a changelog fragment announcing the new DB model/migration.

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

Comment on lines +3 to +17
import enum
from dataclasses import dataclass
from datetime import datetime
from typing import Any

from ai.backend.common.identifier.app_config_fragment import AppConfigFragmentID


class AppConfigScopeType(enum.StrEnum):
"""Scope at which an app config fragment is written (BEP-1052)."""

PUBLIC = "public"
DOMAIN = "domain"
USER = "user"

Comment on lines +23 to +25
revision = "a8e06485829f"
down_revision = "2d6443ac0d4a"
# Part of: 26.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants