Skip to content

fix(ui): show tag suggestions by reading suggestedValue - #37398

Merged
anuj-kumary merged 2 commits into
mainfrom
fix/suggestion-tag-labels-from-suggested-value
Nov 9, 2026
Merged

anuj-kumary merged 2 commits into
mainfrom
fix/suggestion-tag-labels-from-suggested-value

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Tracked in open-metadata/openmetadata-collate#7393 (no separate OSS issue, hence skip-pr-checks).

Tag suggestion cards on entity pages showed -- instead of the proposed tags, and accepting one briefly cleared the column's tags in the UI until a refetch.

taskToSuggestion read tag suggestions only from payload.tagsToAdd. Every producer of Suggestion tasks — createSuggestion in this same file, the AI agent tool, the v200 migration — sends the tags as a JSON string in payload.suggestedValue, so Suggestion.tagLabels was always undefined. That fed SuggestionsAlert an empty TagsViewer, made SchemaTable / TableDetailsPageV1 publish { tags: undefined } on accept, and made accept-all send newValue: undefined. The backend already applied the tags correctly (TaskWorkflowHandler reads tagsToAdd, then suggestedValue).

  • suggestionsAPI.ts: for Tag suggestions, parse suggestedValue into tagLabels. tagsToAdd still wins when present, matching the backend's order. Unparsable or non-array values leave tagLabels unset.
  • SuggestionsSliderPermissions.spec.ts: drop the tagsToAdd key from the mocked payload. No real producer sends it, and it hid this bug.

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • A tag suggestion shows its proposed tags on the review card.
  • Accept-all for tag suggestions resolves each task with the suggested tags as newValue.
  • Description suggestions and unparsable suggestedValue leave tagLabels unset.

Unit tests

  • src/rest/suggestionsAPI.test.ts: 3 new tests; 12/12 pass. The two positive tests fail against the previous mapper.

Backend integration tests

  • Not applicable (no backend changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • SuggestionsSliderPermissions.spec.ts: mock payload corrected. Not run locally (pending); the spec's tag assertions now depend on this fix.

Manual testing performed

  1. Seeded a column tag Suggestion task (fieldPath: columns.customer_email.tags, tags only in suggestedValue) on a local server.
  2. Opened the table on the current build: the suggestion card shows --.
  3. Opened it on this branch: the card lists both tags; accepting applies them and the column shows them immediately.

UI screen recording:

Recorded locally against the same backend and the same seeded column tag Suggestion task, whose payload carries only suggestedValue (the shape real producers send). Before = current build; after = this branch served by Vite.

Before: the card shows -- After: the card lists the suggested tags
before-card after-card

After accept, the tags land on the column instead of the cell going blank:

after-accepted

Accept flow on this branch:

after-flow

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation> — no OSS issue; tracked in the Collate issue above.
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Bug fix: I have added a test that covers the exact scenario we are fixing.

Suggestion tasks carry proposed tags as a JSON string in suggestedValue;
the UI only read tagsToAdd, so tag suggestion cards showed no tags and
accepting one cleared the displayed tags until a refetch.
@anuj-kumary
anuj-kumary requested a review from a team as a code owner November 9, 2026 09:04
@anuj-kumary
anuj-kumary requested a review from sweta1308 November 9, 2026 09:04
@anuj-kumary anuj-kumary added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Nov 9, 2026
@anuj-kumary
anuj-kumary enabled auto-merge (squash) November 9, 2026 09:31
@gitar-bot

gitar-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Parsing tag suggestions from suggestedValue lets users accept them, but unexpected parsed values could apply unintended tags to entities.

Fixes tag suggestion cards on entity pages showing -- by reading proposed tags from payload.suggestedValue in taskToSuggestion, so accepting a suggestion no longer clears the column's tags. tagsToAdd still takes precedence when present, matching backend order. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 1 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 1 warning(s) across 1 changed file(s).

Count Rule
1 openmetadata-imports/no-api-calls-in-iteration
All findings
Location Rule Message
🟡 src/rest/suggestionsAPI.ts:263:11 openmetadata-imports/no-api-calls-in-iteration Avoid issuing one API request per item. Fetch at the data owner, use a bulk endpoint, or use useQueries with an intentional concurrency policy.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
81.81% (142397/174047) 69.31% (52208/75324) 72.29% (29220/40417)

@anuj-kumary
anuj-kumary merged commit 3ad9990 into main Nov 9, 2026
65 checks passed
@anuj-kumary
anuj-kumary deleted the fix/suggestion-tag-labels-from-suggested-value branch November 9, 2026 09:58
Rohit0301 added a commit that referenced this pull request Nov 18, 2026
…37398, #38061, #38073) (#38114)

* fix(ui): read tag suggestions from suggestedValue (#37398)

Suggestion tasks carry proposed tags as a JSON string in suggestedValue;
the UI only read tagsToAdd, so tag suggestion cards showed no tags and
accepting one cleared the displayed tags until a refetch.

(cherry picked from commit 3ad9990)

* Fixes #38033: Suggestion tasks render the correct form (tag vs description) (#38061)

* Fixes #38033: Suggestion tasks render the correct form (tag vs description)

* Parse JSON tag suggestions in tagSelector; keep schema fallbacks and drop stale responses

- tagSelector reads a string-typed field (TagSuggestion's suggestedValue) as
  JSON tags and writes edits back as a JSON string, so the tag form no longer
  crashes on the string payload.
- A failed fetch of the stamped schema id falls through to the name/type
  lookup instead of the built-in default.
- TaskTabNew ignores a schema response that lands after the task changed.
- Add TaskSuggestionForm.spec.ts covering both suggestion variants.

---------

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
Co-authored-by: Harsh Vador <[email protected]>
(cherry picked from commit 94f6191)

* fix(ui): show tag suggestion tasks as tags, not a description (#38073)

* fix(ui): show tag suggestion tasks as tags, not a description

A Suggestion task with suggestionType Tag carries its tag labels as a JSON
string in suggestedValue. The task views only treated TagUpdate as a tag
task, and the form schema lookup by type and category always returned
DescriptionSuggestion, so reviewers saw "Suggested Description: [json]".

- isTagsTaskType takes the task and covers Tag suggestions; payload
  normalization, the feed card, the task tab and TagsTaskFromTask use it
- suggestion tasks resolve their form schema by name (TagSuggestion /
  DescriptionSuggestion) instead of the first type+category match
- the tag selector edits the parsed tags and resolution sends them back as
  the JSON string the server applies
- the Inbox detail shows a tag suggestion as a tags change

Refs open-metadata/openmetadata-collate#8554

* fix(ui): keep tag suggestion payloads valid and additive

Address review on #38073:

- The tagSelector widget keeps a string-typed field (TagSuggestion's
  suggestedValue) a JSON string, so the panel and Inbox approvals send a
  payload that validates against the schema (it was rejected with
  "array found, string expected")
- A Tag suggestion's tags are added to the field's current tags, matching
  how the server applies it, instead of current tags hiding the suggestion
- Tag diffs compare labels by tagFQN, so an unchanged tag no longer shows
  as removed and re-added
- Record the <suggestionType>Suggestion form schema naming as a decision

* chore(playwright): add TagSuggestionTask spec to the impact map

* fix(ui): list only added tags in the Inbox and drop the schema-name wait

- The Inbox tags change for a Tag suggestion lists only the tags approval
  adds; tags the field already has no longer show as additions
- TagSuggestionTask.spec no longer waits on /taskFormSchemas/name/TagSuggestion:
  the server stamps taskFormSchemaId on new suggestions, so the panel fetches
  the schema by id and the name request never happens

* chore(ui): address review on tag suggestion task test and record

- TagSuggestionTask.spec creates the suggestion task in beforeAll and
  hard-deletes it in afterAll, and asserts the exact tag text
- isTagsTaskType compares against SuggestionType.Tag
- Rename the decision record to match the resolution order it describes,
  noting it documents #38061 after the fact

* test(ui): clean up the table even when the tag suggestion task was not created

afterAll skips the task delete when beforeAll failed before creating it,
so the table is still deleted, and both hooks release their API session
in a finally.

(cherry picked from commit f853a82)

* fix(ui): adapt the backported task specs and schema cache to 2.0

- TagSuggestionTask.spec uses 2.0's getTaskCard (utils/taskWorkflow, takes
  the CreatedTask) and waitForTaskResolveResponse; both specs import expect
  from @playwright/test, since 2.0's fixtures/pages exports only test
- Bound the task form schema cache (100 entries, oldest evicted), as on main

---------

Co-authored-by: Anujkumar Yadav <[email protected]>
Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
Co-authored-by: Harsh Vador <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants