feat(connections): searchable combobox for secret/env fields#10253
Conversation
Replace the input + dropdown key picker with a searchable combobox that lets users filter secrets, commit free-text literals (non-secret fields), or create a new secret pre-filled with the typed value. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace broad `.*x.*` matchers with targeted patterns per field so the combobox recommends relevant env vars (and excludes noise like KUBERNETES_SERVICE_HOST). Add tests for the partitioning logic. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@cubic-dev-ai please review |
@Light2Dark I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Architecture diagram
sequenceDiagram
participant User
participant Form as Connection Form
participant Renderer as ENV_RENDERER
participant Combobox as SecretCombobox
participant Partitioner as partitionSecretKeys
participant SecretsCtx as SecretsContext
participant Modal as WriteSecretModal
Note over User,Modal: Connection field with optionRegex (e.g., Host, Password)
User->>Form: Open connection form
Form->>Renderer: Render field with optionRegex
Renderer->>SecretsCtx: Read secretKeys, providerNames
SecretsCtx-->>Renderer: secretKeys[], providerNames[]
Renderer->>Partitioner: partitionSecretKeys(keys, optionRegex)
Partitioner-->>Renderer: {recommended, other}
Renderer->>Combobox: Render with value, onChange, secretsOnly, recommended, other, onCreateSecret
alt Field is password/token (secretsOnly = true)
Note over Combobox: Only secrets can be chosen, no free-text
else Field is text (secretsOnly = false)
Note over Combobox: User can select secret or type a literal
end
User->>Combobox: Click trigger
Combobox->>Combobox: Open popover, show search input
alt User types search text
Combobox->>Combobox: Filter recommended/other keys and show "Use ..." option (if not secretsOnly)
end
alt User selects a secret key
Combobox->>Combobox: prefixSecret(key)
Combobox->>Renderer: onChange(prefixedKey)
Renderer->>Form: Update field value
else User commits custom free-text value
Combobox->>Renderer: onChange(literalText)
Renderer->>Form: Update field value
else User clicks "Create a new secret"
Combobox->>Modal: Open with initialValue = search text
Modal->>User: Fill key/value/location
User->>Modal: Confirm
Modal->>SecretsCtx: refreshSecrets()
SecretsCtx-->>Modal: new secret added
Modal->>Combobox: onSuccess(secretKey)
Combobox->>Combobox: prefixSecret(secretKey)
Combobox->>Renderer: onChange(prefixedKey)
Renderer->>Form: Update field value
end
Note over Renderer,Partitioner: NEW: stricter optionRegex improves recommended matches
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- Bound the `pat` token matcher to separators so PATH-like vars aren't recommended - Allow non-secret fields to commit a literal even when it matches a secret key - Remove the unreachable CommandEmpty block (Create item always matches) Co-authored-by: Cursor <cursoragent@cursor.com>
Add a clear control on the trigger so optional fields can be reset, and keep the create-secret menu label generic so typed secrets aren't echoed. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Move clear to a sibling button (avoid nested controls) and add a Clear item in the menu for keyboard users. Co-authored-by: Cursor <cursoragent@cursor.com>
| * - Default: pick a secret, create one, or commit a free-text literal. | ||
| * - `secretsOnly`: pick or create a secret only (for passwords/tokens/keys). | ||
| */ | ||
| export const SecretCombobox: React.FC<SecretComboboxProps> = ({ |
There was a problem hiding this comment.
We have a headless useSelectList hook for building components like this. Maybe you can also use the SelectList component directly.
There was a problem hiding this comment.
I tried, and it made some parts cleaner and some parts more unreadable (to adapt to the hook). I think it's fine to keep this for now, since it's quite custom. But happy to refactor in the future.
There was a problem hiding this comment.
Interesting what did it make harder? I would like to see if i can improve the hook
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.15-dev58 |
📝 Summary
Reworks the secret/env picker used across database and storage connection forms.
Input+ key dropdown with a searchable combobox (SecretCombobox) so users can quickly filter secrets by name, especially when many env vars are present.optionRegexfrom broad.*x.*matchers to targeted patterns, so Recommended env vars are actually relevant and noise (e.g.KUBERNETES_SERVICE_HOSTfor a Host field) is excluded.partitionSecretKeysas a pure, tested helper.Screen.Recording.2026-07-22.at.12.57.43.AM.mov
Why: the previous dropdown was hard to use with long secret lists, and the loose regexes surfaced unrelated env vars as recommendations, undermining trust in the suggestions.
📋 Pre-Review Checklist
✅ Merge Checklist
Made with Cursor