Skip to content

feat(BA-5832): AppConfig v2 SDK + CLI (BEP-1052)#11295

Draft
jopemachine wants to merge 8 commits intoBA-5830from
BA-5832
Draft

feat(BA-5832): AppConfig v2 SDK + CLI (BEP-1052)#11295
jopemachine wants to merge 8 commits intoBA-5830from
BA-5832

Conversation

@jopemachine
Copy link
Copy Markdown
Member

@jopemachine jopemachine commented Apr 25, 2026

📚 Stacked PRs

This PR is part of a 10-PR stack delivering BEP-1052. Merge in order:

  1. ⬇️ chore(BA-5822): drop legacy AppConfig layer (preparation for BEP-1052) #11265chore(BA-5822): drop legacy AppConfig layer
  2. ⬇️ feat(BA-5814): AppConfigPolicy foundation (data / repository / service / adapter, bulk-aware) #11266feat(BA-5814): AppConfigPolicy foundation
  3. ⬇️ feat(BA-5815): AppConfigPolicy GraphQL #11269feat(BA-5815): AppConfigPolicy GraphQL
  4. ⬇️ feat(BA-5844): AppConfigPolicy REST v2 surface #11312feat(BA-5844): AppConfigPolicy REST v2
  5. ⬇️ feat(BA-5827): AppConfigFragment foundation (DB + repository + errors) #11282feat(BA-5827): AppConfigFragment foundation
  6. ⬇️ feat(BA-5836): AppConfigFragment service vertical (service / DTO / adapter) #11296feat(BA-5836): AppConfigFragment service vertical
  7. ⬇️ feat(BA-5829): AppConfigFragment + AppConfig GraphQL #11285feat(BA-5829): AppConfigFragment + AppConfig GraphQL
  8. ⬇️ feat(BA-5830): AppConfigFragment + AppConfig REST v2 #11286feat(BA-5830): AppConfigFragment + AppConfig REST v2
  9. 👉 feat(BA-5832): AppConfig v2 SDK + CLI (BEP-1052) #11295feat(BA-5832): AppConfig v2 SDK + CLI ← you are here
  10. ⬇️ feat(BA-5837): ValkeyCache for AppConfigFragment merged-view reads #11298feat(BA-5837): ValkeyCache for AppConfigFragment merged-view reads

CI on intermediate PRs may show test churn since each one only lands a slice of the new layer. The full picture is guaranteed to build at the tip (#11298).

Summary

Adds the v2 SDK + v2 CLI surface for the three AppConfig entities introduced in BEP-1052.

SDK (client/v2/domains_v2/)

Client Methods
V2AppConfigPolicyClient (new) get / search / admin_bulk_create / admin_bulk_update / admin_bulk_purge
V2AppConfigFragmentClient (new) get (POST + body key) / scope_search / admin_search / admin_bulk_create / admin_bulk_update / admin_bulk_purge
V2AppConfigClient (rewritten) my_get / my_search / admin_get / admin_search / my_bulk_create / my_bulk_update

The legacy V2AppConfigClient (upsert_* / delete_* for domain / user) is replaced — its backing endpoints were dropped in #11265.

All three clients are registered as @cached_property on V2ClientRegistry.

CLI (client/cli/v2/)

Group Commands
bai v2 app-config-policy get, search
bai v2 admin app-config-policy bulk-create, bulk-update, bulk-purge
bai v2 app-config-fragment get, scope-search
bai v2 admin app-config-fragment search, bulk-create, bulk-update, bulk-purge
bai v2 app-config my-get
bai v2 my app-config search, bulk-create, bulk-update
bai v2 admin app-config get, search

Legacy bai v2 app-config get-domain / delete-domain / get-user / delete-user / get-merged are removed — their endpoints are gone post #11265.

Bulk write commands accept JSON list inputs via --items / --keys / --config-names, with @path/to/file.json shorthand:

bai v2 admin app-config-policy bulk-create --items '[{"config_name":"theme","scope_sources":["public","user"]}]'
bai v2 admin app-config-fragment bulk-purge --keys @keys.json
bai v2 my app-config bulk-update --items @my-fragments.json

Resolves BA-5832.


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


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

@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:cli Related to CLI component labels Apr 25, 2026
jopemachine added a commit that referenced this pull request Apr 25, 2026
@jopemachine jopemachine marked this pull request as draft April 25, 2026 07:37
Comment thread changes/11269.feature.md
Comment thread docs/manager/graphql-reference/supergraph.graphql
Comment thread src/ai/backend/client/v2/domains_v2/app_config.py
jopemachine added a commit that referenced this pull request Apr 25, 2026
Extends the legacy-AppConfig drop to the client side:

- `client/v2/domains_v2/app_config.py` — `V2AppConfigClient` with
  `upsert_domain_config` / `delete_user_config` / etc. is removed
  alongside its `v2_registry` `@cached_property` wiring.
- `client/cli/v2/app_config/` — legacy `./bai app-config get-domain`,
  `upsert-user`, etc. are removed from the CLI tree.
- `common/dto/manager/v2/app_config/` — legacy DTO module
  (`UpsertDomainConfigInput`, `DeleteUserConfigPayload`, ...) is
  deleted.

Per #11295 review: BEP-1052's new SDK / CLI / DTO surfaces will land
in their own PRs and should not also have to repeal the legacy
versions there.
jopemachine added a commit that referenced this pull request Apr 25, 2026
jopemachine added a commit that referenced this pull request Apr 25, 2026
jopemachine added a commit that referenced this pull request Apr 25, 2026
jopemachine added a commit that referenced this pull request Apr 25, 2026
jopemachine added a commit that referenced this pull request Apr 25, 2026
Comment thread src/ai/backend/client/cli/v2/my/app_config.py Outdated
jopemachine added a commit that referenced this pull request Apr 26, 2026
jopemachine added a commit that referenced this pull request Apr 26, 2026
jopemachine added a commit that referenced this pull request Apr 26, 2026
jopemachine added a commit that referenced this pull request Apr 26, 2026
jopemachine added a commit that referenced this pull request Apr 27, 2026
jopemachine added a commit that referenced this pull request Apr 27, 2026
jopemachine and others added 8 commits April 27, 2026 11:45
…ed AppConfig

SDK (`client/v2/domains_v2/`):
- New `V2AppConfigPolicyClient` — `get`, `search`, `admin_bulk_create
  / update / purge` (BEP-1052 §3, bulk-only writes).
- New `V2AppConfigFragmentClient` — `get` (POST /get with body-key),
  `scope_search`, `admin_search`, `admin_bulk_create / update /
  purge`.
- Replace legacy `V2AppConfigClient` with the merged-view (BEP-1052
  §5) surface — `my_get`, `my_search`, `admin_get`, `admin_search`,
  `my_bulk_create / update`. Old `upsert_*` / `delete_*` paths are
  removed (their backing endpoints were dropped in BA-5822).
- Register all three clients in `V2ClientRegistry`.

CLI (`client/cli/v2/`):
- `bai v2 app-config-policy` — `get`, `search`.
- `bai v2 admin app-config-policy` — `bulk-create / update / purge`,
  with `--items '{json}'` or `@file.json`.
- `bai v2 app-config-fragment` — `get`, `scope-search`.
- `bai v2 admin app-config-fragment` — `search`, `bulk-create /
  update / purge`.
- `bai v2 app-config` (merged-view) — `my-get`.
- `bai v2 my app-config` — `search`, `bulk-create`, `bulk-update`.
- `bai v2 admin app-config` — `get`, `search`.
- Replace the legacy `bai v2 app-config` commands (`get-domain` /
  `delete-domain` / `get-user` / `delete-user` / `get-merged`) — those
  REST endpoints are gone post BA-5822.

All bulk write commands accept JSON list inputs via `--items` /
`--keys` / `--config-names`, with `@path/to/file.json` shorthand for
file-loaded payloads. The CLI surface follows
`bai admin {entity}` for superadmin-only operations,
`bai my {entity}` for self-service writes that act on the caller's
own data, and `bai {entity}` for any-authenticated-user reads —
mirrors the manager-side adapter convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
End users only interact with the merged AppConfig view (`my_get`,
`my_search` on `V2AppConfigClient`); raw fragment / policy reads were
just an API mirror without convention support. Removes:

- SDK `V2AppConfigFragmentClient.get` / `.scope_search` (the latter did
  not match the per-scope `{scope}_search()` convention used by
  `user.py`, `session.py`, `vfolder.py`, etc.)
- SDK `V2AppConfigPolicyClient.get` / `.search`
- CLI groups `./bai app-config-fragment` and `./bai app-config-policy`

Admin surface (`admin_search`, `admin_bulk_*`) is unchanged — both
clients keep the methods their `admin/` CLI counterparts call.
`list[dict]` was missing the value type parameter and `json.loads`
returns `Any`, so mypy flagged 9 type-arg / no-any-return errors. Use
`list[dict[str, Any]]` and `cast()` to keep CLAUDE.md's
no-`# type: ignore` rule.

Also picks up a stale BA-5829 ruff format on Fragment node.py from the
JSON-scalar fix cascade.
… drop BEP refs

- Type the admin AppConfig CLI's `user_id` argument and `--user-id` flag
  as `click.UUID` (was `str` parsed via `UUID(...)`); the SDK already
  takes `UUID` so this drops a redundant runtime parse and surfaces
  bad input at click parse time. Also wrap the search filter's
  `user_id` in `UUIDFilter`, matching the DTO shape.
- Carry the `bulk_create_my` / `bulk_update_my` → `my_bulk_create` /
  `my_bulk_update` rename through the v2 SDK (`domains_v2/app_config.py`),
  the self-service CLI (`cli/v2/my/app_config.py`), and the remaining
  GQL / adapter / service touchpoints that leaked through `-X theirs`
  during the stack rebase.
- Strip the residual `BEP-1052 §X` references from CLI / SDK
  docstrings and the GraphQL schema dump comments. Only the news
  fragments retain the BEP wording.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…le GQL leftovers

The CLI helptext (`bulk-create` / `bulk-update`) and a few GQL type
fields still referenced `extra_config`; align them with the column
rename. Also refresh the schema dump for the residual `extraConfig`
fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…eyed

Track BA-5814 / BA-5815 / BA-5844 DTO refactor:
  • Use AdminAppConfigPolicyCreateItemInput for bulk-create.
  • Use AdminAppConfigPolicyUpdateItemInput (id + scope_sources) for bulk-update.
  • bulk-purge takes --ids (UUID list) instead of --config-names.
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:manager Related to Manager component size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant