feat(BA-6552): add app_config_fragments DB model and Alembic migration#12306
Merged
Conversation
ee2522e to
e5fdd83
Compare
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>
e5fdd83 to
7fa8339
Compare
Contributor
There was a problem hiding this comment.
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_fragmentsDB table (UUID PK,(config_name, scope_type, scope_id)natural-key uniqueness, JSONB config payload, rank, timestamps). - Add
AppConfigFragmentRowORM model +to_data()conversion to a frozenAppConfigFragmentDatavalue type. - Add
AppConfigFragmentIDtyped 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 |
fregataa
approved these changes
Jun 22, 2026
This was referenced Jun 23, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📚 Stacked PRs
Part of the AppConfigFragment / AppConfig stack under BEP-1052 (epic BA-5781). Merge in order:
feat(BA-6552): app_config_fragments DB model and Alembic migration← you are herefeat(BA-6553): repository layerfeat(BA-6554): service layer (admin/self write paths, allow-list write-gate)feat(BA-6555): merge engine (deep-merge across applicable fragments)Summary
app_config_fragmentstable — the single source-of-truth for scoped app-config values (BEP-1052).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 aconfig_name),config(JSONB),created_at/updated_at.(config_name, scope_type, scope_id).AppConfigFragmentRow, theAppConfigFragmentDatavalue type, and theAppConfigFragmentIDidentifier.Notes
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 sharedapp_configmodule once the stacks land.with_tablestests (BA-6553).Resolves BA-6552.