Repository navigation
Description
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)— convertsfieldsAdded/Updated/Deletedto the map (with a per-fieldaccumulatehelper so a tag swap that emitsfieldsAdded+fieldsDeletedon 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 prioritytagFQN → fullyQualifiedName → displayName → name → raw string.extractProposedChanges(payload)— recovers the map from a persisted payload (handles both the in-memoryFieldDiffrecord and the rawMap<String, List<String>>shape that comes back after JSON round-trip).buildProposedChangesPayload(entity, existingPayload)— orchestrates the merge; prefersentity.getIncrementalChangeDescription()(per-edit hop diff) overentity.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 bysupersedePriorApprovalTask). applyProposedChangesIfApproval(taskType, entity, payload)invoked on both the update and create paths forGlossaryApprovalandRequestApprovaltask 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 aftertaskHeader. - 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
stripHtmlTagsbefore 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
buildChangeMapoverwrite 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