Design note — Multiple accounts per provider (multi_account)
Target registry item: C1e (OB-GAP-6; checklist §5.5 — the vault holds one JSON secret per (tenant, provider), so a tenant with several Google Ads or Meta ad accounts has no modelled way to supply the second one). Status: design note only — NOT built; BLOCKED(owner) on the OB-GAP-6 decision. Measured on 2026-10-12: connector_credentials.py names the secret mizoki-connector-{tenant}-{provider} (collision-resistant form in secret_id, duplicated byte-for-byte in connectors/amazon_sp/client.py with a parity test); direct_connectors.resolve_provider_credentials builds ONE credential view per (tenant, provider) and binds account_id in the sync body as a confirmation against the single declared account.
Before designing a schema: the cheaper answer for Google Ads
Google Ads already models many accounts under one credential: login_customer_id (MCC) plus a per-pull customer_id. A tenant whose accounts sit under a manager account needs no multi-account schema — they need the MCC id on the card and the pull to accept any customer_id that listAccessibleCustomers returns under that MCC. That is a confirmation-set change (one declared MCC, N confirmable customers), not a second vault entry, and it should ship first. The schema below is for Meta (several ad accounts, one business) and for Google Ads without an MCC.
Schema
Two shapes were weighed:
| option | what changes | verdict |
|---|---|---|
A. One secret per account slot — mizoki-connector-{tenant}-{provider}-a{n} plus an index |
the naming formula (duplicated in two images, parity-pinned), the inventory labels, IAM grants per secret, secret_id's collision grammar |
Rejected: every consumer that reproduces the formula changes; the -h<12hex> collision suffix and an -a{n} suffix would need a new disambiguation rule. |
B. One secret per (tenant, provider), payload schema 3 with an accounts list |
the payload only | Proposed. The invariant "one JSON secret per (tenant, provider)" stays true; naming, IAM and inventory are untouched. |
Schema-3 payload (illustrative shape, keys only):
{ "schema": 3, "provider": "meta_ads",
"accounts": [ { "slot": "a1", "label": "<tenant-chosen>", "primary": true,
"<catalog fields for the provider>" … },
{ "slot": "a2", "primary": false, … } ] }
- A schema-1 payload (today's flat fields) reads as a one-element list with
slot: a1, primary: true; nothing is migrated in place. slotis server-minted and immutable;labelis tenant-chosen display text, non-secret, length-bounded, never used for binding.- Exactly one
primary: true; the primary is what a pull without a confirmingaccount_idruns against. - Hard cap on list length (proposal: 10) and the existing serialized-size check before write (
.claude/rules/tenant-onboarding.md"Validate serialized payload size") so the document always fits the backing-store limit. - Secrets masked per entry with the same catalog-driven masking; status echoes
accounts: [{slot, label, primary, configured, hints}]. - Concurrent saves keep the atomic/optimistic contract already required of sections: an entry save carries the document version; a stale version is refused, never merged.
Binding rule (unchanged in spirit, widened in set)
account_id in a sync request is a confirmation that must match ONE declared account of the tenant — now a set membership check instead of an equality check — and never an override: a caller authorised for the tenant can select among the tenant's own declared accounts and nothing else. Absent account_id → the primary. The direction tests in tests/connectors/test_direct_connectors_governed.py are extended, not replaced: a foreign account id is still refused 403 with the existing detail text.
Readiness (onboarding_gaps): connectors.<p>:not-configured means no entry at all; a per-entry gap is connectors.<p>[<slot>].<field>:missing. Completion still reads credential STATE, never values, and still says nothing about arming.
UI contract
The card gains "Add another account" (schema-3 providers only, the catalog row carries multi_account: true), one test-connection per entry, a primary toggle, and removal of a non-primary entry. The entry form is the same field set the catalog serves — no second form.
Consent posture
Not a data-topic change: every account is inside the same tenant boundary and carries the same aggregate insights the single-account pull carries. The one posture property to pin: an entry's label is tenant-chosen free text — it is rendered, never logged with the secret, and never used in a secret name.
Mapper target
Unchanged. Each pull still produces CanonicalRecord rows whose account_id is the declared account the pull ran against; downstream nothing changes except that a tenant can now have rows from several of its own accounts.
Failure modes → test-connection verdicts
| Failure | Verdict / fix |
|---|---|
account_id not among the tenant's declared accounts |
403 — "account_id does not match an account this tenant declared" (existing text, set-widened). |
| Two entries declare the same account | 422 duplicate_account at save. |
| List over the cap or document over the size limit | 422 at save; nothing written. |
| Entry removed while a pull is scheduled against it | the pull refuses merchant_credentials_not_configured for that slot; the readout names the slot. |
| Vault read error | 503 fail-closed. |
Flag
CONNECTOR_MULTI_ACCOUNT default OFF. Flag OFF: schema-3 payloads are still READ (a tenant's data is never unreadable because a flag moved) but the UI shows one entry and the save path refuses a second (422 multi_account_disabled).
Owner / operator gates
- BLOCKED(owner) — OB-GAP-6. Allow several vault entries per provider per tenant (multi-account schema)? Asked once in
ONBOARDING_CONNECTORS_STATE.md; no answer = BLOCKED. The MCC confirmation-set change above is the part that does not need the ruling, and should be presented to the owner as the smaller first step. - Operator: none (naming and IAM unchanged by option B).
Vendor references
- Google Ads manager accounts (MCC) and
login-customer-idsemantics — not re-fetched from this sandbox on 2026-10-12; the catalog's existinglogin_customer_idhelp text is the in-repo statement. - Meta: one business portfolio, several ad accounts, assets granted per integration — https://developers.facebook.com/docs/facebook-login/facebook-login-for-business — fetched 2026-10-12.