[ui] Fix tag filter parsing for values containing = signs#33699
[ui] Fix tag filter parsing for values containing = signs#33699guillaume wants to merge 2 commits into
Conversation
Tag values with `=` characters (e.g. hive-style partition keys like `program=foo/project=bar`) were being truncated at the first `=` when parsed into filter objects. This caused "Add tag to filter" to produce incorrect filters that matched no runs. Use `indexOf`/`slice` to split only on the first `=`, preserving the full tag value.
Greptile SummaryThis PR correctly fixes the root-cause bug where Key findings:
Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| js_modules/ui-core/src/runs/RunsFilterInput.tsx | Fixes split('=') truncation in runsFilterForSearchTokens and tagValueToFilterObject, but misses the same pattern on line 647 inside the tagFilter state memo — custom tags with = in their values will still be mishandled there. |
| js_modules/ui-core/src/runs/tests/RunFilterInput.test.tsx | Adds well-targeted tests for tagValueToFilterObject and runsFilterForSearchTokens covering multi-= tag values; no issues found in the test file itself. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["token.value string containing multiple equals signs"]
A --> B["runsFilterForSearchTokens\nline 160-162 - FIXED"]
A --> C["tagValueToFilterObject\nline 783-787 - FIXED"]
A --> D["tagFilter state useMemo\nline 647 - NOT FIXED"]
B --> B1["indexOf plus slice approach\npreserves full tag value"]
C --> C1["indexOf plus slice approach\npreserves full tag value"]
D --> D1["split destructuring approach\ntruncates tag value at first delimiter"]
B1 --> E["RunsFilter object sent to API"]
C1 --> F["Filter object used for set comparison"]
D1 --> G["tagSuggestionValueObject receives wrong value\nActive filter chip shows truncated value"]
Comments Outside Diff (1)
-
js_modules/ui-core/src/runs/RunsFilterInput.tsx, line 647-649 (link)Missed fix: same
split('=')bug intagFilterstateThis line uses the same destructuring-split pattern that was fixed in
runsFilterForSearchTokensandtagValueToFilterObject, but it was not updated here. For any custom tag whose value contains=(e.g.my-tag=foo=bar),valuewill be silently truncated tofoo, causing the tag filter's active state to display and save the wrong value.
Reviews (1): Last reviewed commit: "[ui] fix tag filter parsing for values c..." | Re-trigger Greptile
Extract splitTagString() helper to DRY up the indexOf/slice logic
across runsFilterForSearchTokens, tagValueToFilterObject, and the
tag filter state mapping. Also fixes a third instance of the same
split('=') bug on the tag filter setState path.
Add dedicated unit tests for splitTagString edge cases.
Summary & Motivation
Tag values containing
=characters (e.g. hive-style partition keys likeprogram=foo/project=bar) are truncated at the first=when parsed into filter objects. This causes "Add tag to filter" on the Runs page to produce incorrect filters that match no runs.The root cause is
split('=')without limiting to the first occurrence in bothtagValueToFilterObjectandrunsFilterForSearchTokens. Replaced withindexOf/sliceto split only on the first=, preserving the full tag value.How I Tested These Changes
tagValueToFilterObjectandrunsFilterForSearchTokenscovering tag values with multiple=signsyarn jest— 150 suites, 1244 tests passed)yarn tsgoandyarn lintpass with no errorsdagster/partition=foo=bar/baz=qux