Skip to content

feat(admin): config-sync export + import — code-keyed bundle (ADR 0003)#53

Merged
jlc488 merged 2 commits into
mainfrom
feat/config-sync-export-import
Jun 3, 2026
Merged

feat(admin): config-sync export + import — code-keyed bundle (ADR 0003)#53
jlc488 merged 2 commits into
mainfrom
feat/config-sync-export-import

Conversation

@jlc488
Copy link
Copy Markdown
Contributor

@jlc488 jlc488 commented Jun 3, 2026

Summary

ADR 0003 config-sync — backend prototype: export + import (code-keyed bundle).

Export

  • ConfigBundle — portable, code-keyed snapshot of definitional config (permissions,
    roles + their permission codes, menus with parent / required-permission by code).
  • ConfigExportService + GET /admin/api/v1/config/export?tenantId=….

Import

  • ConfigImportService — applies a bundle by natural code in one transaction.
    merge (additive, never deletes); dryRun computes the diff without writing.
    Permissions upsert by code; roles create + grant missing permissions (by code); menus
    upsert parent-before-child (parent must exist at create; a menu's parent can't be
    changed via update), so any bundle ordering imports correctly.
  • ImportResult — per-type created/updated diff (codes only).
  • POST /admin/api/v1/config/import?mode=merge&dryRun=true (dry-run is the default).

Gating

  • ConfigSyncAutoConfiguration — the whole surface is OFF unless
    devslab.kit.config-sync.enabled=true
    .

Verification

./gradlew build green (Testcontainers Postgres+Redis). ConfigSyncTests 2/2:
export keys by code; import dry-run writes nothing, apply creates by code with
child-listed-before-parent input handled, re-apply is idempotent.

Next on this track (per the ADR)

PR 3: stronger gating (dev-profile-only + prod fail-fast). PR 4: mirror mode + optional
user sync (guarded). PR 5: admin-ui Config Sync page.


요약 (한국어)

ADR 0003 config-sync 백엔드 프로토타입: export + import(코드 기준 번들).

  • export: ConfigBundle(코드 기준) + GET /config/export
  • import: ConfigImportService — 코드 기준 upsert, 트랜잭션 1개, merge(추가형·삭제 없음) +
    dryRun(쓰기 없이 diff). 메뉴는 부모-먼저 위상순서. POST /config/import?mode=merge&dryRun=true(기본 dry-run).
  • 게이팅: 전체 surface는 config-sync.enabled=true일 때만(기본 off).
  • 검증: ConfigSyncTests 2/2 green(Testcontainers). 다음: 게이팅 강화 → mirror/사용자동기화 → admin-ui 페이지.

jlc488 added 2 commits June 3, 2026 14:19
… PR 1)

First prototype increment of environment config promotion (ADR 0003).

- ConfigBundle: portable, code-keyed snapshot of definitional config (permissions,
  roles + their permission codes, menus with parent/required-permission by code).
- ConfigExportService: builds the bundle from the live DB for a tenant, translating
  every UUID into its natural code.
- ConfigSyncController: GET /admin/api/v1/config/export?tenantId=...
- ConfigSyncAutoConfiguration: registers + gates the whole surface — OFF unless
  devslab.kit.config-sync.enabled=true.
- Testcontainers test seeds perms/roles/menus, exports, and asserts the bundle is
  keyed by code.

Import (merge + dry-run) and the dev-profile / prod fail-fast gating follow on this
branch per the ADR's PR breakdown.
… 0003, PR 2)

- ConfigImportService: applies a bundle by natural code in one transaction. merge mode
  (additive, never deletes); dryRun computes the diff without writing. Permissions upsert
  by code; roles create + grant missing permissions (resolved by code); menus upsert
  parent-before-child (a child's parent must exist at create, and a menu's parent cannot
  be changed via update), so any bundle ordering imports correctly.
- ImportResult: per-type created/updated diff (codes only).
- POST /admin/api/v1/config/import?mode=merge&dryRun=true (dry-run is the default).
- Test: dry-run writes nothing; apply creates by code with child-listed-before-parent
  input; re-apply is idempotent. Round-trip green on Testcontainers Postgres.

(Renamed ConfigSyncExportTests -> ConfigSyncTests now that it covers both sides.)
@jlc488 jlc488 changed the title feat(admin): config-sync export — code-keyed bundle (ADR 0003, PR 1) feat(admin): config-sync export + import — code-keyed bundle (ADR 0003) Jun 3, 2026
@jlc488 jlc488 merged commit 4de0185 into main Jun 3, 2026
1 check passed
jlc488 added a commit that referenced this pull request Jun 3, 2026
All implementation PRs have merged: export/import (#53), prod fail-fast
gating (#54), mirror mode + opt-in user sync (#55), and the admin-ui
"Config Sync" page (devslab-kit-admin-ui #20). Flip the status to Accepted
(item 6 of the plan) and record the PRs; the standalone how-to guide is
the remaining piece. Both language files.
jlc488 added a commit that referenced this pull request Jun 3, 2026
Prepares the 0.4.0 doc surfaces for the config-sync feature (ADR 0003,
shipped in #53#56):

- CHANGELOG.md/.ko.md: 0.4.0 entry (export/import, merge/mirror, dry-run,
  opt-in user sync, prod fail-fast).
- README.md/.ko.md: bump install coordinates to 0.4.0 + a "Config sync"
  feature row.
- docs: bump install/configuration coordinates to 0.4.0; add a config-sync
  card to the home page; a new "Config Sync" guide (en/ko) wired into the
  mkdocs nav + ko nav translation; note it under the roadmap's shipped list.

Docs only; `mkdocs build --strict` passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant