feat(BA-6618): app_config_fragment bulk CRUD service layer#12401
Conversation
b596dd2 to
17ee41a
Compare
274b602 to
2d822bb
Compare
17ee41a to
380a8d0
Compare
2d822bb to
408d923
Compare
008639e to
89c2848
Compare
f3e9bed to
cc90dc1
Compare
cc90dc1 to
f9eb9a0
Compare
f67bb21 to
25fc7ff
Compare
ffa35db to
bcc97bb
Compare
25fc7ff to
2a8bd46
Compare
cad6c73 to
3e4beef
Compare
2902ee0 to
59204c4
Compare
There was a problem hiding this comment.
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/AppConfigFragmentBulkActionResultbase classes plus three concrete bulk actions (bulk_create,bulk_update,bulk_purge) with a per-itemtargets()RBAC extension point (no validator wired yet). AppConfigFragmentServicebulk methods delegating to the repository, andBulkActionProcessorwiring 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.
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]>
59204c4 to
b8ccc6e
Compare
Resolves #12400 (BA-6618)
Summary
Bulk
create/update/purgeforapp_config_fragmentat 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.createcarriesSequence[AppConfigFragmentCreatorSpec];update/purgecarry plainUpdater/Purgersequences. No service-level gate — each fragment's FK toapp_config_allow_listauthorizes 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.AppConfigFragmentBulkActionbase with per-itemtargets()(per-entity RBAC extension point — no validator wired yet); action results carrysucceeded+failed[index, message].Test plan
pants check/lint/testpass📚 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 migrationfeat(BA-6553): repository layerrefactor(BA-6619): consolidate AppConfigScopeType into common.datarefactor(BA-6620): ExistsQuerier + AppConfigAllowList.existsfeat(BA-6554): AppConfigFragment service layerfeat(BA-6702): move fragment rank to the allow list with scope defaultsfeat(BA-6701): expose allow-list rank on the v2 API surfacefeat(BA-6704): cascade app config subtree deletion from the definitionfeat(BA-6626): app_config_fragment bulk repository layerfeat(BA-6618): app_config_fragment bulk CRUD service layer← you are herefeat(BA-6555): app_config service layer (merge engine)feat(BA-6556): AppConfig REST v2 API🤖 Generated with Claude Code