Skip to content

feat: Add configurable delimiter for dropdown block options#348

Merged
ellie merged 7 commits intomainfrom
ellie/dropdown-delimiter
Jan 15, 2026
Merged

feat: Add configurable delimiter for dropdown block options#348
ellie merged 7 commits intomainfrom
ellie/dropdown-delimiter

Conversation

@ellie
Copy link
Member

@ellie ellie commented Jan 15, 2026

Change Summary

Users can now customize the label/value delimiter for dropdown options, enabling support for data containing colons like URLs or timestamps. The delimiter defaults to ":" but is configurable in the UI.

Motivation and details

The dropdown block previously used a hardcoded ":" delimiter for label:value pairs, making it impossible to use with data containing colons. This change adds a delimiter prop to the Dropdown struct and implements delimiter-aware parsing in the Rust backend. The frontend now includes a UI field to customize the delimiter. Includes 9 new tests covering single-character, multi-character, and edge case delimiters.

Tasks

  • Regenerated TS-RS bindings (auto-generated from Rust struct changes)
  • Updated the documentation in docs/ (behavior documented in AI block registry)
  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle

Users can now customize the label/value delimiter for dropdown options (previously hardcoded to ":""). This enables support for data containing colons, such as URLs or timestamps. The delimiter is configurable in the UI modal and defaults to ":".

- Add delimiter prop to Dropdown struct with default ":"
- Implement delimiter-aware option parsing in Rust backend
- Add UI field in config modal to customize delimiter
- Include comprehensive tests for custom delimiters
- Update documentation with examples
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 15, 2026

Greptile Summary

Adds configurable delimiter for dropdown label/value pairs, replacing hardcoded :. Enables data containing colons (URLs, timestamps) to work properly by allowing custom delimiters like |, ::, or ->.

Changes:

  • Rust backend implements delimiter-aware parsing with comprehensive tests (9 new test cases covering single/multi-char delimiters and edge cases)
  • Frontend adds delimiter input field with updated placeholder text
  • TypeScript bindings auto-regenerated from Rust structs
  • AI block registry documentation updated with custom delimiter example

Issue Found:

  • parseOption function in TypeScript has off-by-one boundary check error (line 35)

Important Files Changed

Filename Overview
crates/atuin-desktop-runtime/src/blocks/dropdown.rs Solid implementation of configurable delimiter with comprehensive test coverage
src/components/runbooks/editor/blocks/Dropdown/Dropdown.tsx UI integration looks good but has boundary check logic error in parseOption

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

const label = trimmed.substring(0, colonIndex).trim(); // what we display
const value = trimmed.substring(colonIndex + 1).trim(); // what we store as value
const delimiterIndex = trimmed.indexOf(delimiter);
if (delimiterIndex > 0 && delimiterIndex < trimmed.length - delimiter.length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Boundary check off by one - should be trimmed.length - 1. With multi-char delimiter like "::", at position length - 2, you'd accept it but then extract empty value.

Suggested change
if (delimiterIndex > 0 && delimiterIndex < trimmed.length - delimiter.length) {
if (delimiterIndex > 0 && delimiterIndex < trimmed.length - 1) {

ellie added 4 commits January 15, 2026 14:33
Extract the parseOption function from Dropdown.tsx to a separate
parseOption.ts file so it can be tested without importing the entire
Dropdown module and its browser dependencies.
@BinaryMuse
Copy link
Member

The TS bindings show up in the crate sometimes if TS_RS_EXPORT_DIR isn't set (from .envrc)

@ellie
Copy link
Member Author

ellie commented Jan 15, 2026

OH that's it, thank you

@ellie ellie force-pushed the ellie/dropdown-delimiter branch from 37f1ef5 to 45be5a9 Compare January 15, 2026 23:08
@ellie ellie merged commit 0e61322 into main Jan 15, 2026
8 checks passed
@ellie ellie deleted the ellie/dropdown-delimiter branch January 15, 2026 23:24
@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants