feat(secrets): auto-select auth broker type for login-style secret names - #117
Conversation
When a secret name (personal or org) contains EMAIL/ACCOUNT/USER/USERNAME/NAME and a live auth-session broker is registered, the Type dropdown auto-switches to that brokered type. If no such broker is live, Runtime stays the default. Only toggles Runtime <-> the auth type; a different manually chosen broker type is left untouched. 🤖 Built with SMT <smt@agora.build>
🤖 Codex Code ReviewFindings
No security issues found in this client-only change. |
🤖 Claude Code ReviewFindings1. Client heuristic diverges from the existing server one — and omits The server already owns this exact heuristic, with a comment saying it exists to drive this UI: // server/auth-session.ts:273-277
const AUTH_FIELD_RE = /USERNAME|PASSWORD|ACCOUNT|EMAIL/i;
/** Default brokerType suggestion for a secret name (Task 6: pre-selects the UI toggle). */The new client regex is Fix: import/reuse the server rule rather than restating it ( 2. Fuzzy broker-type match vs. hardcoded
3. Auto-select re-fires on every keystroke, overwriting a deliberate manual choice (
4. Minor: races the broker-types query (
The refactor into one shared helper used by both the personal and org forms is the right call, and gating on a live broker being present is a good touch. |
Summary
In
console/secrets, the Type dropdown now auto-follows the secret Name for login-style credentials:EMAIL,ACCOUNT,USER,USERNAME, orNAME(names are uppercased, soUSER/NAMEalso coverUSERNAME), the Type auto-switches to the live auth broker type (first live broker matching/auth|session|login/i, i.e.auth-session).Applies to both the Personal and Org secret create forms.
Scope
Client-only (
console-secrets.tsx). Uses the existing/api/broker-typeslive-broker query; no schema/server changes.Testing
npm run check(tsc) — clean.Generated with SMT smt@agora.io