Skip to content

feat(connections): searchable combobox for secret/env fields#10253

Merged
mscolnick merged 6 commits into
mainfrom
feat/secret-combobox
Jul 22, 2026
Merged

feat(connections): searchable combobox for secret/env fields#10253
mscolnick merged 6 commits into
mainfrom
feat/secret-combobox

Conversation

@Light2Dark

@Light2Dark Light2Dark commented Jul 21, 2026

Copy link
Copy Markdown
Member

📝 Summary

Reworks the secret/env picker used across database and storage connection forms.

  • Replaces the read-only Input + key dropdown with a searchable combobox (SecretCombobox) so users can quickly filter secrets by name, especially when many env vars are present.
  • For non-secret fields, users can still commit a free-text literal ("Use ...") or search secrets; password/token fields are secrets-only.
  • The "create secret" flow pre-fills the modal with the typed value, reducing re-typing.
  • Tightens each field's optionRegex from broad .*x.* matchers to targeted patterns, so Recommended env vars are actually relevant and noise (e.g. KUBERNETES_SERVICE_HOST for a Host field) is excluded.
  • Extracts partitionSecretKeys as 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

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

Made with Cursor

Light2Dark and others added 2 commits July 21, 2026 17:48
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>
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jul 21, 2026 3:54pm

Request Review

@Light2Dark
Light2Dark requested a review from Copilot July 21, 2026 09:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Light2Dark

Copy link
Copy Markdown
Member Author

@cubic-dev-ai please review

@cubic-dev-ai

cubic-dev-ai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai please review

@Light2Dark I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread frontend/src/components/editor/connections/secret-combobox.tsx Outdated
Comment thread frontend/src/components/editor/connections/database/schemas.ts Outdated
Comment thread frontend/src/components/editor/connections/secret-combobox.tsx Outdated
- 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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread frontend/src/components/editor/connections/secret-combobox.tsx Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread frontend/src/components/editor/connections/secret-combobox.tsx Outdated
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread frontend/src/components/editor/connections/secret-combobox.tsx
* - 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> = ({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a headless useSelectList hook for building components like this. Maybe you can also use the SelectList component directly.

export function useSelectList<V>({

@Light2Dark Light2Dark Jul 22, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting what did it make harder? I would like to see if i can improve the hook

@Light2Dark Light2Dark Jul 22, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#10267 first draft

@mscolnick
mscolnick merged commit 2a206af into main Jul 22, 2026
35 checks passed
@mscolnick
mscolnick deleted the feat/secret-combobox branch July 22, 2026 18:13
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.15-dev58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants