Skip to content

feat(BA-6618): app_config_fragment bulk CRUD service layer#12401

Merged
fregataa merged 1 commit into
mainfrom
feat/BA-6618-app-config-fragment-bulk-service
Jul 7, 2026
Merged

feat(BA-6618): app_config_fragment bulk CRUD service layer#12401
fregataa merged 1 commit into
mainfrom
feat/BA-6618-app-config-fragment-bulk-service

Conversation

@jopemachine

@jopemachine jopemachine commented Jun 25, 2026

Copy link
Copy Markdown
Member

Resolves #12400 (BA-6618)

Summary

Bulk create / update / purge for app_config_fragment at the service layer, on top of the repository bulk operations in #12426. Partial success: rejected/failed items are reported per item (batch index + reason) rather than failing the whole batch.

  • Bulk actions: create carries Sequence[AppConfigFragmentCreatorSpec]; update / purge carry plain Updater / Purger sequences. No service-level gate — each fragment's FK to app_config_allow_list authorizes the write (an insert with no matching allow-list row is rejected as write-not-allowed; feat(BA-6704): cascade app config subtree deletion from the definition #12518), and an existing fragment is always writable at its own scope.
  • AppConfigFragmentBulkAction base with per-item targets() (per-entity RBAC extension point — no validator wired yet); action results carry succeeded + failed[index, message].

Test plan

  • Service unit tests (mocked repository): bulk create/update/purge delegate correctly and map partial-success results
  • pants check / lint / test pass

📚 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
  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-6702): move fragment rank to the allow list with scope defaults #12516feat(BA-6702): move fragment rank to the allow list with scope defaults
  7. feat(BA-6701): expose allow-list rank on the v2 API surface #12517feat(BA-6701): expose allow-list rank on the v2 API surface
  8. feat(BA-6704): cascade app config subtree deletion from the definition #12518feat(BA-6704): cascade app config subtree deletion from the definition
  9. feat(BA-6626): app_config_fragment bulk repository layer #12426feat(BA-6626): app_config_fragment bulk repository layer
  10. 👉 feat(BA-6618): app_config_fragment bulk CRUD service layer #12401feat(BA-6618): app_config_fragment bulk CRUD service layer ← you are here
  11. feat(BA-6555): AppConfig merge engine + resolve service (service layer) #12359feat(BA-6555): app_config service layer (merge engine)
  12. feat(BA-6556): AppConfig REST v2 API (raw fragments and merged read/update) #12377feat(BA-6556): AppConfig REST v2 API

🤖 Generated with Claude Code

@github-actions github-actions Bot added size:XL 500~ LoC comp:manager Related to Manager component labels Jun 25, 2026
@jopemachine jopemachine force-pushed the feat/BA-6554-app-config-fragments-service branch from b596dd2 to 17ee41a Compare June 25, 2026 03:41
@jopemachine jopemachine force-pushed the feat/BA-6618-app-config-fragment-bulk-service branch from 274b602 to 2d822bb Compare June 25, 2026 03:41
@jopemachine jopemachine force-pushed the feat/BA-6554-app-config-fragments-service branch from 17ee41a to 380a8d0 Compare June 25, 2026 04:06
@jopemachine jopemachine force-pushed the feat/BA-6618-app-config-fragment-bulk-service branch from 2d822bb to 408d923 Compare June 25, 2026 04:06
@jopemachine jopemachine force-pushed the feat/BA-6554-app-config-fragments-service branch 2 times, most recently from 008639e to 89c2848 Compare June 25, 2026 07:24
@jopemachine jopemachine force-pushed the feat/BA-6618-app-config-fragment-bulk-service branch 3 times, most recently from f3e9bed to cc90dc1 Compare June 25, 2026 10:26
Base automatically changed from feat/BA-6554-app-config-fragments-service to main June 25, 2026 11:39
@jopemachine jopemachine force-pushed the feat/BA-6618-app-config-fragment-bulk-service branch from cc90dc1 to f9eb9a0 Compare June 25, 2026 11:49
Comment thread src/ai/backend/manager/services/app_config_fragment/actions/base.py Outdated
Comment thread src/ai/backend/manager/services/app_config_fragment/actions/bulk_create.py Outdated
Comment thread src/ai/backend/manager/services/app_config_fragment/actions/bulk_create.py Outdated
@jopemachine jopemachine force-pushed the feat/BA-6618-app-config-fragment-bulk-service branch from f67bb21 to 25fc7ff Compare June 26, 2026 05:01
@jopemachine jopemachine changed the base branch from main to feat/BA-6626-app-config-fragment-bulk-repository June 26, 2026 05:01
@github-actions github-actions Bot added size:L 100~500 LoC and removed size:XL 500~ LoC labels Jun 26, 2026
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from ffa35db to bcc97bb Compare June 26, 2026 07:12
@jopemachine jopemachine force-pushed the feat/BA-6618-app-config-fragment-bulk-service branch from 25fc7ff to 2a8bd46 Compare June 26, 2026 07:15
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch 4 times, most recently from cad6c73 to 3e4beef Compare July 7, 2026 06:12
Base automatically changed from feat/BA-6626-app-config-fragment-bulk-repository to main July 7, 2026 06:20
@jopemachine jopemachine force-pushed the feat/BA-6618-app-config-fragment-bulk-service branch 2 times, most recently from 2902ee0 to 59204c4 Compare July 7, 2026 06:38
@jopemachine jopemachine requested a review from Copilot July 7, 2026 06:41
@jopemachine jopemachine marked this pull request as ready for review July 7, 2026 06:41
@jopemachine jopemachine requested a review from a team as a code owner July 7, 2026 06:41

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 adds the bulk mutation service layer for app_config_fragment (BA-6618, part of the BEP-1052 AppConfigFragment stack), building on the bulk repository operations from #12426. It exposes bulk create / update / purge with partial-success semantics: individually rejected or failed items are reported per-item (batch index + reason) instead of failing the whole batch. There is no service-level gate — each fragment's FK to app_config_allow_list authorizes the write, and existing fragments are always writable at their own scope.

Changes:

  • New AppConfigFragmentBulkAction / AppConfigFragmentBulkActionResult base classes plus three concrete bulk actions (bulk_create, bulk_update, bulk_purge) with a per-item targets() RBAC extension point (no validator wired yet).
  • AppConfigFragmentService bulk methods delegating to the repository, and BulkActionProcessor wiring in the processor package.
  • Mocked-repository unit tests for the three bulk delegation paths.

Reviewed changes

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

Show a summary per file
File Description
services/app_config_fragment/actions/base.py Adds AppConfigFragmentBulkTarget, AppConfigFragmentBulkAction, and AppConfigFragmentBulkActionResult base types (entity/element RBAC refs).
services/app_config_fragment/actions/bulk_create.py Bulk create action carrying Sequence[AppConfigFragmentCreatorSpec]; empty targets() (rows don't exist yet).
services/app_config_fragment/actions/bulk_update.py Bulk update action carrying Sequence[Updater]; targets() maps each pk_value to a fragment target.
services/app_config_fragment/actions/bulk_purge.py Bulk purge action carrying Sequence[Purger]; targets() maps each pk_value.
services/app_config_fragment/service.py Adds bulk_create / bulk_update / bulk_purge delegating to the repository and mapping partial-success results.
services/app_config_fragment/processors.py Registers the three bulk BulkActionProcessors and their action specs.
tests/.../app_config_fragment/test_service.py Adds delegation tests for the three bulk service methods.
changes/12401.feature.md Changelog fragment describing the bulk service layer.

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

Comment thread tests/unit/manager/services/app_config_fragment/test_service.py
Bulk create/update/purge for app_config_fragment at the service layer, on top of the
repository primitives in #12426 (BA-6626):

- Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods,
  and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet).
- Partial-success results (succeeded + failed[index, message]).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@jopemachine jopemachine force-pushed the feat/BA-6618-app-config-fragment-bulk-service branch from 59204c4 to b8ccc6e Compare July 7, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:manager Related to Manager component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AppConfigFragment] Bulk CRUD service layer (bulk create/update/purge with allow-list write-gate)

3 participants