Skip to content

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

Merged
harsh-vador merged 2 commits into
mainfrom
detail/bug-fix/fixes-38033-suggestion-tasks-render-the-correct-fo-83833a
Nov 18, 2026
Merged

harsh-vador merged 2 commits into
mainfrom
detail/bug-fix/fixes-38033-suggestion-tasks-render-the-correct-fo-83833a

Conversation

@detail-app

@detail-app detail-app Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Detail bug report: View on Detail

Describe your changes:

Fixes #38033

I worked on disambiguating TaskFormSchema resolution for Suggestion tasks (the new task UI) because every tag-suggestion task was rendering the DescriptionSuggestion form — a mislabeled textarea labeled "Suggested Description" — instead of the TagSuggestion form's tagSelector widget / "Suggested Tags (JSON)" label. As a result, tag suggestions silently failed to apply at resolve when a user edited the free-text area: the resolve body carried a non-JSON string the backend's JsonUtils.readValue then threw on (logged and ignored), marking the task Resolved with no entity change.

Root cause: resolveTaskFormSchema queried /v1/taskFormSchemas filtered only by taskType/taskCategory with limit: 1 and took the first row, even though the two seeded Suggestion schemas (DescriptionSuggestion, TagSuggestion) share that one binding. The list endpoint orders by name, so the first row was deterministically DescriptionSuggestion. The cache in getResolvedTaskFormSchema was keyed only on ${taskType}::${taskCategory}, so description- and tag-suggestion tasks shared one (wrong) schema for the whole session. The UI ignored both task.taskFormSchemaId (already stamped by the backend's payload-aware resolver at task creation) and payload.suggestionType (the very discriminator the backend uses in TaskFormSchemaRepository#mapSuggestionTypeToSchema).

before-after playwright-report

Type of change:

  • Bug fix

High-level design:

The fix wires the two existing backend discriminators into the frontend resolver:

  • rest/taskFormSchemasAPI.ts — added getTaskFormSchemaById (GET /v1/taskFormSchemas/{id}) and getTaskFormSchemaByFqn (GET /v1/taskFormSchemas/name/{fqn}), both of which the backend already exposes; added getSuggestionSchemaName (case-insensitive description/tag → DescriptionSuggestion/TagSuggestion, mirroring the backend's mapSuggestionTypeToSchema); extended resolveTaskFormSchema to take an optional payload, and for Suggestion tasks disambiguate via the FQN endpoint, falling through to the original limit: 1 list query for non-Suggestion paths.
  • utils/TaskFormSchemaUtils.ts — getResolvedTaskFormSchema now takes an optional TaskFormSchemaResolution ({ taskFormSchemaId, payload }). It prefers fetch-by-id when task.taskFormSchemaId is present (the most precise path the backend already disambiguated), then falls back to the payload-aware resolveTaskFormSchema, then the built-in defaults. The cache key now includes both discriminators: ${taskType}::${taskCategory}::${taskFormSchemaId}::${suggestionType}, so description- and tag-suggestion tasks can never share a cache entry. A __resetTaskFormSchemaCache helper is exported for tests.
  • Consumers — TaskTabNew.component.tsx (activity-feed task tab) and TaskDetailPanel.tsx (Inbox legacy-task detail) pass { taskFormSchemaId: task.taskFormSchemaId, payload: task.payload } and add those fields to their resolver useEffect dependency array.

The two-argument form of getResolvedTaskFormSchema(type, category) remains valid (third arg optional), so callers without a task in scope (RequestTagPage, RequestDescriptionPage, UpdateTagPage, UpdateDescriptionPage, TaskFormSettingsPage) keep working unchanged — only the Suggestion rendering path is affected.

Alternatives considered: keeping the limit: 1 list query but raising the limit and picking by payload server-side (would not require adding fetch-by-id). Rejected because the backend already stamps task.taskFormSchemaId for the same disambiguation — using that is exact for all task types (not only Suggestion) and avoids the ambiguous query path entirely.

Tests:

Use cases covered

  • A tag-suggestion task (type: Suggestion, payload.suggestionType: Tag) renders TagSuggestion (the tagSelector widget / "Suggested Tags (JSON)"), not DescriptionSuggestion's textarea.
  • A description-suggestion task still renders DescriptionSuggestion's textarea.
  • A Suggestion task with a stamped taskFormSchemaId resolves through fetch-by-id, bypassing the ambiguous list query.
  • Description- and tag-suggestion tasks viewed in the same session no longer share a cached schema; mutations to a returned schema don't leak into the cache.
  • Non-Suggestion task types (DescriptionUpdate, TagUpdate, approvals, etc.) keep resolving through the limit: 1 list query — no behaviour change for the legacy /Requests pages and TaskFormSettingsPage.

Unit tests

  • Added 23 cases in TaskFormSchemaUtils.test.ts covering getSuggestionSchemaName, the payload-aware resolveTaskFormSchema, the cache-key discriminator, deep-clone behavior, fetch-by-id preference, the fallback chain, and backward-compat for the two-arg call shape.
  • Updated assertions in TaskTabNew.component.test.tsx and TaskDetailPanel.test.tsx to the new 3-arg call shape (these tests would otherwise fail because the resolver signature changed).
  • Coverage on taskFormSchemasAPI.ts is 100% branch / 87.5% line; the uncovered lines are pre-existing createTaskFormSchema / updateTaskFormSchema POST/PUT helpers, untouched by this fix and not exercised by their callers' Jest suites.

Backend integration tests

  • Not applicable (no backend changes — the bug is in the frontend resolver only).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable — no Playwright tests added (see "End-to-end verification" below).

Visual regression baselines

  • Not applicable — this only changes which seeded form a Suggestion task renders through, and the TagSuggestion schema's tagSelector widget is already exercised by other tag-update surfaces.

Manual testing performed

  • No manual UI testing was performed in this environment — see "End-to-end verification" below.

UI screen recording:

Not applicable — this is a standalone fix to form-schema resolution on a task tab. The fix code is exercised by 23 new unit tests against the real resolver paths through an axios mock; the merge queue's full Playwright suite (which runs on a built-from-source 2.0.0-SNAPSHOT stack) is the appropriate lane for end-to-end UI verification of the exact rendering change.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • 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.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (Not applicable — no schema changes.)
  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable).
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
  • Decision check: if this PR decides something the next contributor could undo… (No new decision record needed — the fix relies on backend discriminators that are already documented in TaskFormSchemaRepository.java and task.taskFormSchemaId in the Task schema.)
  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.

End-to-end verification (tests that could not be run here)

The Jest unit tests for the changed files all pass (200 tests across TaskFormSchemaUtils.test.ts, TaskTabNew.component.test.tsx, TaskDetailPanel.test.tsx; plus the four sibling consumer suites and suggestionsAPI.test.ts are unchanged-green), yarn tsc:check introduces no new errors (only the pre-existing OMSelectWidget.tsx one, verified by stash baseline), yarn lint:base --fix reports 0 errors with 6 pre-existing warnings (unchanged), and yarn pretty:base --check passes. The full-task UI build is exercised via Jest with the real resolveTaskFormSchema/getResolvedTaskFormSchema through an axios mock.

Manual / Playwright E2E verification of the rendered UI (tag-suggestion task viewed in the activity-feed Tasks tab showing the tag widget, edit + resolve actually applying tags; description-suggestion task still showing the textarea; cache key disambiguating between two Suggestion variants viewed back-to-back; workflow-driven task with stamped taskFormSchemaId continuing to render its custom form) could not be run here: the published Docker images for 2.0.0-SNAPSHOT server don't exist (the Collate registry only has the released 1.0.0, which predates the /v1/taskFormSchemas and /v1/tasks endpoints introduced in commit 51ecf4502f "Task redesign (#25894)"). Building a 2.0.0-SNAPSHOT server image from the local source via Maven is the workaround but is outside the scope of this fix's verification. Playwright infrastructure itself (browser launch, screenshots) was verified working after npx playwright install chromium and npx playwright install-deps; tests fail only with Error: apiRequestContext.post: connect ECONNREFUSED ::1:8585, i.e. purely on the missing server. The merge-queue Playwright pipeline, which builds a 2.0.0-SNAPSHOT server from source and runs the full impacted spec set, is the right lane for this verification.

For sanity on the backend half of the resolve path, mvn test -pl openmetadata-service -Dtest='TaskWorkflowHandlerTest' passes 31/31; the test logs confirm the existing backend applies tag suggestions from payload.suggestedValue correctly (Applied tag suggestion: 1 tags for entity 'orders'), so the silent-no-op described in the bug only reproduces when the UI submits free text from the wrong textarea — exactly the path this fix removes.


Automatic Fixes PRs can be configured here.

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge; no new blocking issues were found.

Summary

Suggestion tasks now choose the correct tag or description form and keep tag edits in the format the server expects.

  • Suggestion tasks now open the form that matches their kind.
  • Tag suggestion fields now read and save JSON tag values.

Reviews (6) · Last reviewed commit: "Parse JSON tag suggestions in tagSelecto..." · Reviewed by Greptile

…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.
@harsh-vador
harsh-vador enabled auto-merge (squash) November 18, 2026 07:23
@harsh-vador
harsh-vador disabled auto-merge November 18, 2026 08:37
@harsh-vador
harsh-vador enabled auto-merge (squash) November 18, 2026 08:37
@harsh-vador
harsh-vador merged commit 94f6191 into main Nov 18, 2026
65 checks passed
@harsh-vador
harsh-vador deleted the detail/bug-fix/fixes-38033-suggestion-tasks-render-the-correct-fo-83833a branch November 18, 2026 08:59
Rohit0301 added a commit that referenced this pull request Nov 18, 2026
- 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
Rohit0301 added a commit that referenced this pull request Nov 18, 2026
* 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.
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Detail Bug] Tasks UI: Tag suggestion tasks render the description suggestion form (wrong widget/label)

4 participants