Skip to content

feat(BA-6702): move fragment rank to the allow list with scope defaults#12516

Merged
HyeockJinKim merged 1 commit into
mainfrom
feat/BA-6628-allow-list-rank
Jul 6, 2026
Merged

feat(BA-6702): move fragment rank to the allow list with scope defaults#12516
HyeockJinKim merged 1 commit into
mainfrom
feat/BA-6628-allow-list-rank

Conversation

@jopemachine

@jopemachine jopemachine commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary

Applies the review feedback on the AppConfigFragment stack. Replaces #12429 — the conditional-bulk repository primitives are dropped from the stack; the rank redesign lands first instead. Split for review into three PRs: this one (DB/model rank move), #12517 (API surface), and #12518 (FK + cascade).

  • rank moves from app_config_fragments to app_config_allow_list. Fragment writes are partly user-owned (an allow-listed user manages their own user-scope fragment), so a rank on the fragment would let the owner re-order the merge. Merge priority is admin policy — it now lives on the admin-owned allow-list entry, and fragments carry no rank of their own.
  • Scope-type default ranks. A new allow-list entry defaults its rank by scope type — public=100, domain=200, user=300 — so a user's own fragment wins the merge by default; an explicit rank may be passed through AppConfigAllowListCreatorSpec (API exposure comes in feat(BA-6701): expose allow-list rank on the v2 API surface #12517).
  • Fragment create simplification. The per-config_name next-value rank assignment (NextValuePolicy, lock on the definition row) is gone; AppConfigFragmentCreatorSpec becomes a plain CreatorSpec. The allow-list write gates are untouched here (feat(BA-6704): cascade app config subtree deletion from the definition #12518 revisits them together with the FK).
  • Migration 66d0f891ed20: adds app_config_allow_list.rank (backfilled by scope-type default) and drops app_config_fragments.rank. Downgrade restores fragment ranks from their allow-list entry (scope-type default fallback for orphans). Verified up/down against a local DB with seeded data.
  • BEP-1052 updated: rank placement, scope-type defaults, and the revised read-merge description.

📚 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 (replaces feat(BA-6628): conditional-bulk repository primitives #12429) ← you are here
  7. feat(BA-6701): expose allow-list rank on the v2 API surface #12517feat(BA-6628): expose allow-list rank on the v2 API surface
  8. feat(BA-6704): cascade app config subtree deletion from the definition #12518feat(BA-6628): cascade fragment deletion from the allow list
  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): AppConfigFragment bulk CRUD service layer
  11. feat(BA-6555): add app_config 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


📚 Documentation preview 📚: https://sorna--12516.org.readthedocs.build/en/12516/


📚 Documentation preview 📚: https://sorna-ko--12516.org.readthedocs.build/ko/12516/


📚 Documentation preview 📚: https://sorna--12516.org.readthedocs.build/en/12516/


📚 Documentation preview 📚: https://sorna-ko--12516.org.readthedocs.build/ko/12516/

@github-actions github-actions Bot added size:XL 500~ LoC area:docs Documentations comp:manager Related to Manager component comp:client Related to Client component comp:common Related to Common component comp:cli Related to CLI component require:db-migration Automatically set when alembic migrations are added or updated labels Jul 3, 2026
jopemachine added a commit that referenced this pull request Jul 3, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jopemachine jopemachine force-pushed the feat/BA-6628-allow-list-rank branch from 69e564b to 76f61f2 Compare July 3, 2026 06:30
@github-actions github-actions Bot added size:L 100~500 LoC and removed size:XL 500~ LoC labels Jul 3, 2026
@jopemachine jopemachine changed the title feat(BA-6628): move fragment rank to the allow list with scope defaults and cascading deletes feat(BA-6628): move fragment rank to the allow list with scope defaults Jul 3, 2026
@jopemachine jopemachine marked this pull request as ready for review July 6, 2026 00:56
@jopemachine jopemachine requested a review from a team as a code owner July 6, 2026 00:56
Copilot AI review requested due to automatic review settings July 6, 2026 00:56

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 relocates the app-config merge-priority rank from the partly user-owned app_config_fragments table to the admin-owned app_config_allow_list table, so a fragment owner can no longer re-order the merge by editing their own fragment. It is the DB/model step of the BEP-1052 AppConfigFragment stack (API exposure and the FK/cascade land in the follow-up PRs #12517 and #12518).

Changes:

  • Adds rank to AppConfigAllowListRow/AppConfigAllowListData with scope-type defaults (public=100, domain=200, user=300 via the new AppConfigScopeType.default_rank()) and an optional explicit override on AppConfigAllowListCreatorSpec; drops rank from the fragment row/data and simplifies AppConfigFragmentCreatorSpec to a plain CreatorSpec (no more NextValuePolicy next-value assignment).
  • Migration 66d0f891ed20 adds/backfills allow-list rank and drops fragment rank, with a symmetric (lossy, documented) downgrade.
  • Updates BEP-1052, the changelog fragment, and the repository/service tests to match the new rank placement.

Reviewed changes

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

Show a summary per file
File Description
common/data/app_config/types.py Adds default_rank() scope-type default source (100/200/300).
manager/models/app_config_allow_list/row.py Adds non-null rank column + to_data() mapping; updates docstring.
manager/models/app_config_allow_list/orders.py Adds rank query order.
manager/data/app_config_allow_list/types.py Adds rank to the allow-list data type.
manager/repositories/app_config_allow_list/creators.py Optional rank with scope-type default fallback.
manager/models/app_config_fragment/row.py Removes rank column and mapping.
manager/models/app_config_fragment/orders.py Removes the rank order.
manager/data/app_config_fragment/types.py Removes rank from fragment data.
manager/repositories/app_config_fragment/creators.py Becomes plain CreatorSpec (no next-value rank).
manager/repositories/app_config_fragment/db_source/db_source.py Drops NextValuePolicy; plain Creator after the write gate.
manager/repositories/app_config_fragment/updaters.py, services/.../actions/update.py Docstring updates reflecting rank move.
manager/models/alembic/versions/66d0f891ed20_*.py Migration moving rank between tables with backfill + downgrade.
proposals/BEP-1052-scoped-app-config-redesign.md Documents rank placement, scope defaults, join-based read merge.
changes/12516.feature.md Changelog fragment.
tests/unit/manager/.../app_config_allow_list/*, .../app_config_fragment/* Adds allow-list rank tests; removes fragment rank tests; seeds allow-list ranks.

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

# revision identifiers, used by Alembic.
revision = "66d0f891ed20"
down_revision = "a379b72f1206"
# Part of: NEXT_RELEASE_VERSION
@jopemachine jopemachine force-pushed the feat/BA-6628-allow-list-rank branch from 76f61f2 to 974923c Compare July 6, 2026 01:23
@jopemachine jopemachine marked this pull request as draft July 6, 2026 01:42
@jopemachine jopemachine force-pushed the feat/BA-6628-allow-list-rank branch from 974923c to 76f61f2 Compare July 6, 2026 01:49
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jopemachine jopemachine force-pushed the feat/BA-6628-allow-list-rank branch from 76f61f2 to 367f886 Compare July 6, 2026 01:59
@jopemachine jopemachine marked this pull request as ready for review July 6, 2026 02:00
@HyeockJinKim HyeockJinKim merged commit d49b59c into main Jul 6, 2026
36 checks passed
@HyeockJinKim HyeockJinKim deleted the feat/BA-6628-allow-list-rank branch July 6, 2026 02:24
@jopemachine jopemachine changed the title feat(BA-6628): move fragment rank to the allow list with scope defaults feat(BA-6702): move fragment rank to the allow list with scope defaults Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:cli Related to CLI component comp:client Related to Client component comp:common Related to Common component comp:manager Related to Manager component require:db-migration Automatically set when alembic migrations are added or updated size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants