Skip to content

Commit d9c05be

Browse files
jopemachineclaude
andcommitted
feat(BA-5829): add AppConfigFragment + AppConfig GQL surface
Adds the GraphQL exposure for AppConfigFragment and the merged AppConfig view (BEP-1052 §2 / §5). Service / processor additions (only what the GQL layer needs that is not already in BA-5827): - Merged-view actions: get_user_app_config, search_user_app_configs, admin_search_app_configs (single-row + paginated reads of the computed AppConfig view). - Service methods + processor wiring + supported_actions for those three actions. Adapter additions: - Merged-view methods: get_user_app_config / my_app_configs / admin_search_app_configs / public_app_config_fragments. `my_*` pulls the user from current_user() inside the adapter. - Bulk-only `my` mutations: my_bulk_create / my_bulk_update — bulk admin variants are wired in BA-5827 already. DTO additions: - common/dto/manager/v2/app_config/* — AppConfigNode, GetUserAppConfigInput / Payload, SearchAppConfigsInput / Payload, SearchMyAppConfigsInput, BulkCreate/UpdateMyAppConfigFragmentsPayload (the my-bulk payloads live here because they carry AppConfigNode). GraphQL: - app_config package: AppConfigGQL, my/admin/public root resolvers. - app_config_fragment package: scope-bound + admin queries, bulk-only mutations (admin + my variants), AppConfigFragmentGQL + AppConfigScopeTypeGQL + filter/order/key inputs. - DataLoader: app_config_fragment_loader for N+1 batching. - schema.py: register the new root queries / mutations. Resolves BA-5829. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f671845 commit d9c05be

25 files changed

Lines changed: 472 additions & 189 deletions

File tree

src/ai/backend/common/dto/manager/v2/app_config/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
AppConfig (merged view) DTOs v2 for Manager API.
2+
AppConfig (merged view) DTOs v2 for Manager API (BEP-1052 §5).
33
"""
44

55
from .request import (
@@ -11,9 +11,9 @@
1111
)
1212
from .response import (
1313
AppConfigNode,
14+
BulkCreateMyAppConfigFragmentsPayload,
15+
BulkUpdateMyAppConfigFragmentsPayload,
1416
GetUserAppConfigPayload,
15-
MyBulkCreateAppConfigFragmentsPayload,
16-
MyBulkUpdateAppConfigFragmentsPayload,
1717
SearchAppConfigsPayload,
1818
)
1919
from .types import (
@@ -28,8 +28,8 @@
2828
"AppConfigOrder",
2929
"AppConfigOrderField",
3030
"AppConfigScopeType",
31-
"MyBulkCreateAppConfigFragmentsPayload",
32-
"MyBulkUpdateAppConfigFragmentsPayload",
31+
"BulkCreateMyAppConfigFragmentsPayload",
32+
"BulkUpdateMyAppConfigFragmentsPayload",
3333
"GetUserAppConfigInput",
3434
"GetUserAppConfigPayload",
3535
"OrderDirection",

src/ai/backend/common/dto/manager/v2/app_config/request.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Request DTOs for AppConfig (merged view) DTO v2.
2+
Request DTOs for AppConfig (merged view) DTO v2 (BEP-1052 §5).
33
"""
44

55
from __future__ import annotations
@@ -9,7 +9,7 @@
99
from pydantic import Field
1010

1111
from ai.backend.common.api_handlers import BaseRequestModel
12-
from ai.backend.common.dto.manager.query import DateTimeFilter, StringFilter, UUIDFilter
12+
from ai.backend.common.dto.manager.query import StringFilter, UUIDFilter
1313

1414
from .types import AppConfigOrderField, OrderDirection
1515

@@ -31,27 +31,13 @@ class GetUserAppConfigInput(BaseRequestModel):
3131

3232

3333
class AppConfigFilter(BaseRequestModel):
34-
"""Filter for AppConfig merged-view search.
35-
36-
`created_at` / `updated_at` filter against the **oldest** /
37-
**latest** timestamp across the contributing fragments — the
38-
natural projection of "when was this config first created" and
39-
"when was it last touched".
40-
"""
34+
"""Filter for AppConfig merged-view search."""
4135

4236
name: StringFilter | None = Field(default=None, description="Filter by policy name.")
4337
user_id: UUIDFilter | None = Field(
4438
default=None,
4539
description="Filter by target user id (admin cross-user search only).",
4640
)
47-
created_at: DateTimeFilter | None = Field(
48-
default=None,
49-
description=("Filter by the oldest contributing fragment's creation timestamp."),
50-
)
51-
updated_at: DateTimeFilter | None = Field(
52-
default=None,
53-
description=("Filter by the latest contributing fragment's update timestamp."),
54-
)
5541

5642

5743
class AppConfigOrder(BaseRequestModel):
@@ -76,7 +62,7 @@ class SearchMyAppConfigsInput(_AppConfigSearchInputBase):
7662
"""Input for self-service merged-view search (`/v2/app-configs/my/search`).
7763
7864
The adapter pins the caller as the user scope; no `user_id` argument
79-
is accepted here.
65+
is accepted here (BEP-1052 §5 — `filter.userId` is ignored).
8066
"""
8167

8268

src/ai/backend/common/dto/manager/v2/app_config/response.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Response DTOs for AppConfig (merged view) DTO v2.
2+
Response DTOs for AppConfig (merged view) DTO v2 (BEP-1052 §5).
33
"""
44

55
from __future__ import annotations
@@ -17,15 +17,15 @@
1717

1818
__all__ = (
1919
"AppConfigNode",
20-
"MyBulkCreateAppConfigFragmentsPayload",
21-
"MyBulkUpdateAppConfigFragmentsPayload",
20+
"BulkCreateMyAppConfigFragmentsPayload",
21+
"BulkUpdateMyAppConfigFragmentsPayload",
2222
"GetUserAppConfigPayload",
2323
"SearchAppConfigsPayload",
2424
)
2525

2626

2727
class AppConfigNode(BaseResponseModel):
28-
"""Merged per-user AppConfig view.
28+
"""Merged per-user AppConfig view (BEP-1052 §5).
2929
3030
`fragments` are ordered low → high merge priority (matching the
3131
policy's `scope_sources`). `config` is the deep-merged result,
@@ -62,11 +62,11 @@ class SearchAppConfigsPayload(BaseResponseModel):
6262
has_previous_page: bool = Field(default=False, description="Whether there is a previous page.")
6363

6464

65-
class MyBulkCreateAppConfigFragmentsPayload(BaseResponseModel):
65+
class BulkCreateMyAppConfigFragmentsPayload(BaseResponseModel):
6666
"""Payload for `bulkCreateMyAppConfigFragments`.
6767
6868
Each successfully created row produces a recomputed merged
69-
`AppConfigNode`; failures are collected per-item.
69+
`AppConfigNode`; failures are collected per-item (BEP-1052 §3).
7070
"""
7171

7272
created: list[AppConfigNode] = Field(
@@ -75,7 +75,7 @@ class MyBulkCreateAppConfigFragmentsPayload(BaseResponseModel):
7575
failed: list[AppConfigFragmentBulkError] = Field(description="Per-item failures.")
7676

7777

78-
class MyBulkUpdateAppConfigFragmentsPayload(BaseResponseModel):
78+
class BulkUpdateMyAppConfigFragmentsPayload(BaseResponseModel):
7979
"""Payload for `bulkUpdateMyAppConfigFragments`."""
8080

8181
updated: list[AppConfigNode] = Field(

src/ai/backend/common/dto/manager/v2/app_config/types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Common types for AppConfig (merged view) DTO v2.
2+
Common types for AppConfig (merged view) DTO v2 (BEP-1052 §5).
33
"""
44

55
from __future__ import annotations
@@ -21,5 +21,3 @@ class AppConfigOrderField(StrEnum):
2121

2222
USER_ID = "user_id"
2323
NAME = "name"
24-
CREATED_AT = "created_at"
25-
UPDATED_AT = "updated_at"

0 commit comments

Comments
 (0)