Skip to content

feat(configure): plugin OAuth account picker, multi-account hide, configured status (#336, #337, #338)#339

Merged
hyoshi merged 1 commit into
mainfrom
feat/configure-plugin-oauth-account-picker
Jun 25, 2026
Merged

feat(configure): plugin OAuth account picker, multi-account hide, configured status (#336, #337, #338)#339
hyoshi merged 1 commit into
mainfrom
feat/configure-plugin-oauth-account-picker

Conversation

@hyoshi

@hyoshi hyoshi commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

Three configure-UI refinements for broker-OAuth plugin providers (design B — e.g. the Logly-managed Meta provider meta_ads_logly). The OSS layer carries the mechanism; the plugin supplies the values/behaviour, so mureo-pro needs no change.

#336 — post-auth account picker

  • New declarative AccountOAuthConfig.accounts_field (the field the picker fills) + optional provider hook list_oauth_accounts(credentials) -> Sequence[Mapping], discovered defensively via get_oauth_account_lister.
  • New backend plugin_credentials.list_oauth_accounts(): loads the stored credentials section, invokes the hook (sync or async, bridged off the request thread), normalises to [{"id","name"}]. The token never reaches logs; any hook failure — including a non-iterable return — collapses to a clean 502, never a raw 500.
  • New GET /api/credentials/plugins/<provider>/accounts maps typed errors to 404 / 409 / 502.
  • Dashboard renders that field as a picker (Load → radios → dedicated Save) instead of free-text. Picker radios are type="button"-safe and excluded from the OAuth Authenticate-is-save payload.

#337 — hide account_id when multi-account (agency) is active

  • multi_account_picker_scope() returns a per-provider allow-list excluding accounts_field; _resolve_field_scope merges it when a multi-account backend is active (an explicit backend scope wins).
  • The per-account id is chosen per-client at runtime, so pinning one at configure time is meaningless — this hides the input and exempts it from required-validation, with no declaration needed from the agency backend.

#338 — "Configured ✓" status

A typo'd accounts_field is rejected at the registry boundary (loud ValueError) so a wiring mistake can't silently disable the picker or the multi-account hide.

Test plan

  • mureo.web.plugin_credentialslist_oauth_accounts (normalisation, async hook, async-from-running-loop, unknown provider, not-supported, not-authenticated, hook-failure-wrapped, non-iterable-return → 502, token-never-logged), multi_account_picker_scope, oauth-block surfacing.
  • Registry — accounts_field validation (valid / typo→ValueError), get_oauth_account_lister (callable / absent / non-callable).
  • Handlers — accounts endpoint envelopes (200/409/404/404/502), _resolve_field_scope multi-account fold-in (auto-hide, backend-override, single-account no-op).
  • Frontend asset guards — configured status, picker functions, radio-exclusion, success re-render; i18n en/ja parity + key-coverage.
  • ruff + black clean on mureo/; mypy --strict clean on changed files; node --check on dashboard.js.
  • Reviewed by python-reviewer + typescript-reviewer; all findings (Python HIGH ×1, JS HIGH ×2 + LOW ×1) fixed with regression tests.

Closes #336, #337, #338

https://claude.ai/code/session_011rAu94b1o1xWYZhARk1VmL

…figured status

Three configure-UI refinements for broker-OAuth plugin providers (design B,
e.g. the Logly-managed Meta provider). OSS carries the mechanism; the plugin
supplies the values/behaviour — mureo-pro needs no change.

#336 — post-auth account picker. Add declarative
`AccountOAuthConfig.accounts_field` (the field the picker fills) plus an
optional provider hook `list_oauth_accounts(credentials) -> Sequence[Mapping]`
discovered via `get_oauth_account_lister`. New backend
`plugin_credentials.list_oauth_accounts()` loads the stored credentials
section, invokes the hook (sync or async, bridged off the request thread),
and normalises to `[{"id","name"}]` — the token never reaches logs and any
hook failure (including a non-iterable return) collapses to a clean 502, never
a raw 500. New GET `/api/credentials/plugins/<provider>/accounts` maps the
typed errors to 404/409/502. The dashboard renders that field as a picker
(Load -> radios -> dedicated Save) instead of free-text; picker radios are
excluded from the OAuth Authenticate-is-save payload.

#337 — multi-account hide. `multi_account_picker_scope()` returns, per OAuth
provider, an allow-list excluding `accounts_field`; `_resolve_field_scope`
merges it when a multi-account backend is active (an explicit backend scope
wins). The per-account id is selected per-client at runtime, so pinning one at
configure time is meaningless — this both hides the input and exempts it from
required-validation, with no declaration needed from the agency backend.

#338 — configured status. The OAuth target-field status row shows
"Configured ✓" when the token is already stored (keyed off the injected
`field.configured`), instead of always prompting to Authenticate. The
input-suppression for the target field already shipped in #217.

A typo'd `accounts_field` is rejected at the registry boundary (loud
ValueError) so a wiring mistake can't silently disable the picker or the
multi-account hide.

Closes #336, #337, #338

Claude-Session: https://claude.ai/code/session_011rAu94b1o1xWYZhARk1VmL
@hyoshi hyoshi merged commit 9bfd960 into main Jun 25, 2026
9 checks passed
@hyoshi hyoshi deleted the feat/configure-plugin-oauth-account-picker branch June 25, 2026 02:18
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.

configure: プラグインプロバイダの広告アカウントIDを選択式(ピッカー)にする

1 participant