Skip to content

feat: @ measure picker in the adhoc measure expression input - #9953

Merged
nishantmonu51 merged 4 commits into
mainfrom
adhoc-measure-input
Sep 25, 2026
Merged

nishantmonu51 merged 4 commits into
mainfrom
adhoc-measure-input

Conversation

@nishantmonu51

@nishantmonu51 nishantmonu51 commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator
  • Typing @ in the adhoc measure Expression field opens a picker of the referenceable measures, filtered by display name or field name as you type. Each row shows the field name next to the display name, so users learn the mapping.
  • A picked measure renders as a chip showing its display name, like a mention in the AI chat, and serializes to the field name (double-quoted when needed) in the saved expression. Existing expressions are tokenized into chips when the editor opens; names typed by hand stay plain text and remain valid.
  • Arrow keys navigate, Enter selects, Escape dismisses without closing the dialog, and the unexpected character "@" parse error is hidden while the picker is open.
  • A display name already used by a metrics view measure or another adhoc measure is rejected with an inline error, so two measures never show the same label.
  • Definitions gain an optional Description, carried as a fifth field of the adhoc_m URL param and as description in the canvas adhoc_measures YAML, and shown in tooltips instead of the expression.
  • Shared by the explore pivot dialog (EphemeralMeasureDialog) and the canvas inspector editor (EphemeralMeasureEditor) via the new tiptap-based MeasureExpressionInput component. The tokenizer and picker filtering live in measure-mention.ts with unit tests, and the pivot e2e spec covers the picker, description and duplicate-name flows.
  • The existing "Insert a measure" chips stay as a second path.

Addresses the feedback in this Slack thread.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Typing `@` in the expression opens a picker of the referenceable measures, searchable by display name as well as field name, so users no longer need to know a measure's field name to reference it. Picking one inserts the (quoted if needed) field name. Shared by the explore dialog and the canvas inspector editor.
…measures

Picked measures now render as chips showing the display name, like mentions in the AI chat, and serialize to the field name; existing expressions are tokenized into chips when the editor opens. A display name that another measure already uses is rejected. Definitions gain an optional description, carried in the `adhoc_m` URL param and the canvas YAML, and shown in tooltips instead of the expression.

@AdityaHegde AdityaHegde left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clicking on measures from insert a measure section seem to not update the input. Not sure if it a regression in this PR

Image

Comment thread web-common/src/features/canvas/inspector/fields/EphemeralMeasureEditor.svelte Outdated
The "Insert a measure" buttons insert a chip into the expression editor again (they set the parent's string, which the editor only read on mount). A display name that repeats another measure's gets a numeric suffix via `getName`, following the codebase norm, instead of an error. The chip tokenizer walks the expression parser's tree, which now reports reference spans, instead of a regex.
The explore dialog and the canvas inspector editor duplicated the form fields, validation and footer. `EphemeralMeasureForm` now owns those; the two remaining files only supply the referenceable measures and persist the definition to the explore state or the component spec.
@nishantmonu51

Copy link
Copy Markdown
Collaborator Author

The "Insert a measure" buttons were a regression from the chip editor: they set the parent string, which the editor only read on mount. They now insert a chip at the cursor (8eb73d1), covered in the e2e spec.

@nishantmonu51
nishantmonu51 merged commit cbd27c8 into main Sep 25, 2026
17 checks passed
@nishantmonu51
nishantmonu51 deleted the adhoc-measure-input branch September 25, 2026 06:20
nishantmonu51 added a commit that referenced this pull request Sep 25, 2026
* feat: `@` measure picker in the adhoc measure expression input

Typing `@` in the expression opens a picker of the referenceable measures, searchable by display name as well as field name, so users no longer need to know a measure's field name to reference it. Picking one inserts the (quoted if needed) field name. Shared by the explore dialog and the canvas inspector editor.

* feat: measure chips, unique display names and descriptions for adhoc measures

Picked measures now render as chips showing the display name, like mentions in the AI chat, and serialize to the field name; existing expressions are tokenized into chips when the editor opens. A display name that another measure already uses is rejected. Definitions gain an optional description, carried in the `adhoc_m` URL param and the canvas YAML, and shown in tooltips instead of the expression.

* fix: adhoc measure review feedback

The "Insert a measure" buttons insert a chip into the expression editor again (they set the parent's string, which the editor only read on mount). A display name that repeats another measure's gets a numeric suffix via `getName`, following the codebase norm, instead of an error. The chip tokenizer walks the expression parser's tree, which now reports reference spans, instead of a regex.

* refactor: share the adhoc measure form between explore and canvas

The explore dialog and the canvas inspector editor duplicated the form fields, validation and footer. `EphemeralMeasureForm` now owns those; the two remaining files only supply the referenceable measures and persist the definition to the explore state or the component spec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants