Skip to content

feat: show proposed changes with clickable entity links in approval tasks (2.0) #29633

Closed

Description

@yan-3005

Summary

2.0 / new-Task-entity port of #27440.

The original feature (#27440, merged via #27201) wrote the change preview into thread.message and lived in CreateApprovalTaskImpl. The Task Redesign (#25894) removed both the Thread-based storage and CreateApprovalTaskImpl, so the feature stopped working on main. This issue tracks re-implementing the same proposed-changes UI on the new Task entity system used by CreateTask.

Companion PR: #29627


Storage (new)

No new schema fields. The change-preview map lives in the new Task.payload (already a generic Map<String, Object>) under a namespaced proposedChanges key, so it coexists with future payload data (recognizer feedback, DAR expiration, etc.):

{
  "proposedChanges": {
    "tags": {"added": ["PII.Sensitive"], "removed": ["PII.None"]},
    "description": {"added": ["<p>new</p>"], "removed": ["<p>old</p>"]}
  }
}

Backend

All change-preview logic stays in ChangePreviewUtils:

  • buildChangeMap(ChangeDescription) — converts fieldsAdded/Updated/Deleted to the map (with a per-field accumulate helper so a tag swap that emits fieldsAdded + fieldsDeleted on the same field name isn't silently overwritten).
  • mergeChangeMaps(oldMap, newMap) — set-cancellation merge across re-edits.
  • extractIdentifiers(Object fieldValue) — handles JSON arrays, objects, and plain strings; identifier priority tagFQN → fullyQualifiedName → displayName → name → raw string.
  • extractProposedChanges(payload) — recovers the map from a persisted payload (handles both the in-memory FieldDiff record and the raw Map<String, List<String>> shape that comes back after JSON round-trip).
  • buildProposedChangesPayload(entity, existingPayload) — orchestrates the merge; prefers entity.getIncrementalChangeDescription() (per-edit hop diff) over entity.getChangeDescription() (cumulative-between-versions) so a removal that the prior payload has already cancelled doesn't get re-introduced after a version bump.

CreateTask:

  • New findPriorOpenApprovalPayload(...) looks up the open approval Task on the same entity bound to a different workflow instance of the same workflow definition, BEFORE the new Task is created (the prior task is closed async by supersedePriorApprovalTask).
  • applyProposedChangesIfApproval(taskType, entity, payload) invoked on both the update and create paths for GlossaryApproval and RequestApproval task types.

Merge across re-edits (set-cancellation)

mergedAdded   = (oldAdded − newRemoved) ∪ (newAdded − oldRemoved)
mergedRemoved = (oldRemoved − newAdded) ∪ (newRemoved − oldAdded)

Fields where both added and removed become empty are dropped entirely.

UI

  • Proposed Changes card rendered in TaskTabNew.component.tsx — field name + red chips for removed + green chips for added, directly after taskHeader.
  • Fields in FIELD_ROUTE_MAP (tags, tier, glossaryTerms, relatedTerms, domains) render as clickable links to the relevant entity page; other fields render as plain spans.
  • Description and similar HTML-bearing fields are stripped to plain text via stripHtmlTags before display so chips show readable content instead of literal <p>...</p>.

Test plan

  • Create a glossary term with approval workflow enabled → add one tag → open approval task → Proposed Changes shows tag with green chip and clickable link.
  • Update description AND add a tag in one PATCH → both fields appear as separate rows.
  • Re-edit the term while approval is still open → task refreshes with merged changes (set-cancellation across supersession).
  • Tag swap in a single PATCH (remove A, add B) → both chips render (regression for the buildChangeMap overwrite bug).
  • Re-add a previously removed tag → cancels out from the removed list.
  • Add then remove the same tag across a version bump → cancels cleanly (regression for the cumulative-vs-incremental changeDescription bug).
  • Create a brand new term (no changeDescription) → Proposed Changes section absent.
  • No regressions on non-approval task types (RequestDescription, RequestTag, RecognizerFeedback, DAR).

Activity

  1. self-assigned this
    on Jun 30, 2026
  2. added
    UI
    on Jun 30, 2026
  3. added this to Shipping and removed this from Roadmapon Jun 30, 2026
  4. moved this to In Progress 🏗️ in Shippingon Jun 30, 2026
  5. moved this from In Progress 🏗️ to Done ✅ in Shippingon Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

UIbackend

Type

No type

Projects

  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions