Skip to content

Commit 5c68a95

Browse files
committed
fix(BA-5830): wire AppConfigAdapter into Fragment REST handler my_bulk
After BA-5829 split the merged-view methods (`my_bulk_create` / `my_bulk_update`) into their own `AppConfigAdapter`, the Fragment REST handler still referenced them on `AppConfigFragmentAdapter` (404 at type-check time). The fragment routes own these URLs (the SDK already posts to `/v2/app-config-fragments/my/bulk-*`), so inject the `AppConfigAdapter` alongside the Fragment one and dispatch the my-bulk calls there. Also flips `V2AppConfigHandler` to take `AppConfigAdapter` instead of the now-stale Fragment adapter.
1 parent 9964666 commit 5c68a95

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

src/ai/backend/manager/api/rest/v2/app_config_fragment/handler.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,28 @@
3030
)
3131

3232
if TYPE_CHECKING:
33+
from ai.backend.manager.api.adapters.app_config import AppConfigAdapter
3334
from ai.backend.manager.api.adapters.app_config_fragment import AppConfigFragmentAdapter
3435

3536
log: Final = BraceStyleAdapter(logging.getLogger(__spec__.name))
3637

3738

3839
class V2AppConfigFragmentHandler:
39-
"""REST v2 handler for app-config fragment operations."""
40+
"""REST v2 handler for app-config fragment operations.
4041
41-
def __init__(self, *, adapter: AppConfigFragmentAdapter) -> None:
42+
Self-service `my_bulk_*` writes return recomputed merged
43+
`AppConfig` views, so they are dispatched to `AppConfigAdapter`;
44+
everything else is the raw-row Fragment surface.
45+
"""
46+
47+
def __init__(
48+
self,
49+
*,
50+
adapter: AppConfigFragmentAdapter,
51+
app_config_adapter: AppConfigAdapter,
52+
) -> None:
4253
self._adapter = adapter
54+
self._app_config_adapter = app_config_adapter
4355

4456
# ── Reads ────────────────────────────────────────────────────
4557

@@ -107,15 +119,15 @@ async def my_bulk_create(
107119
body: BodyParam[BulkCreateMyAppConfigFragmentsInput],
108120
) -> APIResponse:
109121
"""Self-service bulk create on the caller's `USER` row."""
110-
result = await self._adapter.my_bulk_create(body.parsed)
122+
result = await self._app_config_adapter.my_bulk_create(body.parsed)
111123
return APIResponse.build(status_code=HTTPStatus.OK, response_model=result)
112124

113125
async def my_bulk_update(
114126
self,
115127
body: BodyParam[BulkUpdateMyAppConfigFragmentsInput],
116128
) -> APIResponse:
117129
"""Self-service bulk update on the caller's `USER` row."""
118-
result = await self._adapter.my_bulk_update(body.parsed)
130+
result = await self._app_config_adapter.my_bulk_update(body.parsed)
119131
return APIResponse.build(status_code=HTTPStatus.OK, response_model=result)
120132

121133

src/ai/backend/manager/api/rest/v2/tree.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ def build_v2_routes(
122122
# Build all handlers (each takes its individual adapter)
123123
agent_handler = V2AgentHandler(adapter=adapters.agent)
124124
app_config_handler = V2AppConfigHandler(adapter=adapters.app_config)
125-
app_config_fragment_handler = V2AppConfigFragmentHandler(adapter=adapters.app_config_fragment)
125+
app_config_fragment_handler = V2AppConfigFragmentHandler(
126+
adapter=adapters.app_config_fragment,
127+
app_config_adapter=adapters.app_config,
128+
)
126129
app_config_policy_handler = V2AppConfigPolicyHandler(adapter=adapters.app_config_policy)
127130
artifact_handler = V2ArtifactHandler(adapter=adapters.artifact)
128131
artifact_registry_handler = V2ArtifactRegistryHandler(adapter=adapters.artifact_registry)

0 commit comments

Comments
 (0)